Skip to content

Commit

Permalink
[level-zero] added new recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
RaguzovaTatyana committed Aug 28, 2024
1 parent 7266d08 commit 8153f72
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/level-zero/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.17.28":
url: "https://github.com/oneapi-src/level-zero/archive/refs/tags/v1.17.28.tar.gz"
sha256: "54638426802df958af91f6a6013242d272b89f4bc9b0c9c4663eabc20210ab50"
83 changes: 83 additions & 0 deletions recipes/level-zero/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
from conan import ConanFile
from conan.errors import ConanException, ConanInvalidConfiguration

Check warning on line 2 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused ConanException imported from conan.errors
from conan.tools.build import check_min_cppstd

Check warning on line 3 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused check_min_cppstd imported from conan.tools.build
from conan.tools.scm import Version

Check warning on line 4 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused Version imported from conan.tools.scm
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv

Check warning on line 6 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused VirtualRunEnv imported from conan.tools.env
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir

Check warning on line 7 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused apply_conandata_patches imported from conan.tools.files

Check warning on line 7 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused rmdir imported from conan.tools.files
import functools

Check warning on line 8 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused import functools
import os

Check warning on line 9 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused import os
import yaml

Check warning on line 10 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused import yaml

class LevelZeroConan(ConanFile):
name = "level-zero"
version = "1.17.28"

Check failure on line 14 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Recipe should not contain version attribute
package_type = "library"

license = "MIT"
homepage = "https://github.com/oneapi-src/level-zero"
url = "https://github.com/conan-io/conan-center-index"
description = "OneAPI Level Zero Specification Headers and Loader"
topics = ("api-headers", "loader", "level-zero", "oneapi")
package_id_non_embed_mode = "patch_mode"
package_type = "library"

# Binary configuration
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

def source(self):
version_data = self.conan_data["sources"][self.version]
get(self, **version_data, strip_root=True)

def export(self):
copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder)

Check failure on line 41 in recipes/level-zero/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Instance of 'LevelZeroConan' has no '_dependencies_filename' member. Please, check https://github.com/conan-io/conan-center-index/blob/master/docs/v2_linter.md

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def generate(self):
env = VirtualBuildEnv(self)
env.generate()
deps = CMakeDeps(self)
deps.generate()

toolchain = CMakeToolchain(self)
toolchain.cache_variables["SYSTEM_SPDLOG"] = True
toolchain.generate()

def validate_build(self):
if not self.options.shared:
raise ConanInvalidConfiguration(
f"{self.ref} does not support static build")

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["ze_loader", "ze_core"]
self.cpp_info.includedirs = ["include"]
116 changes: 116 additions & 0 deletions recipes/level-zero/all/patches/1.17.28/001-patch-install-rules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 5ef252c..c9d05dd 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -49,21 +49,10 @@ endif()
target_link_libraries(${TARGET_LOADER_NAME} utils)

install(TARGETS ze_loader
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero
- NAMELINK_SKIP
-)
-
-install(TARGETS ze_loader
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero-devel
- NAMELINK_ONLY
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero
+ NAMELINK_COMPONENT level-zero-devel
)

if(UNIX)
diff --git a/source/drivers/null/CMakeLists.txt b/source/drivers/null/CMakeLists.txt
index b384434..0cb8801 100644
--- a/source/drivers/null/CMakeLists.txt
+++ b/source/drivers/null/CMakeLists.txt
@@ -21,18 +21,10 @@ target_include_directories(${TARGET_NAME}

if(INSTALL_NULL_DRIVER)
install(TARGETS ze_null
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero
- NAMELINK_SKIP
- )
- install(TARGETS ze_null
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero-devel
- NAMELINK_ONLY
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero
+ NAMELINK_COMPONENT level-zero-devel
)
endif()

diff --git a/source/layers/tracing/CMakeLists.txt b/source/layers/tracing/CMakeLists.txt
index 1dde028..63e0b20 100644
--- a/source/layers/tracing/CMakeLists.txt
+++ b/source/layers/tracing/CMakeLists.txt
@@ -49,20 +49,8 @@ set_target_properties(${TARGET_NAME} PROPERTIES
)

install(TARGETS ze_tracing_layer
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero
- NAMELINK_SKIP
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero
+ NAMELINK_COMPONENT level-zero-devel
)
-
-install(TARGETS ze_tracing_layer
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero-devel
- NAMELINK_ONLY
-)
-
diff --git a/source/layers/validation/CMakeLists.txt b/source/layers/validation/CMakeLists.txt
index 3a4162c..ced5f21 100644
--- a/source/layers/validation/CMakeLists.txt
+++ b/source/layers/validation/CMakeLists.txt
@@ -37,21 +37,10 @@ set_target_properties(${TARGET_NAME} PROPERTIES
)

install(TARGETS ze_validation_layer
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero
- NAMELINK_SKIP
-)
-
-install(TARGETS ze_validation_layer
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY
- DESTINATION ${CMAKE_INSTALL_LIBDIR}
- COMPONENT level-zero-devel
- NAMELINK_ONLY
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero
+ NAMELINK_COMPONENT level-zero-devel
)

add_subdirectory(handle_lifetime_tracking)
3 changes: 3 additions & 0 deletions recipes/level-zero/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.17.28":
folder: "all"

0 comments on commit 8153f72

Please sign in to comment.