aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-28 01:21:13 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-28 01:27:11 +0100
commitbcd3c09fc6f4264108e0e658122515b50db29c77 (patch)
tree8a3de84a800a5295a5f09d9b5943ac386802beaa /backend
parent0cf81a4421f9a4d267245a3041508b617a01d68d (diff)
Add package include dirs config
Fix getRealPath returning corrupt path. This allows you to specifying a list of include dirs under [package], like: [package] name = "blabla" include_dirs = ["include"] There are many libraries that include paths to header files like this, so when including a header file, you dont have to specify relative path to header files (which can be long), and you can use same path no matter where you are including header from. Currently include_dirs is not propagated to dependant packages and im not sure if they should be, from the looks of it the reason you want include_dirs is internal package setup.
Diffstat (limited to 'backend')
-rw-r--r--backend/ninja/Ninja.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index e290436..3c2b848 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -215,12 +215,19 @@ namespace backend
string result;
result.reserve(16384);
- string globalLibDir = getHomeDir();
- globalLibDir += "/.sibs/lib";
+ string globalIncDir = getHomeDir();
+ globalIncDir += "/.sibs/lib";
- result += "globalLibDir = '-I";
- result += globalLibDir;
- result += "'\n\n";
+ result += "globalIncDir = '-I";
+ result += globalIncDir;
+ result += "'";
+ for(const auto &includeDir : config.getIncludeDirs())
+ {
+ result += " '-I../../";
+ result += includeDir;
+ result += "'";
+ }
+ result += "\n\n";
string buildJob;
switch(libraryType)
@@ -276,7 +283,7 @@ namespace backend
result += ": cpp_COMPILER ../../";
result += sourceFile;
result += "\n";
- result += " ARGS = $globalLibDir '-I" + config.getPackageName() + "@exe' '-I..' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-O0' '-g'\n\n";
+ result += " ARGS = $globalIncDir '-I" + config.getPackageName() + "@exe' '-I..' '-fdiagnostics-color=always' '-pipe' '-D_FILE_OFFSET_BITS=64' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-O0' '-g'\n\n";
objectNames.emplace_back(objectName);
}