Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Apr 2, 2024
1 parent 84a6937 commit ecb2ae3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/emnapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,10 @@ Output code can run in recent version modern browsers and Node.js latest LTS. IE
### Using node-gyp (Experimental)
Currently node-gyp works on Linux only and don't support static library linking in cross-compiling.
There are opened PRs to try to make node-gyp work fine.
There are related PRs to try to make node-gyp work fine.
- https://github.com/nodejs/gyp-next/pull/222
- https://github.com/nodejs/gyp-next/pull/240
- https://github.com/nodejs/node-gyp/pull/2974
If you experienced issues on Windows or macOS, please check the PRs for upstream changes detail and see
Expand All @@ -643,7 +644,7 @@ Arch: `node-gyp configure --arch=<wasm32 | wasm64>`
```ts
// node-gyp configure -- -Dvariable_name=value

declare var OS: 'emscripten' | 'wasi' | 'unknown' | ''
declare var OS: 'emscripten' | 'wasi' | 'unknown' | 'wasm' | ''

/**
* Enable async work and threadsafe-functions
Expand Down Expand Up @@ -699,7 +700,7 @@ declare var emnapi_manual_linking: 0 | 1
["OS == 'wasi'", {
# ...
}],
["OS == 'unknown' or OS == ''", {
["OS in ' wasm unknown'", {
# ...
}]
]
Expand Down Expand Up @@ -750,35 +751,35 @@ call set CXX_target=%%WASI_SDK_PATH:\=/%%/bin/clang++.exe
emmake node-gyp rebuild \
--arch=wasm32 \
--nodedir=./node_modules/emnapi \
-- -f make-linux -DOS=emscripten # -Dwasm_threads=1
-- -f make-emscripten # -Dwasm_threads=1

# wasi
node-gyp rebuild \
--arch=wasm32 \
--nodedir=./node_modules/emnapi \
-- -f make-linux -DOS=wasi # -Dwasm_threads=1
-- -f make-wasi # -Dwasm_threads=1

# bare wasm32
node-gyp rebuild \
--arch=wasm32 \
--nodedir=./node_modules/emnapi \
-- -f make-linux -DOS=unknown # -Dwasm_threads=1
-- -f make-wasm # -Dwasm_threads=1
```
```bat
@REM Use make generator on Windows
@REM Run the bat file in POSIX-like environment (e.g. Cygwin)

@REM emscripten
call npx.cmd node-gyp configure --arch=wasm32 --nodedir=./node_modules/emnapi -- -f make-linux -DOS=emscripten
call npx.cmd node-gyp configure --arch=wasm32 --nodedir=./node_modules/emnapi -- -f make-emscripten
call emmake.bat make -C %~dp0build

@REM wasi
call npx.cmd node-gyp configure --arch=wasm32 --nodedir=./node_modules/emnapi -- -f make-linux -DOS=wasi
call npx.cmd node-gyp configure --arch=wasm32 --nodedir=./node_modules/emnapi -- -f make-wasi
make -C %~dp0build

@REM bare wasm32
call npx.cmd node-gyp configure --arch=wasm32 --nodedir=./node_modules/emnapi -- -f make-linux -DOS=unknown
call npx.cmd node-gyp configure --arch=wasm32 --nodedir=./node_modules/emnapi -- -f make-wasm
make -C %~dp0build
```
Expand Down

0 comments on commit ecb2ae3

Please sign in to comment.