-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCompiler.h
67 lines (51 loc) · 1.38 KB
/
Compiler.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
61
62
63
64
65
66
67
#ifndef JET_COMPILER_HEADER
#define JET_COMPILER_HEADER
/*#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif*/
#include "Types/Types.h"
#include "Token.h"
#include "Compilation.h"
class OptionParser;
namespace Jet
{
//void ParserError(const std::string& msg, Token token);//todo
struct CompilerOptions
{
int optimization;//from 0-3
int debug;//0 = none, 1 = lines, 2 = everything
bool force, run = false, time = false;
bool output_ir = false;
std::string target, linker;
CompilerOptions()
{
this->force = false;
this->optimization = 0;
}
void ApplyOptions(OptionParser* parser);
};
//todo: why is this a class?
class Compiler
{
void UpdateProjectList(JetProject* project);
public:
static std::string FindProject(const std::string& name, const std::string& desired_version);
struct ProjectInfo
{
std::string name;
std::string path;
std::string version;
};
static std::vector<ProjectInfo> GetProjectList();
//returns if was successful, errored, or if there was a rebuild
//0 = error, 1 = success, 2 = successful, was recompiled
int Compile(const char* projectfile, CompilerOptions* options = 0, const std::string& config = "", OptionParser* parser = 0);
};
void SetupDefaultCommandOptions(OptionParser* parser);
};
#endif