X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fandroidcompiler.cpp;h=68c4e56d2ad675a4ac64f72a492f4ff38305e78c;hb=HEAD;hp=139d743a016d0c65a2acef29b47b3aba13a2a7ab;hpb=494022085666b79b4ca5ebf17d6b9acc7db11b25;p=builder.git diff --git a/source/androidcompiler.cpp b/source/androidcompiler.cpp deleted file mode 100644 index 139d743..0000000 --- a/source/androidcompiler.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include -#include -#include "androidcompiler.h" -#include "androidtools.h" -#include "builder.h" -#include "externaltask.h" -#include "filetarget.h" - -using namespace std; -using namespace Msp; - -AndroidCompiler::AndroidCompiler(Builder &b, const Architecture &a, const string &t, const AndroidNdk &n): - CustomizedTool(b, t, a), - ndk(n) -{ - 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"); - 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(); - - if(tag=="CXX") - build_info.libs.push_back("gnustl_static"); -} - -void AndroidCompiler::do_prepare(ToolData &tool) const -{ - const Architecture &arch = *static_cast(tool).get_architecture(); - - CustomizedTool::do_prepare(tool); - if(tag=="CXX") - { - unsigned version = tool.extra_data; - string version_str = format("%d.%d.%d", version>>16, (version>>8)&0xFF, version&0xFF); - FS::Path libstdcxx_dir = ndk.get_root_dir()/"sources"/"cxx-stl"/"gnu-libstdc++"; - FS::Path libstdcxx_path; - while(1) - { - libstdcxx_path = libstdcxx_dir/version_str; - if(FS::exists(libstdcxx_path)) - break; - - string::size_type dot = version_str.rfind('.'); - if(dot==string::npos) - { - tool.problems.push_back("C++ standard library not found"); - return; - } - - version_str = version_str.substr(0, dot); - } - - FS::Path public_dir = libstdcxx_path/"include"; - tool.system_path.push_back(public_dir); - tool.build_info.incpath.push_back(public_dir); - - FS::Path arch_path = libstdcxx_path/"libs"; - builder.get_logger().log("files", "Traversing %s", arch_path.str()); - string arch_dir = arch.best_match(list_files(arch_path)); - if(!arch_dir.empty()) - { - tool.build_info.incpath.push_back(libstdcxx_path/"libs"/arch_dir/"include"); - tool.build_info.libpath.push_back(libstdcxx_path/"libs"/arch_dir); - } - } -}