diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-05-19 14:43:06 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-05-27 20:23:58 +0300 |
commit | a340b413ef7f25d458806f92d342e52a7356dc01 (patch) | |
tree | 570ccdab57b2e72c5c9766970242bdc3ad05ae38 | |
parent | 4852ee8cebb2e0a6c00d3ddf41fe85f54a43240e (diff) | |
download | meson-a340b413ef7f25d458806f92d342e52a7356dc01.zip meson-a340b413ef7f25d458806f92d342e52a7356dc01.tar.gz meson-a340b413ef7f25d458806f92d342e52a7356dc01.tar.bz2 |
ninja: Always use to_native on CompilerArgs (fixes #7167)
4 files changed, 23 insertions, 9 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index f7b697f..69e7618 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -151,6 +151,10 @@ class NinjaBuildElement: self.orderdeps.add(dep) def add_item(self, name, elems): + # Always convert from GCC-style argument naming to the naming used by the + # current compiler. Also filter system include paths, deduplicate, etc. + if isinstance(elems, CompilerArgs): + elems = elems.to_native() if isinstance(elems, str): elems = [elems] self.elems.append((name, elems)) @@ -1985,9 +1989,6 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) # Write the Ninja build command compiler_name = self.get_compiler_rule_name('llvm_ir', compiler.for_machine) element = NinjaBuildElement(self.all_outputs, rel_obj, compiler_name, rel_src) - # Convert from GCC-style link argument naming to the naming used by the - # current compiler. - commands = commands.to_native() element.add_item('ARGS', commands) self.add_build(element) return rel_obj @@ -2204,9 +2205,6 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) d = os.path.join(self.get_target_private_dir(target), d) element.add_orderdep(d) element.add_dep(pch_dep) - # Convert from GCC-style link argument naming to the naming used by the - # current compiler. - commands = commands.to_native() for i in self.get_fortran_orderdeps(target, compiler): element.add_orderdep(i) element.add_item('DEPFILE', dep_file) @@ -2594,9 +2592,6 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) commands += extra_args commands += custom_target_libraries commands += stdlib_args # Standard library arguments go last, because they never depend on anything. - # Convert from GCC-style link argument naming to the naming used by the - # current compiler. - commands = commands.to_native() dep_targets.extend([self.get_dependency_filename(t) for t in dependencies]) dep_targets.extend([self.get_dependency_filename(t) for t in target.link_depends]) diff --git a/test cases/common/226 include_type dependency/main.cpp b/test cases/common/226 include_type dependency/main.cpp new file mode 100644 index 0000000..bf8c4a4 --- /dev/null +++ b/test cases/common/226 include_type dependency/main.cpp @@ -0,0 +1,8 @@ +#include <iostream> +#include <boost/graph/filtered_graph.hpp> + +using namespace std; + +int main(void) { + return 0; +} diff --git a/test cases/common/226 include_type dependency/meson.build b/test cases/common/226 include_type dependency/meson.build index fafceaf..d17e920 100644 --- a/test cases/common/226 include_type dependency/meson.build +++ b/test cases/common/226 include_type dependency/meson.build @@ -4,10 +4,16 @@ project( ) dep = dependency('zlib', method: 'pkg-config', required : false) +boost_dep = dependency('boost', modules: ['graph'], include_type : 'system', required: false) + if not dep.found() error('MESON_SKIP_TEST zlib was not found') endif +if not boost_dep.found() + error('MESON_SKIP_TEST boost was not found') +endif + assert(dep.include_type() == 'preserve', 'include_type must default to "preserve"') dep_sys = dep.as_system() @@ -26,3 +32,7 @@ assert(sp_dep.include_type() == 'preserve', 'default is preserve') sp_dep_sys = sp_dep.as_system('system') assert(sp_dep_sys.include_type() == 'system', 'changing include_type works') assert(sp_dep.include_type() == 'preserve', 'as_system must not mutate the original object') + +# Check that PCH works with `include_type : 'system'` See https://github.com/mesonbuild/meson/issues/7167 +main_exe = executable('main_exe', 'main.cpp', cpp_pch: 'pch/test.hpp', dependencies: boost_dep) +test('main_test', main_exe) diff --git a/test cases/common/226 include_type dependency/pch/test.hpp b/test cases/common/226 include_type dependency/pch/test.hpp new file mode 100644 index 0000000..0d40fe1 --- /dev/null +++ b/test cases/common/226 include_type dependency/pch/test.hpp @@ -0,0 +1 @@ +#include <boost/graph/filtered_graph.hpp> |