msvc.yml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Build (MSVC)
  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. Build:
  8. name: ${{ matrix.platform.name }}
  9. runs-on: windows-latest
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. platform:
  14. - { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', artifact: 'SDL-VC-x64' }
  15. - { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' }
  16. - { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x64' }
  17. - { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x86' }
  18. - { name: Windows (clang-cl x64), flags: -T ClangCL -A x64, artifact: 'SDL-clang-cl-x64' }
  19. - { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' }
  20. - { name: Windows (ARM), flags: -A ARM, artifact: 'SDL-VC-arm32' }
  21. - { name: Windows (ARM64), flags: -A ARM64, artifact: 'SDL-VC-arm64' }
  22. - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, nowerror: true,
  23. project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0', artifact: 'SDL-VC-UWP' }
  24. steps:
  25. - uses: actions/checkout@v3
  26. - name: Create CMake project using SDL as a subproject
  27. shell: python
  28. run: |
  29. import os
  30. import textwrap
  31. srcdir = r"${{ github.workspace }}".replace("\\", "/")
  32. builddir = f"{ srcdir }/build"
  33. os.makedirs(builddir)
  34. with open(f"{ builddir }/CMakeLists.txt", "w") as f:
  35. f.write(textwrap.dedent(f"""\
  36. cmake_minimum_required(VERSION 3.0)
  37. project(sdl_user)
  38. add_subdirectory("{ srcdir }" SDL)
  39. """))
  40. - name: Configure (CMake)
  41. run: cmake -S build -B build `
  42. -Wdeprecated -Wdev -Werror `
  43. -DSDL_WERROR=${{ !matrix.platform.nowerror }} `
  44. -DSDL_TESTS=ON `
  45. -DSDL_INSTALL_TESTS=ON `
  46. -DSDL_VENDOR_INFO="Github Workflow" `
  47. -DSDL_DISABLE_INSTALL=OFF `
  48. -DSDL_DISABLE_INSTALL_CPACK=OFF `
  49. ${{ matrix.platform.flags }} `
  50. -DCMAKE_INSTALL_PREFIX=prefix
  51. - name: Build (CMake)
  52. run: cmake --build build/ --config Release --parallel
  53. - name: Run build-time tests
  54. if: "! contains(matrix.platform.name, 'ARM')"
  55. run: |
  56. $env:SDL_TESTS_QUICK=1
  57. ctest -VV --test-dir build/ -C Release
  58. - name: Install (CMake)
  59. run: |
  60. echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
  61. cmake --install build/
  62. - name: Package (CPack)
  63. run: |
  64. cmake --build build/ --config Release --target PACKAGE
  65. - name: Verify CMake configuration files
  66. if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP
  67. run: |
  68. cmake -S cmake/test -B cmake_config_build `
  69. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} `
  70. ${{ matrix.platform.flags }}
  71. cmake --build cmake_config_build --config Release
  72. - name: Add msbuild to PATH
  73. if: ${{ matrix.platform.project != '' }}
  74. uses: microsoft/setup-msbuild@v1.1.3
  75. - name: Build msbuild
  76. if: ${{ matrix.platform.project != '' }}
  77. run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}
  78. - uses: actions/upload-artifact@v3
  79. with:
  80. if-no-files-found: error
  81. name: ${{ matrix.platform.artifact }}
  82. path: build/dist/SDL3*