X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farchitecture.h;h=153230244f6aedfdce7fd6a5648619108fe93d12;hb=bc85cc286c8a3f1055f1979a7ff8697cf1b61912;hp=af586192f9ef44b4dafa9103c68ca2b797000e43;hpb=3585dea6eabf5f1565886bf09c2bdb2eee978912;p=builder.git diff --git a/source/architecture.h b/source/architecture.h index af58619..1532302 100644 --- a/source/architecture.h +++ b/source/architecture.h @@ -1,47 +1,64 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef ARCHITECTURE_H_ #define ARCHITECTURE_H_ #include -#include "misc.h" +#include "buildinfo.h" +#include "pattern.h" class Builder; -// XXX Add lib/exe prefix/suffix fields. Some archs may need multiple alternatives, how to handle this? +/** +Stores information about an architecture. This includes CPU type, model and +bitness and operating system. +*/ class Architecture { public: - class Loader: public Msp::DataFile::Loader + class Loader: public Msp::DataFile::ObjectLoader { public: Loader(Architecture &); - Architecture &get_object() { return arch; } - private: - Architecture &arch; - - void tool(const std::string &t, const std::string &p); }; - Architecture(Builder &b, const std::string &n, bool a=false); - void set_tool(const std::string &t, const std::string &p); - std::string get_tool(const std::string &t) const; + typedef std::list PatternList; + +private: + Builder &builder; + std::string type; + std::string cpu; + std::string fpu; + std::string system; + unsigned bits; + std::string name; + bool native; + std::string cross_prefix; + PatternList sharedlib_patterns; + PatternList staticlib_patterns; + PatternList executable_patterns; + +public: + Architecture(Builder &b, const std::string &spec); + + const std::string &get_type() const { return type; } const std::string &get_name() const { return name; } + const std::string &get_system() const { return system; } + unsigned get_bits() const { return bits; } + const std::string &get_cpu() const { return cpu; } + const std::string &get_fpu() const { return fpu; } + bool match_name(const std::string &) const; + std::string best_match(const std::list &) const; bool is_native() const { return native; } - const std::string &get_prefix() const { return prefix; } + bool is_cross() const { return !cross_prefix.empty(); } + + const std::string &get_cross_prefix() const { return cross_prefix; } + + const PatternList &get_shared_library_patterns() const { return sharedlib_patterns; } + const PatternList &get_static_library_patterns() const { return staticlib_patterns; } + const PatternList &get_executable_patterns() const { return executable_patterns; } + private: - Builder &builder; - std::string name; - bool native; - std::string prefix; - StringMap tools; + static void resolve_aliases(std::vector &); + void parse_specification(const std::string &); }; -typedef std::map ArchMap; - #endif