From d376b476b15359df460977a3e64c58811fab2c91 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 1 Feb 2018 20:55:15 +0100 Subject: Add parent project expose include dir to tests --- backend/ninja/Ninja.cpp | 14 +++++++++++++- 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 -- cgit v1.2.3