This repository was archived by the owner on Jun 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathproject_build.h
60 lines (46 loc) · 2.06 KB
/
project_build.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include <boost/filesystem.hpp>
#include "cmake.h"
#include "meson.h"
namespace Project {
class Build {
public:
virtual ~Build() {}
boost::filesystem::path project_path;
virtual boost::filesystem::path get_default_path();
virtual bool update_default(bool force=false) {return false;}
virtual boost::filesystem::path get_debug_path();
virtual bool update_debug(bool force=false) {return false;}
virtual std::string get_compile_command() { return std::string(); }
virtual boost::filesystem::path get_executable(const boost::filesystem::path &path) {return boost::filesystem::path();}
static std::unique_ptr<Build> create(const boost::filesystem::path &path);
};
class CMakeBuild : public Build {
::CMake cmake;
public:
CMakeBuild(const boost::filesystem::path &path);
bool update_default(bool force=false) override;
bool update_debug(bool force=false) override;
std::string get_compile_command() override;
boost::filesystem::path get_executable(const boost::filesystem::path &path) override;
};
class MesonBuild : public Build {
Meson meson;
public:
MesonBuild(const boost::filesystem::path &path);
bool update_default(bool force=false) override;
bool update_debug(bool force=false) override;
std::string get_compile_command() override;
boost::filesystem::path get_executable(const boost::filesystem::path &path) override;
};
class CargoBuild : public Build {
public:
boost::filesystem::path get_default_path() override { return project_path/"target"/"debug"; }
bool update_default(bool force=false) override { return true; }
boost::filesystem::path get_debug_path() override { return get_default_path(); }
bool update_debug(bool force=false) override { return true; }
std::string get_compile_command() override { return "cargo build"; }
boost::filesystem::path get_executable(const boost::filesystem::path &path) override { return get_debug_path()/project_path.filename(); }
};
class NpmBuild : public Build {};
}