From 8c5ffcfcfae52204cebd6cd74515aa8710799252 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 22 Feb 2023 15:54:19 +0100 Subject: [PATCH 1/2] modernize more --- recipes/vulkan-loader/all/conanfile.py | 27 ++++++++++---------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/recipes/vulkan-loader/all/conanfile.py b/recipes/vulkan-loader/all/conanfile.py index e1a6db65c0bf0..96661bf1c273d 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -2,13 +2,14 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.env import VirtualBuildEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import check_min_vs from conan.tools.scm import Version import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.55.0" class VulkanLoaderConan(ConanFile): @@ -68,7 +69,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires(f"vulkan-headers/{self.version}") + self.requires(f"vulkan-headers/{self.version}", transitive_headers=True) if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") if Version(self.version) < "1.3.231" and self.options.get_safe("with_wsi_wayland"): @@ -80,22 +81,21 @@ def validate(self): raise ConanInvalidConfiguration("Conan recipe for DirectFB is not available yet.") if not is_apple_os(self) and not self.options.shared: raise ConanInvalidConfiguration(f"Static builds are not supported on {self.settings.os}") - if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < 15: - # FIXME: It should build but Visual Studio 2015 container in CI of CCI seems to lack some Win SDK headers - raise ConanInvalidConfiguration("Visual Studio < 2017 not yet supported in this recipe") + # FIXME: It should build but Visual Studio 2015 container in CI of CCI seems to lack some Win SDK headers + check_min_vs(self, "191") # TODO: to replace by some version range check if self.dependencies["vulkan-headers"].ref.version != self.version: self.output.warn("vulkan-loader should be built & consumed with the same version than vulkan-headers.") def build_requirements(self): if self._is_pkgconf_needed: - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") if self._is_mingw: self.tool_requires("jwasm/2.13") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if self._is_pkgconf_needed or self._is_mingw: @@ -126,10 +126,6 @@ def generate(self): if self._is_pkgconf_needed: pkg = PkgConfigDeps(self) pkg.generate() - # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) - env = Environment() - env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) - env.vars(self).save_script("conanbuildenv_pkg_config_path") def _patch_sources(self): apply_conandata_patches(self) @@ -178,10 +174,7 @@ def package_info(self): self.cpp_info.libs = [f"vulkan{suffix}"] # allow to properly set Vulkan_INCLUDE_DIRS in CMake like generators - vulkan_headers = self.dependencies["vulkan-headers"] - self.cpp_info.includedirs = [ - os.path.join(vulkan_headers.package_folder, includedir) for includedir in vulkan_headers.cpp_info.includedirs - ] + self.cpp_info.includedirs = self.dependencies["vulkan-headers"].cpp_info.aggregated_components().includedirs if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "pthread", "m"] From 2b4d29f59cbe2375f5d9c9c39e9d369929071f7d Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 22 Mar 2023 11:04:48 +0100 Subject: [PATCH 2/2] self.output.warning instead of self.output.warn --- recipes/vulkan-loader/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/vulkan-loader/all/conanfile.py b/recipes/vulkan-loader/all/conanfile.py index 96661bf1c273d..26c55ed9363d7 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -85,7 +85,7 @@ def validate(self): check_min_vs(self, "191") # TODO: to replace by some version range check if self.dependencies["vulkan-headers"].ref.version != self.version: - self.output.warn("vulkan-loader should be built & consumed with the same version than vulkan-headers.") + self.output.warning("vulkan-loader should be built & consumed with the same version than vulkan-headers.") def build_requirements(self): if self._is_pkgconf_needed: