Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
04069fc
Add CMake support.
FtZPetruska May 29, 2022
fd6bc05
Add CMake tests to test-versioning.sh.
FtZPetruska May 29, 2022
553058d
Add CMake workflow
FtZPetruska May 29, 2022
61ccf8e
Apply suggestion from review
FtZPetruska May 29, 2022
6004b9b
CMake: Define SDL_MAIN_HANDLED for showinterfaces.
FtZPetruska May 29, 2022
918d216
Apply suggestion from review.
FtZPetruska May 29, 2022
90a143d
CMake: Update MSVC compiler flags.
FtZPetruska May 29, 2022
614a40b
Apply suggestions from code review.
FtZPetruska May 30, 2022
eb0e85d
CMake: Fix missing parenthesis.
FtZPetruska May 30, 2022
6e90ae0
CMake: Remove dead code.
FtZPetruska Jun 8, 2022
7ef9b42
CMake: Add config files for XCode Frameworks
FtZPetruska Jun 11, 2022
be4936a
CMake: Generate cmake config when using autotools.
FtZPetruska Jun 11, 2022
2c79c92
CMake: Add config files for mingw devel archive.
FtZPetruska Jun 11, 2022
7b8c4b1
CMake: Add config files for VC devel archive.
FtZPetruska Jun 11, 2022
78ca5c2
Merge branch 'libsdl-org:main' into CMake
FtZPetruska Jun 11, 2022
7baa006
Regenerate autotools file with CMake support.
FtZPetruska Jun 11, 2022
6d5749d
autogen.sh + cmake integration test
madebr Jun 11, 2022
11a9715
Don't force an installed SDL2_net::SDL2_net-static to link with a spe…
madebr Jun 12, 2022
6d1d9a5
Update PrivateSdlFunctions.cmake
madebr Jun 12, 2022
691403c
Apply suggestion from review.
FtZPetruska Jun 12, 2022
03f5378
CMake: Escape framework parent path.
FtZPetruska Jun 12, 2022
9739a52
Apply suggestion from review.
FtZPetruska Jun 13, 2022
499bb18
Apply suggestion from review.
FtZPetruska Jun 13, 2022
8c910a8
Apply suggestion from review.
FtZPetruska Jun 13, 2022
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/fetch_sdl_vc.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$ErrorActionPreference = "Stop"

$project_root = "$psScriptRoot\.."
Write-Output "project_root: $project_root"

$sdl2_version = "2.0.0"
$sdl2_zip = "SDL2-devel-$($sdl2_version)-VC.zip"

$sdl2_url = "https://www.libsdl.org/release/$($sdl2_zip)"
$sdl2_dlpath = "$($Env:TEMP)\$sdl2_zip"

$sdl2_bindir = "$($project_root)"
$sdl2_extractdir = "$($sdl2_bindir)\SDL2-$($sdl2_version)"
$sdl2_root_name = "SDL2-devel-VC"

echo "sdl2_bindir: $sdl2_bindir"
echo "sdl2_extractdir: $sdl2_extractdir"
echo "sdl2_root_name: $sdl2_root_name"

echo "Cleaning previous artifacts"
if (Test-Path $sdl2_extractdir) {
Remove-Item $sdl2_extractdir -Recurse -Force
}
if (Test-Path "$($sdl2_bindir)/$sdl2_root_name") {
Remove-Item "$($sdl2_bindir)/$sdl2_root_name" -Recurse -Force
}
if (Test-Path $sdl2_dlpath) {
Remove-Item $sdl2_dlpath -Force
}

Write-Output "Downloading $sdl2_url"
Invoke-WebRequest -Uri $sdl2_url -OutFile $sdl2_dlpath

Write-Output "Extracting archive"
Expand-Archive $sdl2_dlpath -DestinationPath $sdl2_bindir

Write-Output "Setting up SDL2 folder"
Rename-Item $sdl2_extractdir $sdl2_root_name

