+#include <msp/fs/dir.h>
+#include <msp/strings/format.h>
#include "androidcxxcompiler.h"
#include "androidtools.h"
#include "architecture.h"
+#include "builder.h"
using namespace std;
using namespace Msp;
{
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";
+ FS::Path public_dir = libstdcxx_path/"include";
+ system_path.push_back(public_dir);
+ build_info.incpath.push_back(public_dir);
- 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);
+ FS::Path arch_path = libstdcxx_path/"libs";
+ builder.get_logger().log("files", format("Traversing %s", arch_path.str()));
+ string arch_dir = architecture->best_match(list_files(arch_path));
+ if(!arch_dir.empty())
+ {
+ build_info.incpath.push_back(libstdcxx_path/"libs"/arch_dir/"include");
+ build_info.libpath.push_back(libstdcxx_path/"libs"/arch_dir);
+ }
}
}