msvc.yml 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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', notests: true }
  21. - { name: Windows (ARM64), flags: -A ARM64, artifact: 'SDL-VC-arm64', notests: true }
  22. - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0", nowerror: true, notests: 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...3.25)
  37. project(sdl_user)
  38. enable_testing()
  39. add_subdirectory("{ srcdir }" SDL)
  40. """))
  41. - name: Configure (CMake)
  42. run: cmake -S build -B build `
  43. -Wdeprecated -Wdev -Werror `
  44. -DSDL_WERROR=${{ !matrix.platform.nowerror }} `
  45. -DSDL_SHARED=ON `
  46. -DSDL_STATIC=ON `
  47. -DSDL_TESTS=ON `
  48. -DSDL_INSTALL_TESTS=ON `
  49. -DSDL_VENDOR_INFO="Github Workflow" `
  50. -DSDL_DISABLE_INSTALL=OFF `
  51. -DSDL_DISABLE_INSTALL_CPACK=OFF `
  52. -DSDL_DISABLE_INSTALL_DOCS=OFF `
  53. ${{ matrix.platform.flags }} `
  54. -DCMAKE_INSTALL_PREFIX=prefix
  55. - name: Build (CMake)
  56. id: build
  57. run: |
  58. cmake --build build/ --config Release --parallel
  59. - name: Run build-time tests
  60. if: ${{ !matrix.platform.notests }}
  61. run: |
  62. $env:SDL_TESTS_QUICK=1
  63. ctest -VV --test-dir build/ -C Release -j2
  64. - name: Install (CMake)
  65. run: |
  66. echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
  67. cmake --install build/
  68. - name: Package (CPack)
  69. if: ${{ always() && steps.build.outcome == 'success' }}
  70. run: |
  71. cmake --build build/ --config Release --target PACKAGE
  72. - name: Verify CMake configuration files
  73. run: |
  74. cmake -S cmake/test -B cmake_config_build `
  75. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} `
  76. ${{ matrix.platform.flags }}
  77. cmake --build cmake_config_build --config Release
  78. - name: Add msbuild to PATH
  79. if: ${{ matrix.platform.project != '' }}
  80. uses: microsoft/setup-msbuild@v1.1.3
  81. - name: Build msbuild
  82. if: ${{ matrix.platform.project != '' }}
  83. run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}
  84. - uses: actions/upload-artifact@v3
  85. if: ${{ always() && steps.build.outcome == 'success' }}
  86. with:
  87. if-no-files-found: error
  88. name: ${{ matrix.platform.artifact }}
  89. path: build/dist/SDL3*