Skip to content

Commit 76cf369

Browse files
GitHub Actions/Emscripten: strip debug information to fix the toolchain crash
1 parent a5a85e4 commit 76cf369

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/build-emscripten.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
uses: DiligentGraphics/github-action/configure-cmake@v1
4545
with:
4646
build-type: ${{ matrix.build_type }}
47-
cmake-args: "-DDILIGENT_BUILD_CORE_INCLUDE_TEST=ON -DDILIGENT_BUILD_CORE_TESTS=ON"
47+
cmake-args: "-DDILIGENT_BUILD_CORE_INCLUDE_TEST=ON -DDILIGENT_BUILD_CORE_TESTS=ON -DDILIGENT_EMSCRIPTEN_STRIP_DEBUG_INFO=ON"
4848

4949
- name: Build
5050
if: success()

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,17 @@ if (PLATFORM_EMSCRIPTEN)
372372
"-pthread"
373373
"-mbulk-memory"
374374
)
375+
376+
# WebAssembly integration with JavaScript BigInt: wasm VM will use a BigInt where an i64 is used
377+
target_link_options(Diligent-BuildSettings INTERFACE "SHELL: -s WASM_BIGINT")
378+
379+
# Compile code to WebAssembly (0 - JavaScript, 2 - WebAsm + JS)
380+
target_link_options(Diligent-BuildSettings INTERFACE "SHELL: -s WASM=1")
381+
382+
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND DILIGENT_EMSCRIPTEN_STRIP_DEBUG_INFO)
383+
# Strip debug info from WebAssembly binary. Without this option, the toolchain crashes on CI.
384+
target_link_options(Diligent-BuildSettings INTERFACE "SHELL: -gseparate-dwarf -g0")
385+
endif()
375386
endif()
376387

377388
target_link_libraries(Diligent-BuildSettings INTERFACE Diligent-PublicBuildSettings)

0 commit comments

Comments
 (0)