Initial commit

This commit is contained in:
2026-01-23 22:15:36 +01:00
commit ca60108606
167 changed files with 5311 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
sources:
"1.4.313.0":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/vulkan-sdk-1.4.313.0.tar.gz"
sha256: "49b8ee6c2352157b12b1c87eb1165bc0f82a885bc2135ad97041ac84f79aacd0"
"1.3.243.0":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.243.0.tar.gz"
sha256: "fd9f6c24027de177b2fb0eb6385542d62f4c21665a8d4cc7e1c118688e0836de"
"1.3.239.0":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.239.0.tar.gz"
sha256: "7aa7fb46e25e5ef0144d29c92122b631dc7c7c6804a6339f195b368ad53328e4"
"1.3.236.0":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.236.0.tar.gz"
sha256: "68f2cf70b1960f85e931ef56935e6ceda1beeb214f8fa319e6b95128b02b485a"
"1.3.231.1":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.231.1.tar.gz"
sha256: "ea40af0f499e7e97a86ee54410c5c78e7f7bac40f65ae09a1549773b6501bf4d"
"1.3.224.1":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.224.1.tar.gz"
sha256: "49c00e0119e3bc11e13c0c740e57c76b582b14f754f3779b85508c4d90d9df85"
"1.3.216.0":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.216.0.tar.gz"
sha256: "593d9b818d536490b70322a01b306ec165df5e7a70d770d05014fbd0b325fa15"
"1.3.211.0":
url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.211.0.tar.gz"
sha256: "927c1cb98c81fe8a1a529cf2d977d701dcda49c495a19583dc00e178b6757203"
patches:
"1.3.243.0":
- patch_file: "patches/1.3.243.0-0001-fix-cmake.patch"
patch_description: "CMake: Adapt to conan"
patch_type: "conan"
"1.3.239.0":
- patch_file: "patches/1.3.239.0-0001-fix-cmake.patch"
patch_description: "CMake: Adapt to conan"
patch_type: "conan"
"1.3.236.0":
- patch_file: "patches/1.3.236.0-0001-fix-cmake.patch"
patch_description: "CMake: Adapt to conan"
patch_type: "conan"
"1.3.231.1":
- patch_file: "patches/1.3.231.1-0001-fix-cmake.patch"
patch_description: "CMake: Adapt to conan"
patch_type: "conan"
- patch_file: "patches/1.3.231.1-0002-cmake-no-werror.patch"
patch_description: "Allow to disable Werror for old gcc/clang versions"
patch_type: "portability"
"1.3.224.1":
- patch_file: "patches/1.3.224.1-0001-fix-cmake.patch"
patch_description: "CMake: Adapt to conan"
patch_type: "conan"
"1.3.216.0":
- patch_file: "patches/1.3.204.1-0001-fix-cmake.patch"
patch_description: "CMake: Adapt to conan"
patch_type: "conan"
"1.3.211.0":
- patch_file: "patches/1.3.204.1-0001-fix-cmake.patch"
patch_description: "CMake: Adapt to conan"
patch_type: "conan"

View File

