build: hardcode `gcc` and `g++` paths for Android on Linux x86

This commit is contained in:
92306 2024-09-26 23:33:17 +08:00
parent 5ce3d1078d
commit ca2b483d82
1 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import platform
import sys
import os
import shutil
# TODO: In next version, it will be a JSON file listing all the patches, and then it will iterate through to apply them.
def patch_android():
@ -61,6 +62,9 @@ if platform.system() == "Darwin":
elif platform.system() == "Linux":
host_os = "linux"
toolchain_path = android_ndk_path + "/toolchains/llvm/prebuilt/linux-x86_64"
if platform.machine() in {"x86_64", "x86"}:
os.environ['CC_host'] = shutil.which('gcc').strip()
os.environ['CXX_host'] = shutil.which('g++').strip()
os.environ['PATH'] += os.pathsep + toolchain_path + "/bin"
os.environ['CC'] = toolchain_path + "/bin/" + TOOLCHAIN_PREFIX + android_sdk_version + "-" + "clang"