--- /dev/null
+#include "androidcxxcompiler.h"
+#include "androidtools.h"
+#include "architecture.h"
+
+using namespace std;
+using namespace Msp;
+
+AndroidCxxCompiler::AndroidCxxCompiler(Builder &b, const Architecture &a, const AndroidNdk &n):
+ GnuCxxCompiler(b, a, n.get_platform_sysroot()),
+ ndk(n)
+{
+ set_command((ndk.get_bin_dir()/command).str());
+ build_info.incpath.insert(build_info.incpath.end(), system_path.begin(), system_path.end());
+ build_info.libs.push_back("gnustl_shared");
+}
+
+void AndroidCxxCompiler::do_prepare()
+{
+ GnuCxxCompiler::do_prepare();
+ if(executable)
+ {
+ FS::Path libstdcxx_path = ndk.get_root_dir()/"sources"/"cxx-stl"/"gnu-libstdc++"/version;
+
+ /* TODO Match against architecture. Armeabi-v7a is problematic.
+ Architecture currently has no provisions for ABI, and the gcc -march
+ flag for ARMv7-A contains a dash. */
+ string subdir;
+ if(architecture->get_type()=="pc")
+ subdir = "x86";
+ else if(architecture->get_type()=="arm")
+ subdir = "armeabi-v7a";
+
+ SearchPath incpath;
+ incpath.push_back(libstdcxx_path/"include");
+ incpath.push_back(libstdcxx_path/"libs"/subdir/"include");
+ system_path.insert(system_path.end(), incpath.begin(), incpath.end());
+ build_info.incpath.insert(build_info.incpath.end(), incpath.begin(), incpath.end());
+ build_info.libpath.push_back(libstdcxx_path/"libs"/subdir);
+ }
+}