]> git.tdb.fi Git - builder.git/blobdiff - source/buildinfo.h
Use default member initializers and constructor delegation
[builder.git] / source / buildinfo.h
index ee831f3c4da453dfdfc3c16567e5350a9174026d..26afabffd4db6f323824ddeba99f98954c78c926 100644 (file)
@@ -1,8 +1,8 @@
 #ifndef BUILDINFO_H_
 #define BUILDINFO_H_
 
-#include <list>
 #include <string>
+#include <vector>
 #include <msp/datafile/objectloader.h>
 #include <msp/fs/path.h>
 
@@ -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<BuildInfo>
        {
        public:
@@ -28,10 +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
@@ -41,6 +51,17 @@ public:
                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
@@ -52,41 +73,39 @@ public:
        class Tracked
        {
        public:
-               typedef T LoadType;
+               using LoadType = T;
 
        private:
-               T value;
-               bool set;
+               T value{};
+               bool set = false;
 
        public:
-               Tracked(): value(T()), set(false) { }
-               Tracked(T v): value(v), set(false) { }
+               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=(v) { value = v; set = true; return *this; }
-               operator T() const { return value; }
+               Tracked &operator=(const T &v) { value = v; set = true; return *this; }
+               operator const T &() const { return value; }
        };
 
-       typedef std::map<std::string, std::string> DefineMap;
-       typedef std::list<Msp::FS::Path> PathList;
-       typedef std::list<std::string> WordList;
-       typedef std::map<std::string, LibraryMode> LibModeMap;
-
-       DefineMap defines;
-       PathList incpath;
-       PathList local_incpath;
-       PathList libpath;
-       WordList libs;
-       Tracked<LibraryMode> libmode;
-       LibModeMap libmodes;
-       Tracked<bool> threads;
-       Tracked<bool> debug;
-       Tracked<int> optimize;
-       Tracked<bool> strip;
-       Tracked<unsigned> warning_level;
-       Tracked<bool> fatal_warnings;
-
-       BuildInfo();
+       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