From 3b99b3a9f02af061f06a21e26f279b2ae2790810 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 20 Jan 2019 04:18:35 +0100 Subject: Fix rpath for dynamic library dependencies for tests, cleanup empty rpath lib --- backend/ninja/Ninja.cpp | 16 ++++++++++++---- backend/ninja/Ninja.hpp | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 3d4039f..5d1a506 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -715,9 +715,12 @@ namespace backend string result; for(const string &flag : linkerFlags) { - if(!result.empty()) + string dynamicLibFullPath = extractDynamicLibDirsFromLinkerFlag(flag); + if(!result.empty() && !dynamicLibFullPath.empty()) result += ":"; - result += extractDynamicLibDirsFromLinkerFlag(flag); + + if(!dynamicLibFullPath.empty()) + result += dynamicLibFullPath; } return result; } @@ -1677,14 +1680,14 @@ namespace backend } } - Result buildTestResult = buildTests(allLinkerFlags, projectGeneratedBinary, config, cflags, dependencyExportIncludeDirs); + Result buildTestResult = buildTests(allLinkerFlags, projectGeneratedBinary, config, cflags, dependencyExportIncludeDirs, dynamicLinkerFlags); if(!buildTestResult) return buildTestResult; return Result::Ok(true); } - Result Ninja::buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const SibsConfig &config, const vector &parentCflags, const string &parentDependencyExportIncludeDirs) + Result Ninja::buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const SibsConfig &config, const vector &parentCflags, const string &parentDependencyExportIncludeDirs, const std::vector &parentDynamicLinkerFlags) { if(testSourceDir.empty() || !config.shouldBuildTests()) return Result::Ok(true); @@ -1731,6 +1734,11 @@ namespace backend if(!parentLinkerFlags.empty()) ninja.addDependency(parentLinkerFlags); + for(const std::string &parentDynamicLinkerFlag : parentDynamicLinkerFlags) + { + ninja.addDynamicDependency(parentDynamicLinkerFlag); + } + switch(config.getPackageType()) { case PackageType::STATIC: diff --git a/backend/ninja/Ninja.hpp b/backend/ninja/Ninja.hpp index 96396d6..e2e892e 100644 --- a/backend/ninja/Ninja.hpp +++ b/backend/ninja/Ninja.hpp @@ -54,7 +54,7 @@ namespace backend std::vector customCflags; private: sibs::Result buildSubProjects(sibs::LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, sibs::LinkerFlagCallbackFunc dynamicLinkerFlagCallback, sibs::GlobalIncludeDirCallbackFunc globalIncludeDirCallback); - sibs::Result buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const sibs::SibsConfig &config, const std::vector &parentCflags, const std::string &parentDependencyExportIncludeDirs); + sibs::Result buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const sibs::SibsConfig &config, const std::vector &parentCflags, const std::string &parentDependencyExportIncludeDirs, const std::vector &parentDynamicLinkerFlags); bool containsSourceFile(const std::string &filepath) const; bool containsDependency(const std::string &dependency) const; bool containsDynamicDependency(const std::string &dependency) const; -- cgit v1.2.3