diff options
Diffstat (limited to 'backend/ninja')
-rw-r--r-- | backend/ninja/Ninja.cpp | 8 | ||||
-rw-r--r-- | backend/ninja/Ninja.hpp | 2 |
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; |