android.yml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. name: Build (Android)
  2. on: [push, pull_request]
  3. jobs:
  4. android:
  5. name: ${{ matrix.platform.name }}
  6. runs-on: ubuntu-latest
  7. strategy:
  8. fail-fast: false
  9. matrix:
  10. platform:
  11. - { name: Android.mk }
  12. - { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" }
  13. steps:
  14. - uses: actions/checkout@v3
  15. - uses: nttld/setup-ndk@v1
  16. id: setup_ndk
  17. with:
  18. ndk-version: r21e
  19. - name: Build (Android.mk)
  20. if: ${{ matrix.platform.name == 'Android.mk' }}
  21. run: |
  22. ./build-scripts/androidbuildlibs.sh
  23. - name: Setup (CMake)
  24. if: ${{ matrix.platform.name == 'CMake' }}
  25. run: |
  26. sudo apt-get update
  27. sudo apt-get install ninja-build pkg-config
  28. - name: Configure (CMake)
  29. if: ${{ matrix.platform.name == 'CMake' }}
  30. run: |
  31. cmake -B build \
  32. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  33. -DSDL_WERROR=ON \
  34. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  35. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  36. -DSDL_STATIC_PIC=ON \
  37. -DCMAKE_INSTALL_PREFIX=prefix \
  38. -DCMAKE_BUILD_TYPE=Release \
  39. -GNinja
  40. - name: Build (CMake)
  41. if: ${{ matrix.platform.name == 'CMake' }}
  42. run: |
  43. cmake --build build --config Release --parallel --verbose
  44. - name: Install (CMake)
  45. if: ${{ matrix.platform.name == 'CMake' }}
  46. run: |
  47. cmake --install build --config Release
  48. echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  49. ( cd prefix; find ) | LC_ALL=C sort -u
  50. - name: Verify CMake configuration files
  51. if: ${{ matrix.platform.name == 'CMake' }}
  52. run: |
  53. cmake -S cmake/test -B cmake_config_build -G Ninja \
  54. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  55. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  56. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  57. -DCMAKE_BUILD_TYPE=Release \
  58. -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
  59. cmake --build cmake_config_build --verbose
  60. - name: Verify sdl2-config
  61. if: ${{ matrix.platform.name == 'CMake' }}
  62. run: |
  63. export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
  64. export PATH=${{ env.SDL2_DIR }}/bin:$PATH
  65. cmake/test/test_sdlconfig.sh
  66. - name: Verify sdl2.pc
  67. if: ${{ matrix.platform.name == 'CMake' }}
  68. run: |
  69. export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
  70. export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
  71. cmake/test/test_pkgconfig.sh
  72. - name: Verify Android.mk
  73. if: ${{ matrix.platform.name == 'CMake' }}
  74. run: |
  75. export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules
  76. ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1