Skip to content

Commit

Permalink
(#16297) moltenvk: add 1.2.2 + modernize a little bit more
Browse files Browse the repository at this point in the history
* add moltenvk/1.2.2

* modernize more for conan v2
  • Loading branch information
SpaceIm authored Apr 4, 2023
1 parent 75e16b3 commit 3f407fd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
3 changes: 3 additions & 0 deletions recipes/moltenvk/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.2.2":
url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.2.tar.gz"
sha256: "8065a10c2d70b561f48475dedb118e643176527b162d6e439fa127270c2a07dd"
"1.2.1":
url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.1.tar.gz"
sha256: "4742df8f35473c5a737f2b120ae06aa6b9e8a7a3753b88932e501b06b1d17ea8"
Expand Down
24 changes: 6 additions & 18 deletions recipes/moltenvk/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class MoltenVKConan(ConanFile):
homepage = "https://github.com/KhronosGroup/MoltenVK"
url = "https://github.com/conan-io/conan-center-index"

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
Expand Down Expand Up @@ -84,7 +85,7 @@ def requirements(self):
self.requires("cereal/1.3.2")
self.requires(self._require("glslang"))
self.requires(self._require("spirv-cross"))
self.requires(self._require("vulkan-headers"))
self.requires(self._require("vulkan-headers"), transitive_headers=True)
if self.options.with_spirv_tools:
self.requires(self._require("spirv-tools"))

Expand All @@ -93,34 +94,21 @@ def _require(self, recipe_name):
raise ConanException(f"{recipe_name} is missing in {self._dependencies_filename}")
return f"{recipe_name}/{self._dependencies_versions[recipe_name]}"

def package_id(self):
# MoltenVK >=1.O.42 requires at least XCode 12.0 (11.4 actually) at build
# time but can be consumed by older compiler versions if shared
if Version(self.version) >= "1.0.42" and self.options.shared:
if Version(self.settings.compiler.version) < "12.0":
compatible_pkg = self.info.clone()
compatible_pkg.settings.compiler.version = "12.0"
self.compatible_packages.append(compatible_pkg)

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
if self.settings.os not in ["Macos", "iOS", "tvOS"]:
raise ConanInvalidConfiguration(f"{self.ref} only supported on MacOS, iOS and tvOS")
if self.settings.compiler != "apple-clang":
raise ConanInvalidConfiguration(f"{self.ref} requires apple-clang")
if Version(self.version) >= "1.0.42":
if Version(self.settings.compiler.version) < "12.0":
raise ConanInvalidConfiguration(f"{self.ref} requires XCode 12.0 or higher at build time")

def validate_build(self):
if Version(self.settings.compiler.version) < "12.0":
raise ConanInvalidConfiguration(f"{self.ref} requires XCode 12.0 or higher")
spirv_cross = self.dependencies["spirv-cross"]
if spirv_cross.options.shared or not spirv_cross.options.msl or not spirv_cross.options.reflect:
if spirv_cross.options.shared or not (spirv_cross.options.msl and spirv_cross.options.reflect):
raise ConanInvalidConfiguration(f"{self.ref} requires spirv-cross static with msl & reflect enabled")

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):
tc = CMakeToolchain(self)
Expand Down
4 changes: 4 additions & 0 deletions recipes/moltenvk/all/dependencies/dependencies-1.2.2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
glslang: "1.3.239.0"
spirv-cross: "1.3.239.0"
spirv-tools: "1.3.239.0"
vulkan-headers: "1.3.239.0"
2 changes: 2 additions & 0 deletions recipes/moltenvk/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.2.2":
folder: all
"1.2.1":
folder: all
"1.2.0":
Expand Down

0 comments on commit 3f407fd

Please sign in to comment.