From 2a6b8e209fc6cbcd9499a0697c08bcb0169a2e54 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 19 Mar 2019 12:47:15 -0700 Subject: dependencies/openmp: Pass openmp arguments to look for _OPENMP define On GCC anc Clang th _OPENMP preprocessor define is only defined if -fopenmp is passed to the compiler. --- mesonbuild/dependencies/misc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mesonbuild/dependencies/misc.py') diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index c95acff..51dc9f3 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -363,7 +363,8 @@ class OpenMPDependency(ExternalDependency): super().__init__('openmp', environment, language, kwargs) self.is_found = False try: - openmp_date = self.clib_compiler.get_define('_OPENMP', '', self.env, [], [self]) + openmp_date = self.clib_compiler.get_define( + '_OPENMP', '', self.env, self.clib_compiler.openmp_flags(), [self]) except mesonlib.EnvironmentException as e: mlog.debug('OpenMP support not available in the compiler') mlog.debug(e) -- cgit v1.1 From 1f342a208122c86fa564688c518ecc63b67650df Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 18 Mar 2019 15:52:04 -0700 Subject: dependencies/openmp: Don't special case OpenMP Currently we specialcase OpenMP like we do threads, with a special `need_openmp` method. This seems like a great idea, but doesn't work out in practice, as well as it complicates the opemp implementation. If GCC is built without opemp support for example, we still add -fopenmp to the the command line, which results in compilation errors. This patch discards that and treats it like a normal dependency, removes the need_openmp() method, and sets the compile_args attributes from the compiler. Fixes #5115 --- mesonbuild/dependencies/misc.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'mesonbuild/dependencies/misc.py') diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 51dc9f3..52e8ee6 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -374,12 +374,10 @@ class OpenMPDependency(ExternalDependency): self.version = self.VERSIONS[openmp_date] if self.clib_compiler.has_header('omp.h', '', self.env, dependencies=[self]): self.is_found = True + self.compile_args = self.link_args = self.clib_compiler.openmp_flags() else: mlog.log(mlog.yellow('WARNING:'), 'OpenMP found but omp.h missing.') - def need_openmp(self) -> bool: - return True - class ThreadDependency(ExternalDependency): def __init__(self, environment, kwargs): -- cgit v1.1