Skip to content

Commit

Permalink
Remove emscripten stack and memory flags
Browse files Browse the repository at this point in the history
  • Loading branch information
guusw committed Jan 20, 2025
1 parent a63aa3b commit 5c9da13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
target_include_directories(UnitTests PUBLIC ${UNIT_TESTS_ROOT})
target_link_libraries(UnitTests LINK_PUBLIC Jolt)

if (EMSCRIPTEN)
target_link_options(UnitTests PUBLIC -sSTACK_SIZE=1048576 -sINITIAL_MEMORY=134217728)
endif()

# Code coverage doesn't work when using precompiled headers
if (CMAKE_GENERATOR STREQUAL "Ninja Multi-Config" AND MSVC)
# The Ninja Multi-Config generator errors out when selectively disabling precompiled headers for certain configurations.
Expand Down Expand Up @@ -367,6 +371,9 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
if (MSVC)
target_link_options(HelloWorld PUBLIC "/SUBSYSTEM:CONSOLE")
endif()
if (EMSCRIPTEN)
target_link_options(HelloWorld PUBLIC -sSTACK_SIZE=1048576 -sINITIAL_MEMORY=134217728)
endif()
endif()

if (TARGET_PERFORMANCE_TEST)
Expand All @@ -383,6 +390,7 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
target_link_options(PerformanceTest PUBLIC "SHELL:--preload-file ${PHYSICS_REPO_ROOT}/Assets/Human.tof@/Assets/Human.tof")
target_link_options(PerformanceTest PUBLIC "SHELL:--preload-file ${PHYSICS_REPO_ROOT}/Assets/Human/dead_pose1.tof@/Assets/Human/dead_pose1.tof")
target_link_options(PerformanceTest PUBLIC "SHELL:--preload-file ${PHYSICS_REPO_ROOT}/Assets/terrain2.bof@/Assets/terrain2.bof")
target_link_options(PerformanceTest PUBLIC -sSTACK_SIZE=1048576 -sINITIAL_MEMORY=134217728)
endif()
set_property(TARGET PerformanceTest PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${PHYSICS_REPO_ROOT}")

Expand Down
3 changes: 2 additions & 1 deletion Jolt/Jolt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ endif()

if (EMSCRIPTEN)
# We need more than the default 64KB stack and 16MB memory
# In your application, specify at least -sSTACK_SIZE=1048576 -sINITIAL_MEMORY=134217728
# Also disable warning: running limited binaryen optimizations because DWARF info requested (or indirectly required)
target_link_options(Jolt PUBLIC -sSTACK_SIZE=1048576 -sINITIAL_MEMORY=134217728 -Wno-limited-postlink-optimizations)
target_link_options(Jolt PUBLIC -Wno-limited-postlink-optimizations)
endif()

0 comments on commit 5c9da13

Please sign in to comment.