Skip to content
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

CMakeLists: Add support for targeting Emscripten/WebAssembly #12918

Merged
merged 8 commits into from
Mar 4, 2024

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Mar 4, 2024

This adds initial support for targeting Emscripten/WebAssembly. Most of the changes are relatively straightforward with just some smaller quirks to work around (e.g. the SSE flags or OpenGL).

fwcd added 8 commits March 4, 2024 05:04
The issue turned out to be the missing `clang-scan-deps` binary in the
compiler invocation in `check_cxx_source_compiles`.

Note for future self and anyone debugging this: build/CMakeFiles/
CMakeConfigureLog.yaml is really useful here.
Emscripten does not support -mtune=generic or -mfpmath=sse. It does
support -msse2, however only if -msimd128 or -mrelaxed-simd is also set.

Note that Emscripten sets `CMAKE_SYSTEM_PROCESSOR` to `x86`.
Comment on lines +157 to +159
if(NOT DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "$ENV{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" CACHE STRING "")
endif()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be redundant, since the vcpkg triplet (wasm32-emscripten or any of its derivatives) should already set this.

@github-actions github-actions bot added the build label Mar 4, 2024
Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you.

@daschuer daschuer merged commit 61f1b5f into mixxxdj:main Mar 4, 2024
13 checks passed
@fwcd fwcd deleted the emscripten-cmake branch March 4, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants