}
-AndroidDevKit::AndroidDevKit(Builder &b, const string &type):
+AndroidDevKit::AndroidDevKit(Builder &b, const string &type, const FS::Path &default_path):
builder(b)
{
string var = format("ANDROID_%s_ROOT", type);
if(const char *value = getenv(var.c_str()))
root = value;
+ else if(!default_path.empty() && FS::exists(default_path))
+ root = default_path;
else
{
builder.get_logger().log("problems", format("Android %s not found", type));
}
-AndroidNdk::AndroidNdk(Builder &b, const Architecture &a):
- AndroidDevKit(b, "NDK"),
+AndroidNdk::AndroidNdk(Builder &b, const Architecture &a, const AndroidSdk &sdk):
+ AndroidDevKit(b, "NDK", create_default_path(sdk)),
architecture(a)
{
if(!root.empty())
find_toolchain_dir();
}
+FS::Path AndroidNdk::create_default_path(const AndroidSdk &sdk)
+{
+ if(sdk.get_root_dir().empty())
+ return FS::Path();
+ return sdk.get_root_dir()/"ndk-bundle";
+}
+
void AndroidNdk::find_toolchain_dir()
{
if(root.empty())
AndroidTools::AndroidTools(Builder &builder, const Architecture &arch):
sdk(builder),
- ndk(builder, arch)
+ ndk(builder, arch, sdk)
{
const set<unsigned> &sdk_api_levels = sdk.get_supported_api_levels();
const set<unsigned> &ndk_api_levels = ndk.get_supported_api_levels();
Msp::FS::Path root;
std::set<unsigned> supported_api_levels;
- AndroidDevKit(Builder &, const std::string &);
+ AndroidDevKit(Builder &, const std::string &, const Msp::FS::Path & = Msp::FS::Path());
~AndroidDevKit() { }
public:
Msp::FS::Path platform_sysroot;
public:
- AndroidNdk(Builder &, const Architecture &);
-
+ AndroidNdk(Builder &, const Architecture &, const AndroidSdk &);
private:
+ static Msp::FS::Path create_default_path(const AndroidSdk &);
+
void find_toolchain_dir();
virtual void init_api_level(unsigned);