]> git.tdb.fi Git - builder.git/blob - source/buildinfo.h
Rewrite BuildInfo to be compiler-agnostic
[builder.git] / source / buildinfo.h
1 #ifndef BUILDINFO_H_
2 #define BUILDINFO_H_
3
4 #include <list>
5 #include <string>
6 #include <msp/datafile/objectloader.h>
7 #include "misc.h"
8
9 /**
10 Stores information about compiler command line parameters in a more abstract
11 form.  Allows combining with other BuildInfos to support package dependencies.
12 */
13 class BuildInfo
14 {
15 public:
16         class Loader: public Msp::DataFile::ObjectLoader<BuildInfo>
17         {
18         public:
19                 Loader(BuildInfo &);
20         private:
21                 void incpath(const std::string &);
22                 void define(const std::string &, const std::string &);
23                 void libpath(const std::string &);
24                 void library(const std::string &);
25                 void warning(const std::string &);
26         };
27         
28         enum UpdateLevel
29         {
30                 LOCAL,
31                 DEPENDENCY,
32                 CHAINED
33         };
34
35         typedef std::map<std::string, std::string> DefineMap;
36
37         DefineMap defines;
38         StringList incpath;
39         StringList libpath;
40         StringList libs;
41         StringList warnings;
42         bool threads;
43         bool debug;
44         int optimize;
45         bool strip;
46
47         BuildInfo();
48
49         /** Adds another BuildInfo to the end of this one. */
50         void update_from(const BuildInfo &, UpdateLevel = LOCAL);
51
52         /** Makes sure there are no duplicate entries in the lists.  For warnings,
53         contradicting flags are eliminated and the last one stays in effect. */
54         void unique();
55 };
56
57 #endif