cmake: Support using system SPIRV-Headers
This commit is contained in:
parent
b8f133bf63
commit
aa292d5665
2 changed files with 13 additions and 3 deletions
|
@ -10,6 +10,10 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||||
set(MASTER_PROJECT ON)
|
set(MASTER_PROJECT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Sirit project options
|
||||||
|
option(SIRIT_TESTS "Build tests" OFF)
|
||||||
|
option(SIRIT_USE_SYSTEM_SPIRV_HEADERS "Use system SPIR-V headers" OFF)
|
||||||
|
|
||||||
# Default to a Release build
|
# Default to a Release build
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||||
|
@ -81,7 +85,12 @@ endif()
|
||||||
enable_testing(true)
|
enable_testing(true)
|
||||||
|
|
||||||
# SPIR-V headers
|
# SPIR-V headers
|
||||||
|
if (SIRIT_USE_SYSTEM_SPIRV_HEADERS)
|
||||||
|
find_package(SPIRV-Headers REQUIRED)
|
||||||
|
else()
|
||||||
add_subdirectory(externals/SPIRV-Headers EXCLUDE_FROM_ALL)
|
add_subdirectory(externals/SPIRV-Headers EXCLUDE_FROM_ALL)
|
||||||
|
add_library(SPIRV-Headers::SPIRV-Headers ALIAS SPIRV-Headers)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Sirit project files
|
# Sirit project files
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
|
@ -27,5 +27,6 @@ target_compile_options(sirit PRIVATE ${SIRIT_CXX_FLAGS})
|
||||||
|
|
||||||
target_include_directories(sirit
|
target_include_directories(sirit
|
||||||
PUBLIC ../include
|
PUBLIC ../include
|
||||||
PRIVATE . ${SPIRV-Headers_SOURCE_DIR}/include
|
PRIVATE .)
|
||||||
INTERFACE ${SPIRV-Headers_SOURCE_DIR}/include)
|
|
||||||
|
target_link_libraries(sirit PUBLIC SPIRV-Headers::SPIRV-Headers)
|
||||||
|
|
Loading…
Reference in a new issue