CMake: Add support for building with emscripten (#2948)

This commit is contained in:
Corentin Wallez 2019-10-09 17:45:11 +02:00 committed by Steven Perron
parent c3ca047419
commit df15a4a3cb
2 changed files with 3 additions and 1 deletions

View File

@ -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")

View File

@ -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"; }