Browse Source

Added support for builds that includes compile_commands.json files created by tools like Bear and compiledb. Fixes #392

merge-requests/393/head
eidheim 7 years ago
parent
commit
dc026f5fa6
  1. 9
      src/project_build.cc
  2. 5
      src/project_build.h

9
src/project_build.cc

@ -21,6 +21,11 @@ std::unique_ptr<Project::Build> Project::Build::create(const boost::filesystem::
return build; return build;
} }
if(boost::filesystem::exists(search_path / Config::get().project.default_build_path / "compile_commands.json")) {
std::unique_ptr<Project::Build> build(new CompileCommandsBuild(search_path));
return build;
}
if(boost::filesystem::exists(search_path / "Cargo.toml")) { if(boost::filesystem::exists(search_path / "Cargo.toml")) {
std::unique_ptr<Project::Build> build(new CargoBuild()); std::unique_ptr<Project::Build> build(new CargoBuild());
build->project_path = search_path; 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) { boost::filesystem::path Project::MesonBuild::get_executable(const boost::filesystem::path &path) {
return meson.get_executable(get_default_path(), path); return meson.get_executable(get_default_path(), path);
} }
Project::CompileCommandsBuild::CompileCommandsBuild(const boost::filesystem::path &path) {
project_path = path;
}

5
src/project_build.h

@ -47,6 +47,11 @@ namespace Project {
boost::filesystem::path get_executable(const boost::filesystem::path &path) override; 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 { class CargoBuild : public Build {
public: public:
boost::filesystem::path get_default_path() override { return project_path / "target" / "debug"; } boost::filesystem::path get_default_path() override { return project_path / "target" / "debug"; }

Loading…
Cancel
Save