diff options
-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; |