-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vulkan] Fix SDK detection fails for official debian packages (#30783)
* [vulkan] Fix SDK detection fails for official debian packages Fixes #13331 * [vulkan] Update version database
- Loading branch information
1 parent
bb53a07
commit a403a65
Showing
7 changed files
with
61 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
|
||
project(FIND_VULKAN LANGUAGES C) | ||
|
||
set(CMAKE_FIND_DEBUG_MODE ON) | ||
|
||
find_package(Vulkan ${VCPKG_VULKAN_VERSION}) | ||
|
||
set(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}/vulkan-result.cmake" CACHE FILEPATH "") | ||
configure_file("vulkan-result.cmake.in" "${OUTFILE}" @ONLY ESCAPE_QUOTES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,36 @@ | ||
# Due to the complexity involved, this package doesn't install the Vulkan SDK. | ||
# It instead verifies that Vulkan is installed. | ||
# Other packages can depend on this package to declare a dependency on Vulkan. | ||
message(STATUS "Querying VULKAN_SDK Enviroment variable") | ||
file(TO_CMAKE_PATH "$ENV{VULKAN_SDK}" VULKAN_DIR) | ||
set(VULKAN_INCLUDE "${VULKAN_DIR}/include/vulkan/") | ||
set(VULKAN_ERROR_DL "Before continuing, please download and install Vulkan from:\n https://vulkan.lunarg.com/sdk/home\nIf you have already downloaded it, make sure the VULKAN_SDK environment variable is set to vulkan's installation root.") | ||
# This package just verifies that the Vulkan SDK is installed. | ||
set(VCPKG_BUILD_TYPE release) | ||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
|
||
if(NOT DEFINED ENV{VULKAN_SDK}) | ||
message(FATAL_ERROR "Could not find Vulkan SDK. ${VULKAN_ERROR_DL}") | ||
if(DEFINED ENV{VULKAN_SDK}) | ||
message(STATUS "VULKAN_SDK environment variable: $ENV{VULKAN_SDK}") | ||
endif() | ||
|
||
message(STATUS "Searching " ${VULKAN_INCLUDE} " for vulkan.h") | ||
if(NOT EXISTS "${VULKAN_INCLUDE}/vulkan.h") | ||
message(FATAL_ERROR "Could not find vulkan.h. ${VULKAN_ERROR_DL}") | ||
endif() | ||
message(STATUS "Found vulkan.h") | ||
|
||
# Check if the user left the version in the installation directory e.g. c:/vulkanSDK/1.1.82.1/ | ||
if(VULKAN_DIR MATCHES "(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))") | ||
set(VULKAN_VERSION "${CMAKE_MATCH_1}") | ||
set(VULKAN_MAJOR "${CMAKE_MATCH_2}") | ||
set(VULKAN_MINOR "${CMAKE_MATCH_3}") | ||
set(VULKAN_PATCH "${CMAKE_MATCH_4}") | ||
message(STATUS "Found Vulkan SDK version ${VULKAN_VERSION}") | ||
|
||
set(VULKAN_REQUIRED_VERSION "1.1.82.1") | ||
if (VULKAN_MAJOR LESS 1 OR VULKAN_MINOR LESS 1 OR VULKAN_PATCH LESS 82) | ||
message(FATAL_ERROR "Vulkan ${VULKAN_VERSION} but ${VULKAN_REQUIRED_VERSION} is required. Please download and install a more recent version from:" | ||
"\n https://vulkan.lunarg.com/sdk/home\n") | ||
endif() | ||
endif() | ||
set(vulkan_result_file "${CURRENT_BUILDTREES_DIR}/vulkan-${TARGET_TRIPLET}.cmake.log") | ||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}" | ||
OPTIONS | ||
"-DVCPKG_VULKAN_VERSION=${VERSION}" | ||
OPTIONS_RELEASE | ||
"-DOUTFILE=${vulkan_result_file}" | ||
) | ||
|
||
if (EXISTS ${VULKAN_DIR}/../LICENSE.txt) | ||
configure_file(${VULKAN_DIR}/../LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/vulkan/copyright COPYONLY) | ||
elseif(EXISTS ${VULKAN_DIR}/LICENSE.txt) | ||
configure_file(${VULKAN_DIR}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/vulkan/copyright COPYONLY) | ||
include("${vulkan_result_file}") | ||
if(DETECTED_Vulkan_FOUND) | ||
message(STATUS "Found Vulkan SDK ${DETECTED_Vulkan_VERSION} (${DETECTED_Vulkan_LIBRARIES})") | ||
else() | ||
configure_file(${CURRENT_PORT_DIR}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/vulkan/copyright COPYONLY) | ||
set(message "The Vulkan SDK wasn't found. ") | ||
if(VCPKG_TARGET_IS_WINDOWS) | ||
string(APPEND message "Refer to Getting Started with the Windows Vulkan SDK: https://vulkan.lunarg.com/doc/sdk/latest/windows/getting_started.html") | ||
elseif(VCPKG_TARGET_IS_OSX) | ||
string(APPEND message "Refer to Getting Started with the MacOS Vulkan SDK: https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html") | ||
elseif(VCPKG_TARGET_IS_LINUX) | ||
string(APPEND message "Refer to Getting Started with the Linux Vulkan SDK: https://vulkan.lunarg.com/doc/sdk/latest/linux/getting_started.html") | ||
endif() | ||
message(FATAL_ERROR "${message}") | ||
endif() | ||
|
||
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) | ||
find_file(vulkan_license NAMES LICENSE.txt PATHS ${DETECTED_Vulkan_INCLUDE_DIRS} "${CURRENT_PORT_DIR}" PATH_SUFFIXES "..") | ||
vcpkg_install_copyright(FILE_LIST "${vulkan_license}") | ||
|
||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
The package vulkan does not provide cmake or visual studio integration directly. | ||
However, it can still easily be used. | ||
vulkan is compatible with built-in CMake targets: | ||
|
||
Visual Studio: | ||
Include $(VULKAN_SDK)/include to your include path. | ||
|
||
CMake: | ||
# https://cmake.org/cmake/help/latest/module/FindVulkan.html | ||
find_package(Vulkan REQUIRED) | ||
target_link_libraries(main PRIVATE Vulkan::Vulkan) | ||
|
||
The vulkan package does not provide direct Visual Studio integration. | ||
For manual integration, add $(VULKAN_SDK)/include to your include path. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
{ | ||
"name": "vulkan", | ||
"version": "1.1.82.1", | ||
"port-version": 5, | ||
"description": "A graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs on a wide variety of devices.", | ||
"port-version": 6, | ||
"description": "A stub package that ensures that the Vulkan SDK is installed.", | ||
"license": null, | ||
"supports": "!uwp & !xbox" | ||
"supports": "!uwp & !xbox", | ||
"dependencies": [ | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set(DETECTED_Vulkan_FOUND "@Vulkan_FOUND@") | ||
set(DETECTED_Vulkan_VERSION "@Vulkan_VERSION@") | ||
set(DETECTED_Vulkan_INCLUDE_DIRS "@Vulkan_INCLUDE_DIRS@") | ||
set(DETECTED_Vulkan_LIBRARIES "@Vulkan_LIBRARIES@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters