loongarch64.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. name: Build (LoongArch64)
  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. jobs:
  7. loongarch64:
  8. runs-on: ubuntu-latest
  9. strategy:
  10. fail-fast: false
  11. matrix:
  12. platform:
  13. - { toolchain-version: 2022.09.06 }
  14. steps:
  15. - uses: actions/checkout@v4
  16. - name: Install build requirements
  17. run: |
  18. sudo apt-get update -y
  19. sudo apt-get install -y --no-install-recommends cmake ninja-build pkg-config tar wget
  20. - uses: actions/cache/restore@v4
  21. id: restore-cache
  22. with:
  23. path: /opt/cross-tools
  24. key: loongarch64-${{ matrix.platform.toolchain-version }}
  25. - name: Download LoongArch64 gcc+glibc toolchain
  26. if: ${{ !steps.restore-cache.outputs.cache-hit }}
  27. run: |
  28. url="https://github.com/loongson/build-tools/releases/download/${{ matrix.platform.toolchain-version }}/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz"
  29. wget "$url" -O /tmp/toolchain.tar.xz
  30. mkdir -p /opt
  31. tar -C /opt -x -f /tmp/toolchain.tar.xz
  32. - uses: actions/cache/save@v3
  33. if: ${{ !steps.restore-cache.outputs.cache-hit }}
  34. with:
  35. path: /opt/cross-tools
  36. key: loongarch64-${{ matrix.platform.toolchain-version }}
  37. - name: Set-up Loongarch64 build environment
  38. run: |
  39. echo "/opt/cross-tools/bin" >> $GITHUB_PATH
  40. echo "CC=loongarch64-unknown-linux-gnu-gcc" >> $GITHUB_ENV
  41. echo "CXX=loongarch64-unknown-linux-gnu-g++" >> $GITHUB_ENV
  42. - name: Configure (CMake)
  43. run: |
  44. cmake -S . -B build -G Ninja \
  45. -Wdeprecated -Wdev -Werror \
  46. -DSDL_SHARED=ON \
  47. -DSDL_STATIC=ON \
  48. -DSDL_TESTS=ON \
  49. -DSDL_WERROR=ON \
  50. -DSDL_TESTS=ON \
  51. -DSDL_INSTALL_TESTS=ON \
  52. -DSDL_DISABLE_INSTALL_DOCS=OFF \
  53. -DSDL_VENDOR_INFO="Github Workflow" \
  54. -DCMAKE_BUILD_TYPE=Release \
  55. -DCMAKE_INSTALL_PREFIX=prefix
  56. - name: Build (CMake)
  57. run: |
  58. cmake --build build --verbose
  59. - name: Install (CMake)
  60. run: |
  61. echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  62. cmake --install build/
  63. ( cd prefix; find ) | LC_ALL=C sort -u
  64. - name: Package (CPack)
  65. run: |
  66. cmake --build build/ --config Release --target package
  67. - name: Verify CMake configuration files
  68. run: |
  69. cmake -S cmake/test -B cmake_config_build -G Ninja \
  70. -DTEST_SHARED=TRUE \
  71. -DTEST_STATIC=TRUE \
  72. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \
  73. -DCMAKE_BUILD_TYPE=Release
  74. cmake --build cmake_config_build --verbose
  75. - name: Verify sdl3.pc
  76. run: |
  77. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  78. cmake/test/test_pkgconfig.sh
  79. - uses: actions/upload-artifact@v4
  80. with:
  81. if-no-files-found: error
  82. name: SDL-loongarch64
  83. path: build/dist/SDL3*