android.yml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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@v2
  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. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  34. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  35. -DSDL_STATIC_PIC=ON \
  36. -DCMAKE_INSTALL_PREFIX=prefix \
  37. -DCMAKE_BUILD_TYPE=Release \
  38. -GNinja
  39. - name: Build (CMake)
  40. if: ${{ matrix.platform.name == 'CMake' }}
  41. run: |
  42. cmake --build build --config Release --parallel --verbose
  43. - name: Install (CMake)
  44. if: ${{ matrix.platform.name == 'CMake' }}
  45. run: |
  46. cmake --install build --config Release
  47. echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  48. ( cd prefix; find ) | LC_ALL=C sort -u
  49. - name: Verify CMake configuration files
  50. if: ${{ matrix.platform.name == 'CMake' }}
  51. run: |
  52. cmake -S cmake/test -B cmake_config_build -G Ninja \
  53. -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
  54. -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
  55. -DANDROID_ABI=${{ matrix.platform.android_abi }} \
  56. -DCMAKE_BUILD_TYPE=Release \
  57. -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
  58. cmake --build cmake_config_build --verbose
  59. - name: Verify sdl2-config
  60. if: ${{ matrix.platform.name == 'CMake' }}
  61. run: |
  62. 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 }}"
  63. export PATH=${{ env.SDL2_DIR }}/bin:$PATH
  64. cmake/test/test_sdlconfig.sh
  65. - name: Verify sdl2.pc
  66. if: ${{ matrix.platform.name == 'CMake' }}
  67. run: |
  68. 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 }}"
  69. export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
  70. cmake/test/test_pkgconfig.sh
  71. - name: Verify Android.mk
  72. if: ${{ matrix.platform.name == 'CMake' }}
  73. run: |
  74. export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules
  75. 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