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: Enable asyncify when targeting WASM #12921

Merged
merged 2 commits into from
Mar 5, 2024
Merged
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
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,17 @@ elseif(GNU_GCC OR LLVM_CLANG)
# The following optimisation flags makes the engine code ~3 times
# faster, measured on a Atom CPU.
add_compile_options(
-O3
-ffast-math
-funroll-loops
)
if(EMSCRIPTEN)
# Optimize for size + speed when targeting Emscripten/WebAssembly
# This is recommended as we use asyncify:
# See https://doc.qt.io/qt-6/wasm.html#asyncify
add_compile_options(-Os)
else()
add_compile_options(-O3)
endif()
# set -fomit-frame-pointer when we don't profile and are not using
# Clang sanitizers.
# Note: It is only included in -O on machines where it does not
Expand Down Expand Up @@ -1585,6 +1592,13 @@ if(APPLE)
endif()
endif()

if(EMSCRIPTEN)
# We need asyncify to support asynchronous calls (e.g. QDialog::exec)
# when targeting Emscripten/WebAssembly.
# See https://doc.qt.io/qt-6/wasm.html#asyncify
target_link_options(mixxx-lib PUBLIC -sASYNCIFY)
endif()

# QML Debugging
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(mixxx-lib PUBLIC QT_QML_DEBUG)
Expand Down
Loading