2022-02-28 07:50:37 -07:00
|
|
|
name: Build (MSVC)
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
2022-12-04 10:06:06 -07:00
|
|
|
concurrency:
|
2022-12-28 14:06:46 -07:00
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
2022-12-04 10:06:06 -07:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-02-28 07:50:37 -07:00
|
|
|
jobs:
|
|
|
|
Build:
|
|
|
|
name: ${{ matrix.platform.name }}
|
|
|
|
runs-on: windows-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform:
|
2023-01-28 22:12:40 -07:00
|
|
|
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', artifact: 'SDL-VC-x64' }
|
|
|
|
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' }
|
|
|
|
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64, artifact: 'SDL-clang-cl-x64' }
|
|
|
|
- { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' }
|
2023-03-14 12:51:52 -06:00
|
|
|
- { name: Windows (ARM), flags: -A ARM, artifact: 'SDL-VC-arm32', notests: true }
|
|
|
|
- { name: Windows (ARM64), flags: -A ARM64, artifact: 'SDL-VC-arm64', notests: true }
|
|
|
|
- { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0", nowerror: true, notests: true,
|
2023-01-28 22:12:40 -07:00
|
|
|
project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0', artifact: 'SDL-VC-UWP' }
|
2022-02-28 07:50:37 -07:00
|
|
|
|
|
|
|
steps:
|
2024-01-25 18:33:20 -07:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-23 06:18:44 -06:00
|
|
|
- name: Create CMake project using SDL as a subproject
|
|
|
|
shell: python
|
|
|
|
run: |
|
|
|
|
import os
|
|
|
|
import textwrap
|
|
|
|
srcdir = r"${{ github.workspace }}".replace("\\", "/")
|
|
|
|
builddir = f"{ srcdir }/build"
|
|
|
|
os.makedirs(builddir)
|
2023-10-11 16:49:43 -06:00
|
|
|
cmakelists_txt = textwrap.dedent(f"""\
|
|
|
|
# Always build .PDB symbol file
|
|
|
|
set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction")
|
|
|
|
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries")
|
|
|
|
cmake_minimum_required(VERSION 3.0...3.25)
|
|
|
|
project(sdl_user)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory("{ srcdir }" SDL)
|
|
|
|
""")
|
|
|
|
print(cmakelists_txt)
|
2022-06-23 06:18:44 -06:00
|
|
|
with open(f"{ builddir }/CMakeLists.txt", "w") as f:
|
2023-10-11 16:49:43 -06:00
|
|
|
f.write(cmakelists_txt)
|
2022-06-23 06:18:44 -06:00
|
|
|
- name: Configure (CMake)
|
|
|
|
run: cmake -S build -B build `
|
2023-01-23 21:30:24 -07:00
|
|
|
-Wdeprecated -Wdev -Werror `
|
2022-10-05 21:27:37 -06:00
|
|
|
-DSDL_WERROR=${{ !matrix.platform.nowerror }} `
|
2023-02-16 12:15:59 -07:00
|
|
|
-DSDL_SHARED=ON `
|
|
|
|
-DSDL_STATIC=ON `
|
2022-06-03 11:24:20 -06:00
|
|
|
-DSDL_TESTS=ON `
|
2022-05-08 10:08:41 -06:00
|
|
|
-DSDL_INSTALL_TESTS=ON `
|
2022-10-20 13:02:21 -06:00
|
|
|
-DSDL_VENDOR_INFO="Github Workflow" `
|
2023-01-18 10:05:54 -07:00
|
|
|
-DSDL_DISABLE_INSTALL=OFF `
|
2023-01-28 22:12:40 -07:00
|
|
|
-DSDL_DISABLE_INSTALL_CPACK=OFF `
|
2023-09-28 15:32:35 -06:00
|
|
|
-DSDL_DISABLE_INSTALL_DOCS=OFF `
|
2022-06-03 11:24:20 -06:00
|
|
|
${{ matrix.platform.flags }} `
|
|
|
|
-DCMAKE_INSTALL_PREFIX=prefix
|
2022-06-23 06:18:44 -06:00
|
|
|
- name: Build (CMake)
|
2023-08-27 08:25:55 -06:00
|
|
|
id: build
|
|
|
|
run: |
|
|
|
|
cmake --build build/ --config Release --parallel
|
2022-05-08 10:08:41 -06:00
|
|
|
- name: Run build-time tests
|
2023-03-14 12:51:52 -06:00
|
|
|
if: ${{ !matrix.platform.notests }}
|
2022-05-08 10:08:41 -06:00
|
|
|
run: |
|
|
|
|
$env:SDL_TESTS_QUICK=1
|
2023-09-07 19:24:47 -06:00
|
|
|
ctest -VV --test-dir build/ -C Release -j2
|
2022-06-23 06:18:44 -06:00
|
|
|
- name: Install (CMake)
|
2022-06-03 11:24:20 -06:00
|
|
|
run: |
|
2022-11-21 22:36:19 -07:00
|
|
|
echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
|
2022-06-03 11:24:20 -06:00
|
|
|
cmake --install build/
|
2023-01-28 22:12:40 -07:00
|
|
|
- name: Package (CPack)
|
2023-08-27 08:25:55 -06:00
|
|
|
if: ${{ always() && steps.build.outcome == 'success' }}
|
2023-01-28 22:12:40 -07:00
|
|
|
run: |
|
|
|
|
cmake --build build/ --config Release --target PACKAGE
|
2022-06-03 11:24:20 -06:00
|
|
|
- name: Verify CMake configuration files
|
|
|
|
run: |
|
|
|
|
cmake -S cmake/test -B cmake_config_build `
|
2022-11-21 22:36:19 -07:00
|
|
|
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} `
|
2022-06-03 11:24:20 -06:00
|
|
|
${{ matrix.platform.flags }}
|
|
|
|
cmake --build cmake_config_build --config Release
|
2022-02-28 07:50:37 -07:00
|
|
|
|
2022-02-28 08:47:59 -07:00
|
|
|
- name: Add msbuild to PATH
|
|
|
|
if: ${{ matrix.platform.project != '' }}
|
2022-11-15 14:20:28 -07:00
|
|
|
uses: microsoft/setup-msbuild@v1.1.3
|
2022-02-28 08:47:59 -07:00
|
|
|
- name: Build msbuild
|
|
|
|
if: ${{ matrix.platform.project != '' }}
|
|
|
|
run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}
|
2024-01-25 18:33:20 -07:00
|
|
|
- uses: actions/upload-artifact@v4
|
2023-08-27 08:25:55 -06:00
|
|
|
if: ${{ always() && steps.build.outcome == 'success' }}
|
2023-01-28 22:12:40 -07:00
|
|
|
with:
|
|
|
|
if-no-files-found: error
|
|
|
|
name: ${{ matrix.platform.artifact }}
|
|
|
|
path: build/dist/SDL3*
|