diff --git a/CMakeLists.txt b/CMakeLists.txt index 7633d94..5594581 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,11 @@ option(CGLM_STATIC "Static build" OFF) option(CGLM_USE_C99 "" OFF) option(CGLM_USE_TEST "Enable Tests" OFF) +if(CMAKE_SYSTEM_NAME STREQUAL WASI) + set(CGLM_STATIC ON CACHE BOOL "Static option" FORCE) + set(CGLM_SHARED OFF CACHE BOOL "Shared option" FORCE) +endif() + if(NOT CGLM_STATIC AND CGLM_SHARED) set(CGLM_BUILD SHARED) else(CGLM_STATIC) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 26fef9c..0c76203 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,6 +22,11 @@ set(TEST_RUNNER_PARAMS "") add_executable(${TEST_MAIN} ${TESTFILES}) target_compile_definitions(${TEST_MAIN} PRIVATE CGLM_DEFINE_PRINTS=1) +if(CMAKE_SYSTEM_NAME STREQUAL WASI) + target_compile_definitions(${TEST_MAIN} PRIVATE _WASI_EMULATED_PROCESS_CLOCKS=1) + target_link_options(${TEST_MAIN} PRIVATE "-lwasi-emulated-process-clocks") +endif() + if(NOT MSVC) target_link_libraries(${TEST_MAIN} PRIVATE m) endif()