]> git.tdb.fi Git - builder.git/blob - source/architecture.h
Replace per-file copyright notices with a single file
[builder.git] / source / architecture.h
1 #ifndef ARCHITECTURE_H_
2 #define ARCHITECTURE_H_
3
4 #include <msp/datafile/loader.h>
5 #include "buildinfo.h"
6 #include "misc.h"
7
8 class Builder;
9
10 // XXX Add lib/exe prefix/suffix fields.  Some archs may need multiple alternatives, how to handle this?
11 class Architecture
12 {
13 public:
14         class Loader: public Msp::DataFile::Loader
15         {
16         private:
17                 Architecture &arch;
18
19         public:
20                 Loader(Architecture &);
21                 Architecture &get_object() { return arch; }
22         private:
23                 void tool(const std::string &t, const std::string &p);
24         };
25
26 private:
27         Builder &builder;
28         std::string type;
29         std::string cpu;
30         std::string system;
31         unsigned bits;
32         std::string name;
33         bool native;
34         std::string cross_prefix;
35         StringMap tools;
36         BuildInfo build_info;
37
38 public:
39         Architecture(Builder &b, const std::string &spec);
40
41         const std::string &get_name() const { return name; }
42         const std::string &get_system() const { return system; }
43         bool match_name(const std::string &) const;
44         bool is_native() const { return native; }
45
46         void set_tool(const std::string &t, const std::string &p);
47         void set_cross_prefix(const std::string &);
48         std::string get_tool(const std::string &t) const;
49         const std::string &get_cross_prefix() const { return cross_prefix; }
50
51         const BuildInfo &get_build_info() const { return build_info; }
52
53 private:
54         std::string resolve_alias(const std::string &) const;
55         void parse_specification(const std::string &);
56 };
57
58 typedef std::map<std::string, Architecture> ArchMap;
59
60 #endif