Skip to content
Snippets Groups Projects

feat(BSS-2): cleanup env handling during build

Merged Eric Müller requested to merge feat_BSS2_cleanup_env_in_build into master
All threads resolved!
Files
2
+ 33
18
@@ -5,6 +5,8 @@
@@ -5,6 +5,8 @@
import os
import os
from spack import *
from spack import *
 
from spack.util.environment import EnvironmentModifications
 
import spack.build_environment
class Hxtorch(WafPackage):
class Hxtorch(WafPackage):
@@ -71,8 +73,37 @@ class Hxtorch(WafPackage):
@@ -71,8 +73,37 @@ class Hxtorch(WafPackage):
dep = self.spec[ppu_dep_name]
dep = self.spec[ppu_dep_name]
dep_include_dirs = set(dep.headers.directories)
dep_include_dirs = set(dep.headers.directories)
ppu_include_dirs.extend(list(dep_include_dirs))
ppu_include_dirs.extend(list(dep_include_dirs))
env.set('C_INCLUDE_PATH', ':'.join(ppu_include_dirs))
for dir in reversed(ppu_include_dirs):
env.set('CPLUS_INCLUDE_PATH', ':'.join(ppu_include_dirs))
env.prepend_path("C_INCLUDE_PATH", dir)
 
env.prepend_path("CPLUS_INCLUDE_PATH", dir)
 
 
def setup_build_environment(self, env):
 
my_envmod = EnvironmentModifications(env)
 
spack.build_environment.set_wrapper_variables(self, my_envmod)
 
my_env = {}
 
my_envmod.apply_modifications(my_env)
 
 
def get_path(env, name):
 
path = env.get(name, "").strip()
 
if path:
 
return path.split(os.pathsep)
 
return []
 
 
# spack tries to find headers and libraries by itself (i.e. it's not
 
# relying on the compiler to find it); we explicitly expose the
 
# spack-provided env vars that contain include and library paths
 
if 'SPACK_INCLUDE_DIRS' in my_env:
 
for dir in reversed(get_path(my_env, "SPACK_INCLUDE_DIRS")):
 
env.prepend_path("C_INCLUDE_PATH", dir)
 
env.prepend_path("CPLUS_INCLUDE_PATH", dir)
 
if 'SPACK_LINK_DIRS' in my_env:
 
for dir in reversed(get_path(my_env, "SPACK_LINK_DIRS")):
 
env.prepend_path("LIBRARY_PATH", dir)
 
env.prepend_path("LD_LIBRARY_PATH", dir)
 
for dir in reversed(self.compiler.implicit_rpaths()):
 
env.prepend_path("LIBRARY_PATH", dir)
 
# technically this is probably not needed for the non-configure steps
 
env.prepend_path("LD_LIBRARY_PATH", dir)
def setup_dependent_build_environment(self, env, dependent_spec):
def setup_dependent_build_environment(self, env, dependent_spec):
self._setup_common_env(env)
self._setup_common_env(env)
@@ -87,20 +118,6 @@ class Hxtorch(WafPackage):
@@ -87,20 +118,6 @@ class Hxtorch(WafPackage):
def configure(self, spec, prefix):
def configure(self, spec, prefix):
"""Setup and configure the project."""
"""Setup and configure the project."""
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
env = os.environ
if 'SPACK_INCLUDE_DIRS' in env:
env['C_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
env['CPLUS_INCLUDE_PATH'] = env['SPACK_INCLUDE_DIRS']
if 'SPACK_LINK_DIRS' in env:
env['LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
env['LD_LIBRARY_PATH'] = env['SPACK_LINK_DIRS']
if 'SPACK_COMPILER_IMPLICIT_RPATHS' in env:
env['LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LIBRARY_PATH']
env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LD_LIBRARY_PATH']
self.waf('setup', '--repo-db-url=https://github.com/electronicvisions/projects',
self.waf('setup', '--repo-db-url=https://github.com/electronicvisions/projects',
'--without-munge',
'--without-munge',
'--without-hxcomm-hostarq',
'--without-hxcomm-hostarq',
@@ -111,8 +128,6 @@ class Hxtorch(WafPackage):
@@ -111,8 +128,6 @@ class Hxtorch(WafPackage):
args = ['--prefix={0}'.format(self.prefix)]
args = ['--prefix={0}'.format(self.prefix)]
args += self.configure_args()
args += self.configure_args()
env['LD_LIBRARY_PATH'] = env.get('WAF_CONFIGURE_LD_LIBRARY_PATH')
self.waf('configure', '--build-profile=release', '--disable-doxygen', *args)
self.waf('configure', '--build-profile=release', '--disable-doxygen', *args)
def build_args(self):
def build_args(self):