Skip to content

Commit

Permalink
Explicitly check for OpenMP headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Apr 17, 2018
1 parent 9c254cc commit 461f3af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion mesonbuild/compilers/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,8 @@ def openmp_flags(self):
elif version_compare(self.version, '>=3.7.0'):
return ['-fopenmp=libomp']
else:
return None
# Shouldn't work, but it'll be checked explicitly in the OpenMP dependency.
return []


# Tested on linux for ICC 14.0.3, 15.0.6, 16.0.4, 17.0.1
Expand Down
14 changes: 11 additions & 3 deletions mesonbuild/dependencies/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,18 @@ class OpenMPDependency(ExternalDependency):
def __init__(self, environment, kwargs):
language = kwargs.get('language')
super().__init__('openmp', environment, language, kwargs)
self.is_found = True
self.is_found = False
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)
if openmp_date:
self.version = self.VERSIONS[openmp_date]
if self.compiler.has_header('omp.h', '', self.env, dependencies=[self]):
self.is_found = True
else:
mlog.log(mlog.yellow('WARNING:'), 'OpenMP found but omp.h missing.')
if self.is_found:
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES'), self.version)
else:
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.red('NO'))

def need_openmp(self):
return True
Expand Down

0 comments on commit 461f3af

Please sign in to comment.