1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- cmake_minimum_required (VERSION 2.8.12 )
15+ cmake_minimum_required (VERSION 3.2 )
1616if (POLICY CMP0048)
1717 cmake_policy (SET CMP0048 NEW )
1818endif ()
@@ -24,14 +24,28 @@ if (POLICY CMP0054)
2424endif ()
2525set_property (GLOBAL PROPERTY USE_FOLDERS ON )
2626
27+ include (cmake/HunterGate.cmake )
28+ HunterGate (
29+ URL "https://github.com/cpp-pm/hunter/archive/v0.24.8.tar.gz"
30+ SHA1 "ca7838dded9a1811b04ffd56175f629e0af82d3d"
31+ FILEPATH "${CMAKE_CURRENT_LIST_DIR } /cmake/HunterConfig.cmake"
32+ )
33+
2734project (spirv-tools)
2835enable_testing ()
2936set (SPIRV_TOOLS "SPIRV-Tools" )
37+ set (SPIRV_TOOLS_NS ${SPIRV_TOOLS} ::)
38+
39+ hunter_add_package (SPIRV-Headers )
40+ find_package (SPIRV-Headers CONFIG REQUIRED )
41+ set (SPIRV-Headers_SOURCE_DIR ${SPIRV-HEADERS_ROOT} )
3042
3143include (GNUInstallDirs )
3244
33- set (CMAKE_POSITION_INDEPENDENT_CODE ON )
34- set (CMAKE_CXX_STANDARD 11)
45+ if (NOT HUNTER_ENABLED)
46+ set (CMAKE_POSITION_INDEPENDENT_CODE ON )
47+ set (CMAKE_CXX_STANDARD 11)
48+ endif ()
3549
3650option (ENABLE_RTTI "Enables RTTI" OFF )
3751option (SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON )
@@ -243,7 +257,11 @@ if(NOT COMMAND find_host_program)
243257endif ()
244258
245259# Tests require Python3
246- find_host_package (PythonInterp 3 REQUIRED )
260+ if (NOT SPIRV_SKIP_TESTS)
261+ find_host_package (PythonInterp 3 REQUIRED )
262+ else ()
263+ find_host_package (PythonInterp REQUIRED )
264+ endif ()
247265
248266# Check for symbol exports on Linux.
249267# At the moment, this check will fail on the OSX build machines for the Android NDK.
@@ -281,7 +299,7 @@ if(ENABLE_SPIRV_TOOLS_INSTALL)
281299 "find_dependency(${SPIRV_TOOLS} )\n "
282300 "include(\$ {CMAKE_CURRENT_LIST_DIR}/${TARGET} Targets.cmake)\n "
283301 "set(${TARGET} _LIBRARIES ${TARGET} )\n "
284- "get_target_property(${TARGET} _INCLUDE_DIRS ${TARGET} INTERFACE_INCLUDE_DIRECTORIES)\n " )
302+ "get_target_property(${TARGET} _INCLUDE_DIRS ${SPIRV_TOOLS_NS}${ TARGET} INTERFACE_INCLUDE_DIRECTORIES)\n " )
285303 endmacro ()
286304endif ()
287305
0 commit comments