1 #ifndef ARCHITECTURE_H_
2 #define ARCHITECTURE_H_
5 #include <msp/datafile/loader.h>
12 Stores information about an architecture. This includes CPU type, model and
13 bitness and operating system.
18 class Loader: public Msp::DataFile::ObjectLoader<Architecture>
21 Loader(Architecture &);
31 std::string toolchain;
34 std::string cross_prefix;
35 std::map<std::string, std::list<Pattern>> filename_patterns;
38 Architecture(Builder &b, const std::string &spec);
40 const std::string &get_type() const { return type; }
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 const std::string &get_fpu() const { return fpu; }
46 const std::string &get_toolchain() const { return toolchain; }
47 bool match_name(const std::string &) const;
48 std::string best_match(const std::vector<std::string> &) const;
49 bool is_native() const { return native; }
50 bool is_cross() const { return !cross_prefix.empty(); }
52 const std::string &get_cross_prefix() const { return cross_prefix; }
55 const std::list<Pattern> &get_patterns() const;
58 std::string create_filename(const std::string &) const;
62 void add_pattern(const std::string &);
65 static void resolve_aliases(std::vector<std::string> &);
66 void parse_specification(const std::string &);
70 inline const std::list<Pattern> &Architecture::get_patterns() const
72 auto i = filename_patterns.find(typeid(T).name());
73 if(i!=filename_patterns.end())
76 static std::list<Pattern> empty;
81 inline std::string Architecture::create_filename(const std::string &base) const
83 const std::list<Pattern> &patterns = get_patterns<T>();
84 return patterns.empty() ? base : patterns.front().apply(base);