X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbuildinfo.h;h=595fe1a55ccd5bb414ebbe5febec8f86431465b2;hb=486adc75285b8b5d62a990dd9f9cd4737c8ab7f6;hp=18f33a093676a2d98c54b4a3c2c9a338d8c10df7;hpb=243d7c7355c1c5d9a0134440f340936325caaf88;p=builder.git diff --git a/source/buildinfo.h b/source/buildinfo.h index 18f33a0..595fe1a 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 @@ -13,6 +13,14 @@ form. Allows combining with other BuildInfos to support package dependencies. class BuildInfo { public: + enum LibraryMode + { + FORCE_STATIC, //< Only accept static libraries + STATIC, //< Prefer static libraries but accept dynamic as well + DYNAMIC, //< Prefer dynamic libraries but accept static as well + FORCE_DYNAMIC //< Only accept dynamic libraries + }; + class Loader: public Msp::DataFile::ObjectLoader { public: @@ -22,7 +30,6 @@ public: void define(const std::string &, const std::string &); void libpath(const std::string &); void library(const std::string &); - void warning(const std::string &); }; enum UpdateLevel @@ -32,17 +39,47 @@ 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=(T v) { value = v; set = true; return *this; } + operator T() const { return value; } + }; + typedef std::map DefineMap; + typedef std::list PathList; + typedef std::list WordList; DefineMap defines; - StringList incpath; - StringList libpath; - StringList libs; - StringList warnings; - bool threads; - bool debug; - int optimize; - bool strip; + PathList incpath; + PathList libpath; + WordList libs; + Tracked libmode; + Tracked threads; + Tracked debug; + Tracked optimize; + Tracked strip; + Tracked warning_level; + Tracked fatal_warnings; BuildInfo(); @@ -51,10 +88,6 @@ public: The update level determines what information is updated. */ void update_from(const BuildInfo &, UpdateLevel = LOCAL); - - /** Makes sure there are no duplicate entries in the lists. For warnings, - contradicting flags are eliminated and the last one stays in effect. */ - void unique(); }; #endif