Skip to content

Commit 2d6fc7c

Browse files
authored
feat!: remove wasm32-unknown-unknown and wasm32-wasi target (#185)
1 parent f6e296e commit 2d6fc7c

File tree

12 files changed

+253
-249
lines changed

12 files changed

+253
-249
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ jobs:
5050
target:
5151
- 'wasm32-unknown-emscripten'
5252
- 'wasm64-unknown-emscripten'
53-
- 'wasm32-unknown-unknown'
54-
- 'wasm32-wasi'
5553
- 'wasm32-wasi-threads'
54+
# - 'wasm32-unknown-unknown'
55+
# - 'wasm32-wasi'
5656

5757
steps:
5858
- uses: actions/checkout@v4

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"options": [
4141
"wasm32-unknown-emscripten",
4242
"wasm64-unknown-emscripten",
43-
"wasm32-unknown-unknown",
44-
"wasm32-wasi",
43+
// "wasm32-unknown-unknown",
44+
// "wasm32-wasi",
4545
"wasm32-wasi-threads"
4646
]
4747
},

.vscode/tasks.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,42 @@
3737
"CMake: configure wasm64-unknown-emscripten"
3838
]
3939
},
40-
{
41-
"type": "cmake",
42-
"label": "CMake: configure wasm32-unknown-unknown",
43-
"command": "configure",
44-
"preset": "configure: wasm32-unknown-unknown",
45-
"detail": "configure: wasm32-unknown-unknown"
46-
},
47-
{
48-
"type": "cmake",
49-
"label": "CMake: build wasm32-unknown-unknown",
50-
"command": "build",
51-
"preset": "build: wasm32-unknown-unknown",
52-
"detail": "build: wasm32-unknown-unknown",
53-
"group": "build",
54-
"dependsOn": [
55-
"CMake: configure wasm32-unknown-unknown"
56-
]
57-
},
58-
{
59-
"type": "cmake",
60-
"label": "CMake: configure wasm32-wasi",
61-
"command": "configure",
62-
"preset": "configure: wasm32-wasi",
63-
"detail": "configure: wasm32-wasi"
64-
},
65-
{
66-
"type": "cmake",
67-
"label": "CMake: build wasm32-wasi",
68-
"command": "build",
69-
"preset": "build: wasm32-wasi",
70-
"detail": "build: wasm32-wasi",
71-
"group": "build",
72-
"dependsOn": [
73-
"CMake: configure wasm32-wasi"
74-
]
75-
},
40+
// {
41+
// "type": "cmake",
42+
// "label": "CMake: configure wasm32-unknown-unknown",
43+
// "command": "configure",
44+
// "preset": "configure: wasm32-unknown-unknown",
45+
// "detail": "configure: wasm32-unknown-unknown"
46+
// },
47+
// {
48+
// "type": "cmake",
49+
// "label": "CMake: build wasm32-unknown-unknown",
50+
// "command": "build",
51+
// "preset": "build: wasm32-unknown-unknown",
52+
// "detail": "build: wasm32-unknown-unknown",
53+
// "group": "build",
54+
// "dependsOn": [
55+
// "CMake: configure wasm32-unknown-unknown"
56+
// ]
57+
// },
58+
// {
59+
// "type": "cmake",
60+
// "label": "CMake: configure wasm32-wasi",
61+
// "command": "configure",
62+
// "preset": "configure: wasm32-wasi",
63+
// "detail": "configure: wasm32-wasi"
64+
// },
65+
// {
66+
// "type": "cmake",
67+
// "label": "CMake: build wasm32-wasi",
68+
// "command": "build",
69+
// "preset": "build: wasm32-wasi",
70+
// "detail": "build: wasm32-wasi",
71+
// "group": "build",
72+
// "dependsOn": [
73+
// "CMake: configure wasm32-wasi"
74+
// ]
75+
// },
7676
{
7777
"type": "cmake",
7878
"label": "CMake: configure wasm32-wasi-threads",

packages/emnapi/CMakeLists.txt

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ else()
9090
set(EMNAPI_MT_CFLAGS "-pthread")
9191
endif()
9292

93-
set(EMNAPI_BASIC_TARGET_NAME "emnapi-basic")
94-
set(EMNAPI_BASIC_MT_TARGET_NAME "emnapi-basic-mt")
93+
# set(EMNAPI_BASIC_TARGET_NAME "emnapi-basic")
94+
# set(EMNAPI_BASIC_MT_TARGET_NAME "emnapi-basic-mt")
9595
set(EMNAPI_TARGET_NAME "emnapi")
9696
set(EMNAPI_MT_TARGET_NAME "emnapi-mt")
9797

98-
set(EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME "emnapi-basic-napi-rs-mt")
98+
# set(EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME "emnapi-basic-napi-rs-mt")
9999
set(EMNAPI_NAPI_RS_MT_TARGET_NAME "emnapi-napi-rs-mt")
100100

101101
set(DLMALLOC_TARGET_NAME "dlmalloc")
@@ -193,22 +193,22 @@ if(IS_EMSCRIPTEN)
193193
target_link_options(${EMNAPI_TARGET_NAME} INTERFACE "--js-library=${EMNAPI_JS_LIB}")
194194
endif()
195195

196-
add_library(${EMNAPI_BASIC_TARGET_NAME} STATIC ${ENAPI_BASIC_SRC})
197-
target_include_directories(${EMNAPI_BASIC_TARGET_NAME} PUBLIC ${EMNAPI_INCLUDE})
198-
target_compile_definitions(${EMNAPI_BASIC_TARGET_NAME}
199-
PUBLIC ${EMNAPI_DEFINES}
200-
PRIVATE "EMNAPI_DISABLE_UV"
201-
)
202-
if(IS_EMSCRIPTEN)
203-
set_target_properties(${EMNAPI_BASIC_TARGET_NAME} PROPERTIES INTERFACE_LINK_DEPENDS ${EMNAPI_JS_LIB})
204-
target_link_options(${EMNAPI_BASIC_TARGET_NAME} INTERFACE "--js-library=${EMNAPI_JS_LIB}")
205-
endif()
196+
# add_library(${EMNAPI_BASIC_TARGET_NAME} STATIC ${ENAPI_BASIC_SRC})
197+
# target_include_directories(${EMNAPI_BASIC_TARGET_NAME} PUBLIC ${EMNAPI_INCLUDE})
198+
# target_compile_definitions(${EMNAPI_BASIC_TARGET_NAME}
199+
# PUBLIC ${EMNAPI_DEFINES}
200+
# PRIVATE "EMNAPI_DISABLE_UV"
201+
# )
202+
# if(IS_EMSCRIPTEN)
203+
# set_target_properties(${EMNAPI_BASIC_TARGET_NAME} PROPERTIES INTERFACE_LINK_DEPENDS ${EMNAPI_JS_LIB})
204+
# target_link_options(${EMNAPI_BASIC_TARGET_NAME} INTERFACE "--js-library=${EMNAPI_JS_LIB}")
205+
# endif()
206206

207-
if(IS_WASM32 OR IS_WASM32_WASIP1 OR IS_WASM32_WASIP1_THREADS)
208-
set(EMNAPI_BUILD_BASIC_MT ON)
209-
else()
210-
set(EMNAPI_BUILD_BASIC_MT OFF)
211-
endif()
207+
# if(IS_WASM32 OR IS_WASM32_WASIP1 OR IS_WASM32_WASIP1_THREADS)
208+
# set(EMNAPI_BUILD_BASIC_MT ON)
209+
# else()
210+
# set(EMNAPI_BUILD_BASIC_MT OFF)
211+
# endif()
212212

213213
if(IS_WASM32_WASIP1_THREADS)
214214
set(EMNAPI_BUILD_FOR_NAPI_RS ON)
@@ -223,36 +223,36 @@ if(EMNAPI_BUILD_FOR_NAPI_RS)
223223
PUBLIC ${EMNAPI_DEFINES} "NAPI_EXTERN=__attribute__((__import_module__(\"env\")))"
224224
)
225225

