aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ian Holland <markianholland@live.co.uk>2018-11-14 23:25:50 +0000
committerRobert Schumacher <roschuma@microsoft.com>2018-11-14 15:25:50 -0800
commitf1eb3aa4b95540a8fb4a8e8d341e4c08136bd756 (patch)
tree5c870d0c0ee4a2775af162df52c3de32b3509be1
parent3b40d323e92866222f6dd15b00c7a79abde9aedb (diff)
downloadvcpkg-f1eb3aa4b95540a8fb4a8e8d341e4c08136bd756.tar.gz
vcpkg-f1eb3aa4b95540a8fb4a8e8d341e4c08136bd756.zip
Vulkan port (#4664)
* [Vulkan] Add a vulkan port based on the cuda port * Add VULKAN_SDK env variable to whitelist * * Added some additional diagnostic information * Corrected if NOT exists statement
-rw-r--r--ports/vulkan/CONTROL3
-rw-r--r--ports/vulkan/portfile.cmake37
-rw-r--r--toolsrc/src/vcpkg/base/system.cpp2
3 files changed, 42 insertions, 0 deletions
diff --git a/ports/vulkan/CONTROL b/ports/vulkan/CONTROL
new file mode 100644
index 000000000..77f99641d
--- /dev/null
+++ b/ports/vulkan/CONTROL
@@ -0,0 +1,3 @@
+Source: vulkan
+Version: 1.1.82.1
+Description: A graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs on a wide variety of devices. \ No newline at end of file
diff --git a/ports/vulkan/portfile.cmake b/ports/vulkan/portfile.cmake
new file mode 100644
index 000000000..31eb802b4
--- /dev/null
+++ b/ports/vulkan/portfile.cmake
@@ -0,0 +1,37 @@
+# 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.
+include(vcpkg_common_functions)
+
+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\n")
+
+if(NOT DEFINED ENV{VULKAN_SDK})
+ message(FATAL_ERROR "Could not find Vulkan SDK. ${VULKAN_ERROR_DL}")
+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()
+
+configure_file(${VULKAN_DIR}/LICENSE.TXT ${CURRENT_PACKAGES_DIR}/share/vulkan/copyright COPYONLY)
+SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) \ No newline at end of file
diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp
index 6797111c2..9c72f8401 100644
--- a/toolsrc/src/vcpkg/base/system.cpp
+++ b/toolsrc/src/vcpkg/base/system.cpp
@@ -168,6 +168,8 @@ namespace vcpkg::System
L"CUDA_PATH",
// Environmental variable generated automatically by CUDA after installation
L"NVCUDASAMPLES_ROOT",
+ // Enables find_package(Vulkan) in CMake. Environmental variable generated by Vulkan SDK installer
+ L"VULKAN_SDK",
};
std::wstring env_cstr;