aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-02-20 08:02:48 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-02-21 01:36:08 +0530
commit8e48f232628a749efe393f92db0302c93d8496ca (patch)
treeb59b6eead963cad255b4de8db52b7cd61620ab4e
parent01f207f34793cfdcff2b3cfe4da4a4e0e0d42cf7 (diff)
downloadmeson-8e48f232628a749efe393f92db0302c93d8496ca.zip
meson-8e48f232628a749efe393f92db0302c93d8496ca.tar.gz
meson-8e48f232628a749efe393f92db0302c93d8496ca.tar.bz2
Detect GCC type on macOS for ObjC/C++ too
These compilers are available in MinGW and can be built on macOS. More interestingly, `gcc` is a wrapper around `clang` on macOS, so we will detect the compiler type incorrectly on macOS without this.
-rw-r--r--mesonbuild/compilers.py16
-rw-r--r--mesonbuild/environment.py6
2 files changed, 10 insertions, 12 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 30f2608..8c2bb92 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -2404,11 +2404,9 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
class GnuObjCCompiler(GnuCompiler, ObjCCompiler):
- def __init__(self, exelist, version, is_cross, exe_wrapper=None, defines=None):
+ def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None):
ObjCCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
- # Not really correct, but GNU objc is only used on non-OSX non-win. File a bug
- # if this breaks your use case.
- GnuCompiler.__init__(self, GCC_STANDARD, defines)
+ GnuCompiler.__init__(self, gcc_type, defines)
default_warn_args = ['-Wall', '-Winvalid-pch']
self.warn_args = {'1': default_warn_args,
'2': default_warn_args + ['-Wextra'],
@@ -2416,11 +2414,9 @@ class GnuObjCCompiler(GnuCompiler, ObjCCompiler):
class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler):
- def __init__(self, exelist, version, is_cross, exe_wrapper=None, defines=None):
+ def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None):
ObjCPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
- # Not really correct, but GNU objc is only used on non-OSX non-win. File a bug
- # if this breaks your use case.
- GnuCompiler.__init__(self, GCC_STANDARD, defines)
+ GnuCompiler.__init__(self, gcc_type, defines)
default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
self.warn_args = {'1': default_warn_args,
'2': default_warn_args + ['-Wextra'],
@@ -2549,13 +2545,13 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler):
class ClangObjCCompiler(ClangCompiler, GnuObjCCompiler):
def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None):
- GnuObjCCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
+ GnuObjCCompiler.__init__(self, exelist, version, cltype, is_cross, exe_wrapper)
ClangCompiler.__init__(self, cltype)
self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage']
class ClangObjCPPCompiler(ClangCompiler, GnuObjCPPCompiler):
def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None):
- GnuObjCPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
+ GnuObjCPPCompiler.__init__(self, exelist, version, cltype, is_cross, exe_wrapper)
ClangCompiler.__init__(self, cltype)
self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage']
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index b184b3f..88dc4cf 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -521,8 +521,9 @@ class Environment:
if not defines:
popen_exceptions[compiler] = 'no pre-processor defines'
continue
+ gtype = self.get_gnu_compiler_type(defines)
version = self.get_gnu_version_from_defines(defines)
- return GnuObjCCompiler(ccache + compiler, version, is_cross, exe_wrap, defines)
+ return GnuObjCCompiler(ccache + compiler, version, gtype, is_cross, exe_wrap, defines)
if out.startswith('Apple LLVM'):
return ClangObjCCompiler(ccache + compiler, version, CLANG_OSX, is_cross, exe_wrap)
if out.startswith('clang'):
@@ -545,8 +546,9 @@ class Environment:
if not defines:
popen_exceptions[compiler] = 'no pre-processor defines'
continue
+ gtype = self.get_gnu_compiler_type(defines)
version = self.get_gnu_version_from_defines(defines)
- return GnuObjCPPCompiler(ccache + compiler, version, is_cross, exe_wrap, defines)
+ return GnuObjCPPCompiler(ccache + compiler, version, gtype, is_cross, exe_wrap, defines)
if out.startswith('Apple LLVM'):
return ClangObjCPPCompiler(ccache + compiler, version, CLANG_OSX, is_cross, exe_wrap)
if out.startswith('clang'):