Fix pthreads check on emscripten

This commit is contained in:
Ethan O'Brien 2025-01-18 17:54:16 -06:00
parent f7ca73c6eb
commit 06ec59d938
2 changed files with 7 additions and 2 deletions

View file

@ -57,7 +57,7 @@ var EmscriptenDeps = {
alert("JSZip library not found. Aborting");
return;
}
const clearDatabase = async function(dir) => {
const clearDatabase = async(dir) => {
await new Promise(res => Module.FS.syncfs(false, res));
const processFolder = (path) => {
let contents;

View file

@ -122,7 +122,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
endif ()
set(SHARED_FLAGS "-fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS} ${SHARED_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_LDFLAGS} --bind ${SHARED_FLAGS} --js-library ${ROOT_DIR}/emscripten/deps.js")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_LDFLAGS} --bind ${SHARED_FLAGS}")
find_package(SpeexDSP REQUIRED)
elseif (MSVC)
find_package(png 1.6 REQUIRED)
@ -181,6 +181,11 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} Threads::Threads)
# For some reason, these flags break the check for pthreads. Add them after.
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORTED_FUNCTIONS=_GetVersion,_main --js-library ${ROOT_DIR}/emscripten/deps.js")
endif()
if (NOT MINGW AND NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
if (APPLE AND NOT MACOS_USE_DEPENDENCIES)
execute_process(COMMAND brew --prefix icu4c OUTPUT_VARIABLE HOMEBREW_PREFIX_ICU OUTPUT_STRIP_TRAILING_WHITESPACE)