这是indexloc提供的服务,不要输入任何密码
Skip to content

Remove or update old references to SDL2 #689

Remove or update old references to SDL2

Remove or update old references to SDL2 #689

Workflow file for this run

name: Builds
on:
push:
branches:
- "**"
tags:
- "*.*.*"
pull_request:
types: [opened, reopened]
defaults:
run:
shell: bash
env:
VCPKG_FETCH_DEPTH: 1 # Depth to fetch vcpkg commits, must include the baseline.
SDL_LINUX_DEPENDENCIES: libltdl-dev libx11-dev libxft-dev libxext-dev libwayland-dev libxkbcommon-dev libegl1-mesa-dev libibus-1.0-dev
CMAKE_BUILD_DIR: build
VCPKG_ROOT: ${{github.workspace}}/vcpkg
jobs:
CMake:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-24.04
triplet: x64-linux
shared: dynamic
config: Debug
- os: ubuntu-24.04
triplet: x64-linux
shared: static
config: Debug
- os: ubuntu-24.04
triplet: x64-linux
shared: dynamic
config: Release
cpack: true
- os: macos-13
triplet: x64-osx
shared: dynamic
config: Release
cpack: true
- os: macos-14
triplet: arm64-osx
shared: static
config: Debug
- os: macos-14
triplet: arm64-osx
shared: dynamic
config: Release
cpack: true
- os: windows-2022
triplet: x64-windows
shared: static
config: Debug
- os: windows-2022
triplet: x64-windows
shared: dynamic
config: Release
cpack: true
# Test libtcod without SDL.
- os: ubuntu-24.04
triplet: x64-linux
shared: dynamic
config: Debug
cmake_extra_args: "-DLIBTCOD_SAMPLES=OFF -DCMAKE_DISABLE_FIND_PACKAGE_SDL3=1 -DCMAKE_DISABLE_FIND_PACKAGE_Threads=1"
- os: windows-2022
triplet: x64-windows
shared: dynamic
config: Debug
cmake_extra_args: "-DLIBTCOD_SAMPLES=OFF -DCMAKE_DISABLE_FIND_PACKAGE_SDL3=1 -DCMAKE_DISABLE_FIND_PACKAGE_Threads=1"
# Test libtcod without zlib.
- os: ubuntu-24.04
triplet: x64-linux
shared: dynamic
config: Debug
cmake_extra_args: "-DLIBTCOD_SAMPLES=OFF -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=1 -DCMAKE_DISABLE_FIND_PACKAGE_Threads=1"
# Test libtcod without PNG.
- os: ubuntu-24.04
triplet: x64-linux
shared: dynamic
config: Debug
cmake_extra_args: "-DLIBTCOD_SAMPLES=OFF -DCMAKE_DISABLE_FIND_PACKAGE_lodepng-c=1 -DCMAKE_DISABLE_FIND_PACKAGE_Threads=1"
# Test libtcod without utf8proc.
- os: ubuntu-24.04
triplet: x64-linux
shared: dynamic
config: Debug
cmake_extra_args: "-DLIBTCOD_SAMPLES=OFF -DCMAKE_DISABLE_FIND_PACKAGE_utf8proc=1 -DCMAKE_DISABLE_FIND_PACKAGE_Threads=1"
# Test libtcod without everything.
- os: ubuntu-24.04
triplet: x64-linux
shared: dynamic
config: Debug
cmake_extra_args: "-DLIBTCOD_SAMPLES=OFF -DCMAKE_DISABLE_FIND_PACKAGE_SDL3=1 -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=1 -DCMAKE_DISABLE_FIND_PACKAGE_lodepng-c=1 -DCMAKE_DISABLE_FIND_PACKAGE_utf8proc=1 -DCMAKE_DISABLE_FIND_PACKAGE_Threads=1"
env:
VCPKG_LIBRARY_LINKAGE: ${{matrix.shared}}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch Vcpkg commits
working-directory: vcpkg
run: git fetch --depth=${{env.VCPKG_FETCH_DEPTH}}
- name: Install latest CMake
uses: lukka/get-cmake@latest
- name: Install APT dependencies
if: runner.os == 'Linux'
run: sudo apt-get install ${{ env.SDL_LINUX_DEPENDENCIES }}
# Restore both vcpkg and its artifacts from the GitHub cache service.
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v4
with:
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file.
# The second path is the location of vcpkg (it contains the vcpkg executable and data files).
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
path: |
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service.
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already).
key: |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json', '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
- uses: ilammy/msvc-dev-cmd@v1
- name: CMake configure
run: |
cmake -S . -B ${{env.CMAKE_BUILD_DIR}} -G Ninja \
-DVCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \
-DCMAKE_BUILD_TYPE=${{matrix.config}} \
-DLIBTCOD_SDL3=find_package \
-DLIBTCOD_ZLIB=find_package \
-DLIBTCOD_LODEPNG=find_package \
-DLIBTCOD_UTF8PROC=vcpkg \
-DLIBTCOD_STB=vcpkg \
-DCMAKE_INSTALL_PREFIX=local \
-DBUILD_SHARED_LIBS=${{ matrix.shared == 'dynamic' && 'TRUE' || 'FALSE' }} \
-DLIBTCOD_SAMPLES=ON \
-DLIBTCOD_TESTS=ON \
-DCPACK_SYSTEM_NAME=${{ matrix.triplet }}\
-Wdev \
${{ matrix.cmake_extra_args }}
- name: CMake build
run: |
cmake --build ${{env.CMAKE_BUILD_DIR}}
- name: CMake verify headers
run: |
cmake --build ${{env.CMAKE_BUILD_DIR}} --target all_verify_interface_header_sets
- name: List build files
run: find ${{env.CMAKE_BUILD_DIR}}
- name: Run tests
env:
LD_LIBRARY_PATH: ${{env.CMAKE_BUILD_DIR}}/lib
run: |
${{env.CMAKE_BUILD_DIR}}/bin/unittest ~[!nonportable] ${{ matrix.config != 'Release' && '~[benchmark]' || '' }}
- name: CMake test install
if: runner.os != 'Windows'
run: |
cmake --install ${{env.CMAKE_BUILD_DIR}} --config ${{matrix.config}}
- name: CPack
if: matrix.cpack
run: |
cpack --config ${{env.CMAKE_BUILD_DIR}}/CPackConfig.cmake --verbose
- name: Upload CPack
if: matrix.cpack
uses: actions/upload-artifact@v4
with:
name: cpack-dist-${{ matrix.triplet }}
path: |
*.zip
*.tar.*
retention-days: 3
compression-level: 0
if-no-files-found: error
coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-24.04
triplet: x64-linux
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch Vcpkg commits
working-directory: vcpkg
run: git fetch --depth=${{env.VCPKG_FETCH_DEPTH}}
- name: Install the latest CMake
uses: lukka/get-cmake@latest
- name: Install APT dependencies
if: runner.os == 'Linux'
run: sudo apt-get install ${{ env.SDL_LINUX_DEPENDENCIES }}
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v4
with:
path: |
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
key: |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json', '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
- name: CMake configure
run: |
cmake . -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="--coverage" \
-DCMAKE_C_FLAGS="--coverage" \
-DLIBTCOD_SDL3=find_package \
-DLIBTCOD_ZLIB=find_package \
-DLIBTCOD_LODEPNG=find_package \
-DLIBTCOD_UTF8PROC=vcpkg \
-DLIBTCOD_STB=vcpkg \
-DLIBTCOD_SAMPLES=OFF \
-DLIBTCOD_TESTS=ON \
-Wdev
- name: CMake build
run: |
cmake --build .
- name: Run tests
env:
LD_LIBRARY_PATH: lib
run: |
bin/unittest ~[!nonportable] ~[benchmark]
- name: List coverage files
run: find . | grep -e ".gc..$"
- name: Generate coverage data
run: gcov CMakeFiles/libtcod.dir/src/libtcod/*.o CMakeFiles/libtcod.dir/src/libtcod/*/*.o tests/CMakeFiles/unittest.dir/*.o
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Autotools:
# Disabled until SDL3 is supported
if: false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-14]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install APT dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libsdl3-dev
- name: Install Brew dependencies
if: runner.os == 'macOS'
run: |
brew install automake sdl3 libtool
- name: libtoolize
run: ${{ runner.os == 'macOS' && 'glibtoolize' || 'libtoolize' }} --install
working-directory: buildsys/autotools
- name: Configure package
working-directory: buildsys/autotools
run: |
autoreconf --install
./configure --prefix=$HOME/.local
- name: Build package
working-directory: buildsys/autotools
run: |
make -j 3 install
- name: Run tests
working-directory: buildsys/autotools
run: |
make check
SCons:
# Disabled until SDL3 is supported
if: false
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-24.04]
architecture: [x86_64]
include:
- os: "macos-13"
architecture: universal2
- os: "macos-13"
architecture: x86_64
- os: "windows-2022"
architecture: x86
- os: "windows-2022"
architecture: x86_64
- os: "windows-2022"
architecture: x86_64
toolset: mingw
steps:
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install SCons
run: |
python -m pip install --upgrade pip
python -m pip install scons
- name: Install APT dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libsdl3-dev
- name: Install Brew dependencies
if: runner.os == 'macOS'
run: |
brew install sdl3
- uses: msys2/setup-msys2@v2
if: ${{ matrix.toolset == 'mingw' }}
with:
msystem: MINGW64
update: true
install: git scons mingw-w64-x86_64-toolchain mingw-w64-x86_64-SDL3
- name: Build package.
if: ${{ matrix.toolset != 'mingw' }}
working-directory: buildsys/scons
run: |
scons develop_all dist -j 3 -s CPPDEFINES=NDEBUG MODE=DEBUG_RELEASE ARCH=${{ matrix.architecture }}
- name: Build package (MinGW)
if: ${{ matrix.toolset == 'mingw' }}
working-directory: buildsys/scons
shell: msys2 {0}
run: |
scons develop_all dist -j 3 -s CPPDEFINES=NDEBUG MODE=DEBUG_RELEASE ARCH=${{ matrix.architecture }} \
TOOLSET=mingw
- name: Archive distribution
uses: actions/upload-artifact@v4
with:
name: scons-dist-${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.toolset }}
path: |
buildsys/scons/libtcod-*.zip
buildsys/scons/libtcod-*.tar.*
retention-days: 3
compression-level: 0
Emscripten:
runs-on: ubuntu-latest
env:
BUILD_TYPE: Release
CMAKE_BUILD_DIR: build
EM_VERSION: 4.0.5
EM_CACHE_FOLDER: "emsdk-cache"
VCPKG_ROOT: ${{github.workspace}}/vcpkg
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch Vcpkg commits
working-directory: vcpkg
run: git fetch --depth=${{env.VCPKG_FETCH_DEPTH}}
- name: Restore vcpkg and its artifacts
uses: actions/cache@v4
with:
path: |
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
key: wasm32-emscripten-${{ hashFiles('vcpkg.json', '.git/modules/vcpkg/HEAD') }}
- name: Setup cache
id: cache-system-libraries
uses: actions/cache@v4
with:
path: ${{ env.EM_CACHE_FOLDER }}
key: ${{ env.EM_VERSION }}-${{ runner.os }}
- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EM_VERSION }}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Verify
run: emcc -v
- name: Configure
run: emcmake cmake -S . -B ${{ env.CMAKE_BUILD_DIR }} -G Ninja
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
-DVCPKG_TARGET_TRIPLET=wasm32-emscripten
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}"
-DLIBTCOD_SAMPLES=ON
-DLIBTCOD_THREADS=OFF
- name: Build
run: cmake --build ${{ env.CMAKE_BUILD_DIR }}
- name: Show contents of the build directory
run: find ${{ env.CMAKE_BUILD_DIR }}
- uses: actions/upload-artifact@v4
with:
name: emscripten-builds
path: ${{ env.CMAKE_BUILD_DIR }}/bin
retention-days: 7
if-no-files-found: error
compression-level: 6
release:
needs: [CMake]
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Generate body
run: |
scripts/get_release_description.py | tee release_body.md
- uses: actions/download-artifact@v4
with:
pattern: cpack-dist-*
path: artifacts
merge-multiple: true
- name: Create Release
uses: ncipollo/release-action@v1
with:
bodyFile: release_body.md
draft: true
artifacts: artifacts/*