]> git.tdb.fi Git - builder.git/blob - source/androidtools.h
Recognize and use the common sysroot in newer Android NDKs
[builder.git] / source / androidtools.h
1 #ifndef ANDROIDTOOLS_H_
2 #define ANDROIDTOOLS_H_
3
4 #include <set>
5 #include <msp/fs/path.h>
6 #include "toolchain.h"
7
8 class Architecture;
9 class Builder;
10
11 class AndroidDevKit
12 {
13 protected:
14         Builder &builder;
15         Msp::FS::Path root;
16         std::set<unsigned> supported_api_levels;
17
18         AndroidDevKit(Builder &, const std::string &);
19         ~AndroidDevKit() { }
20
21 public:
22         const Msp::FS::Path &get_root_dir() const { return root; }
23         const std::set<unsigned> &get_supported_api_levels() const { return supported_api_levels; }
24         void select_api_level(unsigned);
25 protected:
26         virtual void init_api_level(unsigned) = 0;
27 };
28
29 class AndroidSdk: public AndroidDevKit
30 {
31 private:
32         Msp::FS::Path build_tools_dir;
33         // TODO use a FileTarget for the jar
34         Msp::FS::Path platform_jar;
35
36 public:
37         AndroidSdk(Builder &);
38
39 private:
40         void find_build_tools_dir();
41         virtual void init_api_level(unsigned);
42
43 public:
44         const Msp::FS::Path &get_build_tools_dir() const { return build_tools_dir; }
45         const Msp::FS::Path &get_platform_jar() const { return platform_jar; }
46 };
47
48 class AndroidNdk: public AndroidDevKit
49 {
50 private:
51         const Architecture &architecture;
52         Msp::FS::Path bin_dir;
53         Msp::FS::Path common_sysroot;
54         Msp::FS::Path platform_sysroot;
55
56 public:
57         AndroidNdk(Builder &, const Architecture &);
58
59 private:
60         void find_toolchain_dir();
61         virtual void init_api_level(unsigned);
62
63 public:
64         const Msp::FS::Path &get_bin_dir() const { return bin_dir; }
65         const Msp::FS::Path &get_common_sysroot() const { return common_sysroot; }
66         const Msp::FS::Path &get_platform_sysroot() const { return platform_sysroot; }
67 };
68
69
70 class AndroidTools: public Toolchain
71 {
72 private:
73         AndroidSdk sdk;
74         AndroidNdk ndk;
75
76 public:
77         AndroidTools(Builder &, const Architecture &);
78 };
79
80 #endif