Skip to content

Commit

Permalink
21584: Build wasm64 for nodejs, MINOR (#270)
Browse files Browse the repository at this point in the history
- Removed the wasm64-release-linux and wasm64-release build presets
- Added wasm64-release-unknown preset which builds for both workers and
nodejs
  • Loading branch information
fulpm authored Sep 26, 2024
1 parent 10a89ca commit cc4ad6c
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 51 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- arch: arm64_8a
platform: linux
- arch: wasm64
platform: linux
platform: unknown
permissions:
contents: write

Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'
Expand Down Expand Up @@ -424,7 +424,7 @@ jobs:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: amalgam-${{ inputs.version }}-linux-wasm64
name: amalgam-${{ inputs.version }}-unknown-wasm64

- name: Extract Amalgam
run: |
Expand Down
27 changes: 6 additions & 21 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
}
},
{
"name": "wasm64-release",
"name": "wasm64-release-unknown",
"description": "emcc for wasm64 (release)",
"inherits": [ "base", "wasm64", "release", "emcc" ],
"cacheVariables": {
Expand All @@ -272,16 +272,6 @@
"CMAKE_TRY_COMPILE_TARGET_TYPE": "STATIC_LIBRARY"
}
},
{
"name": "wasm64-release-linux",
"description": "emcc for wasm64 (release) for linux",
"inherits": [ "base", "linux", "wasm64", "release", "emcc" ],
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},

{
"name": "amd64-debug-macos",
Expand Down Expand Up @@ -362,13 +352,8 @@
"description": "linux arm64_8a release build"
},
{
"name": "wasm64-release-linux",
"configurePreset": "wasm64-release-linux",
"description": "linux wasm64 release build"
},
{
"name": "wasm64-release",
"configurePreset": "wasm64-release",
"name": "wasm64-release-unknown",
"configurePreset": "wasm64-release-unknown",
"description": "wasm64 release build"
},
{
Expand Down Expand Up @@ -450,10 +435,10 @@
"configurePreset": "arm64_8a-debug-linux"
},
{
"name": "wasm64-release-linux",
"description": "linux wasm64 release tests",
"name": "wasm64-release-unknown",
"description": "wasm64 release tests",
"inherits": "base",
"configurePreset": "wasm64-release-linux"
"configurePreset": "wasm64-release-unknown"
},
{
"name": "amd64-release-macos",
Expand Down
2 changes: 1 addition & 1 deletion build/cmake/global_compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" S
# TODO 1599: WASM support is experimental, these flags will be cleaned up and auto-generated where possible
if(IS_WASM)
string(APPEND CMAKE_CXX_FLAGS " -sMEMORY64=2 -Wno-experimental -DSIMDJSON_NO_PORTABILITY_WARNING")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -sINVOKE_RUN=0 -sALLOW_MEMORY_GROWTH=1 -sINITIAL_MEMORY=65536000 -sMEMORY_GROWTH_GEOMETRIC_STEP=0.50 -sMODULARIZE=1 -sEXPORT_NAME=AmalgamRuntime -sENVIRONMENT=worker -sEXPORTED_RUNTIME_METHODS=cwrap,ccall,FS,setValue,getValue,UTF8ToString -sEXPORTED_FUNCTIONS=_malloc,_free,_LoadEntity,_LoadEntityLegacy,_VerifyEntity,_StoreEntity,_ExecuteEntity,_ExecuteEntityJsonPtr,_DestroyEntity,_GetEntities,_SetRandomSeed,_SetJSONToLabel,_GetJSONPtrFromLabel,_SetSBFDataStoreEnabled,_IsSBFDataStoreEnabled,_GetVersionString,_SetMaxNumThreads,_GetMaxNumThreads,_GetConcurrencyTypeString,_DeleteString --preload-file /wasm/tzdata@/tzdata --preload-file /wasm/etc@/etc")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -sINVOKE_RUN=0 -sALLOW_MEMORY_GROWTH=1 -sINITIAL_MEMORY=65536000 -sMEMORY_GROWTH_GEOMETRIC_STEP=0.50 -sMODULARIZE=1 -sEXPORT_NAME=AmalgamRuntime -sENVIRONMENT=worker,node -sEXPORTED_RUNTIME_METHODS=cwrap,ccall,FS,setValue,getValue,UTF8ToString -sEXPORTED_FUNCTIONS=_malloc,_free,_LoadEntity,_CloneEntity,_VerifyEntity,_StoreEntity,_ExecuteEntity,_ExecuteEntityJsonPtr,_DestroyEntity,_GetEntities,_SetRandomSeed,_SetJSONToLabel,_GetJSONPtrFromLabel,_SetSBFDataStoreEnabled,_IsSBFDataStoreEnabled,_GetVersionString,_SetMaxNumThreads,_GetMaxNumThreads,_GetConcurrencyTypeString,_DeleteString --preload-file /wasm/tzdata@/tzdata --preload-file /wasm/etc@/etc")
endif()

elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
Expand Down
1 change: 0 additions & 1 deletion build/wasm/amalgam-wasm.d.cts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export = AmalgamRuntime;
declare function AmalgamRuntime<T extends EmscriptenModule = EmscriptenModule>(overrides?: Partial<T>): Promise<T>;
1 change: 0 additions & 1 deletion test/wasm_test/.env.sample

This file was deleted.

2 changes: 1 addition & 1 deletion test/wasm_test/jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const config = {
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
globalSetup: "./jest/global.setup.js",
// globalSetup: "./jest/global.setup.js",

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
Expand Down
5 changes: 0 additions & 5 deletions test/wasm_test/jest/global.setup.js

This file was deleted.

21 changes: 4 additions & 17 deletions test/wasm_test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion test/wasm_test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
},
"devDependencies": {
"@babel/preset-env": "^7.24.8",
"dotenv": "^16.4.5",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0"
}
Expand Down

0 comments on commit cc4ad6c

Please sign in to comment.