]> git.tdb.fi Git - builder.git/blob - source/architecture.h
Rename create_targets to prepare_build and make it return bool
[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 "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 system;
30         unsigned bits;
31         std::string name;
32         bool native;
33         std::string cross_prefix;
34         PatternList sharedlib_patterns;
35         PatternList staticlib_patterns;
36         PatternList executable_patterns;
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         unsigned get_bits() const { return bits; }
44         const std::string &get_cpu() const { return cpu; }
45         bool match_name(const std::string &) const;
46         bool is_native() const { return native; }
47         bool is_cross() const { return !cross_prefix.empty(); }
48
49         const std::string &get_cross_prefix() const { return cross_prefix; }
50
51         const PatternList &get_shared_library_patterns() const { return sharedlib_patterns; }
52         const PatternList &get_static_library_patterns() const { return staticlib_patterns; }
53         const PatternList &get_executable_patterns() const { return executable_patterns; }
54
55 private:
56         std::string resolve_alias(const std::string &) const;
57         void parse_specification(const std::string &);
58 };
59
60 typedef std::map<std::string, Architecture> ArchMap;
61
62 #endif