diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-08-22 11:24:12 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-10-07 12:08:20 -0700 |
commit | afbed79baa579a1d3550631168c0810a5d0f522c (patch) | |
tree | f72c096bc25c9dbf8625706afe52ec0c202c1aff /mesonbuild/compilers | |
parent | 0c22798b1ad4678abb205280060175678a790c4a (diff) | |
download | meson-afbed79baa579a1d3550631168c0810a5d0f522c.zip meson-afbed79baa579a1d3550631168c0810a5d0f522c.tar.gz meson-afbed79baa579a1d3550631168c0810a5d0f522c.tar.bz2 |
compilers: replace uses of mesonlib.is_<os>() with self.info.is_<os>()
Since these are cross compilation safe, while the former is not.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/cs.py | 3 | ||||
-rw-r--r-- | mesonbuild/compilers/d.py | 39 |
2 files changed, 19 insertions, 23 deletions
diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py index 1dea33a..137acc1 100644 --- a/mesonbuild/compilers/cs.py +++ b/mesonbuild/compilers/cs.py @@ -16,7 +16,6 @@ import os.path, subprocess import typing from ..mesonlib import EnvironmentException -from ..mesonlib import is_windows from .compilers import Compiler, MachineChoice, mono_buildtype_args from .mixins.islinker import BasicLinkerIsCompilerMixin @@ -152,7 +151,7 @@ class VisualStudioCsCompiler(CsCompiler): def get_buildtype_args(self, buildtype): res = mono_buildtype_args[buildtype] - if not is_windows(): + if not self.info.is_windows(): tmp = [] for flag in res: if flag == '-debug': diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 28a4fad..f028bd5 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -16,7 +16,7 @@ import os.path, subprocess import typing from ..mesonlib import ( - EnvironmentException, MachineChoice, version_compare, is_windows, is_osx + EnvironmentException, MachineChoice, version_compare, ) from .compilers import ( @@ -119,7 +119,7 @@ class DmdLikeCompilerMixin: return 'deps' def get_pic_args(self): - if is_windows(): + if self.info.is_windows(): return [] return ['-fPIC'] @@ -217,7 +217,7 @@ class DmdLikeCompilerMixin: return ['-Wl,--out-implib=' + implibname] def build_rpath_args(self, env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath): - if is_windows(): + if self.info.is_windows(): return [] # This method is to be used by LDC and DMD. @@ -235,8 +235,7 @@ class DmdLikeCompilerMixin: paths = paths + ':' + padding return ['-Wl,-rpath,{}'.format(paths)] - @classmethod - def translate_args_to_nongnu(cls, args): + def translate_args_to_nongnu(self, args): dcargs = [] # Translate common arguments to flags the LDC/DMD compilers # can understand. @@ -245,10 +244,10 @@ class DmdLikeCompilerMixin: for arg in args: # Translate OS specific arguments first. osargs = [] - if is_windows(): - osargs = cls.translate_arg_to_windows(arg) - elif is_osx(): - osargs = cls.translate_arg_to_osx(arg) + if self.info.is_windows(): + osargs = self.translate_arg_to_windows(arg) + elif self.info.is_darwin(): + osargs = self.translate_arg_to_osx(arg) if osargs: dcargs.extend(osargs) continue @@ -367,7 +366,7 @@ class DmdLikeCompilerMixin: return clike_debug_args[is_debug] + ddebug_args def get_crt_args(self, crt_val, buildtype): - if not is_windows(): + if not self.info.is_windows(): return [] if crt_val in self.mscrt_args: @@ -433,7 +432,7 @@ class DCompiler(Compiler): return 'deps' def get_pic_args(self): - if is_windows(): + if self.info.is_windows(): return [] return ['-fPIC'] @@ -569,7 +568,7 @@ class DCompiler(Compiler): def get_target_arch_args(self): # LDC2 on Windows targets to current OS architecture, but # it should follow the target specified by the MSVC toolchain. - if is_windows(): + if self.info.is_windows(): if self.arch == 'x86_64': return ['-m64'] return ['-m32'] @@ -668,9 +667,8 @@ class LLVMDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompi def get_crt_link_args(self, crt_val, buildtype): return self.get_crt_args(crt_val, buildtype) - @classmethod - def unix_args_to_native(cls, args): - return cls.translate_args_to_nongnu(args) + def unix_args_to_native(self, args): + return self.translate_args_to_nongnu(args) def get_optimization_args(self, optimization_level): return ldc_optimization_args[optimization_level] @@ -695,7 +693,7 @@ class DmdDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompil return d_dmd_buildtype_args[buildtype] def get_std_exe_link_args(self): - if is_windows(): + if self.info.is_windows(): # DMD links against D runtime only when main symbol is found, # so these needs to be inserted when linking static D libraries. if self.arch == 'x86_64': @@ -707,7 +705,7 @@ class DmdDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompil def get_std_shared_lib_link_args(self): libname = 'libphobos2.so' - if is_windows(): + if self.info.is_windows(): if self.arch == 'x86_64': libname = 'phobos64.lib' elif self.arch == 'x86_mscoff': @@ -720,7 +718,7 @@ class DmdDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompil # DMD32 and DMD64 on 64-bit Windows defaults to 32-bit (OMF). # Force the target to 64-bit in order to stay consistent # across the different platforms. - if is_windows(): + if self.info.is_windows(): if self.arch == 'x86_64': return ['-m64'] elif self.arch == 'x86_mscoff': @@ -731,9 +729,8 @@ class DmdDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompil def get_crt_compile_args(self, crt_val, buildtype): return self.get_crt_args(crt_val, buildtype) - @classmethod - def unix_args_to_native(cls, args): - return cls.translate_args_to_nongnu(args) + def unix_args_to_native(self, args): + return self.translate_args_to_nongnu(args) def get_optimization_args(self, optimization_level): return dmd_optimization_args[optimization_level] |