From 0666c889714a09ad38abc7e78ec2375616f2779e Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Fri, 20 Oct 2023 17:35:12 +0200 Subject: [PATCH] emscripten: if multithreading, pass -pthread to all dependers of imgui --- hello_imgui_cmake/emscripten/hello_imgui_emscripten.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hello_imgui_cmake/emscripten/hello_imgui_emscripten.cmake b/hello_imgui_cmake/emscripten/hello_imgui_emscripten.cmake index 44839b78..f6e8a8ef 100644 --- a/hello_imgui_cmake/emscripten/hello_imgui_emscripten.cmake +++ b/hello_imgui_cmake/emscripten/hello_imgui_emscripten.cmake @@ -6,7 +6,6 @@ function(hello_imgui_emscripten_set_shell_file app_name) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/shell.emscripten.html) set(shell_file ${CMAKE_CURRENT_SOURCE_DIR}/shell.emscripten.html) - message(WARNING "app_name=${app_name} shell_file=${shell_file}") else() set(shell_template_file ${HELLOIMGUI_BASEPATH}/hello_imgui_cmake/emscripten/shell.emscripten.html) get_property(runtime_output_directory TARGET ${app_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY) @@ -43,6 +42,11 @@ function(hello_imgui_emscripten_target_compile_options app_name) if (NOT HELLOIMGUI_EMSCRIPTEN_PTHREAD OR HELLOIMGUI_EMSCRIPTEN_PTHREAD_ALLOW_MEMORY_GROWTH) target_link_options(${app_name} PRIVATE -sALLOW_MEMORY_GROWTH) endif() + if (HELLOIMGUI_EMSCRIPTEN_PTHREAD) + # if using multithreading, *everything* needs to be compiled with -pthread + target_compile_options(imgui PUBLIC -pthread) + target_link_options(imgui PUBLIC -pthread) + endif() endfunction()