From df15a4a3cbda6bde5e4bbd43492e17ac7752cd68 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 9 Oct 2019 17:45:11 +0200 Subject: [PATCH] CMake: Add support for building with emscripten (#2948) --- CMakeLists.txt | 2 ++ source/print.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b95b714a9..53750f641 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,8 @@ option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") add_definitions(-DSPIRV_LINUX) set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS}) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Emscripten") + add_definitions(-DSPIRV_EMSCRIPTEN) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") add_definitions(-DSPIRV_WINDOWS) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") diff --git a/source/print.cpp b/source/print.cpp index f75e2d457..24ef5199f 100644 --- a/source/print.cpp +++ b/source/print.cpp @@ -15,7 +15,7 @@ #include "source/print.h" #if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \ - defined(SPIRV_FREEBSD) + defined(SPIRV_FREEBSD) || defined(SPIRV_EMSCRIPTEN) namespace spvtools { clr::reset::operator const char*() { return "\x1b[0m"; }