mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-24 12:30:13 +00:00
Avoid maintaining a list of all operating systems by hand. (#5881)
See #5467 Co-authored-by: Patrick Welche <prlw1@cam.ac.uk>
This commit is contained in:
parent
1601ec2639
commit
df94b2db4a
@ -49,37 +49,13 @@ option(ENABLE_RTTI "Enables RTTI" OFF)
|
||||
option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON)
|
||||
|
||||
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}" MATCHES "Windows")
|
||||
add_definitions(-DSPIRV_WINDOWS)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
add_definitions(-DSPIRV_WINDOWS)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
add_definitions(-DSPIRV_MAC)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS")
|
||||
add_definitions(-DSPIRV_IOS)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "tvOS")
|
||||
add_definitions(-DSPIRV_TVOS)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "visionOS")
|
||||
add_definitions(-DSPIRV_VISIONOS)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
|
||||
add_definitions(-DSPIRV_ANDROID)
|
||||
set(SPIRV_TIMER_ENABLED ${SPIRV_ALLOW_TIMERS})
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
||||
add_definitions(-DSPIRV_FREEBSD)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
|
||||
add_definitions(-DSPIRV_OPENBSD)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
|
||||
add_definitions(-DSPIRV_FUCHSIA)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
|
||||
add_definitions(-DSPIRV_GNU)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "QNX")
|
||||
add_definitions(-DSPIRV_QNX)
|
||||
else()
|
||||
message(FATAL_ERROR "Your platform '${CMAKE_SYSTEM_NAME}' is not supported!")
|
||||
endif()
|
||||
|
||||
if (${SPIRV_TIMER_ENABLED})
|
||||
|
@ -14,26 +14,7 @@
|
||||
|
||||
#include "source/print.h"
|
||||
|
||||
#if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \
|
||||
defined(SPIRV_IOS) || defined(SPIRV_TVOS) || defined(SPIRV_FREEBSD) || \
|
||||
defined(SPIRV_OPENBSD) || defined(SPIRV_EMSCRIPTEN) || \
|
||||
defined(SPIRV_FUCHSIA) || defined(SPIRV_GNU) || defined(SPIRV_QNX)
|
||||
namespace spvtools {
|
||||
|
||||
clr::reset::operator const char*() { return "\x1b[0m"; }
|
||||
|
||||
clr::grey::operator const char*() { return "\x1b[1;30m"; }
|
||||
|
||||
clr::red::operator const char*() { return "\x1b[31m"; }
|
||||
|
||||
clr::green::operator const char*() { return "\x1b[32m"; }
|
||||
|
||||
clr::yellow::operator const char*() { return "\x1b[33m"; }
|
||||
|
||||
clr::blue::operator const char*() { return "\x1b[34m"; }
|
||||
|
||||
} // namespace spvtools
|
||||
#elif defined(SPIRV_WINDOWS)
|
||||
#if defined(SPIRV_WINDOWS)
|
||||
#include <windows.h>
|
||||
|
||||
namespace spvtools {
|
||||
@ -111,17 +92,17 @@ clr::blue::operator const char*() {
|
||||
#else
|
||||
namespace spvtools {
|
||||
|
||||
clr::reset::operator const char*() { return ""; }
|
||||
clr::reset::operator const char*() { return "\x1b[0m"; }
|
||||
|
||||
clr::grey::operator const char*() { return ""; }
|
||||
clr::grey::operator const char*() { return "\x1b[1;30m"; }
|
||||
|
||||
clr::red::operator const char*() { return ""; }
|
||||
clr::red::operator const char*() { return "\x1b[31m"; }
|
||||
|
||||
clr::green::operator const char*() { return ""; }
|
||||
clr::green::operator const char*() { return "\x1b[32m"; }
|
||||
|
||||
clr::yellow::operator const char*() { return ""; }
|
||||
clr::yellow::operator const char*() { return "\x1b[33m"; }
|
||||
|
||||
clr::blue::operator const char*() { return ""; }
|
||||
clr::blue::operator const char*() { return "\x1b[34m"; }
|
||||
|
||||
} // namespace spvtools
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user