6 #include <msp/datafile/objectloader.h>
7 #include <msp/fs/path.h>
10 Stores information about compiler command line parameters in a more abstract
11 form. Allows combining with other BuildInfos to support package dependencies.
18 FORCE_STATIC, //< Only accept static libraries
19 STATIC, //< Prefer static libraries but accept dynamic as well
20 DYNAMIC, //< Prefer dynamic libraries but accept static as well
21 FORCE_DYNAMIC //< Only accept dynamic libraries
24 class Loader: public Msp::DataFile::ObjectLoader<BuildInfo>
29 void incpath(const std::string &);
30 void define(const std::string &, const std::string &);
31 void keep_symbol(const std::string &);
32 void libmode_for_lib(const std::string &, LibraryMode);
33 void libpath(const std::string &);
34 void library(const std::string &);
35 void local_incpath(const std::string &);
36 void standard(Msp::DataFile::Symbol, const std::string &);
37 void sysroot(const std::string &);
42 LOCAL, //< Include all information
43 DEPENDENCY, //< Include all but code generation options
44 CHAINED //< Include only compilation options
48 A wrapper which tracks the set status of the wrapped variable. A default
49 value may be provided in initialization without causing it to be treated as
50 set. Assigning from a raw value flags the Tracked object as set. Assigning
51 from another Tracked object will only change the value of the target if the
65 Tracked(): value(T()), set(false) { }
66 Tracked(T v): value(v), set(false) { }
67 Tracked &operator=(const Tracked &v) { if(v.set) { value = v.value; set = true; } return *this; }
69 Tracked &operator=(T v) { value = v; set = true; return *this; }
70 operator T() const { return value; }
73 typedef std::map<std::string, std::string> DefineMap;
74 typedef std::list<Msp::FS::Path> PathList;
75 typedef std::list<std::string> WordList;
76 typedef std::map<std::string, LibraryMode> LibModeMap;
77 typedef std::map<std::string, std::string> StandardMap;
79 Tracked<Msp::FS::Path> sysroot;
82 PathList local_incpath;
85 Tracked<LibraryMode> libmode;
87 WordList keep_symbols;
88 StandardMap standards;
89 Tracked<bool> threads;
91 Tracked<int> optimize;
93 Tracked<unsigned> warning_level;
94 Tracked<bool> fatal_warnings;
98 /** Returns the library mode for linking a particular library. If no mode
99 has been specified for that library, the the global library mode is
101 LibraryMode get_libmode_for(const std::string &) const;
103 /** Updates the BuildInfo from another one. Lists are concatenated, with
104 the first occurrence of each item preserved. Scalars are overwritten.
106 The update level determines what information is updated. */
107 void update_from(const BuildInfo &, UpdateLevel = LOCAL);