Permit packages that depend on Intel oneAPI packages to access sdk (#41117)

* Permit packages that depend on Intel oneAPI packages to access sdk

* Implement and use IntelOneapiLibraryPackageWithSdk

* Restore libs property to IntelOneapiLibraryPackage

* Conform to style

* Provide new class to infrastructure

* Treat sdk/include as the main include
This commit is contained in:
Mark Abraham
2023-11-17 15:59:04 +01:00
committed by GitHub
parent 81e73b4dd4
commit ec8bd38c4e
5 changed files with 33 additions and 3 deletions

View File

@@ -179,6 +179,35 @@ def libs(self):
return find_libraries("*", root=lib_path, shared=True, recursive=True)
class IntelOneApiLibraryPackageWithSdk(IntelOneApiPackage):
"""Base class for Intel oneAPI library packages with SDK components.
Contains some convenient default implementations for libraries
that expose functionality in sdk subdirectories.
Implement the method directly in the package if something
different is needed.
"""
@property
def include(self):
return join_path(self.component_prefix, "sdk", "include")
@property
def headers(self):
return find_headers("*", self.include, recursive=True)
@property
def lib(self):
lib_path = join_path(self.component_prefix, "sdk", "lib64")
lib_path = lib_path if isdir(lib_path) else dirname(lib_path)
return lib_path
@property
def libs(self):
return find_libraries("*", root=self.lib, shared=True, recursive=True)
class IntelOneApiStaticLibraryList:
"""Provides ld_flags when static linking is needed

View File

@@ -52,6 +52,7 @@
from spack.build_systems.oneapi import (
INTEL_MATH_LIBRARIES,
IntelOneApiLibraryPackage,
IntelOneApiLibraryPackageWithSdk,
IntelOneApiPackage,
IntelOneApiStaticLibraryList,
)