Skip to content

Commit b5e4769

Browse files
committed
Fix the case where there is an @ in the absolute path of sysroot and XEUS_CPP_RESOURCE_DIR in Emscripten build
1 parent 7693844 commit b5e4769

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

CMakeLists.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,19 @@ if(EMSCRIPTEN)
446446
xeus_cpp_set_kernel_options(xcpp)
447447
xeus_wasm_compile_options(xcpp)
448448
xeus_wasm_link_options(xcpp "web,worker")
449+
if (SYSROOT_PATH MATCHES "@")
450+
execute_process(
451+
COMMAND ln -s ${SYSROOT_PATH}
452+
)
453+
set(SYSROOT_PATH_ORIGINAL ${SYSROOT_PATH})
454+
set(SYSROOT_PATH "./sysroot/")
455+
endif()
456+
if (XEUS_CPP_RESOURCE_DIR MATCHES "@")
457+
execute_process(
458+
COMMAND ln -s ${XEUS_CPP_RESOURCE_DIR}
459+
)
460+
set(XEUS_CPP_RESOURCE_DIR "./${CPPINTEROP_LLVM_VERSION_MAJOR}")
461+
endif()
449462
target_link_options(xcpp
450463
PUBLIC "SHELL: -s USE_SDL=2"
451464
PUBLIC "SHELL: --preload-file ${SYSROOT_PATH}/include@/include"
@@ -460,6 +473,11 @@ endif()
460473

461474
if(XEUS_CPP_BUILD_TESTS)
462475
add_subdirectory(test)
476+
if (SYSROOT_PATH_ORIGINAL MATCHES "@")
477+
execute_process(
478+
COMMAND ln -s ${SYSROOT_PATH_ORIGINAL} "${CMAKE_CURRENT_BINARY_DIR}/test/"
479+
)
480+
endif()
463481
endif()
464482

465483
# Installation
@@ -546,4 +564,4 @@ if(EMSCRIPTEN)
546564
"$<TARGET_FILE_DIR:xcpp>/xcpp.wasm"
547565
"$<TARGET_FILE_DIR:xcpp>/xcpp.data"
548566
DESTINATION ${CMAKE_INSTALL_BINDIR})
549-
endif ()
567+
endif ()

0 commit comments

Comments
 (0)