Previously the cmake code would try to run the LIBDIR specific "findX.cmake" files for both vulkan and shaderc. However these would pick up system headers and libraries when LIBDIR were not present. This would lead to compilation errors as the system library configurations were not taken into account or queried. This changes it so that if LIBDIR is not present, the proper pkgconfig files will be used instead. Pull Request: https://projects.blender.org/blender/blender/pulls/114639
63 lines
1.4 KiB
CMake
63 lines
1.4 KiB
CMake
# SPDX-FileCopyrightText: 2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# - Find Vulkan libraries
|
|
# Find the Vulkan includes and libraries
|
|
# This module defines
|
|
# VULKAN_INCLUDE_DIRS, where to find Vulkan headers, Set when
|
|
# VULKAN_INCLUDE_DIR is found.
|
|
# VULKAN_LIBRARIES, libraries to link against to use Vulkan.
|
|
# VULKAN_ROOT_DIR, The base directory to search for Vulkan.
|
|
# This can also be an environment variable.
|
|
# VULKAN_FOUND, If false, do not try to use Vulkan.
|
|
#
|
|
|
|
# If `VULKAN_ROOT_DIR` was defined in the environment, use it.
|
|
if(DEFINED VULKAN_ROOT_DIR)
|
|
# Pass.
|
|
elseif(DEFINED ENV{VULKAN_ROOT_DIR})
|
|
set(VULKAN_ROOT_DIR $ENV{VULKAN_ROOT_DIR})
|
|
else()
|
|
set(VULKAN_ROOT_DIR "")
|
|
endif()
|
|
|
|
set(_vulkan_SEARCH_DIRS
|
|
${VULKAN_ROOT_DIR}
|
|
)
|
|
|
|
find_path(VULKAN_INCLUDE_DIR
|
|
NAMES
|
|
vulkan/vulkan.h
|
|
HINTS
|
|
${_vulkan_SEARCH_DIRS}
|
|
PATH_SUFFIXES
|
|
include
|
|
)
|
|
|
|
find_library(VULKAN_LIBRARY
|
|
NAMES
|
|
vulkan
|
|
HINTS
|
|
${_vulkan_SEARCH_DIRS}
|
|
PATH_SUFFIXES
|
|
lib
|
|
)
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set VULKAN_FOUND to TRUE if
|
|
# all listed variables are TRUE
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
|
|
|
|
if(VULKAN_FOUND)
|
|
set(VULKAN_LIBRARIES ${VULKAN_LIBRARY})
|
|
set(VULKAN_INCLUDE_DIRS ${VULKAN_INCLUDE_DIR})
|
|
endif()
|
|
|
|
mark_as_advanced(
|
|
VULKAN_INCLUDE_DIR
|
|
VULKAN_LIBRARY
|
|
)
|
|
|
|
unset(_vulkan_SEARCH_DIRS)
|