Skip to content

Commit

Permalink
Implement CI
Browse files Browse the repository at this point in the history
  • Loading branch information
artdeell committed Nov 19, 2023
1 parent a258c95 commit 8bf7958
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 60 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build Android

on:
[push, pull_request]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
strategy:
matrix:
arch: [ "arm32", "aarch64" ]
fail-fast: false

name: "Build for ${{matrix.arch}}"

runs-on: ubuntu-latest

steps:
- name: Disable symlinks in git config
run: git config --global core.symlinks false

- uses: actions/checkout@v2

- name: Build
run: |
sudo apt update
sudo apt install -y meson libxrandr-dev libxxf86vm-dev libxcb-*-dev libx11-xcb-dev libxfixes-dev libdrm-dev libx11-dev
pip3 install mako
export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk-bundle"
# Build plain libdrm as a static library
envsubst <android-drm-${{matrix.arch}} >build-crossfile-drm
git clone --depth 1 https://gitlab.freedesktop.org/mesa/drm.git
cd drm
meson setup "build-android" \
--prefix=/tmp/drm-static \
--cross-file "../build-crossfile-drm" \
-Dintel=disabled \
-Dradeon=disabled \
-Damdgpu=disabled \
-Dnouveau=disabled \
-Dvmwgfx=disabled \
-Dfreedreno=disabled \
-Dvc4=disabled \
-Detnaviv=disabled
ninja -C "build-android" install
cd ..
#Now, build OSMesa with panfrost
envsubst <android-${{matrix.arch}} >build-crossfile
meson setup "build-android" \
--prefix=/tmp/zink \
--cross-file "build-crossfile" \
-Dplatforms=android \
-Dplatform-sdk-version=25 \
-Dandroid-stub=true \
-Dllvm=disabled \
-Dxlib-lease=disabled \
-Degl=disabled \
-Dgbm=disabled \
-Dglx=disabled \
-Dopengl=true \
-Dosmesa=true \
-Dvulkan-drivers= \
-Dgallium-drivers=swrast,zink \
-Dshared-glapi=false
ninja -C "build-android" install
- name: Upload libraries
uses: actions/upload-artifact@v2
with:
name: libzink_${{matrix.arch}}
path: /tmp/zink
60 changes: 0 additions & 60 deletions .github/workflows/macos.yml

This file was deleted.

26 changes: 26 additions & 0 deletions android-aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[binaries]
ar = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar'
c = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC']
cpp = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang++', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
c_ld = 'lld'
cpp_ld = 'lld'
strip = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip'
# Android doesn't come with a pkg-config, but we need one for meson to be happy not
# finding all the optional deps it looks for. Use system pkg-config pointing at a
# directory we get to populate with any .pc files we want to add for Android

# Also, include the plain DRM lib we found earlier. Panfrost relies on it rather heavily, especially when
# interacting with the panfrost DRM module and not kbase

pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=.:/tmp/drm-static/lib/pkgconfig', '/usr/bin/pkg-config']

[host_machine]
system = 'linux'
# cpu_family = 'x86_64'
# cpu = 'amd64'

# ik this is wrong but workaround sanity check
cpu_family = 'arm'
cpu = 'armv8'

endian = 'little'
26 changes: 26 additions & 0 deletions android-arm32
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[binaries]
ar = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar'
c = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi26-clang', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC']
cpp = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi26-clang++', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
c_ld = 'lld'
cpp_ld = 'lld'
strip = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip'
# Android doesn't come with a pkg-config, but we need one for meson to be happy not
# finding all the optional deps it looks for. Use system pkg-config pointing at a
# directory we get to populate with any .pc files we want to add for Android

# Also, include the plain DRM lib we found earlier. Panfrost relies on it rather heavily, especially when
# interacting with the panfrost DRM module and not kbase

pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=.:/tmp/drm-static/lib/pkgconfig', '/usr/bin/pkg-config']

[host_machine]
system = 'linux'
# cpu_family = 'x86_64'
# cpu = 'amd64'

# ik this is wrong but workaround sanity check
cpu_family = 'arm'
cpu = 'armv7'

endian = 'little'
22 changes: 22 additions & 0 deletions android-drm-aarch64
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[binaries]
ar = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar'
c = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC']
cpp = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
c_ld = 'lld'
cpp_ld = 'lld'
strip = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip'
# Android doesn't come with a pkg-config, but we need one for meson to be happy not
# finding all the optional deps it looks for. Use system pkg-config pointing at a
# directory we get to populate with any .pc files we want to add for Android
pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=.', '/usr/bin/pkg-config']

[host_machine]
system = 'linux'
# cpu_family = 'x86_64'
# cpu = 'amd64'

# ik this is wrong but workaround sanity check
cpu_family = 'arm'
cpu = 'armv8'

endian = 'little'
22 changes: 22 additions & 0 deletions android-drm-arm32
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[binaries]
ar = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar'
c = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC']
cpp = ['ccache', '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi24-clang++', '-O3', '-DVK_USE_PLATFORM_ANDROID_KHR', '-fPIC', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
c_ld = 'lld'
cpp_ld = 'lld'
strip = '$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip'
# Android doesn't come with a pkg-config, but we need one for meson to be happy not
# finding all the optional deps it looks for. Use system pkg-config pointing at a
# directory we get to populate with any .pc files we want to add for Android
pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=.', '/usr/bin/pkg-config']

[host_machine]
system = 'linux'
# cpu_family = 'x86_64'
# cpu = 'amd64'

# ik this is wrong but workaround sanity check
cpu_family = 'arm'
cpu = 'armv7'

endian = 'little'

0 comments on commit 8bf7958

Please sign in to comment.