Skip to content

Commit 2f36faa

Browse files
committed
Update cmake-wasm.yml
1 parent 36f59b7 commit 2f36faa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/cmake-wasm.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ jobs:
3131
wget --no-verbose https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{matrix.wasi_sdk_version}}/wasi-sdk-${{matrix.wasi_sdk_version}}.0-linux.tar.gz
3232
tar xf wasi-sdk-${{matrix.wasi_sdk_version}}.0-linux.tar.gz
3333
34+
# Building a wasm library without needing to define a main():
35+
# https://github.com/WebAssembly/wasi-sdk/issues/332
36+
- name: Modify CMakeLists.txt for WASI
37+
run: |
38+
echo 'if (CMAKE_SYSTEM_NAME STREQUAL "WASI")' >> CMakeLists.txt
39+
echo ' target_link_options(${PROJECT_NAME} PRIVATE -mexec-model=reactor)' >> CMakeLists.txt
40+
echo 'endif()' >> CMakeLists.txt
41+
3442
- name: Configure CMake
3543
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
3644
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
37-
# Building a wasm library without needing to define a main():
38-
# https://github.com/WebAssembly/wasi-sdk/issues/332
39-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DCMAKE_C_FLAGS="${{matrix.C_FLAGS}}" -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/wasi-sdk-${{matrix.wasi_sdk_version}}.0/share/cmake/wasi-sdk.cmake -DWASI_SDK_PREFIX=${{github.workspace}}/wasi-sdk-${{matrix.wasi_sdk_version}}.0 -DCMAKE_EXE_LINKER_FLAGS="-mexec-model=reactor" -DCGLM_USE_TEST=ON
45+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} -DCMAKE_C_FLAGS="${{matrix.C_FLAGS}}" -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/wasi-sdk-${{matrix.wasi_sdk_version}}.0/share/cmake/wasi-sdk.cmake -DWASI_SDK_PREFIX=${{github.workspace}}/wasi-sdk-${{matrix.wasi_sdk_version}}.0 -DCGLM_USE_TEST=ON
4046

4147
- name: Build
4248
# Build your program with the given configuration

0 commit comments

Comments
 (0)