diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2018-10-04 20:52:08 -0400 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2019-06-09 13:13:25 -0400 |
commit | 07777e15d47dbddaf849d24b3a30c85745c533ca (patch) | |
tree | f472472ed511498c329b4e13e19b1585e1afb621 /mesonbuild/compilers/d.py | |
parent | 32e827dcdc451e1c5dde952cf08e4b654eac7057 (diff) | |
download | meson-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/d.py')
-rw-r--r-- | mesonbuild/compilers/d.py | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 46cc054..b7bc49a 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -73,11 +73,10 @@ class DCompiler(Compiler): 'mtd': ['-mscrtlib=libcmtd'], } - def __init__(self, exelist, version, is_cross, arch, **kwargs): + def __init__(self, exelist, version, for_machine: MachineChoice, arch, **kwargs): self.language = 'd' - super().__init__(exelist, version, **kwargs) + super().__init__(exelist, version, for_machine, **kwargs) self.id = 'unknown' - self.is_cross = is_cross self.arch = arch def sanity_check(self, work_dir, environment): @@ -308,17 +307,12 @@ class DCompiler(Compiler): # Add link flags needed to find dependencies args += d.get_link_args() - if env.is_cross_build() and not self.is_cross: - for_machine = MachineChoice.BUILD - else: - for_machine = MachineChoice.HOST - if mode == 'compile': # Add DFLAGS from the env - args += env.coredata.get_external_args(for_machine, self.language) + args += env.coredata.get_external_args(self.for_machine, self.language) elif mode == 'link': # Add LDFLAGS from the env - args += env.coredata.get_external_link_args(for_machine, self.language) + args += env.coredata.get_external_link_args(self.for_machine, self.language) # extra_args must override all other arguments, so we add them last args += extra_args return args @@ -494,8 +488,8 @@ class DCompiler(Compiler): return ['-pthread'] class GnuDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross, arch, **kwargs): - DCompiler.__init__(self, exelist, version, is_cross, arch, **kwargs) + def __init__(self, exelist, version, for_machine: MachineChoice, arch, **kwargs): + DCompiler.__init__(self, exelist, version, for_machine, arch, **kwargs) self.id = 'gcc' default_warn_args = ['-Wall', '-Wdeprecated'] self.warn_args = {'0': [], @@ -557,8 +551,8 @@ class GnuDCompiler(DCompiler): return gnu_optimization_args[optimization_level] class LLVMDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross, arch, **kwargs): - DCompiler.__init__(self, exelist, version, is_cross, arch, **kwargs) + def __init__(self, exelist, version, for_machine: MachineChoice, arch, **kwargs): + DCompiler.__init__(self, exelist, version, for_machine, arch, **kwargs) self.id = 'llvm' self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt'] @@ -595,8 +589,8 @@ class LLVMDCompiler(DCompiler): class DmdDCompiler(DCompiler): - def __init__(self, exelist, version, is_cross, arch, **kwargs): - DCompiler.__init__(self, exelist, version, is_cross, arch, **kwargs) + def __init__(self, exelist, version, for_machine: MachineChoice, arch, **kwargs): + DCompiler.__init__(self, exelist, version, for_machine, arch, **kwargs) self.id = 'dmd' self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt'] |