Skip to content

Fix check_type_size for Cmake when building with pthreads enabled #15590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion emcmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def has_substr(args, substr):

if not has_substr(args, '-DCMAKE_CROSSCOMPILING_EMULATOR'):
node_js = config.NODE_JS[0]
args.append(f'-DCMAKE_CROSSCOMPILING_EMULATOR={node_js}')
# In order to allow cmake to run code built with pthreads we need to pass some extra flags to node.
# Note that we also need --experimental-wasm-bulk-memory which is true by default and hence not added here
# See https://github.com/emscripten-core/emscripten/issues/15522
args.append(f'-DCMAKE_CROSSCOMPILING_EMULATOR={node_js};--experimental-wasm-threads')

# On Windows specify MinGW Makefiles or ninja if we have them and no other
# toolchain was specified, to keep CMake from pulling in a native Visual
Expand Down
4 changes: 4 additions & 0 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ def test_cmake_static_lib(self, custom):
else:
self.assertTrue(building.is_ar('libstatic_lib.a'))

# Tests that cmake functions which require evaluation via the node runtime run properly with pthreads
def test_cmake_pthreads(self):
self.run_process([EMCMAKE, 'cmake', '-DCMAKE_C_FLAGS=-pthread', test_file('cmake/target_js')])

# Tests that the CMake variable EMSCRIPTEN_VERSION is properly provided to user CMake scripts
def test_cmake_emscripten_version(self):
self.run_process([EMCMAKE, 'cmake', test_file('cmake/emscripten_version')])
Expand Down