diff --git a/packages/emnapi/README.md b/packages/emnapi/README.md index ee62119b..4349e2e3 100644 --- a/packages/emnapi/README.md +++ b/packages/emnapi/README.md @@ -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 @@ -643,7 +644,7 @@ Arch: `node-gyp configure --arch=` ```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 @@ -699,7 +700,7 @@ declare var emnapi_manual_linking: 0 | 1 ["OS == 'wasi'", { # ... }], - ["OS == 'unknown' or OS == ''", { + ["OS in ' wasm unknown'", { # ... }] ] @@ -750,19 +751,19 @@ 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 @@ -770,15 +771,15 @@ node-gyp rebuild \ @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 ``` diff --git a/packages/emnapi/common.gypi b/packages/emnapi/common.gypi index 26909569..058f9e43 100644 --- a/packages/emnapi/common.gypi +++ b/packages/emnapi/common.gypi @@ -2,7 +2,7 @@ # in https://github.com/lovell/sharp/pull/3522 { 'variables': { - # OS: 'emscripten' | 'wasi' | 'unknown' + # OS: 'emscripten' | 'wasi' | 'unknown' | 'wasm' 'clang': 1, 'target_arch%': 'wasm32', 'wasm_threads%': 0, @@ -139,7 +139,7 @@ }], ], }], - ['OS in "wasi unknown "', { + ['OS in "wasi wasm unknown "', { 'configurations': { 'Release': { 'ldflags': [ '-Wl,--strip-debug' ], @@ -239,7 +239,7 @@ 'target_conditions': [ ['_type=="executable"', { 'conditions': [ - ['OS in "wasi unknown "', { + ['OS in "wasi wasm unknown "', { 'product_extension': 'wasm', 'ldflags': [ @@ -326,7 +326,7 @@ }] ], }], - ['OS in "wasi unknown "', { + ['OS in "wasi wasm unknown "', { 'product_extension': 'wasm', 'ldflags': [ diff --git a/packages/emnapi/emnapi.gyp b/packages/emnapi/emnapi.gyp index edb81c1c..53089fed 100644 --- a/packages/emnapi/emnapi.gyp +++ b/packages/emnapi/emnapi.gyp @@ -63,7 +63,7 @@ ] }, 'conditions': [ - ['wasm_threads != 0 and OS in " unknown wasi"', { + ['wasm_threads != 0 and OS in " unknown wasm wasi"', { 'sources': [ 'src/thread/async_worker_create.c', 'src/thread/async_worker_init.S',