+ enum UpdateLevel
+ {
+ LOCAL, //< Include all information
+ DEPENDENCY, //< Include all but code generation options
+ CHAINED //< Include only compilation options
+ };
+
+ struct LanguageStandard
+ {
+ std::string type;
+ unsigned year = 0;
+
+ LanguageStandard() = default;
+ LanguageStandard(const std::string &);
+
+ std::string str() const;
+ };
+
+ /**
+ 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<typename T>
+ class Tracked
+ {
+ public:
+ using LoadType = T;
+
+ private:
+ T value{};
+ bool set = false;
+
+ public:
+ Tracked() = default;
+ Tracked(T v): value(v) { }
+ Tracked(const Tracked &t) = default;
+ 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; }
+ };
+
+ Tracked<Msp::FS::Path> sysroot;
+ std::map<std::string, std::string> defines;
+ std::vector<Msp::FS::Path> incpath;
+ std::vector<Msp::FS::Path> local_incpath;
+ std::vector<Msp::FS::Path> libpath;
+ std::vector<std::string> libs;
+ Tracked<LibraryMode> libmode = DYNAMIC;
+ Tracked<RuntimePathMode> rpath_mode = NO_RPATH;
+ std::map<std::string, LibraryMode> libmodes;
+ std::vector<std::string> keep_symbols;
+ std::map<std::string, LanguageStandard> standards;
+ Tracked<bool> threads = false;
+ Tracked<bool> debug = false;
+ Tracked<int> optimize = 0;
+ Tracked<bool> strip = false;
+ Tracked<unsigned> warning_level = 0;
+ Tracked<bool> fatal_warnings = false;
+
+ /** 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.