Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,64 @@ jobs:
with:
name: tinymesa-whl-${{ matrix.tag }}-${{ matrix.os }}
path: dist/
android:
name: Build tinymesa mesa-25.2.7 on Android arm64
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup tinymesa
uses: ./.github/actions/setup
- name: Verify Android NDK
shell: bash
run: |
test -x "${ANDROID_SDK_ROOT}/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android25-clang"
- name: Clone mesa
run: git clone --depth 1 --branch mesa-25.2.7 https://gitlab.freedesktop.org/mesa/mesa.git ${{ github.workspace }}/mesa
- name: Patch mesa
run: ./apply_patches.py ${{ github.workspace }}/mesa mesa-25.2.7
- name: Build mesa
shell: bash
run: |
TOOLCHAIN=${ANDROID_SDK_ROOT}/ndk/29.0.14206865/toolchains/llvm/prebuilt/linux-x86_64
cat > ${{ runner.temp }}/android.ini <<EOF
[binaries]
Comment thread
rishavsanjay marked this conversation as resolved.
Outdated
ar = '${TOOLCHAIN}/bin/llvm-ar'
c = '${TOOLCHAIN}/bin/aarch64-linux-android25-clang'
cpp = '${TOOLCHAIN}/bin/aarch64-linux-android25-clang++'
strip = '${TOOLCHAIN}/bin/llvm-strip'
[host_machine]
system = 'android'
cpu_family = 'aarch64'
cpu = 'armv8'
endian = 'little'
[properties]
needs_exe_wrapper = true
EOF
cd ${{ github.workspace }}/mesa
meson setup build/ --cross-file=${{ runner.temp }}/android.ini -Db_staticpic=true -Dplatforms=android -Dplatform-sdk-version=25 -Dandroid-stub=true -Dandroid-libbacktrace=disabled -Dgallium-drivers="[]" -Dvulkan-drivers=freedreno -Dfreedreno-kmds=kgsl -Dllvm=disabled -Dshader-cache=disabled -Dzstd=disabled -Dzlib=disabled -Dopengl=false -Degl=disabled -Dgbm=disabled -Dvideo-codecs="[]"
meson compile -C build tinymesa
- name: Build wheel
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
VERSION_ARG=(--tag "$GITHUB_REF_NAME")
else
VERSION_ARG=(--sha "${GITHUB_SHA::7}")
fi

./build_wheel.py "${VERSION_ARG[@]}" \
--platform android_25_arm64_v8a \
mesa-25.2.7 ${{ github.workspace }}/mesa/build/src/tinymesa/libtinymesa.so
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tinymesa-whl-mesa-25.2.7-android-arm64-v8a
path: dist/

release:
name: Release tinymesa
runs-on: ubuntu-22.04
needs: tinymesa
needs: [ tinymesa, android ]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ all these symbols, but in addition, a subset of symbols from `gallium`
(see release notes), and as a result depends on LLVM-20.

Builds are automatically generated upon new releases of mesa (checked daily).

### Android

Android arm64-v8a wheels target API 25 and currently ship
`libtinymesa.so` with NIR + IR3/freedreno support. NAK is not included,
and `libtinymesa_cpu.so`/LLVMpipe is not built.
8 changes: 6 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ foreach sym : ir3_symbols
ir3_link_args += '-Wl,-u,' + symbol_prefix + sym
endforeach

shared_library('tinymesa', link_whole : [ _libnir ], link_args : nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common ], dependencies : [ idep_nak ])
shared_library('tinymesa_cpu', link_whole : [ _libnir ], link_args : lvp_link_args+nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common, libgallium ], dependencies : [ idep_nak ])
if host_machine.system() == 'android'
shared_library('tinymesa', link_whole : [ _libnir ], link_args : ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common ])
else
shared_library('tinymesa', link_whole : [ _libnir ], link_args : nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common ], dependencies : [ idep_nak ])
shared_library('tinymesa_cpu', link_whole : [ _libnir ], link_args : lvp_link_args+nak_link_args+ir3_link_args, link_with : [ libfreedreno_ir3, libfreedreno_common, libgallium ], dependencies : [ idep_nak ])
endif

Loading