Support supplying extra definitions via CMAKE variable
authorLei Zhang <antiagainst@google.com>
Wed, 16 Aug 2017 20:42:50 +0000 (16:42 -0400)
committerLei Zhang <antiagainst@google.com>
Wed, 16 Aug 2017 21:38:48 +0000 (17:38 -0400)
CMakeLists.txt
README.md

index 56896f9..070c6da 100644 (file)
@@ -98,6 +98,10 @@ if(${SPIRV_LOG_DEBUG})
   add_definitions(-DSPIRV_LOG_DEBUG)
 endif()
 
+if (DEFINED SPIRV_TOOLS_EXTRA_DEFINITIONS)
+  add_definitions(${SPIRV_TOOLS_EXTRA_DEFINITIONS})
+endif()
+
 function(spvtools_default_compile_options TARGET)
   target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS})
 
index 6d1a54b..82ddd61 100644 (file)
--- a/README.md
+++ b/README.md
@@ -206,6 +206,11 @@ The following CMake options are supported:
   warnings encountered by enabling the compiler-specific compiler front-end
   option.
 
+Additionally, you can pass additional C preprocessor definitions to SPIRV-Tools
+via setting `SPIRV_TOOLS_EXTRA_DEFINITIONS`. For example, by setting it to
+`/D_ITERATOR_DEBUG_LEVEL=0` on Windows, you can disable checked iterators and
+iterator debugging.
+
 ## Library
 
 ### Usage