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>
27 The main application class. Controls and owns everything. Rules the world.
29 class Builder: public Msp::Application
32 Builder(int, char **);
33 unsigned get_verbose() const { return verbose; }
34 bool get_dry_run() const { return dry_run; }
35 bool get_build_all() const { return build_all; }
36 Package *get_package(const std::string &);
37 SourcePackage *get_default_package() const { return default_pkg; }
38 Target *get_target(const std::string &) const;
39 const TargetMap &get_targets() const { return targets; }
40 Target *get_header(const std::string &, const std::string &, const std::string &, const StringList &);
41 Target *get_library(const std::string &, const std::string &, const StringList &, LibMode);
42 const Msp::Path::Path &get_cwd() const { return cwd; }
43 const std::string &get_arch_prefix(const std::string &) const;
44 std::string get_tool(const std::string &, const std::string &);
45 void apply_profile_template(Config &, const std::string &) const;
46 void add_target(Target *);
50 static void usage(const char *, const char *, bool);
52 class Loader: public Msp::DataFile::Loader
55 Loader(Builder &, const Msp::Path::Path &);
60 void architecture(const std::string &, const std::string &);
61 void binpkg(const std::string &);
62 void profile(const std::string &);
63 void package(const std::string &);
66 class ProfileLoader: public Msp::DataFile::Loader
69 ProfileLoader(StringMap &);
73 void option(const std::string &, const std::string &);
76 typedef std::list<Package *> PackageList;
77 typedef std::map<std::string, Package *> PackageMap;
78 typedef std::map<std::string, StringMap> ToolMap;
79 typedef std::map<std::string, StringMap> ProfileTemplateMap;
81 StringList cmdline_targets;
82 StringMap cmdline_options;
86 SourcePackage *default_pkg;
93 ToolMap tools; //< arch, tool name -> program name
94 StringMap archs; //< arch -> prefix
95 ProfileTemplateMap profile_tmpl;
104 std::string build_file;
110 bool create_makefile;
112 int load_build_file(const Msp::Path::Path &);
113 int create_targets();
114 Target *get_header(const Msp::Path::Path &);
115 Target *get_library(const std::string &, const std::string &, const Msp::Path::Path &, LibMode);
116 void update_hash(std::string &, const std::string &);
119 int do_create_makefile();
122 static Msp::Application::RegApp<Builder> reg;