Write-Output "Done"
76 changes: 72 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
- { name: Linux (autotools), os: ubuntu-20.04, shell: sh }
- { name: Windows (MSVC+CMake), os: windows-latest, shell: sh, cmake: '-GNinja', msvc: 1 }
- { name: Windows (mingw32+autotools), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
- { name: Windows (mingw64+CMake), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, cmake: '-G "Ninja Multi-Config"' }
- { name: Linux (autotools), os: ubuntu-20.04, shell: sh }
- { name: Linux (CMake), os: ubuntu-20.04, shell: sh, cmake: '-GNinja' }
- { name: 'Linux (CMake, static)', os: ubuntu-20.04, shell: sh, cmake: '-DBUILD_SHARED_LIBS=OFF -GNinja' }
- { name: macOS (autotools), os: macos-latest, shell: sh }
- { name: macOS (CMake), os: macos-latest, shell: sh, cmake: '-GNinja' }

steps:
- name: Set up MSYS2
Expand All @@ -28,35 +33,97 @@ jobs:
install: >-
${{ matrix.platform.msys-env }}-SDL2
${{ matrix.platform.msys-env }}-autotools
${{ matrix.platform.msys-env }}-cmake
${{ matrix.platform.msys-env }}-gcc
${{ matrix.platform.msys-env }}-ninja
${{ matrix.platform.msys-env }}-pkg-config

- name: Setup macOS dependencies
if: runner.os == 'macOS'
run: |
brew install \
autoconf \
automake \
ninja \
pkg-config \
sdl2 \
${NULL+}

- name: Setup Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get -y install \
autoconf \
automake \
cmake \
libsdl2-dev \
ninja-build \
pkg-config \
${NULL+}

- uses: actions/checkout@v2

- name: Setup MSVC dependencies
if: "matrix.platform.msvc"
shell: pwsh
run: |
.github/fetch_sdl_vc.ps1
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/SDL2-devel-VC" >> $Env:GITHUB_ENV
- name: Setup Ninja for MSVC
if: "matrix.platform.msvc"
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- uses: ilammy/msvc-dev-cmd@v1
if: "matrix.platform.msvc"
with:
arch: x64

- name: Check that versioning is consistent
# We only need to run this once: arbitrarily use the Linux/CMake build
if: "runner.os == 'Linux' && matrix.platform.cmake"
run: ./test-versioning.sh

- name: Configure CMake
if: "matrix.platform.cmake"
run: |
set -eu
cmake -S . \
-B build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DSDL2NET_SHOWINTERFACES=ON \
${{ matrix.platform.cmake }}

- name: Build with CMake
if: "matrix.platform.cmake"
run: cmake --build build/ --config Release --parallel --verbose

- name: Install with CMake
if: "matrix.platform.shell == 'sh' && matrix.platform.cmake"
run: |
set -eu
rm -fr DESTDIR-cmake
DESTDIR=$(pwd)/DESTDIR-cmake cmake --install build/ --config Release
find DESTDIR-cmake | LC_ALL=C sort -u

- name: Configure Autotools
if: "! matrix.platform.cmake"
run: |
set -eu
./autogen.sh
./configure

- name: Build with Autotools
if: "! matrix.platform.cmake"
run: |
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" V=1

- name: Install with Autotools
if: "! matrix.platform.cmake"
run: |
set -eu
curdir="$(pwd)"
Expand All @@ -65,8 +132,9 @@ jobs:
mkdir DESTDIR-autotools
make -j"${parallel}" install DESTDIR="${curdir}/DESTDIR-autotools" V=1
( cd DESTDIR-autotools; find ) | LC_ALL=C sort -u

- name: Distcheck with Autotools
if: "runner.os == 'Linux'"
if: "runner.os == 'Linux' && ! matrix.platform.cmake"
run: |
set -eu
parallel="$(getconf _NPROCESSORS_ONLN)"
Expand Down
Loading