Skip to content

Commit

Permalink
Simplify how we enable wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
abique committed Dec 1, 2024
1 parent aed100c commit 48c62e9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
52 changes: 36 additions & 16 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
Expand All @@ -42,34 +42,45 @@
}
}
},
{
"name": "wasm",
"hidden": true,
"cacheVariables": {
"CLAP_PLUGINS_WASM": true
}
},
{
"name": "wasm-clang-linux",
"hidden": true,
"toolchainFile": "cmake/toolchains/wasm-clang-linux.cmake"
"toolchainFile": "cmake/toolchains/wasm-clang-linux.cmake",
"inherits": "wasm"
},
{
"name": "wasi-linux",
"hidden": true,
"toolchainFile": "/opt/wasi-sdk/share/cmake/wasi-sdk-pthread.cmake"
"toolchainFile": "/opt/wasi-sdk/share/cmake/wasi-sdk-pthread.cmake",
"inherits": "wasm"
},
{
"name": "emscripten-linux",
"hidden": true,
"toolchainFile": "/usr/lib/emscripten/cmake/Modules/Platform/Emscripten.cmake",
"inherits": "wasm",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
},
{
"name": "emscripten-macOS",
"hidden": true,
"toolchainFile": "/opt/homebrew/Cellar/emscripten/3.1.73/libexec/cmake/Modules/Platform/Emscripten.cmake",
"inherits": "wasm",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
Expand All @@ -96,7 +107,8 @@
"description": "Ninja + System Libraries + Headless",
"binaryDir": "${sourceDir}/builds/${presetName}",
"inherits": [
"base", "headless"
"base",
"headless"
]
},
{
Expand All @@ -120,31 +132,39 @@
"description": "Ninja + System Libraries + Headless / WASM",
"binaryDir": "${sourceDir}/builds/${presetName}",
"inherits": [
"base", "headless", "wasm-clang-linux"
"base",
"headless",
"wasm-clang-linux"
]
},
{
"name": "ninja-wasi-headless",
"description": "Ninja + System Libraries + Headless / WASM",
"binaryDir": "${sourceDir}/builds/${presetName}",
"inherits": [
"base", "headless", "wasi-linux"
"base",
"headless",
"wasi-linux"
]
},
{
"name": "ninja-emscripten-linux-headless",
"description": "Ninja + System Libraries + Headless / WASM",
"binaryDir": "${sourceDir}/builds/${presetName}",
"inherits": [
"base", "headless", "emscripten-linux"
"base",
"headless",
"emscripten-linux"
]
},
{
"name": "ninja-emscripten-macOS-headless",
"description": "Ninja + System Libraries + Headless / WASM",
"binaryDir": "${sourceDir}/builds/${presetName}",
"inherits": [
"base", "headless", "emscripten-macOS"
"base",
"headless",
"emscripten-macOS"
]
}
],
Expand Down
3 changes: 2 additions & 1 deletion plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
set(CLAP_PLUGINS_EMBED_QML TRUE CACHE BOOL "Embed QML resources into the plugin")
set(CLAP_PLUGINS_HEADLESS FALSE CACHE BOOL "Compile the plugins without a GUI")
set(CLAP_PLUGINS_WASM FALSE CACHE BOOL "Build plugins for WASM")

if(CLAP_PLUGINS_HEADLESS)
add_compile_definitions(CLAP_PLUGINS_HEADLESS)
Expand Down Expand Up @@ -107,7 +108,7 @@ target_link_libraries(clap-plugins-core PUBLIC clap-helpers)

set(clap_plugins_src clap-entry.cc)

if (CMAKE_SYSTEM_PROCESSOR MATCHES wasm)
if (CLAP_PLUGINS_WASM)
add_executable(clap-plugins ${clap_plugins_src}) # cxx-except-workaround.cc)
target_link_options(clap-plugins PRIVATE -Wl,--export=clap_entry -Wl,--export-table)
else()
Expand Down

0 comments on commit 48c62e9

Please sign in to comment.