226-
add_library(${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME} STATIC
227-
${ENAPI_BASIC_SRC}
228-
"${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_create.c"
229-
"${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_init.S"
230-
)
231-
target_include_directories(${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME} PUBLIC ${EMNAPI_INCLUDE})
232-
target_compile_definitions(${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME}
233-
PUBLIC ${EMNAPI_DEFINES} "NAPI_EXTERN=__attribute__((__import_module__(\"env\")))"
234-
PRIVATE "EMNAPI_DISABLE_UV"
235-
)
226+
# add_library(${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME} STATIC
227+
# ${ENAPI_BASIC_SRC}
228+
# "${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_create.c"
229+
# "${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_init.S"
230+
# )
231+
# target_include_directories(${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME} PUBLIC ${EMNAPI_INCLUDE})
232+
# target_compile_definitions(${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME}
233+
# PUBLIC ${EMNAPI_DEFINES} "NAPI_EXTERN=__attribute__((__import_module__(\"env\")))"
234+
# PRIVATE "EMNAPI_DISABLE_UV"
235+
# )
236236
endif()
237237

238-
if(EMNAPI_BUILD_BASIC_MT)
239-
add_library(${EMNAPI_BASIC_MT_TARGET_NAME} STATIC
240-
${ENAPI_BASIC_SRC}
241-
"${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_create.c"
242-
"${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_init.S"
243-
)
244-
target_compile_options(${EMNAPI_BASIC_MT_TARGET_NAME} PUBLIC "-matomics" "-mbulk-memory")
245-
target_include_directories(${EMNAPI_BASIC_MT_TARGET_NAME} PUBLIC ${EMNAPI_INCLUDE})
246-
target_compile_definitions(${EMNAPI_BASIC_MT_TARGET_NAME}
247-
PUBLIC ${EMNAPI_DEFINES}
248-
PRIVATE "EMNAPI_DISABLE_UV"
249-
)
250-
251-
if(IS_EMSCRIPTEN)
252-
set_target_properties(${EMNAPI_BASIC_MT_TARGET_NAME} PROPERTIES INTERFACE_LINK_DEPENDS ${EMNAPI_JS_LIB})
253-
target_link_options(${EMNAPI_BASIC_MT_TARGET_NAME} INTERFACE "--js-library=${EMNAPI_JS_LIB}")
254-
endif()
255-
endif()
238+
# if(EMNAPI_BUILD_BASIC_MT)
239+
# add_library(${EMNAPI_BASIC_MT_TARGET_NAME} STATIC
240+
# ${ENAPI_BASIC_SRC}
241+
# "${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_create.c"
242+
# "${CMAKE_CURRENT_SOURCE_DIR}/src/thread/async_worker_init.S"
243+
# )
244+
# target_compile_options(${EMNAPI_BASIC_MT_TARGET_NAME} PUBLIC "-matomics" "-mbulk-memory")
245+
# target_include_directories(${EMNAPI_BASIC_MT_TARGET_NAME} PUBLIC ${EMNAPI_INCLUDE})
246+
# target_compile_definitions(${EMNAPI_BASIC_MT_TARGET_NAME}
247+
# PUBLIC ${EMNAPI_DEFINES}
248+
# PRIVATE "EMNAPI_DISABLE_UV"
249+
# )
250+
251+
# if(IS_EMSCRIPTEN)
252+
# set_target_properties(${EMNAPI_BASIC_MT_TARGET_NAME} PROPERTIES INTERFACE_LINK_DEPENDS ${EMNAPI_JS_LIB})
253+
# target_link_options(${EMNAPI_BASIC_MT_TARGET_NAME} INTERFACE "--js-library=${EMNAPI_JS_LIB}")
254+
# endif()
255+
# endif()
256256

