Skip to content

Commit cd7c15b

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

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.github/workflows/build-emscripten.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ jobs:
1717
include:
1818
- os: "windows-latest"
1919
host_name: "Win10"
20+
cmake_args: "-DDILIGENT_BUILD_CORE_TESTS=ON -DDILIGENT_EMSCRIPTEN_STRIP_DEBUG_INFO=ON"
2021

2122
- os: "ubuntu-20.04"
2223
host_name: "Linux"
24+
cmake_args: "-DDILIGENT_BUILD_CORE_TESTS=ON -DDILIGENT_EMSCRIPTEN_STRIP_DEBUG_INFO=ON"
2325

2426
- os: "macos-14"
2527
host_name: "MacOS"
28+
cmake_args: "-DDILIGENT_BUILD_CORE_TESTS=ON -DDILIGENT_BUILD_CORE_INCLUDE_TEST=ON"
2629

2730
runs-on: ${{ matrix.os }}
2831
name: ${{ matrix.host_name }} -> Emscripten, ${{ matrix.build_type }}
@@ -44,7 +47,7 @@ jobs:
4447
uses: DiligentGraphics/github-action/configure-cmake@v1
4548
with:
4649
build-type: ${{ matrix.build_type }}
47-
cmake-args: "-DDILIGENT_BUILD_CORE_INCLUDE_TEST=ON -DDILIGENT_BUILD_CORE_TESTS=ON"
50+
cmake-args: ${{ matrix.cmake_args }}
4851

4952
- name: Build
5053
if: success()

BuildTools/CMake/BuildUtils.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ function(set_common_target_properties TARGET)
210210
endif()
211211
endif() # if(MSVC)
212212

213+
if (PLATFORM_EMSCRIPTEN)
214+
if((${CMAKE_BUILD_TYPE} STREQUAL "Debug") AND (TARGET_TYPE STREQUAL EXECUTABLE) AND DILIGENT_EMSCRIPTEN_STRIP_DEBUG_INFO)
215+
# Strip debug info from WebAssembly binary. Without this option, the toolchain crashes on CI.
216+
target_link_options(${TARGET} PRIVATE "SHELL: -gseparate-dwarf -g0")
217+
endif()
218+
endif()
219+
213220
if(COMMAND custom_post_configure_target)
214221
custom_post_configure_target(${TARGET})
215222
endif()

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ else()
306306
endif()
307307
option(DILIGENT_NO_ARCHIVER "Do not build archiver" OFF)
308308

309+
option(DILIGENT_EMSCRIPTEN_STRIP_DEBUG_INFO "Strip debug information from WebAsm binaries" OFF)
310+
311+
309312
if(${DILIGENT_NO_DIRECT3D11})
310313
set(D3D11_SUPPORTED FALSE CACHE INTERNAL "D3D11 backend is forcibly disabled")
311314
endif()

0 commit comments

Comments
 (0)