From 83972272512ce4ede5fc3b2ba98f6468b179f192 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 29 Dec 2023 09:21:45 +0100 Subject: [PATCH] [vulkan-sdk-components] Use separate port for the SDK (#35742) * [vulkan-sdk] Separate port * Update ci.baseline.txt * [hikogui] Using glslc from shaderc * [vulkan] Drop LICENSE.txt * [vulkan-sdk-components] Avoid vulkan-sdk name * [vulkan] Fixup copyright text --- ports/hikogui/vcpkg.json | 3 +- .../LICENSE.txt | 0 ports/vulkan-sdk-components/portfile.cmake | 26 ++++++++++ ports/vulkan-sdk-components/usage | 12 +++++ ports/vulkan-sdk-components/vcpkg.json | 47 +++++++++++++++++++ ports/vulkan-utility-libraries/vcpkg.json | 2 +- ports/vulkan/CMakeLists.txt | 8 ++-- ports/vulkan/portfile.cmake | 26 +++++----- ports/vulkan/usage | 3 -- ports/vulkan/vcpkg.json | 45 ++++-------------- ports/vulkan/vulkan-result.cmake.in | 1 + scripts/ci.baseline.txt | 8 ++++ versions/baseline.json | 10 ++-- versions/h-/hikogui.json | 5 ++ versions/v-/vulkan-sdk-components.json | 9 ++++ versions/v-/vulkan-utility-libraries.json | 5 ++ versions/v-/vulkan.json | 5 ++ 17 files changed, 155 insertions(+), 60 deletions(-) rename ports/{vulkan => vulkan-sdk-components}/LICENSE.txt (100%) create mode 100644 ports/vulkan-sdk-components/portfile.cmake create mode 100644 ports/vulkan-sdk-components/usage create mode 100644 ports/vulkan-sdk-components/vcpkg.json create mode 100644 versions/v-/vulkan-sdk-components.json diff --git a/ports/hikogui/vcpkg.json b/ports/hikogui/vcpkg.json index 31679e9317..cff97ce128 100644 --- a/ports/hikogui/vcpkg.json +++ b/ports/hikogui/vcpkg.json @@ -1,7 +1,7 @@ { "name": "hikogui", "version": "0.8.1", - "port-version": 1, + "port-version": 2, "maintainers": "@takev", "description": "A portable, low latency, retained-mode GUI framework written in C++.", "homepage": "https://github.com/hikogui/hikogui", @@ -14,6 +14,7 @@ "tools" ] }, + "shaderc", { "name": "vcpkg-cmake", "host": true diff --git a/ports/vulkan/LICENSE.txt b/ports/vulkan-sdk-components/LICENSE.txt similarity index 100% rename from ports/vulkan/LICENSE.txt rename to ports/vulkan-sdk-components/LICENSE.txt diff --git a/ports/vulkan-sdk-components/portfile.cmake b/ports/vulkan-sdk-components/portfile.cmake new file mode 100644 index 0000000000..58168e2538 --- /dev/null +++ b/ports/vulkan-sdk-components/portfile.cmake @@ -0,0 +1,26 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +set(components COMPONENTS glslang) +if(VCPKG_TARGET_IS_WINDOWS) + list(APPEND components dxc) +endif() + +set(vulkan_result_file "${CURRENT_BUILDTREES_DIR}/vulkan-${TARGET_TRIPLET}.cmake.log") +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_INSTALLED_DIR}/share/vulkan/detect-vulkan" + OPTIONS + "-DVCPKG_VULKAN_VERSION=${VERSION}" + "-DVCPKG_VULKAN_COMPONENTS=${components}" + OPTIONS_RELEASE + "-DOUTFILE=${vulkan_result_file}" +) + +include("${vulkan_result_file}") +if(NOT DETECTED_Vulkan_FOUND) + message(FATAL_ERROR "The Vulkan SDK wasn't found.") +endif() + +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}") diff --git a/ports/vulkan-sdk-components/usage b/ports/vulkan-sdk-components/usage new file mode 100644 index 0000000000..436a83136f --- /dev/null +++ b/ports/vulkan-sdk-components/usage @@ -0,0 +1,12 @@ +vulkan-sdk-components is compatible with built-in CMake targets: + + # https://cmake.org/cmake/help/latest/module/FindVulkan.html + find_package(Vulkan REQUIRED) + # SPIR-V generator library + target_link_libraries(main PRIVATE Vulkan::glslang) + # DirectX Shader Compiler + target_link_libraries(main PRIVATE Vulkan::dxc) + +The vulkan-sdk-components package does not provide direct Visual Studio +integration. For manual integration, add $(VULKAN_SDK)/include to your +include path. diff --git a/ports/vulkan-sdk-components/vcpkg.json b/ports/vulkan-sdk-components/vcpkg.json new file mode 100644 index 0000000000..29d7462d68 --- /dev/null +++ b/ports/vulkan-sdk-components/vcpkg.json @@ -0,0 +1,47 @@ +{ + "$comment": "Dependencies extracted from e.g. https://sdk.lunarg.com/sdk/download/1.3.268.0/windows/config.json", + "name": "vulkan-sdk-components", + "version": "1.3.268.0", + "description": "Installs packages which are part of the Vulkan SDK.", + "license": null, + "supports": "!uwp & !xbox", + "dependencies": [ + { + "name": "directx-dxc", + "platform": "windows" + }, + "glm", + "glslang", + "jsoncpp", + { + "name": "mimalloc", + "platform": "windows" + }, + "robin-hood-hashing", + "sdl2", + "shaderc", + "spirv-cross", + "spirv-headers", + "valijson", + { + "name": "vcpkg-cmake", + "host": true + }, + "volk", + "vulkan", + "vulkan-memory-allocator", + "vulkan-utility-libraries", + "vulkan-validationlayers" + ], + "features": { + "tools": { + "description": "Build Vulkan related tools", + "dependencies": [ + "lunarg-vulkantools", + "spirv-reflect", + "spirv-tools", + "vulkan-tools" + ] + } + } +} diff --git a/ports/vulkan-utility-libraries/vcpkg.json b/ports/vulkan-utility-libraries/vcpkg.json index 70c054eef6..bd9f18607e 100644 --- a/ports/vulkan-utility-libraries/vcpkg.json +++ b/ports/vulkan-utility-libraries/vcpkg.json @@ -1,10 +1,10 @@ { "name": "vulkan-utility-libraries", "version": "1.3.268.0", + "port-version": 1, "description": "Utility libraries for Vulkan developers", "homepage": "https://github.com/KhronosGroup/Vulkan-Utility-Libraries", "license": null, - "supports": "!android", "dependencies": [ { "name": "vcpkg-cmake", diff --git a/ports/vulkan/CMakeLists.txt b/ports/vulkan/CMakeLists.txt index faf48f7423..3370eb11f6 100644 --- a/ports/vulkan/CMakeLists.txt +++ b/ports/vulkan/CMakeLists.txt @@ -2,9 +2,11 @@ cmake_minimum_required(VERSION 3.25) project(FIND_VULKAN LANGUAGES C) -set(CMAKE_FIND_DEBUG_MODE ON) - -find_package(Vulkan ${VCPKG_VULKAN_VERSION}) +find_package(Vulkan ${VCPKG_VULKAN_VERSION} ${VCPKG_VULKAN_COMPONENTS}) +if(NOT Vulkan_FOUND) + set(CMAKE_FIND_DEBUG_MODE ON) + find_package(Vulkan ${VCPKG_VULKAN_VERSION} ${VCPKG_VULKAN_COMPONENTS}) +endif() set(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}/vulkan-result.cmake" CACHE FILEPATH "") configure_file("vulkan-result.cmake.in" "${OUTFILE}" @ONLY ESCAPE_QUOTES) diff --git a/ports/vulkan/portfile.cmake b/ports/vulkan/portfile.cmake index d48d9d0f8f..cd198112a2 100644 --- a/ports/vulkan/portfile.cmake +++ b/ports/vulkan/portfile.cmake @@ -1,31 +1,31 @@ set(VCPKG_POLICY_EMPTY_PACKAGE enabled) - 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}" ) include("${vulkan_result_file}") if(DETECTED_Vulkan_FOUND) - message(STATUS "Found Vulkan SDK ${DETECTED_Vulkan_VERSION} (${DETECTED_Vulkan_LIBRARIES})") + message(STATUS "Found Vulkan ${DETECTED_Vulkan_VERSION} (${DETECTED_Vulkan_LIBRARIES})") else() - 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") + set(message "Vulkan wasn't found.") + if(VCPKG_TARGET_IS_ANDROID AND DETECTED_ANDROID_NATIVE_API_LEVEL AND DETECTED_ANDROID_NATIVE_API_LEVEL LESS "24") + string(APPEND message " Vulkan support from the Android NDK requires API level 24 (found: ${DETECTED_ANDROID_NATIVE_API_LEVEL})") endif() message(FATAL_ERROR "${message}") endif() -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}/CMakeLists.txt" + "${CMAKE_CURRENT_LIST_DIR}/vulkan-result.cmake.in" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/detect-vulkan" +) file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" [[ +This is a stub package. Copyright and license information +is provided with Vulkan headers and loader. +For Android, the loader is provided by the NDK. +]]) diff --git a/ports/vulkan/usage b/ports/vulkan/usage index e2df7fcf0a..e742892f1c 100644 --- a/ports/vulkan/usage +++ b/ports/vulkan/usage @@ -3,6 +3,3 @@ vulkan is compatible with built-in CMake targets: # 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. diff --git a/ports/vulkan/vcpkg.json b/ports/vulkan/vcpkg.json index a8cb3174e0..cff6df67e4 100644 --- a/ports/vulkan/vcpkg.json +++ b/ports/vulkan/vcpkg.json @@ -1,48 +1,21 @@ { - "$comment": "Dependencies extracted from e.g. https://sdk.lunarg.com/sdk/download/1.3.268.0/windows/config.json", "name": "vulkan", - "version": "1.3.268.0", - "description": "A stub package that ensures that the Vulkan SDK is installed.", + "version-date": "2023-12-17", + "description": [ + "A stub package that ensures that Vulkan headers and a loader are available.", + "On Android, the NDK provides a loader at API level 24 or higher." + ], "license": null, "supports": "!uwp & !xbox", "dependencies": [ - { - "name": "directx-dxc", - "platform": "windows" - }, - "glm", - "glslang", - "jsoncpp", - { - "name": "mimalloc", - "platform": "windows" - }, - "robin-hood-hashing", - "sdl2", - "shaderc", - "spirv-cross", - "spirv-headers", - "valijson", { "name": "vcpkg-cmake", "host": true }, - "volk", "vulkan-headers", - "vulkan-loader", - "vulkan-memory-allocator", - "vulkan-utility-libraries", - "vulkan-validationlayers" - ], - "features": { - "tools": { - "description": "Build Vulkan related tools", - "dependencies": [ - "lunarg-vulkantools", - "spirv-reflect", - "spirv-tools", - "vulkan-tools" - ] + { + "name": "vulkan-loader", + "platform": "!android" } - } + ] } diff --git a/ports/vulkan/vulkan-result.cmake.in b/ports/vulkan/vulkan-result.cmake.in index daed342036..877df8d34d 100644 --- a/ports/vulkan/vulkan-result.cmake.in +++ b/ports/vulkan/vulkan-result.cmake.in @@ -2,3 +2,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@") +set(DETECTED_ANDROID_NATIVE_API_LEVEL "@ANDROID_NATIVE_API_LEVEL@") diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 1b4aacf308..b99ac0575d 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1188,6 +1188,14 @@ vowpal-wabbit:x64-android=fail vtk-m:arm-neon-android=fail vtk-m:arm64-android=fail vtk-m:x64-android=fail +# Needs android-24 to supply a vulkan loader library +vulkan:arm-neon-android=fail +vulkan:arm64-android=fail +vulkan:x64-android=fail +# Needs android-26 +vulkan-utility-libraries:arm-neon-android=fail +vulkan-utility-libraries:arm64-android=fail +vulkan-utility-libraries:x64-android=fail # Conflicts with latest openjpeg port (vxl ships with an old version of openjpeg) # conflicts with qt5-location vxl:arm-neon-android=skip diff --git a/versions/baseline.json b/versions/baseline.json index 7a160653c6..d20ea4f53b 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3334,7 +3334,7 @@ }, "hikogui": { "baseline": "0.8.1", - "port-version": 1 + "port-version": 2 }, "hiredis": { "baseline": "1.2.0", @@ -8973,7 +8973,7 @@ "port-version": 2 }, "vulkan": { - "baseline": "1.3.268.0", + "baseline": "2023-12-17", "port-version": 0 }, "vulkan-headers": { @@ -8996,13 +8996,17 @@ "baseline": "3.0.1.1", "port-version": 0 }, + "vulkan-sdk-components": { + "baseline": "1.3.268.0", + "port-version": 0 + }, "vulkan-tools": { "baseline": "1.3.268.0", "port-version": 0 }, "vulkan-utility-libraries": { "baseline": "1.3.268.0", - "port-version": 0 + "port-version": 1 }, "vulkan-validationlayers": { "baseline": "1.3.268.0", diff --git a/versions/h-/hikogui.json b/versions/h-/hikogui.json index bcf1b2c492..6607857d1d 100644 --- a/versions/h-/hikogui.json +++ b/versions/h-/hikogui.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d007fc919e0734e139f89d285000d2d166315f73", + "version": "0.8.1", + "port-version": 2 + }, { "git-tree": "89a94b29c6cf63fb3e99c979281751279f02031e", "version": "0.8.1", diff --git a/versions/v-/vulkan-sdk-components.json b/versions/v-/vulkan-sdk-components.json new file mode 100644 index 0000000000..41fadf2a35 --- /dev/null +++ b/versions/v-/vulkan-sdk-components.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "efe1324e0d30a235687686111be4daa4605083e6", + "version": "1.3.268.0", + "port-version": 0 + } + ] +} diff --git a/versions/v-/vulkan-utility-libraries.json b/versions/v-/vulkan-utility-libraries.json index 0f9febe89f..45cd4b53c6 100644 --- a/versions/v-/vulkan-utility-libraries.json +++ b/versions/v-/vulkan-utility-libraries.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d90089cebfde86dcb2c554b9e45271889503fc36", + "version": "1.3.268.0", + "port-version": 1 + }, { "git-tree": "0849291de2e14ef941d30aef9a17e45547329e44", "version": "1.3.268.0", diff --git a/versions/v-/vulkan.json b/versions/v-/vulkan.json index 6f41769dcb..db9b05d552 100644 --- a/versions/v-/vulkan.json +++ b/versions/v-/vulkan.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "3e8d64ec799440b97c7151f97dd00a53e8e1b5ea", + "version-date": "2023-12-17", + "port-version": 0 + }, { "git-tree": "27c107c7bd16ff68d2c9da45b0020713d4b2ea03", "version": "1.3.268.0",