]> git.tdb.fi Git - builder.git/commitdiff
Recognize and use the common sysroot in newer Android NDKs
authorMikko Rasa <tdb@tdb.fi>
Mon, 4 Dec 2017 08:06:41 +0000 (10:06 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 4 Dec 2017 10:14:12 +0000 (12:14 +0200)
source/androidcompiler.cpp
source/androidtools.cpp
source/androidtools.h

index e45715e5a7313068ff66663406473f1e52608565..cdd98af34f5095dd853521535091e5b37e0fc4e8 100644 (file)
@@ -25,6 +25,13 @@ AndroidCompiler::AndroidCompiler(Builder &b, const Architecture &a, const string
 
        if(ndk.get_platform_sysroot().empty())
                problems.push_back("Android platform not found");
+       else if(!ndk.get_common_sysroot().empty())
+       {
+               build_info.sysroot = ndk.get_common_sysroot();
+               /* The common sysroot has asm headers in arch directories and the
+               compiler doesn't pick them up automatically */
+               build_info.incpath.push_back(ndk.get_common_sysroot()/"usr/include"/architecture->get_cross_prefix());
+       }
        else
                build_info.sysroot = ndk.get_platform_sysroot();
 
index 22a893e7bdcf41aac5912aaa8f0b40a09145f138..15126734de660f128b006573713eaf21f71a4874 100644 (file)
@@ -114,6 +114,16 @@ AndroidNdk::AndroidNdk(Builder &b, const Architecture &a):
        AndroidDevKit(b, "NDK"),
        architecture(a)
 {
+       if(!root.empty())
+       {
+               FS::Path csr = root/"sysroot";
+               if(FS::exists(csr))
+               {
+                       common_sysroot = csr;
+                       builder.get_logger().log("tools", format("Android NDK common sysroot is %s", common_sysroot));
+               }
+       }
+
        find_toolchain_dir();
 }
 
@@ -196,7 +206,7 @@ void AndroidNdk::init_api_level(unsigned api)
        }
 
        platform_sysroot = platform_archs_dir/("arch-"+use_arch);
-       builder.get_logger().log("tools", format("Android NDK sysroot is %s", platform_sysroot.str()));
+       builder.get_logger().log("tools", format("Android NDK platform sysroot is %s", platform_sysroot));
 }
 
 
index 16f157d54dadbb2770572c80b90e83b99c8be29f..c0407946b693a67ec6c75f3c218db7f1e71be338 100644 (file)
@@ -50,6 +50,7 @@ class AndroidNdk: public AndroidDevKit
 private:
        const Architecture &architecture;
        Msp::FS::Path bin_dir;
+       Msp::FS::Path common_sysroot;
        Msp::FS::Path platform_sysroot;
 
 public:
@@ -61,6 +62,7 @@ private:
 
 public:
        const Msp::FS::Path &get_bin_dir() const { return bin_dir; }
+       const Msp::FS::Path &get_common_sysroot() const { return common_sysroot; }
        const Msp::FS::Path &get_platform_sysroot() const { return platform_sysroot; }
 };