1 #ifndef ARCHITECTURE_H_
2 #define ARCHITECTURE_H_
5 #include <msp/datafile/loader.h>
7 #include "libbuilder_api.h"
13 Stores information about an architecture. This includes CPU type, model and
14 bitness and operating system.
16 class LIBBUILDER_API Architecture
19 class Loader: public Msp::DataFile::ObjectLoader<Architecture>
22 Loader(Architecture &);
25 void cross_prefix(const std::string &);
35 std::string toolchain;
38 std::string cross_prefix;
39 std::map<std::string, std::vector<Pattern>> filename_patterns;
42 Architecture(Builder &b, const std::string &spec);
44 void refine(const std::string &);
49 const std::string &get_type() const { return type; }
50 const std::string &get_name() const { return name; }
51 const std::string &get_system() const { return system; }
52 unsigned get_bits() const { return bits; }
53 const std::string &get_cpu() const { return cpu; }
54 const std::string &get_fpu() const { return fpu; }
55 const std::string &get_toolchain() const { return toolchain; }
56 bool match_name(const std::string &, unsigned * = 0) const;
57 std::string best_match(const std::vector<std::string> &) const;
58 bool is_native() const { return native; }
59 bool is_cross() const { return !cross_prefix.empty(); }
61 const std::string &get_cross_prefix() const { return cross_prefix; }
64 const std::vector<Pattern> &get_patterns() const;
67 std::string create_filename(const std::string &) const;
71 void add_pattern(const std::string &);
74 static void resolve_aliases(std::vector<std::string> &);
75 void parse_specification(const std::string &);
79 inline const std::vector<Pattern> &Architecture::get_patterns() const
81 auto i = filename_patterns.find(typeid(T).name());
82 if(i!=filename_patterns.end())
85 static std::vector<Pattern> empty;
90 inline std::string Architecture::create_filename(const std::string &base) const
92 const std::vector<Pattern> &patterns = get_patterns<T>();
93 return patterns.empty() ? base : patterns.front().apply(base);