]> git.tdb.fi Git - builder.git/blob - source/lib/binarycomponent.h
eaa123c0a4ae7fcf6d5c02fe481b0389eaee296d
[builder.git] / source / lib / binarycomponent.h
1 #ifndef BINARYCOMPONENT_H_
2 #define BINARYCOMPONENT_H_
3
4 #include "component.h"
5
6 class FileTarget;
7 class Target;
8 class Tool;
9
10 class BinaryComponent: public Component
11 {
12 public:
13         class Loader: public Msp::DataFile::DerivedObjectLoader<BinaryComponent, Component::Loader>
14         {
15         public:
16                 Loader(BinaryComponent &);
17         private:
18                 void use(const std::string &);
19         };
20
21         enum Type
22         {
23                 LIBRARY,
24                 PROGRAM,
25                 MODULE
26         };
27
28 private:
29         Type type;
30         std::vector<const Component *> uses;
31
32 public:
33         BinaryComponent(SourcePackage &p, const std::string &n, Type t): Component(p, n), type(t) { }
34
35         Type get_type() const { return type; }
36
37         void create_build_info() override;
38         void update_exported_build_info(BuildInfo &) const override;
39         void create_targets() const override;
40 private:
41         std::vector<FileTarget *> create_sources() const;
42         static std::vector<Target *> extract_group(std::vector<FileTarget *> &, const Tool &);
43         void create_install(FileTarget &) const;
44 };
45
46 #endif