vita.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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), os: windows-latest, pib: true, version: 1.1.4, artifact: SDL-vita-pib }
  20. - { name: Vita (GLES w/ PVR_PSP2 + gles4vita), os: windows-latest, 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. with:
  66. path: /vita/dependencies
  67. key: ${{ matrix.platform.artifact }}-${{ matrix.platform.version }}
  68. - name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir
  69. run: |
  70. cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi
  71. - name: Configure (CMake)
  72. run: |
  73. cmake -S . -B build -G Ninja \
  74. -Wdeprecated -Wdev -Werror \
  75. -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
  76. -DVIDEO_VITA_PIB=${{ !!matrix.platform.pib }} \
  77. -DVIDEO_VITA_PVR=${{ !!matrix.platform.pvr }} \
  78. -DSDL_WERROR=ON \
  79. -DSDL_TESTS=ON \
  80. -DSDL_INSTALL_TESTS=ON \
  81. -DCMAKE_BUILD_TYPE=Release \
  82. -DCMAKE_INSTALL_PREFIX=prefix
  83. - name: Build (CMake)
  84. run: cmake --build build --verbose
  85. - name: Install (CMake)
  86. run: |
  87. echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  88. cmake --install build/
  89. ( cd prefix; find ) | LC_ALL=C sort -u
  90. - name: Package (CPack)
  91. run: |
  92. cmake --build build/ --config Release --target package
  93. - name: Verify CMake configuration files
  94. run: |
  95. cmake -S cmake/test -B cmake_config_build -G Ninja \
  96. -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
  97. -DTEST_SHARED=FALSE \
  98. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \
  99. -DCMAKE_BUILD_TYPE=Release
  100. cmake --build cmake_config_build --verbose
  101. - name: Verify sdl3.pc
  102. run: |
  103. export CC=arm-vita-eabi-gcc
  104. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  105. cmake/test/test_pkgconfig.sh
  106. - uses: actions/upload-artifact@v3
  107. with:
  108. if-no-files-found: error
  109. name: ${{ matrix.platform.artifact }}
  110. path: build/dist/SDL3*