Skip to content

Commit 5a978ee

Browse files
committed
build(wasi): compile pthreadShim in cxx
To avoid: CMake Error: Error required internal CMake variable not set, cmake may not be built correctly. Missing variable is: CMAKE_C_COMPILE_OBJECT
1 parent 7484b79 commit 5a978ee

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/docker/itk-wasm/ITKWebAssemblyInterface.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ function(add_executable target)
6464
# WASI
6565
set_property(TARGET ${wasm_target} PROPERTY SUFFIX ".wasi.wasm")
6666
if (NOT TARGET wasi-itk-extras AND DEFINED CMAKE_CXX_COMPILE_OBJECT)
67-
add_library(wasi-itk-extras STATIC /ITKWebAssemblyInterface/src/exceptionShim.cxx /ITKWebAssemblyInterface/src/cxaThreadAtExitShim.cxx /ITKWebAssemblyInterface/src/pthreadShim.c /ITKWebAssemblyInterface/src/initialization.cxx)
67+
add_library(wasi-itk-extras STATIC
68+
/ITKWebAssemblyInterface/src/exceptionShim.cxx
69+
/ITKWebAssemblyInterface/src/cxaThreadAtExitShim.cxx
70+
/ITKWebAssemblyInterface/src/pthreadShim.cxx
71+
/ITKWebAssemblyInterface/src/initialization.cxx)
6872
endif()
6973
get_property(_is_imported TARGET ${wasm_target} PROPERTY IMPORTED)
7074
if (NOT ${_is_imported})

src/docker/itk-wasm/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cd $script_dir
1111
mkdir -p ITKWebAssemblyInterfaceModuleCopy/src
1212
cp_exe=$(which rsync 2>/dev/null || which cp)
1313
$cp_exe -a ../../../{include,CMakeLists.txt,itk-module.cmake} ./ITKWebAssemblyInterfaceModuleCopy/
14-
$cp_exe -a ../../../src/{*.cxx,*.c,CMakeLists.txt} ./ITKWebAssemblyInterfaceModuleCopy/src/
14+
$cp_exe -a ../../../src/{*.cxx,CMakeLists.txt} ./ITKWebAssemblyInterfaceModuleCopy/src/
1515
$cp_exe -a ../../../src/emscripten-module ./ITKWebAssemblyInterfaceModuleCopy/src/
1616
mkdir -p median-filter-pipelineCopy
1717
$cp_exe -a ../../../packages/core/typescript/itk-wasm/test/pipelines/median-filter-pipeline/{CMakeLists.txt,median-filter-test.cxx} ./median-filter-pipelineCopy
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
#include <pthread.h>
2222

23+
extern "C" {
24+
2325
int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
2426
{}
2527

@@ -30,3 +32,4 @@ int pthread_atfork(
3032
)
3133
{}
3234

35+
} // end extern "C"

0 commit comments

Comments
 (0)