Skip to content

Enable Windows Emscripten build #362

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,11 @@ endif()

if(EMSCRIPTEN)
# Ensure required SDL2 ports (e.g. SDL2) are built before header preloading
if (CMAKE_C_COMPILER MATCHES ".bat")
set(embuilder_suffix .bat)
endif()
execute_process(
COMMAND embuilder build sdl2
COMMAND embuilder${embuilder_suffix} build sdl2
RESULT_VARIABLE SDL2_RESULT
)
if(NOT SDL2_RESULT EQUAL 0)
Expand All @@ -448,6 +451,8 @@ if(EMSCRIPTEN)
xeus_wasm_link_options(xcpp "web,worker")
string(REPLACE "@" "@@" ESCAPED_SYSROOT_PATH "${SYSROOT_PATH}")
string(REPLACE "@" "@@" ESCAPED_XEUS_CPP_RESOURCE_DIR "${XEUS_CPP_RESOURCE_DIR}")
string(REPLACE "\\" "/" ESCAPED_XEUS_CPP_RESOURCE_DIR "${ESCAPED_XEUS_CPP_RESOURCE_DIR}")
string(REPLACE "\\" "/" ESCAPED_SYSROOT_PATH "${ESCAPED_SYSROOT_PATH}")
target_link_options(xcpp
PUBLIC "SHELL: -s USE_SDL=2"
PUBLIC "SHELL: --preload-file ${ESCAPED_SYSROOT_PATH}/include@/include"
Expand Down