|
| 1 | +import os |
| 2 | + |
| 3 | +from conan import ConanFile |
| 4 | +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout |
| 5 | +from conan.tools.files import copy, get |
| 6 | + |
| 7 | +required_conan_version = ">=2.0" |
| 8 | + |
| 9 | + |
| 10 | +class VulkanToolsConan(ConanFile): |
| 11 | + name = "vulkan-tools" |
| 12 | + homepage = "https://github.com/KhronosGroup/Vulkan-Profiles" |
| 13 | + description = "Vulkan Development Tools" |
| 14 | + license = "Apache-2.0" |
| 15 | + topics = ("vulkan-tools", "vulkan", "gpu") |
| 16 | + url = "https://github.com/conan-io/conan-center-index" |
| 17 | + package_type = "application" |
| 18 | + settings = "os", "arch", "compiler", "build_type" |
| 19 | + |
| 20 | + def layout(self): |
| 21 | + cmake_layout(self, src_folder="src") |
| 22 | + |
| 23 | + def requirements(self): |
| 24 | + self.requires(f"vulkan-headers/{self.version}", transitive_headers=True) |
| 25 | + if self.settings.os != "Android": |
| 26 | + self.requires(f"vulkan-loader/{self.version}", transitive_headers=True) |
| 27 | + |
| 28 | + def source(self): |
| 29 | + get(self, **self.conan_data["sources"][self.version], strip_root=True) |
| 30 | + |
| 31 | + def generate(self): |
| 32 | + tc = CMakeToolchain(self) |
| 33 | + tc.variables["BUILD_TESTS"] = False |
| 34 | + tc.variables["TOOLS_CODEGEN"] = False |
| 35 | + tc.generate() |
| 36 | + |
| 37 | + def build(self): |
| 38 | + cmake = CMake(self) |
| 39 | + cmake.configure() |
| 40 | + cmake.build() |
| 41 | + |
| 42 | + def package(self): |
| 43 | + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) |
| 44 | + cmake = CMake(self) |
| 45 | + cmake.install() |
| 46 | + |
| 47 | + def package_info(self): |
| 48 | + #self.cpp_info.set_property("cmake_file_name", "VulkanTools") |
| 49 | + #self.cpp_info.set_property("cmake_target_name", "Vulkan::Tools") |
| 50 | + #self.cpp_info.libs = ["VulkanLayerSettings", "VulkanSafeStruct"] |
| 51 | + bin_path = os.path.join(self.package_folder, "bin") |
| 52 | + self.output.info(f"Appending PATH environment variable: {bin_path}") |
| 53 | + self.env_info.path.append(bin_path) |
| 54 | + |
| 55 | + self.cpp_info.includedirs = [] |
| 56 | + self.cpp_info.libdirs = [] |
0 commit comments