[CI, Drone] Add Android NDK builds

This commit is contained in:
Joel Linn 2021-12-27 21:36:58 +01:00 committed by Rick Gibbed
parent 657645fb2c
commit 59cce10ae1
1 changed files with 168 additions and 0 deletions

View File

@ -3,6 +3,8 @@ def main(ctx):
pipeline_lint(), pipeline_lint(),
pipeline_linux_desktop('x86_64-linux-clang', image_linux_x86_64(), 'amd64', 'clang'), pipeline_linux_desktop('x86_64-linux-clang', image_linux_x86_64(), 'amd64', 'clang'),
pipeline_linux_desktop('x86_64-linux-gcc', image_linux_x86_64(), 'amd64', 'gcc'), pipeline_linux_desktop('x86_64-linux-gcc', image_linux_x86_64(), 'amd64', 'gcc'),
pipeline_android('x86_64-android', image_linux_x86_64(), 'amd64', 'Android-x86_64'),
pipeline_android('aarch64-android', image_linux_x86_64(), 'amd64', 'Android-ARM64'),
] ]
def image_linux_x86_64(): def image_linux_x86_64():
@ -18,6 +20,72 @@ def command_cc(cc):
# set CC, CXX, ... # set CC, CXX, ...
return 'export $(cat /{}.env | sed \'s/#.*//g\' | xargs)'.format(cc) return 'export $(cat /{}.env | sed \'s/#.*//g\' | xargs)'.format(cc)
def command_ndk_build(platform, configuration, target):
return '$ANDROID_NDK_ROOT/build/ndk-build NDK_PROJECT_PATH:=./bin/{configuration} NDK_APPLICATION_MK:=./xenia.Application.mk PREMAKE_ANDROIDNDK_PLATFORMS:={platform} PREMAKE_ANDROIDNDK_CONFIGURATIONS:={configuration} -j$(nproc) {target}'.format(platform=platform, configuration=configuration, target=target)
def targets_android(platform):
targets = [
'aes_128',
'capstone',
'dxbc',
'discord-rpc',
'cxxopts',
'cpptoml',
'avcodec',
'avutil',
'fmt',
'glslang-spirv',
'imgui',
'mspack',
'snappy',
'spirv-tools',
'xxhash',
# 'xenia-core',
# 'xenia-app-discord',
# 'xenia-apu',
# 'xenia-apu-nop',
'xenia-base',
'xenia-base-tests',
# 'xenia-cpu',
# 'xenia-cpu-tests',
# 'xenia-cpu-ppc-tests',
# 'xenia-cpu-backend-x64',
# 'xenia-debug-ui',
# 'xenia-gpu',
# 'xenia-gpu-shader-compiler',
# 'xenia-gpu-null',
# 'xenia-gpu-vulkan',
# 'xenia-gpu-vulkan-trace-viewer',
# 'xenia-gpu-vulkan-trace-dump',
'xenia-hid',
# 'xenia-hid-demo',
'xenia-hid-nop',
# 'xenia-kernel',
'xenia-ui',
'xenia-ui-spirv',
# 'xenia-ui-vulkan',
# 'xenia-ui-window-vulkan-demo',
'xenia-vfs',
'xenia-vfs-dump',
]
if platform == 'Android-x86_64':
targets.extend([
'xenia-core',
'xenia-apu',
'xenia-apu-nop',
'xenia-cpu',
'xenia-cpu-tests',
'xenia-cpu-ppc-tests',
'xenia-cpu-backend-x64',
'xenia-debug-ui',
'xenia-gpu',
'xenia-gpu-null',
'xenia-gpu-vulkan',
'xenia-gpu-shader-compiler',
'xenia-kernel',
])
return targets
# Run lint in a separate pipeline so that it will try building even if lint fails # Run lint in a separate pipeline so that it will try building even if lint fails
def pipeline_lint(): def pipeline_lint():
return { return {
@ -252,3 +320,103 @@ def pipeline_linux_desktop(name, image, arch, cc):
}, },
], ],
} }
def pipeline_android(name, image, arch, platform):
return {
'kind': 'pipeline',
'type': 'docker',
'name': name,
'platform': {
'os': 'linux',
'arch': arch,
},
'steps': [
#
# Setup the source tree
#
{
'name': 'clone-submodules',
'image': image,
'commands': [
'pwd',
# May miss recursive submodules (but faster than xb setup)
'git submodule update --init --depth 1 -j $(nproc)',
],
},
#
# Build premake and generate NDK makefiles
#
# NDK Makefiles
{
'name': 'toolchain',
'image': image,
'commands': [
'c++ --version',
'python3 --version',
'./xenia-build premake --target_os android',
],
'depends_on': ['clone-submodules'],
},
#
# Building
#
{
'name': 'build-debug',
'image': image,
'commands': [
'cd build',
command_ndk_build(platform, 'Debug', ' '.join(targets_android(platform))),
],
'depends_on': ['toolchain'],
},
{
'name': 'build-release',
'image': image,
'commands': [
'cd build',
command_ndk_build(platform, 'Release', ' '.join(targets_android(platform))),
],
'depends_on': ['toolchain'],
},
#
# Stat
#
{
'name': 'stat',
'image': image,
'commands': [
'''
header() {
SEP='============================================================'
echo
echo $SEP
echo $@
echo $SEP
}
for c in Debug Release
do
header $c
p=build/bin/$c/obj/local/*
ls -la $p
sha256sum $p/* || true
done
'''
],
'depends_on': [
'build-debug',
'build-release',
],
},
],
}