diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-02-01 20:55:15 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-02-01 20:55:20 +0100 |
commit | d376b476b15359df460977a3e64c58811fab2c91 (patch) | |
tree | 237373513633755e5ad19aab4b2b7f77ae435b40 | |
parent | 18e90244d305faeb5560c02d6f0b9e848830ecc7 (diff) |
Add parent project expose include dir to tests
-rw-r--r-- | backend/ninja/Ninja.cpp | 14 | ||||
-rw-r--r-- | src/main.cpp | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 9714f1d..ead91a7 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -901,6 +901,18 @@ namespace backend parentProjConfigLib.define("wmain", "sibs_lib_ignore_wmain"); return build(parentProjConfigLib, savePath, nullptr, nullptr); } + + string parentProjectPathUtf8 = toUtf8(config.getProjectPath()); + string parentExportIncludeDirs = parentDependencyExportIncludeDirs; + for (const string &parentGlobalIncludeDir : config.getGlobalIncludeDirs()) + { + string parentExportIncludeDir = parentProjectPathUtf8; + parentExportIncludeDir += "/"; + parentExportIncludeDir += parentGlobalIncludeDir; + + parentExportIncludeDirs += " "; + parentExportIncludeDirs += getIncludeOptionFlag(config.getCompiler(), parentExportIncludeDir); + } for(const string &testSourceDir : testSourceDirs) { @@ -923,7 +935,7 @@ namespace backend } backend::Ninja ninja; - ninja.addGlobalIncludeDirs(parentDependencyExportIncludeDirs); + ninja.addGlobalIncludeDirs(parentExportIncludeDirs); if(!projectGeneratedBinary.empty()) ninja.addDependency(projectGeneratedBinary); // TODO: Use same source file finder as in main.cpp diff --git a/src/main.cpp b/src/main.cpp index bd3171f..f91929c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -73,7 +73,9 @@ using namespace std::chrono; // then you should be able to include it from dependant project by typing #include "xxhash/xxhash.h" // that means we create a symlink with the dependency name to the dependency version directory. // This will make it easier to prevent clashes in header file names and it's easier to see from the include statement -// what exactly we are including +// what exactly we are including. + +// TODO: Implement link-time-optimization which should be used if building with a certain optimization level (sibs build) #if OS_FAMILY == OS_FAMILY_POSIX #define ferr std::cerr |