Skip to content

Commit

Permalink
WIP building wasm binding
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Aug 12, 2024
1 parent c34e1bb commit 5548fb3
Show file tree
Hide file tree
Showing 10 changed files with 1,729 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ coverage/
/packages/realm/binding/build/
/packages/realm/binding/android/build/
/packages/realm/binding/node/build/
/packages/realm/binding/wasm/build/
/packages/realm/prebuilds/
/packages/realm/binding/android/src/main/java/io/realm/react/Version.java
/packages/realm/binding/android/src/main/jniLibs/
Expand Down
22 changes: 22 additions & 0 deletions contrib/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,28 @@ npm install path/to/realm-js/packages/realm
> [!TIP]
> To run any of the `"scripts"` commands from one of the `package.json` files directly from the root, use the `"name"` value from the target `package.json` as such: `npm run <command name> --workspace <package.json name>`.
### Building for WASM (Browsers)

Follow the steps to install the Emscripten SDK (emsdk) on https://emscripten.org/docs/getting_started/downloads.html.

1. Clone the repository and enter the directory
```
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
```
2. Pull, install and activate the latest version
```
git pull
./emsdk install latest
./emsdk activate latest
```
3. Follow the instructions to setup environment variables for your shell (ex add this to your `~/.zshenv`)
```bash
# Emscripten SDK
export EMSDK_QUIET=1
source "$HOME/<insert EMSDK sub-directory>/emsdk_env.sh"
```

### Cleaning up build files

If you need to clean up build files and other untracked files (except for `node_modules` directories), run the following command from the root directory:
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/tests/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ type KnownEnvironment = {
* React native specific variable injected by the runner, to signal if the tests are ran by the legacy chrome debugger (i.e. in a browser).
* @deprecated Since we no longer support the legacy chrome debugger. */
chromeDebugging?: true;
/**
* Browser specific variable injected by the runner, to signal if we're running inside a Browser with WebAssembly.
*/
browser?: true;
};

type Environment = KnownEnvironment & Record<string, unknown>;
Expand Down
Loading

0 comments on commit 5548fb3

Please sign in to comment.