diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/cmake-multi-platform.yml index 3e31698f..31157186 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/cmake-multi-platform.yml @@ -167,6 +167,49 @@ jobs: # working-directory: build # run: ctest --build-config ${{ matrix.build_type }} + emscripten: + runs-on: ${{ matrix.os }} + + concurrency: + group: ${{ github.head_ref || github.ref_name }}-${{ github.workflow }}-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.compiler }}-${{ matrix.compiler_version }} + cancel-in-progress: true + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + build_type: [Debug, Release] + compiler: [emscripten] + compiler_version: [3.1.20, 3.1.40, 3.1.60, latest] + + steps: + - uses: actions/checkout@v4 + + - name: Install Emscripten + run: | + git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install ${{ matrix.compiler_version }} + ./emsdk activate ${{ matrix.compiler_version }} + + - name: Configure CMake + run: | + source emsdk/emsdk_env.sh + emcmake cmake -B build \ + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -DPREVIEW_TEST=ON \ + -DCMAKE_CROSSCOMPILING_EMULATOR=node \ + -S ${{ github.workspace }} + + - name: Build + run: | + source emsdk/emsdk_env.sh + emmake cmake --build build --config ${{ matrix.build_type }} + + - name: Test + working-directory: build + run: ctest --build-config ${{ matrix.build_type }} + macos-appleclang: runs-on: ${{ matrix.os }} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 692dba9c..b8e8a517 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -45,6 +45,11 @@ foreach(test_src ${test_srcs}) # COMMAND ${ADB} push $ /data/local/tmp/${ANDROID_ABI}/ # COMMAND ${ADB} shell \"export LD_LIBRARY_PATH=/data/local/tmp/${ANDROID_ABI}\; /data/local/tmp/${ANDROID_ABI}/${test_name}\") else() + if (EMSCRIPTEN) + target_link_libraries(${test_name} "-sEXIT_RUNTIME=1 -sALLOW_MEMORY_GROWTH=1") + elseif (MSVC) + target_compile_options(${test_name} PRIVATE "/bigobj") + endif() gtest_discover_tests(${test_name}) endif() endforeach ()