Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve browser build target #6135

Merged
merged 5 commits into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ if(EMSCRIPTEN)
endif()

if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
add_link_flag("-sSINGLE_FILE")
# Extra check that cmake has set -O3 in its release flags.
# This is really as an assertion that cmake is behaving as we expect.
if(NOT CMAKE_CXX_FLAGS_RELEASE_INIT MATCHES "-O3")
Expand All @@ -336,6 +335,7 @@ if(EMSCRIPTEN)
endif()

add_link_flag("-sALLOW_MEMORY_GROWTH")
add_link_flag("-sSTACK_SIZE=5MB")
if(EMSCRIPTEN_ENABLE_WASM_EH)
add_compile_flag("-fwasm-exceptions")
else()
Expand All @@ -348,14 +348,15 @@ if(EMSCRIPTEN)
if(BUILD_FOR_BROWSER)
add_link_flag("-sENVIRONMENT=web,worker")
add_link_flag("-sINVOKE_RUN=0")
add_link_flag("-sEXPORTED_RUNTIME_METHODS=run,callMain,FS")
add_link_flag("-sEXPORTED_RUNTIME_METHODS=run,callMain,FS")
add_link_flag("-sMODULARIZE")
add_link_flag("-sEXPORT_ES6")
add_link_flag("-sFILESYSTEM")
add_link_flag("-sFORCE_FILESYSTEM")
add_link_flag("-sFORCE_FILESYSTEM")
else()
# On Node.js, make the tools immediately usable.
else()
add_link_flag("-sNODERAWFS")
add_link_flag("-sSINGLE_FILE")
endif()
# in opt builds, LTO helps so much (>20%) it's worth slow compile times
add_nondebug_compile_flag("-flto")
Expand Down
Loading