vita.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. name: Build (Sony Playstation Vita)
  2. on: [push, pull_request]
  3. concurrency:
  4. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
  5. cancel-in-progress: true
  6. defaults:
  7. run:
  8. shell: sh
  9. jobs:
  10. vita:
  11. name: ${{ matrix.platform.name }}
  12. runs-on: ubuntu-latest
  13. container:
  14. image: vitasdk/vitasdk:latest
  15. strategy:
  16. fail-fast: false
  17. matrix:
  18. platform:
  19. - { name: Vita (GLES w/ pib), pib: true, version: 1.1.4, artifact: SDL-vita-pib }
  20. - { name: Vita (GLES w/ PVR_PSP2 + gles4vita), pvr: true, version: 3.9, artifact: SDL-vita-pvr }
  21. steps:
  22. - uses: actions/checkout@v3
  23. - name: Install build requirements
  24. run: |
  25. apk update
  26. apk add cmake ninja pkgconf bash tar
  27. - uses: actions/cache/restore@v3
  28. id: restore-cache
  29. with:
  30. path: /vita/dependencies
  31. key: ${{ matrix.platform.artifact }}-${{ matrix.platform.version }}
  32. - name: Download PVR_PSP2 (GLES)
  33. if: ${{ !!matrix.platform.pvr && !steps.restore-cache.outputs.cache-hit }}
  34. run: |
  35. pvr_psp2_version=${{ matrix.platform.version }}
  36. mkdir -p /vita/dependencies/include
  37. mkdir -p /vita/dependencies/lib
  38. # Configure PVR_PSP2 headers
  39. wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp
  40. unzip /tmp/v$pvr_psp2_version.zip -d/tmp
  41. cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /vita/dependencies/include
  42. rm /tmp/v$pvr_psp2_version.zip
  43. # include guard of PVR_PSP2's khrplatform.h does not match the usual one
  44. sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /vita/dependencies/include/KHR/khrplatform.h
  45. # Configure PVR_PSP2 stub libraries
  46. wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp
  47. unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs
  48. find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /vita/dependencies/lib \;
  49. rm /tmp/vitasdk_stubs.zip
  50. rm -rf /tmp/pvr_psp2_stubs
  51. - name: Download gl4es4vita (OpenGL)
  52. if: ${{ !!matrix.platform.pib && !steps.restore-cache.outputs.cache-hit }}
  53. run: |
  54. gl4es4vita_version=${{ matrix.platform.version }}
  55. mkdir -p /vita/dependencies/include
  56. mkdir -p /vita/dependencies/lib
  57. # Configure gl4es4vita headers
  58. wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp
  59. unzip -o /tmp/include.zip -d/vita/dependencies/include
  60. rm /tmp/include.zip
  61. # Configure gl4es4vita stub libraries
  62. wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp
  63. unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib
  64. - uses: actions/cache/save@v3
  65. if: ${{ !steps.restore-cache.outputs.cache-hit }}
  66. with:
  67. path: /vita/dependencies
  68. key: ${{ matrix.platform.artifact }}-${{ matrix.platform.version }}
  69. - name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir
  70. run: |
  71. cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi
  72. - name: Fix vita.toolchain.cmake
  73. run: |
  74. # cache PKG_CONFIG_PATH
  75. sed -i -E 's/set\( PKG_CONFIG_EXECUTABLE "\$\{VITASDK}\/bin\/arm-vita-eabi-pkg-config" )/set( PKG_CONFIG_EXECUTABLE "${VITASDK}\/bin\/arm-vita-eabi-pkg-config" CACHE PATH "Path of pkg-config executable" )/' ${VITASDK}/share/vita.toolchain.cmake
  76. - name: Configure (CMake)
  77. run: |
  78. cmake -S . -B build -G Ninja \
  79. -Wdeprecated -Wdev -Werror \
  80. -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
  81. -DVIDEO_VITA_PIB=${{ !!matrix.platform.pib }} \
  82. -DVIDEO_VITA_PVR=${{ !!matrix.platform.pvr }} \
  83. -DSDL_ARMNEON=ON \
  84. -DSDL_ARMSIMD=ON \
  85. -DSDL_WERROR=ON \
  86. -DSDL_TESTS=ON \
  87. -DSDL_INSTALL_TESTS=ON \
  88. -DCMAKE_BUILD_TYPE=Release \
  89. -DCMAKE_INSTALL_PREFIX=prefix
  90. - name: Build (CMake)
  91. run: cmake --build build --verbose
  92. - name: Install (CMake)
  93. run: |
  94. echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  95. cmake --install build/
  96. ( cd prefix; find ) | LC_ALL=C sort -u
  97. - name: Package (CPack)
  98. run: |
  99. cmake --build build/ --config Release --target package
  100. - name: Verify CMake configuration files
  101. run: |
  102. cmake -S cmake/test -B cmake_config_build -G Ninja \
  103. -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
  104. -DTEST_SHARED=FALSE \
  105. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \
  106. -DCMAKE_BUILD_TYPE=Release
  107. cmake --build cmake_config_build --verbose
  108. - name: Verify sdl3.pc
  109. run: |
  110. export CC=arm-vita-eabi-gcc
  111. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  112. cmake/test/test_pkgconfig.sh
  113. - uses: actions/upload-artifact@v3
  114. with:
  115. if-no-files-found: error
  116. name: ${{ matrix.platform.artifact }}
  117. path: build/dist/SDL3*