]> git.tdb.fi Git - builder.git/blob - source/buildinfo.h
Make BuildInfo able to handle chained dependencies
[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 cflag(const std::string &);
22                 void incpath(const std::string &);
23                 void define(const std::string &);
24                 void ldflag(const std::string &);
25                 void libpath(const std::string &);
26                 void library(const std::string &);
27                 void warning(const std::string &);
28         };
29         
30         enum UpdateLevel
31         {
32                 LOCAL,
33                 DEPENDENCY,
34                 CHAINED
35         };
36
37         StringList cflags;
38         StringList defines;
39         StringList incpath;
40         StringList ldflags;
41         StringList libpath;
42         StringList libs;
43         StringList warnings;
44
45         /** Adds another BuildInfo to the end of this one. */
46         void update_from(const BuildInfo &, UpdateLevel = LOCAL);
47
48         /** Makes sure there are no duplicate entries in the lists.  For warnings,
49         contradicting flags are eliminated and the last one stays in effect. */
50         void unique();
51 };
52
53 #endif