diff options
Diffstat (limited to 'backend/ninja')
-rw-r--r-- | backend/ninja/Ninja.cpp | 8 | ||||
-rw-r--r-- | backend/ninja/Ninja.hpp | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index bf5ddf3..60c1060 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -5,7 +5,6 @@ #include "../../include/Exec.hpp" #include "../../include/PkgConfig.hpp" #include "../../include/GlobalLib.hpp" -#include <ninja/Ninja.hpp> #include <algorithm> using namespace std; @@ -849,7 +848,7 @@ namespace backend dynamicLinkerFlagCallback(dynamicDependency); } - vector<ninja::NinjaArg> cflags; + vector<ninja::NinjaArg> cflags = customCflags; auto cflagsCallbackFunc = [&cflags](const string &dependencyCflags) { cflags.push_back(ninja::NinjaArg::createRaw(dependencyCflags)); @@ -1680,14 +1679,14 @@ namespace backend } } - Result<bool> buildTestResult = buildTests(allLinkerFlags, projectGeneratedBinary, config, savePath, dependencyExportIncludeDirs); + Result<bool> buildTestResult = buildTests(allLinkerFlags, projectGeneratedBinary, config, cflags, dependencyExportIncludeDirs); 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 _tinydir_char_t *savePath, 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) { if(testSourceDir.empty() || !config.shouldBuildTests()) return Result<bool>::Ok(true); @@ -1730,6 +1729,7 @@ namespace backend backend::Ninja ninja; ninja.addGlobalIncludeDirs(parentExportIncludeDirs); + ninja.customCflags = std::move(parentCflags); if(!parentLinkerFlags.empty()) ninja.addDependency(parentLinkerFlags); diff --git a/backend/ninja/Ninja.hpp b/backend/ninja/Ninja.hpp index 2928fb3..96396d6 100644 --- a/backend/ninja/Ninja.hpp +++ b/backend/ninja/Ninja.hpp @@ -8,6 +8,7 @@ #include <vector> #include <string> #include <functional> +#include <ninja/Ninja.hpp> namespace backend { @@ -49,9 +50,11 @@ namespace backend void addSubProject(Ninja *subProject, sibs::SibsConfig *config, sibs::FileString &&buildPath); const std::vector<sibs::SourceFile>& getSourceFiles() const; sibs::Result<bool> build(const sibs::SibsConfig &config, const _tinydir_char_t *savePath, sibs::LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc = nullptr, sibs::LinkerFlagCallbackFunc dynamicLinkerFlagCallback = nullptr, sibs::GlobalIncludeDirCallbackFunc globalIncludeDirCallback = nullptr); + + 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 _tinydir_char_t *savePath, 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); bool containsSourceFile(const std::string &filepath) const; bool containsDependency(const std::string &dependency) const; bool containsDynamicDependency(const std::string &dependency) const; |