]> git.tdb.fi Git - builder.git/blob - architecture.h
752c84a2d19b7afd267ed8863fa630fa34e347cd
[builder.git] / architecture.h
1 #ifndef ARCHITECTURE_H_
2 #define ARCHITECTURE_H_
3
4 #include <msp/datafile/loader.h>
5 #include "buildinfo.h"
6 #include "pattern.h"
7
8 class Builder;
9
10 /**
11 Stores information about an architecture.  This includes CPU type, model and
12 bitness and operating system.
13 */
14 class Architecture
15 {
16 public:
17         class Loader: public Msp::DataFile::ObjectLoader<Architecture>
18         {
19         public:
20                 Loader(Architecture &);
21         };
22
23         typedef std::list<Pattern> PatternList;
24
25 private:
26         Builder &builder;
27         std::string type;
28         std::string cpu;
29         std::string fpu;
30         std::string system;
31         unsigned bits;
32         std::string toolchain;
33         std::string name;
34         bool native;
35         std::string cross_prefix;
36         PatternList object_patterns;
37         PatternList sharedlib_patterns;
38         PatternList staticlib_patterns;
39         PatternList executable_patterns;
40
41 public:
42         Architecture(Builder &b, const std::string &spec);
43
44         const std::string &get_type() const { return type; }
45         const std::string &get_name() const { return name; }
46         const std::string &get_system() const { return system; }
47         unsigned get_bits() const { return bits; }
48         const std::string &get_cpu() const { return cpu; }
49         const std::string &get_fpu() const { return fpu; }
50         const std::string &get_toolchain() const { return toolchain; }
51         bool match_name(const std::string &) const;
52         std::string best_match(const std::vector<std::string> &) const;
53         bool is_native() const { return native; }
54         bool is_cross() const { return !cross_prefix.empty(); }
55
56         const std::string &get_cross_prefix() const { return cross_prefix; }
57
58         const PatternList &get_object_patterns() const { return object_patterns; }
59         const PatternList &get_shared_library_patterns() const { return sharedlib_patterns; }
60         const PatternList &get_static_library_patterns() const { return staticlib_patterns; }
61         const PatternList &get_executable_patterns() const { return executable_patterns; }
62
63 private:
64         static void resolve_aliases(std::vector<std::string> &);
65         void parse_specification(const std::string &);
66 };
67
68 #endif