summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAnders Leino <aleino@nvidia.com>2024-09-25 10:24:51 +0300
committerGitHub <noreply@github.com>2024-09-25 10:24:51 +0300
commitf5bf5ba5170058f9a9634438f7ff06f1a02e1da6 (patch)
treef01e2aeb4c2336798fa43a44cf7532a52b2b4bc3 /CMakeLists.txt
parentcb1fc34c7dae3cb8642e150fcc189683c27859d4 (diff)
Enable emscripten builds to compile slang.dll to WebAssembly. (#5131)
* Compile fixes for Wasm The issues are all are due to 'long' types being 32 bits on WASM. - class members redeclared errors - << with StringBuilder and unsigned long is ambiguous This helps to address issue #5115. * Use the host executable suffix for generators Since the generators are run at build-time, we should not use CMAKE_EXECUTABLE_SUFFIX, which is the suffix for the target platform. Instead, define CMAKE_HOST_EXECUTABLE_SUFFIX as appropriate, and use that suffix instead. This helps to address issue #5115. * Add support for Wasm as a platform This helps to address issue #5115. * Add emscripten build This closes #5115.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6580e2680..38486b699 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -253,6 +253,13 @@ add_custom_target(
all-generators
COMMENT "meta target which depends on all generators"
)
+
+if(CMAKE_HOST_WIN32)
+ set(CMAKE_HOST_EXECUTABLE_SUFFIX ".exe")
+else()
+ set(CMAKE_HOST_EXECUTABLE_SUFFIX "")
+endif()
+
set_target_properties(all-generators PROPERTIES FOLDER generators)
function(generator dir)
if(SLANG_GENERATORS_PATH)
@@ -267,7 +274,7 @@ function(generator dir)
TARGET ${target}
PROPERTY
IMPORTED_LOCATION
- "${SLANG_GENERATORS_PATH}/${target}${CMAKE_EXECUTABLE_SUFFIX}"
+ "${SLANG_GENERATORS_PATH}/${target}${CMAKE_HOST_EXECUTABLE_SUFFIX}"
)
else()
slang_add_target(