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 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.environment import EnvironmentModifications
|
||||||
from spack.util.executable import Executable
|
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")
|
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
|
@staticmethod
|
||||||
def update_description(cls):
|
def update_description(cls):
|
||||||
"""Updates oneapi package descriptions with common text."""
|
"""Updates oneapi package descriptions with common text."""
|
||||||
@ -114,6 +121,8 @@ def setup_run_environment(self, env):
|
|||||||
|
|
||||||
$ source {prefix}/{component}/{version}/env/vars.sh
|
$ source {prefix}/{component}/{version}/env/vars.sh
|
||||||
"""
|
"""
|
||||||
|
# Only if environment modifications are desired (default is +envmods)
|
||||||
|
if "+envmods" in self.spec:
|
||||||
env.extend(
|
env.extend(
|
||||||
EnvironmentModifications.from_sourcing_file(
|
EnvironmentModifications.from_sourcing_file(
|
||||||
join_path(self.component_prefix, "env", "vars.sh")
|
join_path(self.component_prefix, "env", "vars.sh")
|
||||||
|
@ -131,6 +131,8 @@ def setup_run_environment(self, env):
|
|||||||
env.append_path("__INTEL_POST_FFLAGS", flag, separator=" ")
|
env.append_path("__INTEL_POST_FFLAGS", flag, separator=" ")
|
||||||
|
|
||||||
def setup_dependent_build_environment(self, env, dependent_spec):
|
def setup_dependent_build_environment(self, env, dependent_spec):
|
||||||
|
# Only if environment modifications are desired (default is +envmods)
|
||||||
|
if "+envmods" in self.spec:
|
||||||
env.set("MKLROOT", self.component_prefix)
|
env.set("MKLROOT", self.component_prefix)
|
||||||
env.append_path("PKG_CONFIG_PATH", self.component_prefix.lib.pkgconfig)
|
env.append_path("PKG_CONFIG_PATH", self.component_prefix.lib.pkgconfig)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user