Skip to content

Commit

Permalink
CMake: use Vulkan-Headers target instead of DILIGENT_VULKAN_HEADERS_D…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Mar 31, 2022
1 parent bfec34c commit e646f6d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
3 changes: 1 addition & 2 deletions Graphics/Archiver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,10 @@ if(D3D12_SUPPORTED)
endif()

if(VULKAN_SUPPORTED)
target_link_libraries(Diligent-Archiver-static PRIVATE Diligent-GraphicsEngineVk-static)
target_link_libraries(Diligent-Archiver-static PRIVATE Diligent-GraphicsEngineVk-static Vulkan-Headers)
target_include_directories(Diligent-Archiver-static
PRIVATE
../GraphicsEngineVulkan/include
${DILIGENT_VULKAN_HEADERS_DIR}/include
)
endif()

Expand Down
2 changes: 1 addition & 1 deletion Graphics/GraphicsEngineVulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ target_include_directories(Diligent-GraphicsEngineVk-static
PRIVATE
include
${DILIGENT_VOLK_DIR}
${DILIGENT_VULKAN_HEADERS_DIR}/include
)

set(PRIVATE_DEPENDENCIES
Expand All @@ -174,6 +173,7 @@ set(PRIVATE_DEPENDENCIES
Diligent-TargetPlatform
Diligent-GraphicsEngineNextGenBase
Diligent-ShaderTools
Vulkan-Headers
)

if (${DILIGENT_NO_HLSL})
Expand Down
9 changes: 3 additions & 6 deletions Tests/GPUTestFramework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@ if(PLATFORM_LINUX)
endif()

if(VULKAN_SUPPORTED)
target_include_directories(Diligent-GPUTestFramework
PUBLIC
${DILIGENT_VOLK_DIR}
${DILIGENT_VULKAN_HEADERS_DIR}/include
)

target_include_directories(Diligent-GPUTestFramework PUBLIC ${DILIGENT_VOLK_DIR})
target_link_libraries(Diligent-GPUTestFramework PUBLIC Vulkan-Headers)

if(PLATFORM_LINUX)
target_link_libraries(Diligent-GPUTestFramework
PUBLIC
Expand Down
14 changes: 8 additions & 6 deletions ThirdParty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ if (VULKAN_SUPPORTED OR METAL_SUPPORTED)
endif()
install(FILES "${SPIRV-Headers_SOURCE_DIR}/LICENSE" DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME SPIRV-Headers-License.txt)

if (NOT DILIGENT_VULKAN_HEADERS_DIR)
set(DILIGENT_VULKAN_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers" CACHE PATH "Vulkan-Headers source directory")
if (NOT TARGET Vulkan-Headers)
# Manually add the Vulkan-Headers target as this is all we need and the
# project's CMake creates unnecessary targets
add_library(Vulkan-Headers INTERFACE)
# Vulkan-Headers_SOURCE_DIR variable is normally created by project(Vulkan-Headers)
set(Vulkan-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers")
target_include_directories(Vulkan-Headers INTERFACE "${Vulkan-Headers_SOURCE_DIR}/include")
endif()
if (NOT EXISTS "${DILIGENT_VULKAN_HEADERS_DIR}/include/vulkan/vulkan.h")
message(FATAL_ERROR "${DILIGENT_VULKAN_HEADERS_DIR}/include/vulkan/vulkan.h does not exist. This indicates that Vulkan-Headers submodule is not checked out or DILIGENT_VULKAN_HEADERS_DIR variable contains invalid path.")
endif()
install(FILES "${DILIGENT_VULKAN_HEADERS_DIR}/LICENSE.txt" DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME Vulkan-Headers-License.txt)
install(FILES "${Vulkan-Headers_SOURCE_DIR}/LICENSE.txt" DESTINATION "Licenses/ThirdParty/${DILIGENT_CORE_DIR}" RENAME Vulkan-Headers-License.txt)

option(DILIGENT_NO_GLSLANG "Do NOT build glslang compiler" OFF)
option(DILIGENT_IMPROVE_SPIRV_TOOLS_DEBUG_PERF "Enable some optimizations for SPIRV-Tools, glslang, SPIRV-Cross and related projects in debug build to improve performance" ON)
Expand Down

0 comments on commit e646f6d

Please sign in to comment.