Skip to content
Snippets Groups Projects

chore(hxtorch): try to drop env modifications

Merged Eric Müller requested to merge hxtorch_try_cleanup into master
All threads resolved!
Files
2
+ 10
71
@@ -62,76 +62,6 @@ class Hxtorch(WafPackage):
@@ -62,76 +62,6 @@ class Hxtorch(WafPackage):
depends_on('yaml-cpp+shared', type=('build', 'link', 'run'))
depends_on('yaml-cpp+shared', type=('build', 'link', 'run'))
extends('python')
extends('python')
def setup_build_environment(self, env):
"""waf needs to find headers and libraries by itself (mostly `boost`
tool, but also `gtest`); it also needs to run executables during
configuration."""
include = []
include_exclude_dirs = set(['/usr/include'])
for dep in self.spec.traverse(deptype='build', root=False):
query = self.spec[dep.name]
if dep.name in ['pthreadpool', 'fxdiv']:
print('skipping {} in SPACK_INCLUDE_DIRS/CPATH/C{{,_PLUS}}_INCLUDE_PATH\n'.format(dep.name))
for d in query.headers.directories:
if os.path.exists(d):
env.remove_path('SPACK_INCLUDE_DIRS', d)
continue
try:
include_dirs = set(query.headers.directories)
include_dirs -= include_exclude_dirs
print('headers (', dep.name, '):', include_dirs, "\n")
include.extend(list(include_dirs))
except spack.error.NoHeadersError:
# we don't care if no header directories are found
pass
library = []
library_exclude_dirs = set(['/lib', '/lib64', '/usr/lib', '/usr/lib64'])
for dep in self.spec.traverse(deptype=('link', 'run'), root=False):
query = self.spec[dep.name]
try:
library_dirs = set(query.libs.directories)
library_dirs -= library_exclude_dirs
print('libs (', dep.name, '):', library_dirs, "\n")
library.extend(list(library_dirs))
except spack.error.NoLibrariesError:
# we don't care if no library directories are found
pass
path = []
for dep in self.spec.traverse(deptype=('build', 'link', 'run'), root=False):
if dep.name in ['pthreadpool', 'fxdiv']:
print('skipping {} for bin'.format(dep.name))
continue
query = self.spec[dep.name]
if os.path.exists(self.prefix.bin):
path.append(query.prefix.bin)
print('bin (', dep.name, '):', query.prefix.bin, "\n")
# llvm might be built with ~shared_libs but still builds shared libs
if not any('llvm' in lib for lib in library):
print("libs: manually adding ", self.spec['llvm'].prefix.lib)
library.append(self.spec['llvm'].prefix.lib)
# explicitly add googletest library if it isn't found above;
# adding in front of the list of libraries is a hack to circumvent
# issues from vendoring packages like pthreadpool
if not any('googletest' in lib for lib in library):
if os.path.isdir(self.spec['googletest'].prefix.lib64):
print("libs: manually inserting at front ", self.spec['googletest'].prefix.lib64)
library.insert(0, self.spec['googletest'].prefix.lib64)
if os.path.isdir(self.spec['googletest'].prefix.lib):
print("libs: manually inserting at front ", self.spec['googletest'].prefix.lib)
library.insert(0, self.spec['googletest'].prefix.lib)
env.set('CPATH', ':'.join(include))
env.set('C_INCLUDE_PATH', ':'.join(include))
env.set('CPLUS_INCLUDE_PATH', ':'.join(include))
env.set('LIBRARY_PATH', ':'.join(library))
env.set('WAF_CONFIGURE_LD_LIBRARY_PATH', ':'.join(library))
env.prepend_path('PATH', ':'.join(path))
def _setup_common_env(self, env):
def _setup_common_env(self, env):
# grenade needs to find some libraries for the JIT-compilation of
# grenade needs to find some libraries for the JIT-compilation of
# programs for BrainScaleS-2's embedded processor.
# programs for BrainScaleS-2's embedded processor.
@@ -157,10 +87,19 @@ class Hxtorch(WafPackage):
@@ -157,10 +87,19 @@ 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
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:
if 'SPACK_COMPILER_IMPLICIT_RPATHS' in env:
env['LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LIBRARY_PATH']
env['LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['LIBRARY_PATH']
env['WAF_CONFIGURE_LD_LIBRARY_PATH'] = env['SPACK_COMPILER_IMPLICIT_RPATHS'] + ':' + env['WAF_CONFIGURE_LD_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',