diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-01-20 04:18:35 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 3b99b3a9f02af061f06a21e26f279b2ae2790810 (patch) | |
tree | bc22612173828ca9586fc404befeb0ce25a574de /backend | |
parent | ba6487d8c0c4500a773297153f1c56067ba8d31f (diff) |
Fix rpath for dynamic library dependencies for tests, cleanup empty rpath lib
Diffstat (limited to 'backend')
-rw-r--r-- | backend/ninja/Ninja.cpp | 16 | ||||
-rw-r--r-- | 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<bool> buildTestResult = buildTests(allLinkerFlags, projectGeneratedBinary, config, cflags, dependencyExportIncludeDirs); + Result<bool> buildTestResult = buildTests(allLinkerFlags, projectGeneratedBinary, config, cflags, dependencyExportIncludeDirs, dynamicLinkerFlags); if(!buildTestResult) return buildTestResult; return Result<bool>::Ok(true); } - Result<bool> Ninja::buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const SibsConfig &config, const vector<ninja::NinjaArg> &parentCflags, const string &parentDependencyExportIncludeDirs) + Result<bool> Ninja::buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const SibsConfig &config, const vector<ninja::NinjaArg> &parentCflags, const string &parentDependencyExportIncludeDirs, const std::vector<std::string> &parentDynamicLinkerFlags) { if(testSourceDir.empty() || !config.shouldBuildTests()) return Result<bool>::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<ninja::NinjaArg> customCflags; private: sibs::Result<bool> buildSubProjects(sibs::LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, sibs::LinkerFlagCallbackFunc dynamicLinkerFlagCallback, sibs::GlobalIncludeDirCallbackFunc globalIncludeDirCallback); - sibs::Result<bool> buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const sibs::SibsConfig &config, const std::vector<ninja::NinjaArg> &parentCflags, const std::string &parentDependencyExportIncludeDirs); + sibs::Result<bool> buildTests(const std::string &parentLinkerFlags, const std::string &parentGeneratedLib, const sibs::SibsConfig &config, const std::vector<ninja::NinjaArg> &parentCflags, const std::string &parentDependencyExportIncludeDirs, const std::vector<std::string> &parentDynamicLinkerFlags); bool containsSourceFile(const std::string &filepath) const; bool containsDependency(const std::string &dependency) const; bool containsDynamicDependency(const std::string &dependency) const; |