3 This file is part of builder
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
14 #include <msp/core/application.h>
15 #include <msp/datafile/loader.h>
16 #include <msp/path/path.h>
17 #include "architecture.h"
29 The main application class. Controls and owns everything. Rules the world.
31 class Builder: public Msp::Application
34 Builder(int, char **);
35 unsigned get_verbose() const { return verbose; }
36 bool get_dry_run() const { return dry_run; }
37 bool get_build_all() const { return build_all; }
38 Package *get_package(const std::string &);
39 SourcePackage *get_main_package() const { return main_pkg; }
40 Target *get_target(const std::string &) const;
41 const TargetMap &get_targets() const { return targets; }
42 Target *get_header(const std::string &, const std::string &, const std::string &, const StringList &);
43 Target *get_library(const std::string &, const std::string &, const StringList &, LibMode);
44 const Msp::Path &get_cwd() const { return cwd; }
45 const Architecture &get_architecture(const std::string &) const;
46 void apply_profile_template(Config &, const std::string &) const;
47 void add_target(Target *);
48 void problem(const std::string &, const std::string &);
52 static void usage(const char *, const char *, bool);
54 class Loader: public Msp::DataFile::Loader
57 Loader(Builder &, const Msp::Path &);
62 void architecture(const std::string &);
63 void binpkg(const std::string &);
64 void profile(const std::string &);
65 void package(const std::string &);
68 class ProfileLoader: public Msp::DataFile::Loader
71 ProfileLoader(StringMap &);
75 void option(const std::string &, const std::string &);
78 typedef std::list<Package *> PackageList;
79 typedef std::map<std::string, Package *> PackageMap;
80 typedef std::map<std::string, StringMap> ProfileTemplateMap;
82 StringList cmdline_targets;
83 StringMap cmdline_options;
87 SourcePackage *main_pkg;
95 ProfileTemplateMap profile_tmpl;
105 std::string build_file;
111 bool create_makefile;
113 int load_build_file(const Msp::Path &);
114 int create_targets();
115 Target *get_header(const Msp::Path &);
116 Target *get_library(const std::string &, const std::string &, const Msp::Path &, LibMode);
117 void update_hash(std::string &, const std::string &);
120 int do_create_makefile();
123 static Msp::Application::RegApp<Builder> reg;