257257
if(IS_EMSCRIPTEN OR IS_WASM32_WASIP1_THREADS)
258258
set(EMNAPI_BUILD_MT ON)
@@ -309,7 +309,7 @@ endif()
309309
# endif()
310310
if(LIB_ARCH)
311311
install(TARGETS ${EMNAPI_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
312-
install(TARGETS ${EMNAPI_BASIC_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
312+
# install(TARGETS ${EMNAPI_BASIC_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
313313
if(EMNAPI_BUILD_V8)
314314
install(TARGETS ${V8_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
315315
endif()
@@ -319,12 +319,12 @@ if(LIB_ARCH)
319319
install(TARGETS ${V8_MT_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
320320
endif()
321321
endif()
322-
if(EMNAPI_BUILD_BASIC_MT)
323-
install(TARGETS ${EMNAPI_BASIC_MT_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
324-
endif()
322+
# if(EMNAPI_BUILD_BASIC_MT)
323+
# install(TARGETS ${EMNAPI_BASIC_MT_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
324+
# endif()
325325
if(EMNAPI_BUILD_FOR_NAPI_RS)
326326
install(TARGETS ${EMNAPI_NAPI_RS_MT_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
327-
install(TARGETS ${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
327+
# install(TARGETS ${EMNAPI_BASIC_NAPI_RS_MT_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")
328328
endif()
329329
if(IS_WASM32)
330330
install(TARGETS ${DLMALLOC_TARGET_NAME} DESTINATION "lib/${LIB_ARCH}")

packages/emnapi/src/async_cleanup_hook.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ EXTERN_C_START
88
typedef void (*async_cleanup_hook)(void* arg, void(*)(void*), void*);
99

1010
struct async_cleanup_hook_info {
11-
napi_env env;
11+
node_api_basic_env env;
1212
async_cleanup_hook fun;
1313
void* arg;
1414
bool started;
1515
};
1616

1717
struct napi_async_cleanup_hook_handle__ {
1818
struct async_cleanup_hook_info* handle_;
19-
napi_env env_;
19+
node_api_basic_env env_;
2020
napi_async_cleanup_hook user_hook_;
2121
void* user_data_;
2222
void (*done_cb_)(void*);
@@ -46,7 +46,7 @@ static void _emnapi_run_async_cleanup_hook(void* arg) {
4646
}
4747

4848
static struct async_cleanup_hook_info*
49-
_emnapi_add_async_environment_cleanup_hook(napi_env env,
49+
_emnapi_add_async_environment_cleanup_hook(node_api_basic_env env,
5050
async_cleanup_hook fun,
5151
void* arg) {
5252
struct async_cleanup_hook_info* info =
@@ -68,7 +68,7 @@ static void _emnapi_remove_async_environment_cleanup_hook(
6868
}
6969

7070
static napi_async_cleanup_hook_handle
71-
_emnapi_ach_handle_create(napi_env env,
71+
_emnapi_ach_handle_create(node_api_basic_env env,
7272
napi_async_cleanup_hook user_hook,
7373
void* user_data) {
7474
napi_async_cleanup_hook_handle handle =
@@ -85,7 +85,7 @@ _emnapi_ach_handle_create(napi_env env,
8585
EMNAPI_INTERNAL_EXTERN void _emnapi_set_immediate(void (*callback)(void*), void* data);
8686

8787
static void _emnapi_ach_handle_env_unref(void* arg) {
88-
napi_env env = (napi_env) arg;
88+
node_api_basic_env env = (node_api_basic_env) arg;
8989
_emnapi_env_unref(env);
9090
}
9191

@@ -94,7 +94,7 @@ _emnapi_ach_handle_delete(napi_async_cleanup_hook_handle handle) {
9494
_emnapi_remove_async_environment_cleanup_hook(handle->handle_);
9595
if (handle->done_cb_ != NULL) handle->done_cb_(handle->done_data_);
9696

97-
_emnapi_set_immediate(_emnapi_ach_handle_env_unref, handle->env_);
97+
_emnapi_set_immediate(_emnapi_ach_handle_env_unref, (void*) handle->env_);
9898

9999
free(handle->handle_);
100100
free(handle);

packages/emnapi/src/core/index.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { wasmMemory, wasmTable } from 'emscripten:runtime'
33

44
import * as asyncMod from './async'
55
import * as memoryMod from './memory'
6-
import * as asyncWorkMod from './async-work'
6+
// import * as asyncWorkMod from './async-work'
77

88
import { emnapiAWST } from '../async-work'
99
import { emnapiExternalMemory } from '../memory'
@@ -25,23 +25,23 @@ import * as nodeMod from '../node'
2525
import * as promiseMod from '../promise'
2626
import * as propertyMod from '../property'
2727
import * as scriptMod from '../script'
28-
import {
29-
emnapiTSFN,
30-
napi_create_threadsafe_function,
31-
napi_get_threadsafe_function_context,
32-
napi_call_threadsafe_function,
33-
napi_acquire_threadsafe_function,
34-
napi_release_threadsafe_function,
35-
napi_unref_threadsafe_function,
36-
napi_ref_threadsafe_function
37-
} from '../threadsafe-function'
28+
// import {
29+
// emnapiTSFN,
30+
// napi_create_threadsafe_function,
31+
// napi_get_threadsafe_function_context,
32+
// napi_call_threadsafe_function,
33+
// napi_acquire_threadsafe_function,
34+
// napi_release_threadsafe_function,
35+
// napi_unref_threadsafe_function,
36+
// napi_ref_threadsafe_function
37+
// } from '../threadsafe-function'
3838
import * as valueOperationMod from '../value-operation'
3939
import * as versionMod from '../version'
4040

4141
emnapiAWST.init()
4242
emnapiExternalMemory.init()
4343
emnapiString.init()
44-
emnapiTSFN.init()
44+
// emnapiTSFN.init()
4545
PThread.init()
4646

4747
napiModule.emnapi.syncMemory = emnapiMod.$emnapiSyncMemory
@@ -65,7 +65,7 @@ function addImports (mod: any): void {
6565

6666
addImports(asyncMod)
6767
addImports(memoryMod)
68-
addImports(asyncWorkMod)
68+
// addImports(asyncWorkMod)
6969

7070
addImports(utilMod)
7171
addImports(convert2cMod)
@@ -86,13 +86,13 @@ addImports(scriptMod)
8686
addImports(valueOperationMod)
8787
addImports(versionMod)
8888

89-
napiModule.imports.napi.napi_create_threadsafe_function = napi_create_threadsafe_function
90-
napiModule.imports.napi.napi_get_threadsafe_function_context = napi_get_threadsafe_function_context
91-
napiModule.imports.napi.napi_call_threadsafe_function = napi_call_threadsafe_function
92-
napiModule.imports.napi.napi_acquire_threadsafe_function = napi_acquire_threadsafe_function
93-
napiModule.imports.napi.napi_release_threadsafe_function = napi_release_threadsafe_function
94-
napiModule.imports.napi.napi_unref_threadsafe_function = napi_unref_threadsafe_function
95-
napiModule.imports.napi.napi_ref_threadsafe_function = napi_ref_threadsafe_function
89+
// napiModule.imports.napi.napi_create_threadsafe_function = napi_create_threadsafe_function
90+
// napiModule.imports.napi.napi_get_threadsafe_function_context = napi_get_threadsafe_function_context
91+
// napiModule.imports.napi.napi_call_threadsafe_function = napi_call_threadsafe_function
92+
// napiModule.imports.napi.napi_acquire_threadsafe_function = napi_acquire_threadsafe_function
93+
// napiModule.imports.napi.napi_release_threadsafe_function = napi_release_threadsafe_function
94+
// napiModule.imports.napi.napi_unref_threadsafe_function = napi_unref_threadsafe_function
95+
// napiModule.imports.napi.napi_ref_threadsafe_function = napi_ref_threadsafe_function
9696

9797
const pluginCtx = {
9898
get wasmMemory () { return wasmMemory },

packages/emnapi/src/emnapi_internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ EMNAPI_INTERNAL_EXTERN void _emnapi_runtime_keepalive_pop();
100100

101101
EMNAPI_INTERNAL_EXTERN napi_handle_scope _emnapi_open_handle_scope();
102102
EMNAPI_INTERNAL_EXTERN void _emnapi_close_handle_scope(napi_handle_scope scope);
103-
EMNAPI_INTERNAL_EXTERN void _emnapi_env_ref(napi_env env);
104-
EMNAPI_INTERNAL_EXTERN void _emnapi_env_unref(napi_env env);
103+
EMNAPI_INTERNAL_EXTERN void _emnapi_env_ref(node_api_basic_env env);
104+
EMNAPI_INTERNAL_EXTERN void _emnapi_env_unref(node_api_basic_env env);
105105
EMNAPI_INTERNAL_EXTERN void _emnapi_ctx_increase_waiting_request_counter();
106106
EMNAPI_INTERNAL_EXTERN void _emnapi_ctx_decrease_waiting_request_counter();
107107

0 commit comments

Comments
 (0)