Update cmake files to support Android as a build target.
authorDerek Sollenberger <djsollen@google.com>
Mon, 18 Apr 2016 14:59:47 +0000 (10:59 -0400)
committerAndrew Woloszyn <awoloszyn@google.com>
Mon, 18 Apr 2016 15:43:24 +0000 (11:43 -0400)
This enables cross-compiling to Android using scripts like
cmake-android that update the system name to reflect the build
target.

CMakeLists.txt
source/print.cpp

index 694789a..5c89b22 100644 (file)
@@ -37,6 +37,8 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
   add_definitions(-DSPIRV_WINDOWS)
 elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
   add_definitions(-DSPIRV_MAC)
+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
+  add_definitions(-DSPIRV_ANDROID)
 else()
   message(FATAL_ERROR "Your platform '${CMAKE_SYSTEM_NAME}' is not supported!")
 endif()
index cd9a3e4..2480f93 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "print.h"
 
-#if defined(SPIRV_LINUX) || defined(SPIRV_MAC)
+#if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC)
 namespace libspirv {
 
 clr::reset::operator const char*() { return "\x1b[0m"; }