Skip to content
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
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ See docs/process.md for more on how version tagging works.
- The system JS libraries in `src/` were renamed from `library_foo.js` to
`lib/libfoo.js`. They are still included via the same `-lfoo.js` flag so
this should not be a user-visible change. (#23348)
- When using cmake the emscripten toolchain will no longer skip the toolchain
detection stages. This means the initial cmake run will be slower, but will
result in more accruate information. If cmake is running too slow for you,
you can revert to the previous behaviour with `-DEMSCRIPTEN_FORCE_COMPILERS=ON`.

4.0.1 - 01/17/25
----------------
Expand Down
8 changes: 3 additions & 5 deletions cmake/Modules/Platform/Emscripten.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ endif()
file(TO_CMAKE_PATH "${_emcache_output}" _emcache_output)
set(EMSCRIPTEN_SYSROOT "${_emcache_output}/sysroot")

# Don't allow CMake to autodetect the compiler, since this is quite slow with
# Emscripten.
# Pass -DEMSCRIPTEN_FORCE_COMPILERS=OFF to disable (sensible mostly only for
# testing/debugging purposes).
option(EMSCRIPTEN_FORCE_COMPILERS "Force C/C++ compiler" ON)
# Allow skipping of CMake compiler autodetection, since this is quite slow with
# Emscripten. Pass -DEMSCRIPTEN_FORCE_COMPILERS=ON to enable
option(EMSCRIPTEN_FORCE_COMPILERS "Force C/C++ compiler" OFF)
if (EMSCRIPTEN_FORCE_COMPILERS)

# Detect version of the 'emcc' executable. Note that for CMake, we tell it the
Expand Down
10 changes: 7 additions & 3 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,11 @@ def test_cmake(self, test_dir, output_file, cmake_args):
# If we update LLVM version and this test fails, copy over the new advertised features from Clang
# and place them to cmake/Modules/Platform/Emscripten.cmake.
@no_windows('Skipped on Windows because CMake does not configure native Clang builds well on Windows.')
def test_cmake_compile_features(self):
@parameterized({
'': ([],),
'force': (['-DEMSCRIPTEN_FORCE_COMPILERS=ON'],),
})
def test_cmake_compile_features(self, args):
os.mkdir('build_native')
cmd = ['cmake',
'-DCMAKE_C_COMPILER=' + CLANG_CC, '-DCMAKE_C_FLAGS=--target=' + clang_native.get_native_triple(),
Expand All @@ -976,7 +980,7 @@ def test_cmake_compile_features(self):
native_features = self.run_process(cmd, stdout=PIPE, cwd='build_native').stdout

os.mkdir('build_emcc')
cmd = [EMCMAKE, 'cmake', test_file('cmake/stdproperty')]
cmd = [EMCMAKE, 'cmake', test_file('cmake/stdproperty')] + args
print(str(cmd))
emscripten_features = self.run_process(cmd, stdout=PIPE, cwd='build_emcc').stdout

Expand Down Expand Up @@ -1023,7 +1027,7 @@ def test_cmake_bitcode_static_libraries(self):
@crossplatform
@parameterized({
'': ([],),
'noforce': (['-DEMSCRIPTEN_FORCE_COMPILERS=OFF'],),
'force': (['-DEMSCRIPTEN_FORCE_COMPILERS=ON'],),
})
def test_cmake_compile_commands(self, args):
self.run_process([EMCMAKE, 'cmake', test_file('cmake/static_lib'), '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON'] + args)
Expand Down