Skip to content

Commit

Permalink
Add Emscripten (#5)
Browse files Browse the repository at this point in the history
* Update CMakeLists.txt

* Update cmake-multi-platform.yml

* Update cmake-multi-platform.yml

* Update cmake-multi-platform.yml

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update cmake-multi-platform.yml
  • Loading branch information
lackhole authored Jun 14, 2024
1 parent c166901 commit 6d09851
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
5 changes: 5 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ foreach(test_src ${test_srcs})
# COMMAND ${ADB} push $<TARGET_FILE:${test_name}> /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 ()

0 comments on commit 6d09851

Please sign in to comment.