@@ -0,0 +1,270 @@
from conan import ConanFile, conan_version
from conan.errors import ConanException, ConanInvalidConfiguration
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, replace_in_file, rm
from conan.tools.gnu import PkgConfigDeps
from conan.tools.scm import Version
import functools
import glob
import os
import shutil
import yaml
required_conan_version = ">=1.55.0"
class VulkanValidationLayersConan(ConanFile):
name = "vulkan-validationlayers"
description = "Khronos official Vulkan validation layers for Windows, Linux, Android, and MacOS."
license = "Apache-2.0"
topics = ("vulkan", "validation-layers")
homepage = "https://github.com/KhronosGroup/Vulkan-ValidationLayers"
url = "https://github.com/conan-io/conan-center-index"
package_type = "static-library"
settings = "os", "arch", "compiler", "build_type"
options = {
"fPIC": [True, False],
"with_wsi_xcb": [True, False],
"with_wsi_xlib": [True, False],
"with_wsi_wayland": [True, False],
}
default_options = {
"fPIC": True,
"with_wsi_xcb": True,
"with_wsi_xlib": True,
"with_wsi_wayland": True,
}
short_paths = True
@property
def _dependencies_filename(self):
return f"dependencies-{self.version}.yml"
@property
@functools.lru_cache(1)
def _dependencies_versions(self):
dependencies_filepath = os.path.join(self.recipe_folder, "dependencies", self._dependencies_filename)
if not os.path.isfile(dependencies_filepath):
raise ConanException(f"Cannot find {dependencies_filepath}")
cached_dependencies = yaml.safe_load(open(dependencies_filepath))
return cached_dependencies
@property
def _needs_wayland_for_build(self):
return (self.options.get_safe("with_wsi_wayland") and
(Version(self.version) < "1.3.231" or Version(self.version) >= "1.3.243.0"))
@property
def _needs_pkg_config(self):
return self.options.get_safe("with_wsi_xcb") or \
self.options.get_safe("with_wsi_xlib") or \
self._needs_wayland_for_build
@property
def _min_cppstd(self):
if Version(self.version) >= "1.3.235":
return "17"
return "11"
@property
def _compilers_minimum_version(self):
return {
"17": {
"apple-clang": "9",
"clang": "6",
"gcc": "7",
"msvc": "191",
"Visual Studio": "15.7",
},
}.get(self._min_cppstd, {})
def export(self):
copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder)
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os not in ["Linux", "FreeBSD"]:
del self.options.with_wsi_xcb
del self.options.with_wsi_xlib
del self.options.with_wsi_wayland
if self.settings.os == "Windows":
del self.options.fPIC
def layout(self):
cmake_layout(self, src_folder="src")
def requirements(self):
self.requires("robin-hood-hashing/3.11.5")
self.requires(self._require("spirv-headers"))
if Version(conan_version).minor >= "1.4.313":
self.requires(self._require("vulkan-utility-libraries"), transitive_headers=True)
if Version(conan_version).major < "2":
# TODO: set private=True, once the issue is resolved https://github.com/conan-io/conan/issues/9390
self.requires(self._require("spirv-tools"), private=not hasattr(self, "settings_build"))
else:
self.requires(self._require("spirv-tools"))
self.requires(self._require("vulkan-headers"), transitive_headers=True)
if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"):
self.requires("xorg/system")
if self._needs_wayland_for_build:
self.requires("wayland/1.22.0")
def _require(self, recipe_name):
if recipe_name not in self._dependencies_versions:
raise ConanException(f"{recipe_name} is missing in {self._dependencies_filename}")
return f"{recipe_name}/{self._dependencies_versions[recipe_name]}"
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
def loose_lt_semver(v1, v2):
lv1 = [int(v) for v in v1.split(".")]
lv2 = [int(v) for v in v2.split(".")]
min_length = min(len(lv1), len(lv2))
return lv1[:min_length] < lv2[:min_length]
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version):
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.",
)
if self.dependencies["spirv-tools"].options.shared:
raise ConanInvalidConfiguration("vulkan-validationlayers can't depend on shared spirv-tools")
if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5":
raise ConanInvalidConfiguration("gcc < 5 is not supported")
def build_requirements(self):
if self._needs_pkg_config and not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/2.1.0")
if Version(self.version) >= "1.3.239":
self.tool_requires("cmake/[>=3.17.2 <4]")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
tc = CMakeToolchain(self)
if Version(self.version) >= "1.3.239":
tc.cache_variables["VVL_CLANG_TIDY"] = False
if Version(self.version) < "1.3.234":
tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/")
tc.variables["USE_CCACHE"] = False
if self.settings.os in ["Linux", "FreeBSD"]:
tc.variables["BUILD_WSI_XCB_SUPPORT"] = self.options.get_safe("with_wsi_xcb")
tc.variables["BUILD_WSI_XLIB_SUPPORT"] = self.options.get_safe("with_wsi_xlib")
tc.variables["BUILD_WSI_WAYLAND_SUPPORT"] = self.options.get_safe("with_wsi_wayland")
elif self.settings.os == "Android":
tc.variables["BUILD_WSI_XCB_SUPPORT"] = False
tc.variables["BUILD_WSI_XLIB_SUPPORT"] = False
tc.variables["BUILD_WSI_WAYLAND_SUPPORT"] = False
tc.variables["BUILD_WERROR"] = False
tc.variables["BUILD_TESTS"] = False
tc.variables["INSTALL_TESTS"] = False
tc.variables["BUILD_LAYERS"] = True
tc.variables["BUILD_LAYER_SUPPORT_FILES"] = True
tc.generate()
deps = CMakeDeps(self)
deps.generate()
if self._needs_pkg_config:
deps = PkgConfigDeps(self)
deps.generate()
def _patch_sources(self):
apply_conandata_patches(self)
# Vulkan-ValidationLayers relies on Vulkan-Headers version from CMake config file
# to set api_version in its manifest file, but this value MUST have format x.y.z (no extra number).
# FIXME: find a way to force correct version in CMakeDeps of vulkan-headers recipe?
# NOTE: At version 1.3.239, the JSON_API_VERSION was removed from the cmakelists file,
if Version(self.version) >= "1.3.235" and Version(self.version) < "1.3.239":
vk_version = Version(self.dependencies["vulkan-headers"].ref.version)
sanitized_vk_version = f"{vk_version.major}.{vk_version.minor}.{vk_version.patch}"
replace_in_file(
self, os.path.join(self.source_folder, "layers", "CMakeLists.txt"),
"set(JSON_API_VERSION ${VulkanHeaders_VERSION})",
f"set(JSON_API_VERSION \"{sanitized_vk_version}\")",
)
# FIXME: two CMake module/config files should be generated (SPIRV-ToolsConfig.cmake and SPIRV-Tools-optConfig.cmake),
# but it can't be modeled right now in spirv-tools recipe
if not os.path.exists(os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake")):
shutil.copy(
os.path.join(self.generators_folder, "SPIRV-ToolsConfig.cmake"),
os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake"),
)
if self.settings.os == "Android":
# INFO: libVkLayer_utils.a: error: undefined symbol: __android_log_print
# https://github.com/KhronosGroup/Vulkan-ValidationLayers/commit/a26638ae9fdd8c40b56d4c7b72859a5b9a0952c9
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"VkLayer_utils PUBLIC Vulkan::Headers", "VkLayer_utils PUBLIC Vulkan::Headers -landroid -llog")
if not self.options.get_safe("fPIC"):
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"CMAKE_POSITION_INDEPENDENT_CODE ON", "CMAKE_POSITION_INDEPENDENT_CODE OFF")
def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
if self.settings.os == "Windows":
# import lib is useless, validation layers are loaded at runtime
lib_dir = os.path.join(self.package_folder, "lib")
rm(self, "VkLayer_khronos_validation.lib", lib_dir)
rm(self, "libVkLayer_khronos_validation.dll.a", lib_dir)
# move dll and json manifest files in bin folder
bin_dir = os.path.join(self.package_folder, "bin")
mkdir(self, bin_dir)
for ext in ("*.dll", "*.json"):
for bin_file in glob.glob(os.path.join(lib_dir, ext)):
shutil.move(bin_file, os.path.join(bin_dir, os.path.basename(bin_file)))
else:
# Move json files to res, but keep in mind to preserve relative
# path between module library and manifest json file
rename(self, os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res"))
fix_apple_shared_install_name(self)
def package_info(self):
if Version(conan_version).minor < "1.4.313.0":
self.cpp_info.libs = ["VkLayer_utils"]
if Version(conan_version).minor >= "1.4.313.0":
self.cpp_info.includedirs = []
manifest_subfolder = "bin" if self.settings.os == "Windows" else os.path.join("res", "vulkan", "explicit_layer.d")
vk_layer_path = os.path.join(self.package_folder, manifest_subfolder)
self.runenv_info.prepend_path("VK_LAYER_PATH", vk_layer_path)
# Update runtime discovery paths to allow libVkLayer_khronos_validation.{so,dll,dylib} to be discovered
# and loaded by vulkan-loader when the consumer executes
# This is necessary because this package exports a static lib to link against and a dynamic lib to load at runtime
runtime_lib_discovery_path = "LD_LIBRARY_PATH"
if self.settings.os == "Windows":
runtime_lib_discovery_path = "PATH"
if self.settings.os == "Macos":
runtime_lib_discovery_path = "DYLD_LIBRARY_PATH"
for libdir in [os.path.join(self.package_folder, libdir) for libdir in self.cpp_info.libdirs]:
self.runenv_info.prepend_path(runtime_lib_discovery_path, libdir)
# TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator
self.env_info.VK_LAYER_PATH.append(vk_layer_path)
if self.settings.os == "Android":
self.cpp_info.system_libs.extend(["android", "log"])

View File

@@ -0,0 +1,3 @@
spirv-headers: "1.3.211.0"
spirv-tools: "1.3.211.0"
vulkan-headers: "1.3.211.0"

View File

@@ -0,0 +1,3 @@
spirv-headers: "1.3.216.0"
spirv-tools: "1.3.216.0"
vulkan-headers: "1.3.216.0"

View File

@@ -0,0 +1,3 @@
spirv-headers: "1.3.224.0"
spirv-tools: "1.3.224.0"
vulkan-headers: "1.3.224.0"

View File

@@ -0,0 +1,3 @@
spirv-headers: "1.3.231.1"
spirv-tools: "1.3.231.1"
vulkan-headers: "1.3.231.1"

View File

@@ -0,0 +1,3 @@
spirv-headers: "1.3.236.0"
spirv-tools: "1.3.236.0"
vulkan-headers: "1.3.236.0"

View File

@@ -0,0 +1,3 @@
spirv-headers: "1.3.239.0"
spirv-tools: "1.3.239.0"
vulkan-headers: "1.3.239.0"

View File

@@ -0,0 +1,3 @@
spirv-headers: "1.3.243.0"
spirv-tools: "1.3.243.0"
vulkan-headers: "1.3.243.0"

View File

@@ -0,0 +1,4 @@
spirv-headers: "1.4.313.0"
spirv-tools: "1.4.313.0"
vulkan-headers: "1.4.313.0"
vulkan-utility-libraries: "1.4.313.0"

View File

@@ -0,0 +1,31 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers)
get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES)
else()
- find_package(VulkanHeaders REQUIRED)
+ find_package(VulkanHeaders REQUIRED MODULE)
# xxxnsubtil: this should eventually be replaced by exported targets
add_library(Vulkan-Headers INTERFACE)
@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux
endif()
if(BUILD_WSI_WAYLAND_SUPPORT)
- find_package(Wayland REQUIRED)
+ find_package(Wayland REQUIRED MODULE)
include_directories(${WAYLAND_CLIENT_INCLUDE_DIR})
endif()
endif()
--- a/cmake/FindVulkanHeaders.cmake
+++ b/cmake/FindVulkanHeaders.cmake
@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR)
NO_CMAKE_FIND_ROOT_PATH)
find_path(VulkanRegistry_DIR
NAMES vk.xml
- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry
+ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry
NO_CMAKE_FIND_ROOT_PATH)
else()
# If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified,

