]> git.tdb.fi Git - builder.git/blobdiff - source/androidcompiler.cpp
Improve problem reporting for the Android toolchain
[builder.git] / source / androidcompiler.cpp
index 53f4de1947b11223138d38930be8180d506cc28f..01daa2a65c6ea2318bcf0a6f79366945e2309575 100644 (file)
@@ -16,7 +16,16 @@ AndroidCompiler::AndroidCompiler(Builder &b, const Architecture &a, const string
        GnuCompiler(b, a, t, n.get_platform_sysroot()),
        ndk(n)
 {
-       set_command((ndk.get_bin_dir()/command).str());
+       if(ndk.get_root_dir().empty())
+               problems.push_back("Android NDK not found");
+       else if(ndk.get_bin_dir().empty())
+               problems.push_back("Android NDK toolchain not found");
+       else
+               set_command((ndk.get_bin_dir()/command).str());
+
+       if(ndk.get_platform_sysroot().empty())
+               problems.push_back("Android platform not found");
+
        build_info.incpath.insert(build_info.incpath.end(), system_path.begin(), system_path.end());
        if(tag=="CXX")
                build_info.libs.push_back("gnustl_static");
@@ -41,7 +50,23 @@ void AndroidCompiler::do_prepare()
                catch(const runtime_error &)
                { }
 
-               FS::Path libstdcxx_path = ndk.get_root_dir()/"sources"/"cxx-stl"/"gnu-libstdc++"/version;
+               FS::Path libstdcxx_dir = ndk.get_root_dir()/"sources"/"cxx-stl"/"gnu-libstdc++";
+               FS::Path libstdcxx_path;
+               while(1)
+               {
+                       libstdcxx_path = libstdcxx_dir/version;
+                       if(FS::exists(libstdcxx_path))
+                               break;
+
+                       string::size_type dot = version.rfind('.');
+                       if(dot==string::npos)
+                       {
+                               problems.push_back("C++ standard library not found");
+                               return;
+                       }
+
+                       version = version.substr(0, dot);
+               }
 
                FS::Path public_dir = libstdcxx_path/"include";
                system_path.push_back(public_dir);