diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-21 11:15:14 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-27 23:42:22 +0530 |
commit | dbcbf19ecea9d07d264dbbc1cd87ab22393be8a7 (patch) | |
tree | e00d94bf17cb98e7b61dab6afca8b1bd65cb6fa8 /mesonbuild/backend | |
parent | 0e078adf5a7d47d5ad168f75e39d4a044032b197 (diff) | |
download | meson-dbcbf19ecea9d07d264dbbc1cd87ab22393be8a7.zip meson-dbcbf19ecea9d07d264dbbc1cd87ab22393be8a7.tar.gz meson-dbcbf19ecea9d07d264dbbc1cd87ab22393be8a7.tar.bz2 |
compilers: New class CompilerArgs derived from list()
The purpose of this class is to make it possible to sanely generate
compiler command-lines by ensuring that new arguments appended or added
to a list of arguments properly override previous arguments.
For instance:
>>> a = CompilerArgs(['-Lfoo', '-DBAR'])
>>> a += ['-Lgah', '-DTAZ']
>>> print(a)
['-Lgah', '-Lfoo', '-DBAR', '-DTAZ']
Arguments will be de-duped if it is safe to do so. Currently, this is
only done for -I and -L arguments (previous occurances are removed when
a new one is added) and arguments that once added cannot be overriden
such as -pipe are removed completely.
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r-- | mesonbuild/backend/backends.py | 2 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 2 | ||||
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 6f8a50e..eadc8cc 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -360,7 +360,7 @@ class Backend: for dep in target.get_external_deps(): # Cflags required by external deps might have UNIX-specific flags, # so filter them out if needed - commands += compiler.unix_compile_flags_to_native(dep.get_compile_args()) + commands += compiler.unix_args_to_native(dep.get_compile_args()) if isinstance(target, build.Executable): commands += dep.get_exe_args() diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 628718f..5bd660c 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2071,7 +2071,7 @@ rule FORTRAN_DEP_HACK custom_target_libraries = self.get_custom_target_provided_libraries(target) commands += extra_args commands += custom_target_libraries - commands = linker.unix_link_flags_to_native(self.dedup_arguments(commands)) + commands = linker.unix_args_to_native(self.dedup_arguments(commands)) dep_targets = [self.get_dependency_filename(t) for t in dependencies] dep_targets += [os.path.join(self.environment.source_dir, target.subdir, t) for t in target.link_depends] diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 61f755b..31a4c0e 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -687,14 +687,14 @@ class Vs2010Backend(backends.Backend): file_args[l] += args for l, args in target.extra_args.items(): if l in file_args: - file_args[l] += compiler.unix_compile_flags_to_native(args) + file_args[l] += compiler.unix_args_to_native(args) for l, comp in target.compilers.items(): if l in file_args: file_args[l] += comp.get_option_compile_args(self.environment.coredata.compiler_options) for d in target.get_external_deps(): # Cflags required by external deps might have UNIX-specific flags, # so filter them out if needed - d_compile_args = compiler.unix_compile_flags_to_native(d.get_compile_args()) + d_compile_args = compiler.unix_args_to_native(d.get_compile_args()) for arg in d_compile_args: if arg.startswith(('-D', '/D')): define = arg[2:] @@ -793,7 +793,7 @@ class Vs2010Backend(backends.Backend): if isinstance(d, build.StaticLibrary): for dep in d.get_external_deps(): extra_link_args += dep.get_link_args() - extra_link_args = compiler.unix_link_flags_to_native(extra_link_args) + extra_link_args = compiler.unix_args_to_native(extra_link_args) (additional_libpaths, additional_links, extra_link_args) = self.split_link_args(extra_link_args) if len(extra_link_args) > 0: extra_link_args.append('%(AdditionalOptions)') |