Merge pull request #116 from luadebug/wasm

Add WASM support
This commit is contained in:
2025-12-17 14:02:58 +03:00
committed by GitHub
2 changed files with 92 additions and 0 deletions

View File

@@ -253,3 +253,57 @@ jobs:
shell: bash shell: bash
run: | run: |
cmake --build cmake-build/build/android-release-vcpkg --target unit_tests omath cmake --build cmake-build/build/android-release-vcpkg --target unit_tests omath
##############################################################################
# 6) WebAssembly (Emscripten) Clang / Ninja / wasm32-emscripten
##############################################################################
wasm-build-and-test:
name: WebAssembly (Emscripten) (wasm32-emscripten)
runs-on: ubuntu-latest
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
steps:
- name: Checkout repository (with sub-modules)
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install basic tool-chain
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y ninja-build
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14
with:
version: 'latest'
- name: Verify Emscripten
shell: bash
run: |
echo "EMSDK=$EMSDK"
emcc --version
# Verify toolchain file exists
ls -la "$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
- name: Set up vcpkg
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg "$VCPKG_ROOT"
cd "$VCPKG_ROOT"
./bootstrap-vcpkg.sh
- name: Configure (cmake --preset)
shell: bash
run: |
cmake --preset wasm-release-vcpkg \
-DVCPKG_INSTALL_OPTIONS="--allow-unsupported" \
-DOMATH_BUILD_TESTS=ON \
-DOMATH_BUILD_BENCHMARK=OFF \
-DVCPKG_MANIFEST_FEATURES="imgui;tests"
- name: Build
shell: bash
run: |
cmake --build cmake-build/build/wasm-release-vcpkg --target unit_tests omath

View File

@@ -327,6 +327,44 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Release" "CMAKE_BUILD_TYPE": "Release"
} }
},
{
"name": "wasm-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/cmake-build/build/${presetName}",
"installDir": "${sourceDir}/cmake-build/install/${presetName}",
"cacheVariables": {
"CMAKE_MAKE_PROGRAM": "ninja"
}
},
{
"name": "wasm-base-vcpkg",
"hidden": true,
"inherits": "wasm-base",
"cacheVariables": {
"OMATH_BUILD_VIA_VCPKG": "ON",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "$env{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
"VCPKG_INSTALLED_DIR": "${sourceDir}/cmake-build/vcpkg_installed",
"VCPKG_TARGET_TRIPLET": "wasm32-emscripten"
}
},
{
"name": "wasm-debug-vcpkg",
"displayName": "WASM Debug Vcpkg",
"inherits": "wasm-base-vcpkg",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "wasm-release-vcpkg",
"displayName": "WASM Release Vcpkg",
"inherits": "wasm-base-vcpkg",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
} }
] ]
} }