3838from easybuild .tools .toolchain .constants import COMPILER_VARIABLES
3939from easybuild .tools .toolchain .toolchain import Toolchain
4040
41- # default optimization 'level' (see COMPILER_SHARED_OPTION_MAP/COMPILER_OPT_FLAGS )
41+ # default optimization 'level' (see COMPILER_SHARED_OPTION_MAP/COMPILER_OPT_OPTIONS )
4242DEFAULT_OPT_LEVEL = 'defaultopt'
4343
4444# 'GENERIC' can be used to enable generic compilation instead of optimized compilation (which is the default)
@@ -127,20 +127,20 @@ class Compiler(Toolchain):
127127 COMPILER_OPTIMAL_ARCHITECTURE_OPTION = None
128128 COMPILER_GENERIC_OPTION = None
129129
130- COMPILER_FLAGS = ['debug' , 'ieee' , 'openmp' , 'pic' , 'shared' , 'static' , 'unroll' , 'verbose' ] # any compiler
131- COMPILER_OPT_FLAGS = ['noopt' , 'lowopt' , DEFAULT_OPT_LEVEL , 'opt' ] # optimisation args, ordered !
132- COMPILER_PREC_FLAGS = ['strict' , 'precise' , 'defaultprec' , 'loose' , 'veryloose' ] # precision flags, ordered !
130+ COMPILER_OPTIONS = ['debug' , 'ieee' , 'openmp' , 'pic' , 'shared' , 'static' , 'unroll' , 'verbose' ] # any compiler
131+ COMPILER_OPT_OPTIONS = ['noopt' , 'lowopt' , DEFAULT_OPT_LEVEL , 'opt' ] # optimisation args, ordered !
132+ COMPILER_PREC_OPTIONS = ['strict' , 'precise' , 'defaultprec' , 'loose' , 'veryloose' ] # precision flags, ordered !
133133
134134 COMPILER_CC = None
135135 COMPILER_CXX = None
136- COMPILER_C_FLAGS = ['- cstd' ]
137- COMPILER_C_UNIQUE_FLAGS = []
136+ COMPILER_C_OPTIONS = ['cstd' ]
137+ COMPILER_C_UNIQUE_OPTIONS = []
138138
139139 COMPILER_F77 = None
140140 COMPILER_F90 = None
141141 COMPILER_FC = None
142- COMPILER_F_FLAGS = ['- i8' , '- r8' ]
143- COMPILER_F_UNIQUE_FLAGS = []
142+ COMPILER_F_OPTIONS = ['i8' , 'r8' ]
143+ COMPILER_F_UNIQUE_OPTIONS = []
144144
145145 LINKER_TOGGLE_STATIC_DYNAMIC = None
146146 LINKER_TOGGLE_START_STOP_GROUP = {
@@ -245,20 +245,20 @@ def _set_compiler_vars(self):
245245 def _set_compiler_flags (self ):
246246 """Collect the flags set, and add them as variables too"""
247247
248- flags = [self .options .option (x ) for x in self .COMPILER_FLAGS if self .options .get (x , False )]
249- cflags = [self .options .option (x ) for x in self .COMPILER_C_FLAGS + self .COMPILER_C_UNIQUE_FLAGS
248+ flags = [self .options .option (x ) for x in self .COMPILER_OPTIONS if self .options .get (x , False )]
249+ cflags = [self .options .option (x ) for x in self .COMPILER_C_OPTIONS + self .COMPILER_C_UNIQUE_OPTIONS
250250 if self .options .get (x , False )]
251- fflags = [self .options .option (x ) for x in self .COMPILER_F_FLAGS + self .COMPILER_F_UNIQUE_FLAGS
251+ fflags = [self .options .option (x ) for x in self .COMPILER_F_OPTIONS + self .COMPILER_F_UNIQUE_OPTIONS
252252 if self .options .get (x , False )]
253253
254254 # Allow a user-defined default optimisation
255255 default_opt_level = build_option ('default_opt_level' )
256- if default_opt_level not in self .COMPILER_OPT_FLAGS :
256+ if default_opt_level not in self .COMPILER_OPT_OPTIONS :
257257 raise EasyBuildError ("Unknown value for default optimisation: %s (possibilities are %s)" %
258- (default_opt_level , self .COMPILER_OPT_FLAGS ))
258+ (default_opt_level , self .COMPILER_OPT_OPTIONS ))
259259
260260 # 1st one is the one to use. add default at the end so len is at least 1
261- optflags = ([self .options .option (x ) for x in self .COMPILER_OPT_FLAGS if self .options .get (x , False )] +
261+ optflags = ([self .options .option (x ) for x in self .COMPILER_OPT_OPTIONS if self .options .get (x , False )] +
262262 [self .options .option (default_opt_level )])[:1 ]
263263
264264 # only apply if the vectorize toolchainopt is explicitly set
@@ -280,7 +280,7 @@ def _set_compiler_flags(self):
280280 elif self .options .get ('optarch' , False ):
281281 optarchflags .append (self .options .option ('optarch' ))
282282
283- precflags = [self .options .option (x ) for x in self .COMPILER_PREC_FLAGS if self .options .get (x , False )] + \
283+ precflags = [self .options .option (x ) for x in self .COMPILER_PREC_OPTION if self .options .get (x , False )] + \
284284 [self .options .option ('defaultprec' )]
285285
286286 self .variables .nextend ('OPTFLAGS' , optflags + optarchflags )
0 commit comments