View File

@@ -0,0 +1,31 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers)
get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES)
else()
- find_package(VulkanHeaders REQUIRED)
+ find_package(VulkanHeaders REQUIRED MODULE)
# xxxnsubtil: this should eventually be replaced by exported targets
add_library(Vulkan-Headers INTERFACE)
@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux
endif()
if(BUILD_WSI_WAYLAND_SUPPORT)
- find_package(Wayland REQUIRED)
+ find_package(Wayland REQUIRED MODULE)
include_directories(${WAYLAND_CLIENT_INCLUDE_DIR})
endif()
endif()
--- a/cmake/FindVulkanHeaders.cmake
+++ b/cmake/FindVulkanHeaders.cmake
@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR)
NO_DEFAULT_PATH)
find_path(VulkanRegistry_DIR
NAMES vk.xml
- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry
+ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
else()

View File

@@ -0,0 +1,30 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -103,7 +103,7 @@ if (GOOGLETEST_INSTALL_DIR)
list(APPEND CMAKE_PREFIX_PATH ${GOOGLETEST_INSTALL_DIR})
endif()
-find_package(VulkanHeaders REQUIRED)
+find_package(VulkanHeaders REQUIRED MODULE)
add_library(Vulkan-Headers INTERFACE)
target_include_directories(Vulkan-Headers INTERFACE ${VulkanHeaders_INCLUDE_DIRS})
add_library(Vulkan::Headers ALIAS Vulkan-Headers)
@@ -229,7 +229,6 @@ if(BUILD_LAYERS OR BUILD_TESTS)
endif()
# VVLGenerateSourceCode depends on spirv/unified1
- include(VVLGenerateSourceCode)
if (NOT TARGET SPIRV-Tools-opt)
find_package(SPIRV-Tools-opt REQUIRED CONFIG)
--- a/cmake/FindVulkanHeaders.cmake
+++ b/cmake/FindVulkanHeaders.cmake
@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR)
NO_DEFAULT_PATH)
find_path(VulkanRegistry_DIR
NAMES vk.xml
- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry
+ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
else()

View File

@@ -0,0 +1,13 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -171,9 +171,7 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
-fno-builtin-memcmp)
# Treat warnings as errors for versions of GCC and c++11-compliant Clang versions that are shipped on Ubuntu 18.04 or older.
- if(BUILD_WERROR OR
- (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 7.3.0) OR
- (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0))
+ if(BUILD_WERROR)
add_compile_options(-Werror)
endif()

