Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcar87 committed Nov 7, 2024
1 parent 377db2e commit c8b996d
Showing 1 changed file with 12 additions and 31 deletions.
43 changes: 12 additions & 31 deletions recipes/level-zero/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.env import VirtualBuildEnv
from conan.tools.cmake import is_apple_os
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import get, apply_conandata_patches, copy, export_conandata_patches, rmdir
from conan.tools.files import get, apply_conandata_patches, copy, export_conandata_patches, rmdir, replace_in_file
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
import os


Expand All @@ -20,26 +19,15 @@ class LevelZeroConan(ConanFile):
# Binary configuration
settings = "os", "arch", "compiler", "build_type"

@property
def _min_cppstd(self):
return 14

@property
def _compilers_minimum_version(self):
return {
"apple-clang": "10",
"clang": "7",
"gcc": "7",
"msvc": "190",
"Visual Studio": "15",
}

def requirements(self):
self.requires("spdlog/1.14.1")

def source(self):
version_data = self.conan_data["sources"][self.version]
get(self, **version_data, strip_root=True)
apply_conandata_patches(self)
replace_in_file(self, os.path.join(self.source_folder, "source", "loader","ze_loader.cpp"),
"#ifdef __linux__", "#if defined(__linux__) || defined(__APPLE__)")

def export_sources(self):
export_conandata_patches(self)
Expand All @@ -55,21 +43,15 @@ def generate(self):
toolchain.generate()

def validate(self):
if self.settings.os == "Macos":
raise ConanInvalidConfiguration("This recipe doesn't prepared for macOS.")
if self.settings.os == "Windows":
if self.settings.get_safe("subsystem") == "uwp":
raise ConanInvalidConfiguration(f"{self.ref} does not support UWP on Windows.")
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
if is_apple_os(self):
self.output.warning("Level Zero is not known to support Apple platforms")
if self.settings.os == "Windows" and self.settings.get_safe("subsystem") == "uwp":
raise ConanInvalidConfiguration(f"{self.ref} does not support UWP on Windows.")

min_cpp_std = "14"
check_min_cppstd(self, min_cpp_std)

def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand All @@ -90,4 +72,3 @@ def package_info(self):
self.cpp_info.components["ze-loader"].set_property("pkg_config_name", "libze_loader")
self.cpp_info.components["level-zero"].requires = ["ze-loader"]
self.cpp_info.components["level-zero"].set_property("pkg_config_name", "level-zero")

0 comments on commit c8b996d

Please sign in to comment.