aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/ci_build.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/ci_build.py')
-rwxr-xr-xsrc/scripts/ci_build.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/scripts/ci_build.py b/src/scripts/ci_build.py
index 91d9d39a3..5eadc6b88 100755
--- a/src/scripts/ci_build.py
+++ b/src/scripts/ci_build.py
@@ -43,6 +43,8 @@ def determine_flags(target, target_os, target_cpu, target_cc, cc_bin, ccache, ro
target_os = 'ios'
elif target == 'cross-win64':
target_os = 'mingw'
+ elif target in ['cross-android-arm32', 'cross-android-arm64']:
+ target_os = 'android'
make_prefix = []
test_prefix = []
@@ -141,6 +143,34 @@ def determine_flags(target, target_os, target_cpu, target_cc, cc_bin, ccache, ro
flags += ['--cpu=arm64', '--cc-abi-flags=-arch arm64 -stdlib=libc++']
else:
raise Exception("Unknown cross target '%s' for iOS" % (target))
+ elif target_os == 'android':
+
+ if os.getenv('ANDROID_NDK') is None:
+ raise Exception('Android CI build requires ANDROID_NDK env variable be set')
+
+ if os.getenv('ANDROID_API_LEVEL') is None:
+ # If not set arbitrarily choose API 16 (Android 4.1) for ARMv7 and 28 (Android 9) for AArch64
+ api_lvl = 16 if target == 'cross-android-arm32' else 28
+ else:
+ api_lvl = int(os.getenv('ANDROID_API_LEVEL'))
+
+ ndk = os.getenv('ANDROID_NDK')
+
+ toolchain_dir = os.path.join(ndk, 'toolchains/llvm/prebuilt/linux-x86_64/bin')
+ test_cmd = None
+
+ if target == 'cross-android-arm32':
+ cc_bin = os.path.join(toolchain_dir, 'armv7a-linux-androideabi%d-clang++' % (api_lvl))
+ flags += ['--cpu=armv7',
+ '--ar-command=%s' % (os.path.join(toolchain_dir, 'arm-linux-androideabi-ar'))]
+
+ if api_lvl < 18:
+ flags += ['--without-os-features=getauxval']
+ elif target == 'cross-android-arm64':
+ cc_bin = os.path.join(toolchain_dir, 'aarch64-linux-android%d-clang++' % (api_lvl))
+ flags += ['--cpu=arm64',
+ '--ar-command=%s' % (os.path.join(toolchain_dir, 'aarch64-linux-android-ar'))]
+
elif target == 'cross-i386':
flags += ['--cpu=x86_32']
@@ -255,6 +285,11 @@ def run_cmd(cmd, root_dir):
if len(cmd) > 1 and cmd[0].startswith('indir:'):
cwd = cmd[0][6:]
cmd = cmd[1:]
+ while len(cmd) > 1 and cmd[0].startswith('env:') and cmd[0].find('=') > 0:
+ env_key, env_val = cmd[0][4:].split('=')
+ sub_env[env_key] = env_val
+ cmd = cmd[1:]
+
proc = subprocess.Popen(cmd, cwd=cwd, close_fds=True, env=sub_env, stdout=redirect_stdout)
proc.communicate()