X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuildinfo.h;h=ccfa2b630bc9f47a03e471c846e8bc7e2e3c8838;hb=fe305f49aae7b7dff4c6be6f7bb8d403ccf53768;hp=ca8819d59e55ec234fbfeb5a67aa2c5bfdf58ee6;hpb=6ed04f66e56958890c2ecca82fa3885f10f8adf0;p=builder.git diff --git a/source/buildinfo.h b/source/buildinfo.h index ca8819d..ccfa2b6 100644 --- a/source/buildinfo.h +++ b/source/buildinfo.h @@ -4,7 +4,7 @@ #include #include #include -#include "misc.h" +#include /** Stores information about compiler command line parameters in a more abstract @@ -21,6 +21,13 @@ public: FORCE_DYNAMIC //< Only accept dynamic libraries }; + enum RuntimePathMode + { + NO_RPATH, //< Do not record rpath in binaries + RELATIVE, //< Record relative rpath in binaries + ABSOLUTE //< Record absolute rpath in binaries + }; + class Loader: public Msp::DataFile::ObjectLoader { public: @@ -28,8 +35,13 @@ public: private: void incpath(const std::string &); void define(const std::string &, const std::string &); + void keep_symbol(const std::string &); + void libmode_for_lib(const std::string &, LibraryMode); void libpath(const std::string &); void library(const std::string &); + void local_incpath(const std::string &); + void standard(Msp::DataFile::Symbol, const std::string &); + void sysroot(const std::string &); }; enum UpdateLevel @@ -39,24 +51,63 @@ public: CHAINED //< Include only compilation options }; + /** + A wrapper which tracks the set status of the wrapped variable. A default + value may be provided in initialization without causing it to be treated as + set. Assigning from a raw value flags the Tracked object as set. Assigning + from another Tracked object will only change the value of the target if the + source is set. + */ + template + class Tracked + { + public: + typedef T LoadType; + + private: + T value; + bool set; + + public: + Tracked(): value(T()), set(false) { } + Tracked(T v): value(v), set(false) { } + Tracked &operator=(const Tracked &v) { if(v.set) { value = v.value; set = true; } return *this; } + + Tracked &operator=(const T &v) { value = v; set = true; return *this; } + operator const T &() const { return value; } + }; + typedef std::map DefineMap; typedef std::list PathList; typedef std::list WordList; + typedef std::map LibModeMap; + typedef std::map StandardMap; + Tracked sysroot; DefineMap defines; PathList incpath; + PathList local_incpath; PathList libpath; WordList libs; - LibraryMode libmode; - bool threads; - bool debug; - int optimize; - bool strip; - unsigned warning_level; - bool fatal_warnings; + Tracked libmode; + Tracked rpath_mode; + LibModeMap libmodes; + WordList keep_symbols; + StandardMap standards; + Tracked threads; + Tracked debug; + Tracked optimize; + Tracked strip; + Tracked warning_level; + Tracked fatal_warnings; BuildInfo(); + /** Returns the library mode for linking a particular library. If no mode + has been specified for that library, the the global library mode is + returned. */ + LibraryMode get_libmode_for(const std::string &) const; + /** Updates the BuildInfo from another one. Lists are concatenated, with the first occurrence of each item preserved. Scalars are overwritten.