From 5b287f5fadfb73b9d6d9b1ce6f5f6328f76c06e0 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 17 Dec 2024 14:49:58 +0100
Subject: [PATCH] Add parametrized release script
[ci skip]
---
.github/actions/setup-ninja/action.yml | 62 +
.github/fetch_sdl_vc.ps1 | 40 -
.github/workflows/release.yml | 517 ++++++
VisualC/SDL_net.vcxproj | 113 +-
VisualC/showinterfaces/showinterfaces.vcxproj | 76 +-
build-scripts/build-release.py | 1469 +++++++++++++++++
.../cmake-toolchain-mingw64-i686.cmake | 18 +
.../cmake-toolchain-mingw64-x86_64.cmake | 18 +
build-scripts/create-release.py | 45 +
build-scripts/release-info.json | 118 ++
build-scripts/test-versioning.sh | 10 +-
mingw/pkg-support/Makefile | 35 +
12 files changed, 2349 insertions(+), 172 deletions(-)
create mode 100644 .github/actions/setup-ninja/action.yml
delete mode 100644 .github/fetch_sdl_vc.ps1
create mode 100644 .github/workflows/release.yml
create mode 100755 build-scripts/build-release.py
create mode 100644 build-scripts/cmake-toolchain-mingw64-i686.cmake
create mode 100644 build-scripts/cmake-toolchain-mingw64-x86_64.cmake
create mode 100755 build-scripts/create-release.py
create mode 100644 build-scripts/release-info.json
create mode 100644 mingw/pkg-support/Makefile
diff --git a/.github/actions/setup-ninja/action.yml b/.github/actions/setup-ninja/action.yml
new file mode 100644
index 0000000..b5d5fad
--- /dev/null
+++ b/.github/actions/setup-ninja/action.yml
@@ -0,0 +1,62 @@
+name: 'Setup ninja'
+description: 'Download ninja and add it to the PATH environment variable'
+inputs:
+ version:
+ description: 'Ninja version'
+ default: '1.12.1'
+runs:
+ using: 'composite'
+ steps:
+ - name: 'Calculate variables'
+ id: calc
+ shell: sh
+ run: |
+ case "${{ runner.os }}-${{ runner.arch }}" in
+ "Linux-X86" | "Linux-X64")
+ archive="ninja-linux.zip"
+ ;;
+ "Linux-ARM64")
+ archive="ninja-linux-aarch64.zip"
+ ;;
+ "macOS-X86" | "macOS-X64" | "macOS-ARM64")
+ archive="ninja-mac.zip"
+ ;;
+ "Windows-X86" | "Windows-X64")
+ archive="ninja-win.zip"
+ ;;
+ "Windows-ARM64")
+ archive="ninja-winarm64.zip"
+ ;;
+ *)
+ echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
+ exit 1;
+ ;;
+ esac
+ echo "archive=${archive}" >> ${GITHUB_OUTPUT}
+ echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
+ - name: 'Restore cached ${{ steps.calc.outputs.archive }}'
+ id: cache-restore
+ uses: actions/cache/restore@v4
+ with:
+ path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
+ key: ${{ steps.calc.outputs.cache-key }}
+ - name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
+ if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
+ shell: pwsh
+ run: |
+ Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
+ - name: 'Cache ${{ steps.calc.outputs.archive }}'
+ if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
+ uses: actions/cache/save@v4
+ with:
+ path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
+ key: ${{ steps.calc.outputs.cache-key }}
+ - name: 'Extract ninja'
+ shell: pwsh
+ run: |
+ 7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
+ - name: 'Set output variables'
+ id: final
+ shell: pwsh
+ run: |
+ echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH
diff --git a/.github/fetch_sdl_vc.ps1 b/.github/fetch_sdl_vc.ps1
deleted file mode 100644
index 6a4e5d5..0000000
--- a/.github/fetch_sdl_vc.ps1
+++ /dev/null
@@ -1,40 +0,0 @@
-$ErrorActionPreference = "Stop"
-
-$project_root = "$psScriptRoot\.."
-Write-Output "project_root: $project_root"
-
-$sdl2_version = "2.0.4"
-$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"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..7ed3ce2
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,517 @@
+name: 'release'
+run-name: 'Create SDL_net release artifacts for ${{ inputs.commit }}'
+
+on:
+ workflow_dispatch:
+ inputs:
+ commit:
+ description: 'Commit of SDL_net'
+ required: true
+
+jobs:
+
+ src:
+ runs-on: ubuntu-latest
+ outputs:
+ project: ${{ steps.releaser.outputs.project }}
+ version: ${{ steps.releaser.outputs.version }}
+ src-tar-gz: ${{ steps.releaser.outputs.src-tar-gz }}
+ src-tar-xz: ${{ steps.releaser.outputs.src-tar-xz }}
+ src-zip: ${{ steps.releaser.outputs.src-zip }}
+ steps:
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Fetch build-release.py'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: 'build-scripts/build-release.py'
+ - name: 'Set up SDL sources'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ path: 'SDL'
+ fetch-depth: 0
+ - name: 'Build Source archive'
+ id: releaser
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py \
+ --actions source \
+ --commit ${{ inputs.commit }} \
+ --root "${{ github.workspace }}/SDL" \
+ --github \
+ --debug
+ - name: 'Store source archives'
+ uses: actions/upload-artifact@v4
+ with:
+ name: sources
+ path: '${{ github.workspace}}/dist'
+
+ linux-verify:
+ needs: [src]
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Download source archives'
+ uses: actions/download-artifact@v4
+ with:
+ name: sources
+ path: '/tmp'
+ - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
+ id: zip
+ run: |
+ set -e
+ mkdir /tmp/zipdir
+ cd /tmp/zipdir
+ unzip "/tmp/${{ needs.src.outputs.src-zip }}"
+ echo "path=/tmp/zipdir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
+ - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
+ id: tar
+ run: |
+ set -e
+ mkdir -p /tmp/tardir
+ tar -C /tmp/tardir -v -x -f "/tmp/${{ needs.src.outputs.src-tar-gz }}"
+ echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
+ - name: 'Compare contents of ${{ needs.src.outputs.src-zip }} and ${{ needs.src.outputs.src-tar-gz }}'
+ run: |
+ set -e
+ diff "${{ steps.zip.outputs.path }}" "${{ steps.tar.outputs.path }}"
+ - name: 'Test versioning'
+ shell: bash
+ run: |
+ ${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
+ - name: 'Fetch build-release.py'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: 'build-scripts/build-release.py'
+ - name: 'Download dependencies'
+ id: deps
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py \
+ --actions download \
+ --commit ${{ inputs.commit }} \
+ --root "${{ steps.tar.outputs.path }}" \
+ --github \
+ --debug
+ - name: 'Extract dependencies, build and install them'
+ id: deps-build
+ run: |
+ tar -C /tmp -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL2-${{ steps.deps.outputs.dep-sdl-version }}.tar.gz"
+ cmake -S /tmp/SDL2-${{ steps.deps.outputs.dep-sdl-version }} -B /tmp/SDL-build -DCMAKE_INSTALL_PREFIX=/tmp/deps-prefix
+ cmake --build /tmp/SDL-build
+ cmake --install /tmp/SDL-build
+ echo "path=/tmp/deps-prefix" >>$GITHUB_OUTPUT
+ - name: 'CMake (configure + build)'
+ run: |
+ cmake \
+ -S ${{ steps.tar.outputs.path }} \
+ -B /tmp/build \
+ -DSDL2NET_SAMPLES=ON \
+ -DCMAKE_PREFIX_PATH="${{ steps.deps-build.outputs.path }}"
+ cmake --build /tmp/build --verbose
+ # ctest --test-dir /tmp/build --no-tests=error --output-on-failure
+
+ dmg:
+ needs: [src]
+ runs-on: macos-latest
+ outputs:
+ dmg: ${{ steps.releaser.outputs.dmg }}
+ steps:
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Fetch build-release.py'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: 'build-scripts/build-release.py'
+ - name: 'Download source archives'
+ uses: actions/download-artifact@v4
+ with:
+ name: sources
+ path: '${{ github.workspace }}'
+ - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
+ id: tar
+ run: |
+ mkdir -p "${{ github.workspace }}/tardir"
+ tar -C "${{ github.workspace }}/tardir" -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
+ echo "path=${{ github.workspace }}/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
+ - name: 'Build SDL2_net.dmg'
+ id: releaser
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py \
+ --actions dmg \
+ --commit ${{ inputs.commit }} \
+ --root "${{ steps.tar.outputs.path }}" \
+ --github \
+ --debug
+ - name: 'Store DMG image file'
+ uses: actions/upload-artifact@v4
+ with:
+ name: dmg
+ path: '${{ github.workspace }}/dist'
+
+ dmg-verify:
+ needs: [dmg, src]
+ runs-on: macos-latest
+ steps:
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Fetch build-release.py'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: 'build-scripts/build-release.py'
+ - name: 'Download source archives'
+ uses: actions/download-artifact@v4
+ with:
+ name: sources
+ path: '${{ github.workspace }}'
+ - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
+ id: src
+ run: |
+ mkdir -p /tmp/tardir
+ tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
+ echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
+ - name: 'Download dependencies'
+ id: deps
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py \
+ --actions download \
+ --commit ${{ inputs.commit }} \
+ --root "${{ steps.src.outputs.path }}" \
+ --github \
+ --debug
+ - name: 'Mount dependencies'
+ id: deps-mount
+ run: |
+ hdiutil attach "${{ steps.deps.outputs.dep-path }}/SDL2-${{ steps.deps.outputs.dep-sdl-version }}.dmg"
+ sdl_mount_pount="/Volumes/SDL2"
+ if [ ! -d "$sdl_mount_pount/SDL2.framework" ]; then
+ echo "Cannot find SDL2.framework!"
+ exit 1
+ fi
+ echo "path=${sdl_mount_pount}" >>$GITHUB_OUTPUT
+ - name: 'Download ${{ needs.dmg.outputs.dmg }}'
+ uses: actions/download-artifact@v4
+ with:
+ name: dmg
+ path: '${{ github.workspace }}'
+ - name: 'Mount ${{ needs.dmg.outputs.dmg }}'
+ id: mount
+ run: |
+ hdiutil attach '${{ github.workspace }}/${{ needs.dmg.outputs.dmg }}'
+ mount_point="/Volumes/${{ needs.src.outputs.project }}"
+ if [ ! -d "$mount_point/${{ needs.src.outputs.project }}.framework" ]; then
+ echo "Cannot find ${{ needs.src.outputs.project }}.framework!"
+ exit 1
+ fi
+ echo "path=${mount_point}">>$GITHUB_OUTPUT
+ - name: 'CMake (configure + build) Darwin'
+ run: |
+ set -e
+ cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
+ -DTEST_SHARED=TRUE \
+ -DTEST_STATIC=FALSE \
+ -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.path }};${{ steps.deps-mount.outputs.path }}" \
+ -DCMAKE_SYSTEM_NAME=Darwin \
+ -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
+ -Werror=dev \
+ -B build_darwin
+ cmake --build build_darwin --config Release --verbose
+
+ msvc:
+ needs: [src]
+ runs-on: windows-2019
+ outputs:
+ VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
+ VC-x64: ${{ steps.releaser.outputs.VC-x64 }}
+ VC-devel: ${{ steps.releaser.outputs.VC-devel }}
+ steps:
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Fetch build-release.py'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: 'build-scripts/build-release.py'
+ - name: 'Download source archives'
+ uses: actions/download-artifact@v4
+ with:
+ name: sources
+ path: '${{ github.workspace }}'
+ - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
+ id: zip
+ run: |
+ New-Item C:\temp -ItemType Directory -ErrorAction SilentlyContinue
+ cd C:\temp
+ unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
+ echo "path=C:\temp\${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$Env:GITHUB_OUTPUT
+ - name: 'Build MSVC binary archives'
+ id: releaser
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py `
+ --actions download msvc `
+ --commit ${{ inputs.commit }} `
+ --root "${{ steps.zip.outputs.path }}" `
+ --github `
+ --debug
+ - name: 'Store MSVC archives'
+ uses: actions/upload-artifact@v4
+ with:
+ name: msvc
+ path: '${{ github.workspace }}/dist'
+
+ msvc-verify:
+ needs: [msvc, src]
+ runs-on: windows-latest
+ steps:
+ - name: 'Fetch .github/actions/setup-ninja/action.yml'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: |
+ .github/actions/setup-ninja/action.yml
+ build-scripts/build-release.py
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Download source archives'
+ uses: actions/download-artifact@v4
+ with:
+ name: sources
+ path: '${{ github.workspace }}'
+ - name: 'Unzip ${{ needs.src.outputs.src-zip }}'
+ id: src
+ run: |
+ mkdir '${{ github.workspace }}/sources'
+ cd '${{ github.workspace }}/sources'
+ unzip "${{ github.workspace }}/${{ needs.src.outputs.src-zip }}"
+ echo "path=${{ github.workspace }}/sources/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
+ - name: 'Download dependencies'
+ id: deps
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py `
+ --actions download `
+ --commit ${{ inputs.commit }} `
+ --root "${{ steps.src.outputs.path }}" `
+ --github `
+ --debug
+ - name: 'Extract dependencies'
+ id: deps-extract
+ run: |
+ mkdir '${{ github.workspace }}/deps-vc'
+ cd '${{ github.workspace }}/deps-vc'
+ unzip "${{ steps.deps.outputs.dep-path }}/SDL2-devel-${{ steps.deps.outputs.dep-sdl-version }}-VC.zip"
+ echo "path=${{ github.workspace }}/deps-vc" >>$env:GITHUB_OUTPUT
+ - name: 'Download MSVC binaries'
+ uses: actions/download-artifact@v4
+ with:
+ name: msvc
+ path: '${{ github.workspace }}'
+ - name: 'Unzip ${{ needs.msvc.outputs.VC-devel }}'
+ id: bin
+ run: |
+ mkdir '${{ github.workspace }}/vc'
+ cd '${{ github.workspace }}/vc'
+ unzip "${{ github.workspace }}/${{ needs.msvc.outputs.VC-devel }}"
+ echo "path=${{ github.workspace }}/vc/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$env:GITHUB_OUTPUT
+ - name: Set up ninja
+ uses: ./.github/actions/setup-ninja
+ - name: 'Configure vcvars x86'
+ uses: ilammy/msvc-dev-cmd@v1
+ with:
+ arch: x64_x86
+ - name: 'CMake (configure + build + tests) x86'
+ run: |
+ cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
+ -B build_x86 `
+ -GNinja `
+ -DCMAKE_BUILD_TYPE=Debug `
+ -Werror `
+ -DTEST_STATIC=FALSE `
+ -DTEST_SHARED=TRUE `
+ -DCMAKE_SUPPRESS_REGENERATION=TRUE `
+ -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
+ Start-Sleep -Seconds 2
+ cmake --build build_x86 --config Release --verbose
+ - name: 'Configure vcvars x64'
+ uses: ilammy/msvc-dev-cmd@v1
+ with:
+ arch: x64
+ - name: 'CMake (configure + build + tests) x64'
+ run: |
+ cmake -S "${{ steps.src.outputs.path }}/cmake/test" `
+ -B build_x64 `
+ -GNinja `
+ -DCMAKE_BUILD_TYPE=Debug `
+ -Werror `
+ -DTEST_STATIC=FALSE `
+ -DTEST_SHARED=TRUE `
+ -DCMAKE_SUPPRESS_REGENERATION=TRUE `
+ -DCMAKE_PREFIX_PATH="${{ steps.bin.outputs.path }};${{ steps.deps-extract.outputs.path }}"
+ Start-Sleep -Seconds 2
+ cmake --build build_x64 --config Release --verbose
+
+ mingw:
+ needs: [src]
+ runs-on: ubuntu-24.04 # FIXME: current ubuntu-latest ships an outdated mingw, replace with ubuntu-latest once 24.04 becomes the new default
+ outputs:
+ mingw-devel-tar-gz: ${{ steps.releaser.outputs.mingw-devel-tar-gz }}
+ mingw-devel-tar-xz: ${{ steps.releaser.outputs.mingw-devel-tar-xz }}
+ steps:
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Fetch build-release.py'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: 'build-scripts/build-release.py'
+ - name: 'Install Mingw toolchain'
+ run: |
+ sudo apt-get update -y
+ sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
+ - name: 'Download source archives'
+ uses: actions/download-artifact@v4
+ with:
+ name: sources
+ path: '${{ github.workspace }}'
+ - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
+ id: tar
+ run: |
+ mkdir -p /tmp/tardir
+ tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
+ echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
+ - name: 'Build MinGW binary archives'
+ id: releaser
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py \
+ --actions download mingw \
+ --commit ${{ inputs.commit }} \
+ --root "${{ steps.tar.outputs.path }}" \
+ --github \
+ --debug
+ - name: 'Store MinGW archives'
+ uses: actions/upload-artifact@v4
+ with:
+ name: mingw
+ path: '${{ github.workspace }}/dist'
+
+ mingw-verify:
+ needs: [mingw, src]
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Set up Python'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - name: 'Fetch build-release.py'
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ inputs.commit }}
+ sparse-checkout: 'build-scripts/build-release.py'
+ - name: 'Install Mingw toolchain'
+ run: |
+ sudo apt-get update -y
+ sudo apt-get install -y gcc-mingw-w64 g++-mingw-w64 ninja-build
+ - name: 'Download source archives'
+ uses: actions/download-artifact@v4
+ with:
+ name: sources
+ path: '${{ github.workspace }}'
+ - name: 'Untar ${{ needs.src.outputs.src-tar-gz }}'
+ id: src
+ run: |
+ mkdir -p /tmp/tardir
+ tar -C /tmp/tardir -v -x -f "${{ github.workspace }}/${{ needs.src.outputs.src-tar-gz }}"
+ echo "path=/tmp/tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}" >>$GITHUB_OUTPUT
+ - name: 'Download dependencies'
+ id: deps
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ python build-scripts/build-release.py \
+ --actions download \
+ --commit ${{ inputs.commit }} \
+ --root "${{ steps.src.outputs.path }}" \
+ --github \
+ --debug
+ - name: 'Untar and install dependencies'
+ id: deps-extract
+ run: |
+ mkdir -p /tmp/deps-mingw/cmake
+ mkdir -p /tmp/deps-mingw/i686-w64-mingw32
+ mkdir -p /tmp/deps-mingw/x86_64-w64-mingw32
+
+ mkdir -p /tmp/deps-mingw-extract/sdl2/
+ tar -C /tmp/deps-mingw-extract/sdl2 -v -x -f "${{ steps.deps.outputs.dep-path }}/SDL2-devel-${{ steps.deps.outputs.dep-sdl-version }}-mingw.tar.gz"
+ make -C /tmp/deps-mingw-extract/sdl2/SDL2-${{ steps.deps.outputs.dep-sdl-version }} install-package arch=i686-w64-mingw32 prefix=/tmp/deps-mingw/i686-w64-mingw32
+ make -C /tmp/deps-mingw-extract/sdl2/SDL2-${{ steps.deps.outputs.dep-sdl-version }} install-package arch=x86_64-w64-mingw32 prefix=/tmp/deps-mingw/x86_64-w64-mingw32
+ cp -r /tmp/deps-mingw-extract/sdl2/SDL2-${{ steps.deps.outputs.dep-sdl-version }}/cmake/* /tmp/deps-mingw/cmake
+ - name: 'Download MinGW binaries'
+ uses: actions/download-artifact@v4
+ with:
+ name: mingw
+ path: '${{ github.workspace }}'
+ - name: 'Untar and install ${{ needs.mingw.outputs.mingw-devel-tar-gz }}'
+ id: bin
+ run: |
+ mkdir -p /tmp/mingw-tardir
+ tar -C /tmp/mingw-tardir -v -x -f "${{ github.workspace }}/${{ needs.mingw.outputs.mingw-devel-tar-gz }}"
+ make -C /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }} install-package arch=i686-w64-mingw32 prefix=/tmp/deps-mingw/i686-w64-mingw32
+ make -C /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }} install-package arch=x86_64-w64-mingw32 prefix=/tmp/deps-mingw/x86_64-w64-mingw32
+ cp -r /tmp/mingw-tardir/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}/cmake/* /tmp/deps-mingw/cmake
+ - name: 'CMake (configure + build) i686'
+ run: |
+ set -e
+ cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
+ -DCMAKE_BUILD_TYPE="Release" \
+ -DTEST_SHARED=TRUE \
+ -DTEST_STATIC=TRUE \
+ -DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
+ -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-i686.cmake" \
+ -Werror=dev \
+ -B build_x86
+ cmake --build build_x86 --config Release --verbose
+ - name: 'CMake (configure + build) x86_64'
+ run: |
+ set -e
+ cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
+ -DCMAKE_BUILD_TYPE="Release" \
+ -DTEST_SHARED=TRUE \
+ -DTEST_STATIC=TRUE \
+ -DCMAKE_PREFIX_PATH="/tmp/deps-mingw" \
+ -DCMAKE_TOOLCHAIN_FILE="${{ steps.src.outputs.path }}/build-scripts/cmake-toolchain-mingw64-x86_64.cmake" \
+ -Werror=dev \
+ -B build_x64
+ cmake --build build_x64 --config Release --verbose
diff --git a/VisualC/SDL_net.vcxproj b/VisualC/SDL_net.vcxproj
index 72ce5ec..a6f2bf6 100644
--- a/VisualC/SDL_net.vcxproj
+++ b/VisualC/SDL_net.vcxproj
@@ -21,40 +21,29 @@
<PropertyGroup Label="Globals">
<ProjectName>SDL2_net</ProjectName>
<ProjectGuid>{8AB3504F-5E58-4910-AFE8-7A1E595AC3F4}</ProjectGuid>
- <RootNamespace>SDL_net</RootNamespace>
+ <RootNamespace>SDL2_net</RootNamespace>
+ <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' != '10.0'">$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
- </ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
@@ -80,20 +69,20 @@
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Pla
(Patch may be truncated, please check the link at the top of this post.)