From 7e1df7540d519f63b4309b380e69b10ca5bff103 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 26 Dec 2015 20:28:23 +0200 Subject: Handle custom targets that produce static libraries that are then linked to other targets. --- ninjabackend.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ninjabackend.py') diff --git a/ninjabackend.py b/ninjabackend.py index c465f7c..5b75bce 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -264,6 +264,8 @@ int dummy; header_deps)) elif self.environment.is_object(src): obj_list.append(src) + elif self.environment.is_library(src): + pass else: # Assume anything not specifically a source file is a header. This is because # people generate files with weird suffixes (.inc, .fh) that they then include @@ -1674,17 +1676,29 @@ rule FORTRAN_DEP_HACK self.determine_rpath_dirs(target), target.install_rpath) if self.environment.coredata.get_builtin_option('coverage'): commands += linker.get_coverage_link_args() + custom_target_libraries = self.get_custom_target_provided_libraries(target) commands += extra_args + commands += custom_target_libraries commands = linker.unixtype_flags_to_native(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] elem = NinjaBuildElement(outname, linker_rule, obj_list) - elem.add_dep(dep_targets) + elem.add_dep(dep_targets + custom_target_libraries) elem.add_item('LINK_ARGS', commands) self.check_outputs(elem) return elem + def get_custom_target_provided_libraries(self, target): + libs = [] + for t in target.get_generated_sources(): + if not isinstance(t, build.CustomTarget): + continue + for f in t.output: + if self.environment.is_library(f): + libs.append(os.path.join(self.get_target_dir(target), f)) + return libs + def determine_rpath_dirs(self, target): link_deps = target.get_all_link_deps() result = [] -- cgit v1.1 From 9bf641e545f163cd5e9e7e3b5e9aa1f9e002e5d9 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 27 Dec 2015 19:27:05 +0200 Subject: Fix path generation so generations in subdirs work. --- ninjabackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ninjabackend.py') diff --git a/ninjabackend.py b/ninjabackend.py index 5b75bce..8fc1772 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -1696,7 +1696,7 @@ rule FORTRAN_DEP_HACK continue for f in t.output: if self.environment.is_library(f): - libs.append(os.path.join(self.get_target_dir(target), f)) + libs.append(os.path.join(self.get_target_dir(t), f)) return libs def determine_rpath_dirs(self, target): -- cgit v1.1