aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/objcpp.py
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-10-04 20:52:08 -0400
committerJohn Ericson <git@JohnEricson.me>2019-06-09 13:13:25 -0400
commit07777e15d47dbddaf849d24b3a30c85745c533ca (patch)
treef472472ed511498c329b4e13e19b1585e1afb621 /mesonbuild/compilers/objcpp.py
parent32e827dcdc451e1c5dde952cf08e4b654eac7057 (diff)
downloadmeson-07777e15d47dbddaf849d24b3a30c85745c533ca.zip
meson-07777e15d47dbddaf849d24b3a30c85745c533ca.tar.gz
meson-07777e15d47dbddaf849d24b3a30c85745c533ca.tar.bz2
Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed.
Diffstat (limited to 'mesonbuild/compilers/objcpp.py')
-rw-r--r--mesonbuild/compilers/objcpp.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py
index 6743f89..2e81b4c 100644
--- a/mesonbuild/compilers/objcpp.py
+++ b/mesonbuild/compilers/objcpp.py
@@ -21,9 +21,9 @@ from .clike import CLikeCompiler
from .compilers import Compiler, ClangCompiler, GnuCompiler
class ObjCPPCompiler(CLikeCompiler, Compiler):
- def __init__(self, exelist, version, is_cross: bool, exe_wrap: typing.Optional[str]):
+ def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool, exe_wrap: typing.Optional[str]):
self.language = 'objcpp'
- Compiler.__init__(self, exelist, version)
+ Compiler.__init__(self, exelist, version, for_machine)
CLikeCompiler.__init__(self, is_cross, exe_wrap)
def get_display_language(self):
@@ -33,15 +33,11 @@ class ObjCPPCompiler(CLikeCompiler, Compiler):
# TODO try to use sanity_check_impl instead of duplicated code
source_name = os.path.join(work_dir, 'sanitycheckobjcpp.mm')
binary_name = os.path.join(work_dir, 'sanitycheckobjcpp')
- if environment.is_cross_build() and not self.is_cross:
- for_machine = MachineChoice.BUILD
- else:
- for_machine = MachineChoice.HOST
- extra_flags = environment.coredata.get_external_args(for_machine, self.language)
+ extra_flags = environment.coredata.get_external_args(self.for_machine, self.language)
if self.is_cross:
extra_flags += self.get_compile_only_args()
else:
- extra_flags += environment.coredata.get_external_link_args(for_machine, self.language)
+ extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
with open(source_name, 'w') as ofile:
ofile.write('#import<stdio.h>\n'
'class MyClass;'
@@ -60,8 +56,8 @@ class ObjCPPCompiler(CLikeCompiler, Compiler):
class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler):
- def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, defines=None):
- ObjCPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
+ def __init__(self, exelist, version, compiler_type, for_machine: MachineChoice, is_cross, exe_wrapper=None, defines=None):
+ ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, exe_wrapper)
GnuCompiler.__init__(self, compiler_type, defines)
default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
self.warn_args = {'0': [],
@@ -71,8 +67,8 @@ class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler):
class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler):
- def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None):
- ObjCPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper)
+ def __init__(self, exelist, version, compiler_type, for_machine: MachineChoice, is_cross, exe_wrapper=None):
+ ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, exe_wrapper)
ClangCompiler.__init__(self, compiler_type)
default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
self.warn_args = {'0': [],