loongarch64.yml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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@v3
  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@v3
  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_VENDOR_INFO="Github Workflow" \
  53. -DCMAKE_BUILD_TYPE=Release \
  54. -DCMAKE_INSTALL_PREFIX=prefix
  55. - name: Build (CMake)
  56. run: |
  57. cmake --build build --verbose
  58. - name: Install (CMake)
  59. run: |
  60. echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
  61. cmake --install build/
  62. ( cd prefix; find ) | LC_ALL=C sort -u
  63. - name: Package (CPack)
  64. run: |
  65. cmake --build build/ --config Release --target package
  66. - name: Verify CMake configuration files
  67. run: |
  68. cmake -S cmake/test -B cmake_config_build -G Ninja \
  69. -DTEST_SHARED=TRUE \
  70. -DTEST_STATIC=TRUE \
  71. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \
  72. -DCMAKE_BUILD_TYPE=Release
  73. cmake --build cmake_config_build --verbose
  74. - name: Verify sdl3.pc
  75. run: |
  76. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  77. cmake/test/test_pkgconfig.sh
  78. - uses: actions/upload-artifact@v3
  79. with:
  80. if-no-files-found: error
  81. name: SDL-loongarch64
  82. path: build/dist/SDL3*