IntelOneApiPackage: add envmods variant to toggle environment modifications by oneapi packages (#34253)
Co-authored-by: Sean Koyama <skoyama@anl.gov> Co-authored-by: Robert Cohn <robert.s.cohn@intel.com>
This commit is contained in:
parent
c6465bd9bd
commit
8a02463d7d
@ -10,7 +10,7 @@
|
||||
|
||||
from llnl.util.filesystem import find_headers, find_libraries, join_path
|
||||
|
||||
from spack.directives import conflicts
|
||||
from spack.directives import conflicts, variant
|
||||
from spack.util.environment import EnvironmentModifications
|
||||
from spack.util.executable import Executable
|
||||
|
||||
@ -36,6 +36,13 @@ class IntelOneApiPackage(Package):
|
||||
]:
|
||||
conflicts(c, msg="This package in only available for x86_64 and Linux")
|
||||
|
||||
# Add variant to toggle environment modifications from vars.sh
|
||||
variant(
|
||||
"envmods",
|
||||
default=True,
|
||||
description="Toggles environment modifications",
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def update_description(cls):
|
||||
"""Updates oneapi package descriptions with common text."""
|
||||
@ -114,11 +121,13 @@ def setup_run_environment(self, env):
|
||||
|
||||
$ source {prefix}/{component}/{version}/env/vars.sh
|
||||
"""
|
||||
env.extend(
|
||||
EnvironmentModifications.from_sourcing_file(
|
||||
join_path(self.component_prefix, "env", "vars.sh")
|
||||
# Only if environment modifications are desired (default is +envmods)
|
||||
if "+envmods" in self.spec:
|
||||
env.extend(
|
||||
EnvironmentModifications.from_sourcing_file(
|
||||
join_path(self.component_prefix, "env", "vars.sh")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class IntelOneApiLibraryPackage(IntelOneApiPackage):
|
||||
|
@ -131,8 +131,10 @@ def setup_run_environment(self, env):
|
||||
env.append_path("__INTEL_POST_FFLAGS", flag, separator=" ")
|
||||
|
||||
def setup_dependent_build_environment(self, env, dependent_spec):
|
||||
env.set("MKLROOT", self.component_prefix)
|
||||
env.append_path("PKG_CONFIG_PATH", self.component_prefix.lib.pkgconfig)
|
||||
# Only if environment modifications are desired (default is +envmods)
|
||||
if "+envmods" in self.spec:
|
||||
env.set("MKLROOT", self.component_prefix)
|
||||
env.append_path("PKG_CONFIG_PATH", self.component_prefix.lib.pkgconfig)
|
||||
|
||||
def _find_mkl_libs(self, shared):
|
||||
libs = []
|
||||
|
Loading…
Reference in New Issue
Block a user