diff --git a/src/project_build.cc b/src/project_build.cc index f225df0..d9aa6a9 100644 --- a/src/project_build.cc +++ b/src/project_build.cc @@ -21,6 +21,11 @@ std::unique_ptr Project::Build::create(const boost::filesystem:: return build; } + if(boost::filesystem::exists(search_path / Config::get().project.default_build_path / "compile_commands.json")) { + std::unique_ptr build(new CompileCommandsBuild(search_path)); + return build; + } + if(boost::filesystem::exists(search_path / "Cargo.toml")) { std::unique_ptr build(new CargoBuild()); build->project_path = search_path; @@ -120,3 +125,7 @@ std::string Project::MesonBuild::get_compile_command() { boost::filesystem::path Project::MesonBuild::get_executable(const boost::filesystem::path &path) { return meson.get_executable(get_default_path(), path); } + +Project::CompileCommandsBuild::CompileCommandsBuild(const boost::filesystem::path &path) { + project_path = path; +} diff --git a/src/project_build.h b/src/project_build.h index 4a08e5e..56f9047 100644 --- a/src/project_build.h +++ b/src/project_build.h @@ -47,6 +47,11 @@ namespace Project { boost::filesystem::path get_executable(const boost::filesystem::path &path) override; }; + class CompileCommandsBuild : public Build { + public: + CompileCommandsBuild(const boost::filesystem::path &path); + }; + class CargoBuild : public Build { public: boost::filesystem::path get_default_path() override { return project_path / "target" / "debug"; }