Skip to content

Commit

Permalink
Merge pull request #12921 from fwcd/emscripten-asyncify
Browse files Browse the repository at this point in the history
CMakeLists: Enable asyncify when targeting WASM
  • Loading branch information
daschuer authored Mar 5, 2024
2 parents ca84095 + 38425dc commit a429977
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit a429977

Please sign in to comment.