View File

@@ -0,0 +1,10 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -230,7 +230,6 @@ endif()
if(BUILD_LAYERS OR BUILD_TESTS)
find_package(SPIRV-Headers REQUIRED CONFIG QUIET)
- include(VVLGenerateSourceCode)
find_package(SPIRV-Tools-opt REQUIRED CONFIG QUIET)

View File

@@ -0,0 +1,11 @@
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -134,7 +134,7 @@ endif()
find_package(PythonInterp 3 QUIET)
-if (PYTHONINTERP_FOUND)
+if (0)
# Get the include directory of the SPIRV-Headers
get_target_property(SPIRV_HEADERS_INCLUDE_DIR SPIRV-Headers::SPIRV-Headers INTERFACE_INCLUDE_DIRECTORIES)

View File

@@ -0,0 +1,11 @@
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -115,7 +115,7 @@ endif()
find_package(PythonInterp 3 QUIET)
-if (PYTHONINTERP_FOUND)
+if (0)
# Get the include directory of the SPIRV-Headers
get_target_property(SPIRV_HEADERS_INCLUDE_DIR SPIRV-Headers::SPIRV-Headers INTERFACE_INCLUDE_DIRECTORIES)

View File

@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES CXX)
find_package(vulkan-validationlayers REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-validationlayers::vulkan-validationlayers)
if(vulkan-validationlayers_VERSION VERSION_GREATER_EQUAL "1.3.235")
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
else()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
endif()

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,8 @@
#include <vulkan/utility/vk_format_utils.h>
#include <iostream>
int main() {
std::cout << "VK_FORMAT_D16_UNORM " << (vkuFormatIsDepthOnly(VK_FORMAT_D16_UNORM) ? "is" : "is not") << " depth only" << std::endl;
return 0;
}

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)

View File

@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)