aboutsummaryrefslogtreecommitdiff
path: root/backend/ninja
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-06-28 18:20:15 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:32 +0200
commit5a13015ad932cffb092da080e8ea0ad2ce1f04a0 (patch)
treea896dabecfa59ea3f20697e6fc8332b90d8e27be /backend/ninja
parente132c085d2438fec368bdaf26032037bc7e88d00 (diff)
Move compile_commands.json to project root directory, needed for IDEs
Diffstat (limited to 'backend/ninja')
-rw-r--r--backend/ninja/Ninja.cpp8
-rw-r--r--backend/ninja/Ninja.hpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index 59e8486..227a179 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -917,7 +917,7 @@ namespace backend
if(config.isMainProject())
{
- buildResult = buildCompilationDatabase(savePath);
+ buildResult = buildCompilationDatabase(savePath, config.getProjectPath());
if(!buildResult)
return buildResult;
}
@@ -1011,7 +1011,7 @@ namespace backend
// Convenient to have project setup to tests as well
if(config.isMainProject())
{
- buildFileResult = buildCompilationDatabase(buildPath.c_str());
+ buildFileResult = buildCompilationDatabase(buildPath.c_str(), testSourceDirNative);
if(!buildFileResult)
return buildFileResult;
}
@@ -1058,12 +1058,12 @@ namespace backend
return Result<bool>::Err("");
}
- Result<bool> Ninja::buildCompilationDatabase(const _tinydir_char_t *buildFilePath)
+ Result<bool> Ninja::buildCompilationDatabase(const _tinydir_char_t *buildFilePath, const FileString &saveDir)
{
FileString command = TINYDIR_STRING("ninja -C \"");
command += buildFilePath;
command += TINYDIR_STRING("\" -t compdb c_COMPILER cpp_COMPILER BUILD_EXEC BUILD_STATIC BUILD_DYNAMIC > \"");
- command += buildFilePath;
+ command += saveDir;
command += TINYDIR_STRING("/compile_commands.json\"");
Result<ExecResult> execResult = exec(command.c_str(), false);
if(execResult.isOk())
diff --git a/backend/ninja/Ninja.hpp b/backend/ninja/Ninja.hpp
index 575a9bc..68e51b1 100644
--- a/backend/ninja/Ninja.hpp
+++ b/backend/ninja/Ninja.hpp
@@ -56,7 +56,7 @@ namespace backend
bool containsDependency(const std::string &dependency) const;
sibs::Result<bool> getLinkerFlags(const sibs::SibsConfig &config, sibs::LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, sibs::LinkerFlagCallbackFunc dynamicLinkerFlagCallback, sibs::GlobalIncludeDirCallbackFunc globalIncludeDirCallback, sibs::CflagsCallbackFunc cflagsCallbackFunc) const;
sibs::Result<bool> compile(const _tinydir_char_t *buildFilePath);
- sibs::Result<bool> buildCompilationDatabase(const _tinydir_char_t *buildFilePath);
+ sibs::Result<bool> buildCompilationDatabase(const _tinydir_char_t *buildFilePath, const sibs::FileString &savePath);
private:
std::string customGlobalIncludeDirs;
std::vector<std::string> sourceFiles;