Skip to content

Discrepancy between CMake toolchain file and emcmake #16382

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

Open
mmarczell-graphisoft opened this issue Feb 24, 2022 · 3 comments
Open

Discrepancy between CMake toolchain file and emcmake #16382

mmarczell-graphisoft opened this issue Feb 24, 2022 · 3 comments

Comments

@mmarczell-graphisoft
Copy link
Contributor

Why is the --experimental-wasm-threads argument only set in emcmake and not in Emscripten.cmake?

args.append(f'-DCMAKE_CROSSCOMPILING_EMULATOR={node_js};--experimental-wasm-threads')
vs
set(CMAKE_CROSSCOMPILING_EMULATOR "${NODE_JS_EXECUTABLE}" CACHE FILEPATH "Path to the emulator for the target system.")

If it was set in the latter, it would make using emcmake and using just the toolchain file more equivalent.
One usecase for this is VSCode based development, where the editor's CMake plugin runs the CMake 'configure' step automatically whenever CMake files change. A so called "kit" file (link) can specify a toolchain file, but not a wrapper executable.

@sbc100
Copy link
Collaborator

sbc100 commented Feb 24, 2022

The changes was originally made here: #15590. I don't see any immediate reason why it should be in Emscripten.cmake instead.

I guess we want to avoid duplication we would need to find a way to set NODE_JS_EXECUTABLE from emcmake.py rather than CMAKE_CROSSCOMPILING_EMULATOR.

Feel free to propose a change

@mmarczell-graphisoft
Copy link
Contributor Author

For posterity, an easy workaround is to put this in your CMakeLists.txt:

if (DEFINED NODE_JS_EXECUTABLE)
	set(CMAKE_CROSSCOMPILING_EMULATOR "${NODE_JS_EXECUTABLE};--experimental-wasm-threads")
endif()

@david-fong
Copy link
Contributor

Now CMAKE_CROSSCOMPILING_EMULATOR seems to be defined in both emcmake.py and the toolchain file? Is this necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants