Skip to content

Commit

Permalink
Merge pull request #200 from jyxiong/master
Browse files Browse the repository at this point in the history
CMake: Improve the include path discovery
  • Loading branch information
zeux authored Sep 4, 2024
2 parents 6368f2c + 01b5e06 commit b465507
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,22 @@ endif()
# Vulkan transitive dependency

if(VOLK_PULL_IN_VULKAN)
# If CMake has the FindVulkan module and it works, use it.
find_package(Vulkan QUIET)

# Try an explicit CMake variable first, then any Vulkan paths
# discovered by FindVulkan.cmake, then the $VULKAN_SDK environment
# variable if nothing else works.
if(VULKAN_HEADERS_INSTALL_DIR)
message("volk: using VULKAN_HEADERS_INSTALL_DIR option")
set(VOLK_INCLUDES "${VULKAN_HEADERS_INSTALL_DIR}/include")
elseif(Vulkan_INCLUDE_DIRS)
message("volk: using Vulkan_INCLUDE_DIRS from FindVulkan module")
set(VOLK_INCLUDES "${Vulkan_INCLUDE_DIRS}")
elseif(DEFINED ENV{VULKAN_SDK})
message("volk: using VULKAN_SDK environment variable")
set(VOLK_INCLUDES "$ENV{VULKAN_SDK}/include")
else()
# If CMake has the FindVulkan module and it works, use it.
find_package(Vulkan QUIET)
if(Vulkan_INCLUDE_DIRS)
message("volk: using Vulkan_INCLUDE_DIRS from FindVulkan module")
set(VOLK_INCLUDES "${Vulkan_INCLUDE_DIRS}")
elseif(DEFINED ENV{VULKAN_SDK})
message("volk: using VULKAN_SDK environment variable")
set(VOLK_INCLUDES "$ENV{VULKAN_SDK}/include")
endif()
endif()

if(VOLK_INCLUDES)
Expand Down

0 comments on commit b465507

Please sign in to comment.