diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..26283617 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pyc +waf diff --git a/ChangeLog b/ChangeLog index 497ba9ad..66382bdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ NEW IN WAF 1.6.9 * Added a workaround to avoid creating include folders not under the build directory #1049 * Added a default virtual folder structure for out-of-tree build files #1053 * Added a way to set variants containing /, for example linux/debug +* Added a more intuitive behaviour for conf.setenv() #1062 NEW IN WAF 1.6.8 ---------------- diff --git a/waflib/Configure.py b/waflib/Configure.py index 92799733..eb1e4d4b 100644 --- a/waflib/Configure.py +++ b/waflib/Configure.py @@ -111,7 +111,8 @@ class ConfigurationContext(Context.Context): def setenv(self, name, env=None): """ - Set a new config set for conf.env + Set a new config set for conf.env. If a config set of that name already exists, + recall it without modification. The name is the filename prefix to save to ``c4che/NAME_cache.py``, and it is also used as *variants* by the build commands. @@ -130,12 +131,13 @@ class ConfigurationContext(Context.Context): :param env: ConfigSet to copy, or an empty ConfigSet is created :type env: :py:class:`waflib.ConfigSet.ConfigSet` """ - if not env: - env = ConfigSet.ConfigSet() - self.prepare_env(env) - else: - env = env.derive() - self.all_envs[name] = env + if name not in self.all_envs or env: + if not env: + env = ConfigSet.ConfigSet() + self.prepare_env(env) + else: + env = env.derive() + self.all_envs[name] = env self.variant = name def get_env(self): diff --git a/waflib/Tools/fc_config.py b/waflib/Tools/fc_config.py index 0fd06bc8..3b460349 100644 --- a/waflib/Tools/fc_config.py +++ b/waflib/Tools/fc_config.py @@ -441,3 +441,21 @@ def set_lib_pat(self): """Set the fortran flags for linking with the python library""" self.env['fcshlib_PATTERN'] = self.env['pyext_PATTERN'] +@conf +def detect_openmp(self): + for x in ['-fopenmp','-openmp','-mp','-xopenmp','-omp','-qsmp=omp']: + try: + conf.check_fc( + msg='Checking for OpenMP flag %s' % x, + fragment='program main\n call omp_get_num_threads()\nend program main', + fcflags=x, + linkflags=x, + uselib_store='OPENMP' + ) + except conf.errors.ConfigurationError: + pass + else: + break + else: + conf.fatal('Could not find OpenMP') + diff --git a/waflib/Tools/ifort.py b/waflib/Tools/ifort.py index b999efb2..75884167 100644 --- a/waflib/Tools/ifort.py +++ b/waflib/Tools/ifort.py @@ -19,6 +19,14 @@ def find_ifort(conf): def ifort_modifier_cygwin(conf): raise NotImplementedError("Ifort on cygwin not yet implemented") +@conf +def ifort_modifier_win32(conf): + fc_config.fortran_modifier_win32(conf) + +@conf +def ifort_modifier_darwin(conf): + fc_config.fortran_modifier_darwin(conf) + @conf def ifort_modifier_platform(conf): dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform() @@ -47,3 +55,4 @@ def configure(conf): conf.find_ar() conf.fc_flags() conf.ifort_modifier_platform() +