Skip to content

Commit

Permalink
build(wasi): compile pthreadShim in cxx
Browse files Browse the repository at this point in the history
To avoid:

CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
  Missing variable is:
    CMAKE_C_COMPILE_OBJECT
  • Loading branch information
thewtex committed Jan 8, 2025
1 parent 7484b79 commit 7a8ae99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/docker/itk-wasm/ITKWebAssemblyInterface.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ function(add_executable target)
# WASI
set_property(TARGET ${wasm_target} PROPERTY SUFFIX ".wasi.wasm")
if (NOT TARGET wasi-itk-extras AND DEFINED CMAKE_CXX_COMPILE_OBJECT)
add_library(wasi-itk-extras STATIC /ITKWebAssemblyInterface/src/exceptionShim.cxx /ITKWebAssemblyInterface/src/cxaThreadAtExitShim.cxx /ITKWebAssemblyInterface/src/pthreadShim.c /ITKWebAssemblyInterface/src/initialization.cxx)
add_library(wasi-itk-extras STATIC
/ITKWebAssemblyInterface/src/exceptionShim.cxx
/ITKWebAssemblyInterface/src/cxaThreadAtExitShim.cxx
/ITKWebAssemblyInterface/src/pthreadShim.cxx
/ITKWebAssemblyInterface/src/initialization.cxx)
endif()
get_property(_is_imported TARGET ${wasm_target} PROPERTY IMPORTED)
if (NOT ${_is_imported})
Expand Down
3 changes: 3 additions & 0 deletions src/pthreadShim.c → src/pthreadShim.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#include <pthread.h>

extern "C" {

int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
{}

Expand All @@ -30,3 +32,4 @@ int pthread_atfork(
)
{}

} // end extern "C"

0 comments on commit 7a8ae99

Please sign in to comment.