From bcd3c09fc6f4264108e0e658122515b50db29c77 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 28 Dec 2017 01:21:13 +0100 Subject: 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. --- backend/ninja/Ninja.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'backend') 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); } -- cgit v1.2.3