]> git.tdb.fi Git - builder.git/blob - source/builder.h
Add command line options (not all of them work yet)
[builder.git] / source / builder.h
1 #ifndef BUILDER_H_
2 #define BUILDER_H_
3
4 #include <list>
5 #include <map>
6 #include <string>
7 #include <msp/core/application.h>
8 #include <msp/parser/loader.h>
9 #include <msp/path/path.h>
10 #include "config.h"
11
12 class Analyzer;
13 class Package;
14 class Target;
15
16 class Builder: public Msp::Application
17 {
18 public:
19         Builder(int, char **);
20         unsigned get_verbose() const { return verbose; }
21         Package  *get_package(const std::string &);
22         Target   *get_target(const std::string &);
23         Target   *get_header(const std::string &, const std::string &, const std::list<std::string> &);
24         Target   *get_library(const std::string &, const std::list<std::string> &);
25         int      main();
26         ~Builder();
27 private:
28         class Loader: public Msp::Parser::Loader
29         {
30         public:
31                 Loader(Builder &, const Msp::Path::Path &);
32         private:
33                 Builder &bld;
34                 Msp::Path::Path src;
35                 
36                 void package(const std::string &);
37         };
38
39         typedef std::map<std::string, Package *>   PackageMap;
40         typedef std::map<std::string, Target *>    TargetMap;
41         typedef std::map<std::string, std::string> ToolMap;
42         
43         std::list<std::string> cmdline_targets;
44         RawOptionMap cmdline_options;
45         
46         PackageMap  packages;
47         std::list<Package *> new_pkgs;
48         Package     *default_pkg;
49
50         TargetMap   targets;
51         std::list<Target *> new_tgts;
52         TargetMap   includes;
53         TargetMap   libraries;
54
55         ToolMap     tools;
56         unsigned    verbose;
57         Msp::Path::Path cwd;
58         Analyzer    *analyzer;
59         unsigned    jobs;
60         std::list<std::string> what_if;
61         bool        chrome;
62
63         int load_build_file(const Msp::Path::Path &);
64         int create_targets();
65         Target *check_header(const Msp::Path::Path &);
66         void add_target(Target *);
67         int build();
68         
69         static Msp::Application::RegApp<Builder> reg;
70 };
71
72 #endif