def test_multiple_conflicting_compiler_definitions(mutable_config): compiler_def = { 'compiler': { 'flags': {}, 'modules': [], 'paths': { 'cc': 'cc', 'cxx': 'cxx', 'f77': 'null', 'fc': 'null' }, 'extra_rpaths': [], 'operating_system': 'test', 'target': 'test', 'environment': {}, 'spec': '[email protected]' } } compiler_config = [compiler_def, compiler_def] compiler_config[0]['compiler']['paths']['f77'] = 'f77' mutable_config.update_config('compilers', compiler_config) arch_spec = spack.spec.ArchSpec(('test', 'test', 'test')) cspec = compiler_config[0]['compiler']['spec'] cmp = compilers.compiler_for_spec(cspec, arch_spec) assert cmp.f77 == 'f77'
def set_compiler_environment_variables(pkg): assert(pkg.spec.concrete) compiler = compilers.compiler_for_spec(pkg.spec.compiler) # Set compiler variables used by CMake and autotools os.environ['CC'] = 'cc' os.environ['CXX'] = 'c++' os.environ['F77'] = 'f77' os.environ['FC'] = 'f90' # Set SPACK compiler variables so that our wrapper knows what to call if compiler.cc: os.environ['SPACK_CC'] = compiler.cc if compiler.cxx: os.environ['SPACK_CXX'] = compiler.cxx if compiler.f77: os.environ['SPACK_F77'] = compiler.f77 if compiler.fc: os.environ['SPACK_FC'] = compiler.fc os.environ['SPACK_COMPILER_SPEC'] = str(pkg.spec.compiler)