made the compiler strategy more easily controllable

This commit is contained in:
Gregory Becker 2016-01-06 13:00:22 -08:00
parent 61b03b72b0
commit 51bd91edc0
6 changed files with 16 additions and 15 deletions

View File

@ -55,19 +55,20 @@ class Target(object):
they came from using the set_architecture method. Targets will have compiler finding strategies
"""
def __init__(self,name, module_name=None):
def __init__(self, name, compiler_strategy, module_name=None):
self.name = name # case of cray "ivybridge" but if it's x86_64
self.compiler_strategy = compiler_strategy
self.module_name = module_name # craype-ivybridge
def set_architecture(self, architecture): # Target should get the architecture class.
self.architecture = architecture
@property
def compiler_strategy(self):
if self.module_name: # If there is a module_name given then use MODULES
return "MODULES"
else:
return "PATH"
# @property
# def compiler_strategy(self):
# if self.module_name: # If there is a module_name given then use MODULES
# return "MODULES"
# else:
# return "PATH"
def to_dict(self):
d = {}

View File

@ -10,8 +10,8 @@ class Bgq(Architecture):
def __init__(self):
super(Bgq, self).__init__('cray')
self.add_target(self.front_end, Target(self.front_end))
self.add_target(self.back_end, Target(self.back_end))
self.add_target(self.front_end, Target(self.front_end, 'PATH'))
self.add_target(self.back_end, Target(self.back_end, 'PATH'))
@classmethod
def detect(self):

View File

@ -26,10 +26,10 @@ def __init__(self):
# Could switch to use modules and fe targets for front end
# Currently using compilers by path for front end.
self.add_target(self.front_end, Target(self.front_end))
self.add_target(self.front_end, Target(self.front_end, 'PATH'))
# Back End compiler needs the proper target module loaded.
self.add_target(self.back_end, Target(self.front_end,'craype-'+ self.back_end))
self.add_target(self.default, Target(self.default,'craype-' + self.default))
# self.add_target(self.back_end, Target(self.front_end, 'MODULES', 'craype-'+ self.back_end))
self.add_target(self.default, Target(self.default, 'MODULES', 'craype-' + self.default))
# This is kludgy and the order matters when the targets are all haswell
# This is because the last one overwrites the others when they have the
# same name.

View File

@ -9,7 +9,7 @@ class Darwin(Architecture):
def __init__(self):
super(Darwin, self).__init__('darwin')
self.add_target(self.default, Target(self.default))
self.add_target(self.default, Target(self.default, 'PATH'))
@classmethod
def detect(self):

View File

@ -9,7 +9,7 @@ class Linux(Architecture):
def __init__(self):
super(Linux, self).__init__('linux')
self.add_target(self.default, Target(self.default))
self.add_target(self.default, Target(self.default, 'PATH'))
@classmethod
def detect(self):

View File

@ -226,7 +226,7 @@ def set_build_environment_variables(pkg):
pkg_config_dirs.append(pcdir)
path_put_first("PKG_CONFIG_PATH", pkg_config_dirs)
if pkg.spec.architecture.compiler_strategy.lower() == 'module':
if pkg.spec.architecture.module_name:
load_module(pkg.spec.architecture.module_name)
def set_module_variables_for_package(pkg):