Skip to content

Commit 6598854

Browse files
authored
Merge pull request #7 from zbai-sc/hunter-2022.3
Hunterize 2022.3
2 parents 409e116 + fd9fab5 commit 6598854

10 files changed

Lines changed: 563 additions & 13 deletions

File tree

CMakeLists.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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)
1616
if (POLICY CMP0048)
1717
cmake_policy(SET CMP0048 NEW)
1818
endif()
@@ -24,14 +24,28 @@ if (POLICY CMP0054)
2424
endif()
2525
set_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+
2734
project(spirv-tools)
2835
enable_testing()
2936
set(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

3143
include(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

3650
option(ENABLE_RTTI "Enables RTTI" OFF)
3751
option(SPIRV_ALLOW_TIMERS "Allow timers via clock_gettime on supported platforms" ON)
@@ -243,7 +257,11 @@ if(NOT COMMAND find_host_program)
243257
endif()
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()
286304
endif()
287305

cmake/HunterConfig.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
hunter_config(SPIRV-Headers
2+
URL https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.231.1.zip
3+
SHA1 c70697e501823485f9a232649b02ab55545eed11
4+
CMAKE_ARGS SPIRV_HEADERS_SKIP_EXAMPLES=ON)

0 commit comments

Comments
 (0)