From 7468fb73243f16059850d06ab9163d13afba7afa Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 6 Sep 2024 22:06:24 +0800 Subject: [PATCH] feat: try install libcxx for android --- maadeps/runtime_android.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/maadeps/runtime_android.py b/maadeps/runtime_android.py index a9dd9ef..1f6a407 100644 --- a/maadeps/runtime_android.py +++ b/maadeps/runtime_android.py @@ -1,9 +1,11 @@ import os +import sys from pathlib import Path import subprocess import shutil from .common import resdir from . import runtime_linux as linux +from .vcpkg import triplet exclude = [ "*onnxruntime_providers_shared*", @@ -47,3 +49,24 @@ def install_runtime(target, debug): install_file(file, target_path) set_rpath(target_path, '$ORIGIN') split_debug(target_path, Path(debug, target_path.name + '.debug')) + + + print("Installing libc++_shared.so for Android") + android_ndk = os.environ.get("ANDROID_NDK_HOME", "/opt/android-ndk") + # if windows: + if sys.platform == "win32" or sys.platform == "cygwin": + host = "windows-x86_64" + elif sys.platform == "linux": + host = "linux-x86_64" + elif sys.platform == "darwin": + host = "darwin-x86_64" + + if "arm" in triplet: + runtime = "arm-linux-androideabi" + elif "arm64" in triplet: + runtime = "aarch64-linux-android" + elif "x64" in triplet: + runtime = "x86_64-linux-android" + + libcxx_shared = os.path.join(android_ndk, f"toolchains/llvm/prebuilt/{host}/sysroot/usr/lib/{runtime}/libc++_shared.so") + install_file(libcxx_shared, target / "libc++_shared.so")