From 9c254cca657ec9556815d173767850df4ca37762 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sat, 7 Apr 2018 04:11:12 -0400 Subject: [PATCH] Determine OpenMP version from _OPENMP macro. --- mesonbuild/dependencies/misc.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 30cb54184..1587f5116 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -238,17 +238,28 @@ class MPIDependency(ExternalDependency): class OpenMPDependency(ExternalDependency): + # Map date of specification release (which is the macro value) to a version. + VERSIONS = { + '201511': '4.5', + '201307': '4.0', + '201107': '3.1', + '200805': '3.0', + '200505': '2.5', + '200203': '2.0', + '199810': '1.0', + } + def __init__(self, environment, kwargs): - super().__init__('openmp', environment, None, {}) + language = kwargs.get('language') + super().__init__('openmp', environment, language, kwargs) self.is_found = True - mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES')) + openmp_date = self.compiler.get_define('_OPENMP', '', self.env, [], [self]) + self.version = self.VERSIONS[openmp_date] + mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES'), self.version) def need_openmp(self): return True - def get_version(self): - return 'unknown' - class ThreadDependency(ExternalDependency): def __init__(self, environment, kwargs):