diff --git a/.github/actions/setup-loongarch64-toolchain/action.yml b/.github/actions/setup-loongarch64-toolchain/action.yml new file mode 100644 index 000000000..9cf53eaf4 --- /dev/null +++ b/.github/actions/setup-loongarch64-toolchain/action.yml @@ -0,0 +1,49 @@ +name: 'Setup libusb for MSBC' +description: 'Greet someone' +inputs: + version: + description: 'LoongArch64 version' + default: '2022.09.06' +outputs: + prefix: + description: "LoongArch toolchain prefix" + value: ${{ steps.final.outputs.prefix }} + cc: + description: "LoongArch C compiler" + value: ${{ steps.final.outputs.cc }} + cxx: + description: "LoongArch C++ compiler" + value: ${{ steps.final.outputs.cxx }} +runs: + using: 'composite' + steps: + - uses: actions/cache/restore@v4 + id: restore-cache + with: + path: /opt/cross-tools + key: loongarch64-${{ matrix.platform.toolchain-version }} + + - name: 'Download LoongArch64 gcc+glibc toolchain' + if: ${{ !steps.restore-cache.outputs.cache-hit }} + shell: bash + run: | + url="https://github.com/loongson/build-tools/releases/download/${{ matrix.platform.toolchain-version }}/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz" + + wget "$url" -O /tmp/toolchain.tar.xz + + mkdir -p /opt + tar -C /opt -x -f /tmp/toolchain.tar.xz + + - uses: actions/cache/save@v4 + if: ${{ !steps.restore-cache.outputs.cache-hit }} + with: + path: /opt/cross-tools + key: loongarch64-${{ matrix.platform.toolchain-version }} + - name: 'Set output vars' + id: final + shell: bash + run: | + prefix=/opt/cross-tools + echo "prefix=${prefix}" >> $GITHUB_OUTPUT + echo "cc=${prefix}/bin/loongarch64-unknown-linux-gnu-gcc" >> $GITHUB_OUTPUT + echo "cxx=${prefix}/bin/loongarch64-unknown-linux-gnu-g++" >> $GITHUB_OUTPUT diff --git a/.github/actions/setup-msvc-libusb-action/action.yml b/.github/actions/setup-msvc-libusb/action.yml similarity index 91% rename from .github/actions/setup-msvc-libusb-action/action.yml rename to .github/actions/setup-msvc-libusb/action.yml index a0e766618..fbf451af6 100644 --- a/.github/actions/setup-msvc-libusb-action/action.yml +++ b/.github/actions/setup-msvc-libusb/action.yml @@ -1,5 +1,5 @@ -name: 'Setup libusb for MSBC' -description: 'Greet someone' +name: 'Setup libusb for MSVC' +description: 'Setup libusb for MSVC' inputs: version: description: 'libusb version' @@ -68,3 +68,4 @@ runs: exit 1 } echo "root=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_OUTPUT + echo "LibUSB_ROOT=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_ENV diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index 28a08c6bf..000000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Build (Android) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - android: - name: ${{ matrix.platform.name }} - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: "Android.mk", ndk-build: 1 } - - { name: "Gradle", gradle: 1 } - - { name: "CMake", cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64", apk-artifact: "SDL-android-apks-arm64" } - - { name: "CMake (lean and mean)", cmake: 1, cppflags: "-DSDL_LEAN_AND_MEAN=1", android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-lean-android-arm64", apk-artifact: "SDL-lean-android-apks-arm64" } - - steps: - - uses: actions/checkout@v4 - - uses: nttld/setup-ndk@v1 - if: ${{ matrix.platform.cmake || matrix.platform.ndk-build }} - id: setup_ndk - with: - local-cache: true - ndk-version: r21e - - name: Build (Android.mk) - if: ${{ matrix.platform.ndk-build }} - run: | - ./build-scripts/androidbuildlibs.sh - - uses: actions/setup-java@v4 - if: ${{ matrix.platform.cmake || matrix.platform.gradle }} - with: - distribution: 'temurin' - java-version: '17' - - name: Create Gradle project - if: ${{ matrix.platform.gradle }} - run: | - python build-scripts/create-android-project.py \ - --output "build" \ - --variant copy \ - org.libsdl.testspriteminimal \ - test/testspriteminimal.c test/icon.h - echo "" - echo "Project contents:" - echo "" - find "build/org.libsdl.testspriteminimal" - - name: Build app (Gradle & ndk-build) - if: ${{ matrix.platform.gradle }} - run: | - cd build/org.libsdl.testspriteminimal - ./gradlew -i assembleRelease - - name: Build app (Gradle & CMake) - if: ${{ matrix.platform.gradle }} - run: | - cd build/org.libsdl.testspriteminimal - ./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1 -# - name: Build library (Gradle) -# if: ${{ matrix.platform.gradle }} -# run: | -# cd build/org.libsdl.testspriteminimal -# ./gradlew -i assembleRelease -PBUILD_AS_LIBRARY=1 - - name: Setup (CMake) - if: ${{ matrix.platform.cmake }} - run: | - sudo apt-get update - sudo apt-get install ninja-build pkg-config - - name: Configure (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake -S . -B build \ - -DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" \ - -DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_CLANG_TIDY=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ - -DANDROID_ABI=${{ matrix.platform.android_abi }} \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_INSTALL_PREFIX=prefix \ - -DCMAKE_BUILD_TYPE=Release \ - -GNinja - - name: Build (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake --build build --config Release --parallel --verbose - - name: Build test apk's (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake --build build --config Release --parallel \ - --target \ - testaudiorecording-apk \ - testautomation-apk \ - testcontroller-apk \ - testmultiaudio-apk \ - testsprite-apk \ - --verbose - - name: Install (CMake) - if: ${{ matrix.platform.cmake }} - run: | - cmake --install build --config Release - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - if: ${{ matrix.platform.cmake }} - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - if: ${{ matrix.platform.cmake }} - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ - -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ - -DANDROID_ABI=${{ matrix.platform.android_abi }} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - if: ${{ matrix.platform.cmake }} - run: | - export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - if: ${{ matrix.platform.cmake }} - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* - - uses: actions/upload-artifact@v4 - if: ${{ matrix.platform.cmake }} - with: - if-no-files-found: error - name: ${{ matrix.platform.apk-artifact }} - path: build/test/*.apk diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..94fb83ca8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: 'Build (All)' + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +jobs: + controller: + name: 'Create test plan' + runs-on: 'ubuntu-latest' + outputs: + platforms: ${{ steps.plan.outputs.platforms }} + steps: + - uses: actions/setup-python@main + with: + python-version: 3.x + - uses: actions/checkout@main + with: + sparse-checkout: '.github/workflows/create-test-plan.py' + - name: 'Create plan' + id: plan + run: | + python .github/workflows/create-test-plan.py \ + --github-variable platforms \ + --github-ci \ + --verbose + level1: + needs: [controller] + uses: './.github/workflows/generic.yml' + with: + platforms: ${{ needs.controller.outputs.platforms }} diff --git a/.github/workflows/cpactions.yml b/.github/workflows/cpactions.yml deleted file mode 100644 index 75f1b712d..000000000 --- a/.github/workflows/cpactions.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Build (C/P Actions) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - freebsd: - runs-on: ubuntu-latest - name: '${{ matrix.platform.name }} ${{ matrix.platform.os-version }}' - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - platform: - - { name: FreeBSD, os: freebsd, os-version: '13.3', os-arch: x86-64, artifact: SDL-freebsd-x64, - sdl-cmake-configure-arguments: '-DSDL_CHECK_REQUIRED_INCLUDES="/usr/local/include" -DSDL_CHECK_REQUIRED_LINK_OPTIONS="-L/usr/local/lib"', - setup-cmd: 'sudo pkg update', - install-cmd: 'sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd', - } - - { name: NetBSD, os: netbsd, os-version: '10.0', os-arch: x86-64, artifact: SDL-netbsd-x64, - sdl-cmake-configure-arguments: '', - setup-cmd: 'export PATH="/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH";export PKG_CONFIG_PATH="/usr/pkg/lib/pkgconfig";export PKG_PATH="https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f "1 2" -d.)/All/";echo "PKG_PATH=$PKG_PATH";echo "uname -a -> \"$(uname -a)\"";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update', - install-cmd: 'sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1', - } - steps: - - uses: actions/checkout@v4 - - name: Build - uses: cross-platform-actions/action@v0.25.0 - with: - operating_system: ${{ matrix.platform.os }} - architecture: ${{ matrix.platform.os-arch }} - version: ${{ matrix.platform.os-version }} - run: | - ${{ matrix.platform.setup-cmd }} - ${{ matrix.platform.install-cmd }} - cmake -S . -B build -GNinja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_BUILD_TYPE=Release \ - -DSDL_WERROR=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - ${{ matrix.platform.sdl-cmake-configure-arguments }} - cmake --build build/ --config Release --verbose - cmake --build build/ --config Release --target package - - cmake --build build/ --config Release --target clean - rm -rf build/dist/_CPack_Packages - rm -rf build/CMakeFiles - rm -rf build/docs - - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py new file mode 100755 index 000000000..e9be4a148 --- /dev/null +++ b/.github/workflows/create-test-plan.py @@ -0,0 +1,614 @@ +#!/usr/bin/env python +import argparse +import dataclasses +from enum import Enum +import json +import logging +import os +from typing import Optional + +logger = logging.getLogger(__name__) + + +class AppleArch(Enum): + Aarch64 = "aarch64" + X86_64 = "x86_64" + + +class MsvcArch(Enum): + X86 = "x86" + X64 = "x64" + Arm32 = "arm" + Arm64 = "arm64" + + +class JobOs(Enum): + WindowsLatest = "windows-latest" + UbuntuLatest = "ubuntu-latest" + MacosLatest = "macos-latest" + Ubuntu20_04 = "ubuntu-20.04" + Ubuntu22_04 = "ubuntu-22.04" + Ubuntu24_04 = "ubuntu-24.04" + Macos12 = "macos-12" + + +class SdlPlatform(Enum): + Android = "android" + Emscripten = "emscripten" + Haiku = "haiku" + LoongArch64 = "loongarch64" + Msys2 = "msys2" + Linux = "linux" + MacOS = "macos" + Ios = "ios" + Tvos = "tvos" + Msvc = "msvc" + N3ds = "n3ds" + PowerPC64 = "powerpc64" + Ps2 = "ps2" + Psp = "psp" + Riscos = "riscos" + FreeBSD = "freebsd" + NetBSD = "netbsd" + + +class Msys2Platform(Enum): + Mingw32 = "mingw32" + Mingw64 = "mingw64" + Clang32 = "clang32" + Clang64 = "clang64" + Ucrt64 = "ucrt64" + + +class IntelCompiler(Enum): + Icc = "icc" + Icx = "icx" + + +@dataclasses.dataclass(slots=True) +class JobSpec: + name: str + os: JobOs + platform: SdlPlatform + artifact: Optional[str] + container: Optional[str] = None + no_cmake: bool = False + android_mk: bool = False + android_gradle: bool = False + lean: bool = False + android_arch: Optional[str] = None + android_abi: Optional[str] = None + android_platform: Optional[int] = None + msys2_platform: Optional[Msys2Platform] = None + intel: Optional[IntelCompiler] = None + apple_framework: Optional[bool] = None + apple_archs: Optional[set[AppleArch]] = None + msvc_project: Optional[str] = None + msvc_arch: Optional[MsvcArch] = None + clang_cl: bool = False + uwp: bool = False + + +JOB_SPECS = [ + JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), + JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), + JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ), + JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), + JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), + JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), + JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), + JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), + JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), + JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), + JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), + JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ), + JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), + JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), + JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ), + JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ), + JobSpec(name="MacOS (Framework) (x86_64)", os=JobOs.Macos12, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), + JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ), + JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ), + JobSpec(name="Android (CMake)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, ), + JobSpec(name="Android (CMake, lean)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact="SDL-lean-android-arm64", android_abi="arm64-v8a", android_arch="aarch64", android_platform=23, lean=True, ), + JobSpec(name="Android (Android.mk)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_mk=True, ), + JobSpec(name="iOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact=None, no_cmake=True, ), + JobSpec(name="tvOS (xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact=None, no_cmake=True, ), + JobSpec(name="Android (Gradle)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Android, artifact=None, no_cmake=True, android_gradle=True, ), + JobSpec(name="Emscripten", os=JobOs.UbuntuLatest, platform=SdlPlatform.Emscripten, artifact="SDL-emscripten", ), + JobSpec(name="Haiku", os=JobOs.UbuntuLatest, platform=SdlPlatform.Haiku, artifact="SDL-haiku-x64", container="haiku/cross-compiler:x86_64-r1beta4", ), + JobSpec(name="LoongArch64", os=JobOs.UbuntuLatest, platform=SdlPlatform.LoongArch64, artifact="SDL-loongarch64", ), + JobSpec(name="Nintendo 3DS", os=JobOs.UbuntuLatest, platform=SdlPlatform.N3ds, artifact="SDL-n3ds", container="devkitpro/devkitarm:latest", ), + JobSpec(name="PowerPC64", os=JobOs.UbuntuLatest, platform=SdlPlatform.PowerPC64, artifact="SDL-ppc64le", container="dockcross/linux-ppc64le:latest", ), + JobSpec(name="Sony PlayStation 2", os=JobOs.UbuntuLatest, platform=SdlPlatform.Ps2, artifact="SDL-ps2", container="ps2dev/ps2dev:latest", ), + JobSpec(name="Sony PlayStation Portable", os=JobOs.UbuntuLatest, platform=SdlPlatform.Psp, artifact="SDL-psp", container="pspdev/pspdev:latest", ), + JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), + JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", ), + JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", ), +] + + +@dataclasses.dataclass(slots=True) +class JobDetails: + name: str + os: str + platform: str + artifact: str + no_cmake: bool + build_tests: bool = True + container: str = "" + cmake_build_type: str = "Release" + shell: str = "sh" + sudo: str = "sudo" + cmake_config_emulator: str = "" + apk_packages: list[str] = dataclasses.field(default_factory=list) + apt_packages: list[str] = dataclasses.field(default_factory=list) + brew_packages: list[str] = dataclasses.field(default_factory=list) + cmake_toolchain_file: str = "" + cmake_arguments: list[str] = dataclasses.field(default_factory=list) + cmake_build_arguments: list[str] = dataclasses.field(default_factory=list) + clang_tidy: bool = True + cppflags: list[str] = dataclasses.field(default_factory=list) + cc: str = "" + cxx: str = "" + cflags: list[str] = dataclasses.field(default_factory=list) + cxxflags: list[str] = dataclasses.field(default_factory=list) + ldflags: list[str] = dataclasses.field(default_factory=list) + pollute_directories: list[str] = dataclasses.field(default_factory=list) + use_cmake: bool = True + shared: bool = True + static: bool = True + run_tests: bool = True + test_pkg_config: bool = True + cc_from_cmake: bool = False + source_cmd: str = "" + java: bool = False + android_apks: list[str] = dataclasses.field(default_factory=list) + android_ndk: bool = False + android_mk: bool = False + android_gradle: bool = False + minidump: bool = False + intel: bool = False + msys2_msystem: str = "" + msys2_env: str = "" + msys2_no_perl: bool = False + werror: bool = True + msvc_vcvars: str = "" + msvc_project: str = "" + msvc_project_flags: list[str] = dataclasses.field(default_factory=list) + setup_ninja: bool = False + setup_libusb_arch: str = "" + xcode_sdk: str = "" + cpactions: bool = False + cpactions_os: str = "" + cpactions_version: str = "" + cpactions_arch: str = "" + cpactions_setup_cmd: str = "" + cpactions_install_cmd: str = "" + + def to_workflow(self) -> dict[str, str|bool]: + data = { + "name": self.name, + "os": self.os, + "container": self.container if self.container else "", + "platform": self.platform, + "artifact": self.artifact, + "shell": self.shell, + "msys2-msystem": self.msys2_msystem, + "msys2-env": self.msys2_env, + "msys2-no-perl": self.msys2_no_perl, + "android-ndk": self.android_ndk, + "java": self.java, + "intel": self.intel, + "apk-packages": my_shlex_join(self.apk_packages), + "apt-packages": my_shlex_join(self.apt_packages), + "test-pkg-config": self.test_pkg_config, + "brew-packages": my_shlex_join(self.brew_packages), + "pollute-directories": my_shlex_join(self.pollute_directories), + "no-cmake": self.no_cmake, + "build-tests": self.build_tests, + "source-cmd": self.source_cmd, + "cmake-config-emulator": self.cmake_config_emulator, + "cc": self.cc, + "cxx": self.cxx, + "cflags": my_shlex_join(self.cppflags + self.cflags), + "cxxflags": my_shlex_join(self.cppflags + self.cxxflags), + "ldflags": my_shlex_join(self.ldflags), + "cmake-toolchain-file": self.cmake_toolchain_file, + "clang-tidy": self.clang_tidy, + "cmake-arguments": my_shlex_join(self.cmake_arguments), + "cmake-build-arguments": my_shlex_join(self.cmake_build_arguments), + "shared": self.shared, + "static": self.static, + "cmake-build-type": self.cmake_build_type, + "run-tests": self.run_tests, + "android-apks": my_shlex_join(self.android_apks), + "android-gradle": self.android_gradle, + "android-mk": self.android_mk, + "werror": self.werror, + "sudo": self.sudo, + "msvc-vcvars": self.msvc_vcvars, + "msvc-project": self.msvc_project, + "msvc-project-flags": my_shlex_join(self.msvc_project_flags), + "setup-ninja": self.setup_ninja, + "setup-libusb-arch": self.setup_libusb_arch, + "cc-from-cmake": self.cc_from_cmake, + "xcode-sdk": self.xcode_sdk, + "cpactions": self.cpactions, + "cpactions-os": self.cpactions_os, + "cpactions-version": self.cpactions_version, + "cpactions-arch": self.cpactions_arch, + "cpactions-setup-cmd": self.cpactions_setup_cmd, + "cpactions-install-cmd": self.cpactions_install_cmd, + } + return {k: v for k, v in data.items() if v != ""} + + +def my_shlex_join(s): + def escape(s): + if s[:1] == "'" and s[-1:] == "'": + return s + if set(s).intersection(set("; \t")): + return f'"{s}"' + return s + + return " ".join(escape(s)) + + +def spec_to_job(spec: JobSpec) -> JobDetails: + job = JobDetails( + name=spec.name, + os=spec.os.value, + artifact=spec.artifact or "", + container=spec.container or "", + platform=spec.platform.value, + sudo="sudo", + no_cmake=spec.no_cmake, + ) + if job.os.startswith("ubuntu"): + job.apt_packages.extend([ + "ninja-build", + "pkg-config", + ]) + win32 = spec.platform in (SdlPlatform.Msys2, SdlPlatform.Msvc) + fpic = None + build_parallel = True + if spec.lean: + job.cppflags.append("-DSDL_LEAN_AND_MEAN=1") + if win32: + job.cmake_arguments.append("-DSDLTEST_PROCDUMP=ON") + job.minidump = True + if spec.intel is not None: + match spec.intel: + case IntelCompiler.Icx: + job.cc = "icx" + job.cxx = "icpx" + case IntelCompiler.Icc: + job.cc = "icc" + job.cxx = "icpc" + job.cppflags.append("-diag-disable=10441") + job.clang_tidy = False + case _: + raise ValueError(f"Invalid intel={spec.intel}") + job.source_cmd = f"source /opt/intel/oneapi/setvars.sh;" + job.intel = True + job.shell = "bash" + job.cmake_arguments.extend(( + f"-DCMAKE_C_COMPILER={job.cc}", + f"-DCMAKE_CXX_COMPILER={job.cxx}", + "-DCMAKE_SYSTEM_NAME=Linux", + )) + match spec.platform: + case SdlPlatform.Msvc: + job.setup_ninja = True + job.clang_tidy = False # complains about \threadsafety: "unknown command tag name [clang-diagnostic-documentation-unknown-command]" + job.msvc_project = spec.msvc_project if spec.msvc_project else "" + job.test_pkg_config = False + job.cmake_arguments.extend(( + "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=ProgramDatabase", + "-DCMAKE_EXE_LINKER_FLAGS=-DEBUG", + "-DCMAKE_SHARED_LINKER_FLAGS=-DEBUG", + )) + if spec.uwp: + job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>DLL'") + else: + job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>'") + if spec.clang_cl: + job.cmake_arguments.extend(( + "-DCMAKE_C_COMPILER=clang-cl", + "-DCMAKE_CXX_COMPILER=clang-cl", + )) + match spec.msvc_arch: + case MsvcArch.X86: + job.cflags.append("/clang:-m32") + job.ldflags.append("/MACHINE:X86") + case MsvcArch.X64: + job.cflags.append("/clang:-m64") + job.ldflags.append("/MACHINE:X64") + case _: + raise ValueError(f"Unsupported clang-cl architecture (arch={spec.msvc_arch})") + if spec.msvc_project: + match spec.msvc_arch: + case MsvcArch.X86: + job.msvc_project_flags.append("-p:Platform=Win32") + case MsvcArch.X64: + job.msvc_project_flags.append("-p:Platform=x64") + case _: + raise ValueError(f"Unsupported vcxproj architecture (arch={spec.msvc_arch})") + match spec.msvc_arch: + case MsvcArch.X86: + job.msvc_vcvars = "x64_x86" + case MsvcArch.X64: + job.msvc_vcvars = "x64" + case MsvcArch.Arm32: + job.msvc_vcvars = "x64_arm" + job.run_tests = False + case MsvcArch.Arm64: + job.msvc_vcvars = "x64_arm64" + job.run_tests = False + if spec.uwp: + job.build_tests = False + job.cmake_arguments.extend(( + "-DCMAKE_SYSTEM_NAME=WindowsStore", + "-DCMAKE_SYSTEM_VERSION=10.0", + )) + job.msvc_project_flags.append("-p:WindowsTargetPlatformVersion=10.0.17763.0") + else: + match spec.msvc_arch: + case MsvcArch.X86: + job.setup_libusb_arch = "x86" + case MsvcArch.X64: + job.setup_libusb_arch = "x64" + case SdlPlatform.Linux: + job.apt_packages.extend(( + "gnome-desktop-testing", + "libasound2-dev", + "libpulse-dev", + "libaudio-dev", + "libjack-dev", + "libsndio-dev", + "libusb-1.0-0-dev", + "libx11-dev", + "libxext-dev", + "libxrandr-dev", + "libxcursor-dev", + "libxfixes-dev", + "libxi-dev", + "libxss-dev", + "libwayland-dev", + "libxkbcommon-dev", + "libdrm-dev", + "libgbm-dev", + "libgl1-mesa-dev", + "libgles2-mesa-dev", + "libegl1-mesa-dev", + "libdbus-1-dev", + "libibus-1.0-dev", + "libudev-dev", + "fcitx-libs-dev", + )) + fpic = True + assert spec.os.value.startswith("ubuntu-") + ubuntu_year, ubuntu_month = [int(v) for v in spec.os.value.removeprefix("ubuntu-").split(".", 1)] + if ubuntu_year >= 22: + job.apt_packages.extend(("libpipewire-0.3-dev", "libdecor-0-dev")) + case SdlPlatform.Ios | SdlPlatform.Tvos: + match spec.platform: + case SdlPlatform.Ios: + job.xcode_sdk = 'iphoneos' + case SdlPlatform.Tvos: + job.xcode_sdk = 'appletvos' + case SdlPlatform.MacOS: + if spec.apple_framework: + job.static = False + job.clang_tidy = False + job.test_pkg_config = False + job.cmake_arguments.extend(( + "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'", + "-DSDL_FRAMEWORK=ON", + )) + else: + job.clang_tidy = True + job.cmake_arguments.extend(( + "-DCMAKE_OSX_ARCHITECTURES=arm64", + "-DCLANG_TIDY_BINARY=$(brew --prefix llvm)/bin/clang-tidy", + )) + job.apt_packages = [] + job.brew_packages.append("ninja") + if job.test_pkg_config: + job.brew_packages.append("pkg-config") + if job.clang_tidy: + job.brew_packages.append("llvm") + case SdlPlatform.Android: + job.android_gradle = spec.android_gradle + job.android_mk = spec.android_mk + job.run_tests = False + if spec.android_mk or not spec.no_cmake: + job.android_ndk = True + if spec.android_gradle or not spec.no_cmake: + job.java = True + if spec.android_mk or spec.android_gradle: + job.apt_packages = [] + if not spec.no_cmake: + job.cmake_arguments.extend(( + f"-DANDROID_PLATFORM={spec.android_platform}", + f"-DANDROID_ABI={spec.android_abi}", + )) + job.cmake_toolchain_file = "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" + job.cc = f"${{ANDROID_NDK_HOME}}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target={spec.android_arch}-none-linux-androideabi{spec.android_platform}" + + job.android_apks = [ + "testaudiorecording-apk", + "testautomation-apk", + "testcontroller-apk", + "testmultiaudio-apk", + "testsprite-apk", + ] + case SdlPlatform.Emscripten: + job.run_tests = False + job.shared = False + job.cmake_config_emulator = "emcmake" + job.cmake_build_type = "Debug" + job.test_pkg_config = False + case SdlPlatform.Ps2: + build_parallel = False + job.shared = False + job.sudo = "" + job.apt_packages = [] + job.apk_packages = ["cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", "git", ] + job.cmake_toolchain_file = "${PS2DEV}/ps2sdk/ps2dev.cmake" + job.clang_tidy = False + job.run_tests = False + job.shared = False + job.cc = "mips64r5900el-ps2-elf-gcc" + job.ldflags = ["-L${PS2DEV}/ps2sdk/ee/lib", "-L${PS2DEV}/gsKit/lib", "-L${PS2DEV}/ps2sdk/ports/lib", ] + case SdlPlatform.Psp: + build_parallel = False + job.sudo = "" + job.apt_packages = [] + job.apk_packages = ["cmake", "gmp", "mpc1", "mpfr4", "ninja", "pkgconf", ] + job.cmake_toolchain_file = "${PSPDEV}/psp/share/pspdev.cmake" + job.clang_tidy = False + job.run_tests = False + job.shared = False + job.cc = "psp-gcc" + job.ldflags = ["-L${PSPDEV}/lib", "-L${PSPDEV}/psp/lib", "-L${PSPDEV}/psp/sdk/lib", ] + job.pollute_directories = ["${PSPDEV}/include", "${PSPDEV}/psp/include", "${PSPDEV}/psp/sdk/include", ] + case SdlPlatform.Haiku: + fpic = False + job.run_tests = False + job.cc = "x86_64-unknown-haiku-gcc" + job.cxx = "x86_64-unknown-haiku-g++" + job.sudo = "" + job.cmake_arguments.extend(( + f"-DCMAKE_C_COMPILER={job.cc}", + f"-DCMAKE_CXX_COMPILER={job.cxx}", + "-DCMAKE_SYSTEM_NAME=Haiku", + )) + case SdlPlatform.PowerPC64: + # FIXME: Enable SDL_WERROR + job.werror = False + job.clang_tidy = False + job.run_tests = False + job.sudo = "" + job.apt_packages = [] + case SdlPlatform.LoongArch64: + job.run_tests = False + job.cc = "${LOONGARCH64_CC}" + job.cxx = "${LOONGARCH64_CXX}" + job.cmake_arguments.extend(( + f"-DCMAKE_C_COMPILER={job.cc}", + f"-DCMAKE_CXX_COMPILER={job.cxx}", + "-DCMAKE_SYSTEM_NAME=Linux", + )) + case SdlPlatform.N3ds: + job.shared = False + job.apt_packages = ["ninja-build"] + job.clang_tidy = False + job.run_tests = False + job.cc_from_cmake = True + job.cmake_toolchain_file = "${DEVKITPRO}/cmake/3DS.cmake" + case SdlPlatform.Msys2: + job.shell = "msys2 {0}" + assert spec.msys2_platform + job.msys2_msystem = spec.msys2_platform.value + job.msys2_env = { + "mingw32": "mingw-w64-i686", + "mingw64": "mingw-w64-x86_64", + "clang32": "mingw-w64-clang-i686", + "clang64": "mingw-w64-clang-x86_64", + "ucrt64": "mingw-w64-ucrt-x86_64", + }[spec.msys2_platform.value] + job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, Msys2Platform.Clang32) + case SdlPlatform.Riscos: + # FIXME: Enable SDL_WERROR + job.werror = False + job.apt_packages = ["cmake", "ninja-build"] + job.test_pkg_config = False + job.shared = False + job.run_tests = False + job.sudo = "" + job.cmake_arguments.extend(( + "-DRISCOS:BOOL=ON", + "-DCMAKE_DISABLE_PRECOMPILE_HEADERS:BOOL=ON", + "-DSDL_GCC_ATOMICS:BOOL=OFF", + )) + job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake" + case SdlPlatform.FreeBSD | SdlPlatform.NetBSD: + job.cpactions = True + job.no_cmake = True + job.run_tests = False + job.apt_packages = [] + match spec.platform: + case SdlPlatform.FreeBSD: + job.cpactions_os = "freebsd" + job.cpactions_version = "13.3" + job.cpactions_arch = "x86-64" + job.cpactions_setup_cmd = "sudo pkg update" + job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd" + job.cmake_arguments.extend(( + "-DSDL_CHECK_REQUIRED_INCLUDES=/usr/local/include", + "-DSDL_CHECK_REQUIRED_LINK_OPTIONS=-L/usr/local/lib", + )) + case SdlPlatform.NetBSD: + job.cpactions_os = "netbsd" + job.cpactions_version = "10.0" + job.cpactions_arch = "x86-64" + job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update" + job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1" + case _: + raise ValueError(f"Unsupported platform={spec.platform}") + + if not build_parallel: + job.cmake_build_arguments.append("-j1") + if job.cflags: + job.cmake_arguments.append(f"-DCMAKE_C_FLAGS={my_shlex_join(job.cflags)}") + if job.cxxflags: + job.cmake_arguments.append(f"-DCMAKE_CXX_FLAGS={my_shlex_join(job.cxxflags)}") + if job.ldflags: + job.cmake_arguments.append(f"-DCMAKE_SHARED_LINKER_FLAGS=\"{my_shlex_join(job.ldflags)}\"") + job.cmake_arguments.append(f"-DCMAKE_EXE_LINKER_FLAGS=\"{my_shlex_join(job.ldflags)}\"") + + def tf(b): + return "ON" if b else "OFF" + + if fpic is not None: + job.cmake_arguments.append(f"-DCMAKE_POSITION_INDEPENDENT_CODE={tf(fpic)}") + + return job + + +def main(): + parser = argparse.ArgumentParser(allow_abbrev=False) + parser.add_argument("--github-variable", default="platforms") + parser.add_argument("--github-ci", action="store_true") + parser.add_argument("--verbose", action="store_true") + args = parser.parse_args() + + logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING) + + all_platforms = [] + for spec in JOB_SPECS: + logger.info("spec=%r", spec) + job = spec_to_job(spec) + logger.info("job=%r", job) + platform = job.to_workflow() + logger.info("platform=%r", platform) + all_platforms.append(platform) + + if args.github_ci: + platforms_json = json.dumps(all_platforms) + txt = f"{args.github_variable}={platforms_json}" + logger.info("%s", txt) + if "GITHUB_OUTPUT" in os.environ: + with open(os.environ["GITHUB_OUTPUT"], "a") as f: + f.write(txt) + f.write("\n") + else: + logger.warning("GITHUB_OUTPUT not defined") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) + diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml deleted file mode 100644 index 875b01dc8..000000000 --- a/.github/workflows/emscripten.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build (Emscripten) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - emscripten: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: mymindstorm/setup-emsdk@v14 - with: - version: 3.1.35 - - name: Install ninja - run: | - sudo apt-get -y update - sudo apt-get install -y ninja-build - - name: Configure (CMake) - run: | - emcmake cmake -S . -B build \ - -Wdeprecated -Wdev -Werror \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_INSTALL_PREFIX=prefix \ - -GNinja - - name: Build (CMake) - run: cmake --build build/ --verbose - - name: Run build-time tests - run: | - set -eu - export SDL_TESTS_QUICK=1 - # FIXME: enable Emscripten build time tests - # ctest -VV --test-dir build/ - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - - name: Package (CPack) - run: | - cmake --build build/ --config Debug --target package - - name: Verify CMake configuration files - run: | - emcmake cmake -S cmake/test -B cmake_config_build \ - -DCMAKE_BUILD_TYPE=Debug \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DTEST_SHARED=FALSE \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} - cmake --build cmake_config_build --verbose - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-emscripten - path: build/dist/SDL3* diff --git a/.github/workflows/generic.yml b/.github/workflows/generic.yml new file mode 100644 index 000000000..917b4b735 --- /dev/null +++ b/.github/workflows/generic.yml @@ -0,0 +1,341 @@ +name: 'Build' +run-name: 'Configure, Build and Test SDL' + +on: + workflow_call: + inputs: + platforms: + description: 'JSON-encoded test properties' + type: string + required: true + +jobs: + build: + name: ${{ matrix.platform.name }} + runs-on: ${{ matrix.platform.os }} + container: ${{ matrix.platform.container }} + defaults: + run: + shell: ${{ matrix.platform.shell }} + strategy: + fail-fast: false + matrix: + platform: ${{ fromJSON(inputs.platforms) }} + steps: + - name: 'Set up MSYS2' + if: ${{ matrix.platform.platform == 'msys2' }} + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.platform.msys2-msystem }} + install: >- + ${{ matrix.platform.msys2-env }}-cc + ${{ matrix.platform.msys2-env }}-cmake + ${{ matrix.platform.msys2-env }}-ninja + ${{ (!matrix.platform.msys2-no-perl && format('{0}-perl', matrix.platform.msys2-env)) || '' }} + ${{ matrix.platform.msys2-env }}-pkg-config + ${{ matrix.platform.msys2-env }}-clang-tools-extra + - uses: actions/checkout@v4 + - name: 'Set up ninja' + if: ${{ matrix.platform.setup-ninja }} + uses: ./.github/actions/setup-ninja + - name: 'Set up libusb' + id: libusb + if: ${{ matrix.platform.setup-libusb-arch != '' }} + uses: ./.github/actions/setup-msvc-libusb + with: + arch: ${{ matrix.platform.setup-libusb-arch }} + - uses: mymindstorm/setup-emsdk@v14 + if: ${{ matrix.platform.platform == 'emscripten' }} + with: + version: 3.1.35 + - uses: nttld/setup-ndk@v1 + if: ${{ matrix.platform.android-ndk }} + id: setup-ndk + with: + local-cache: true + ndk-version: r21e + - name: 'Configure Android NDK variables' + if: ${{ matrix.platform.android-ndk }} + shell: sh + run: | + # We cannot use GitHub expressions in the controller job + echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >>$GITHUB_ENV + - uses: actions/setup-java@v4 + if: ${{ matrix.platform.java }} + with: + distribution: 'temurin' + java-version: '17' + - uses: ilammy/msvc-dev-cmd@v1 + if: ${{ matrix.platform.platform == 'msvc' }} + with: + arch: ${{ matrix.platform.msvc-vcvars }} + - name: 'Set up LoongArch64 toolchain' + uses: ./.github/actions/setup-loongarch64-toolchain + id: setup-loongarch64-toolchain + if: ${{ matrix.platform.platform == 'loongarch64' }} + with: + version: '2022.09.0' + - name: 'Configure LoongArch64 variables' + if: ${{ matrix.platform.platform == 'loongarch64' }} + shell: sh + run: | + # We cannot use GitHub expressions in the controller job + echo "LOONGARCH64_CC=${{ steps.setup-loongarch64-toolchain.outputs.cc }}" >>$GITHUB_ENV + echo "LOONGARCH64_CXX=${{ steps.setup-loongarch64-toolchain.outputs.cxx }}" >>$GITHUB_ENV + - name: 'Setup Intel oneAPI toolchain' + id: intel + if: ${{ matrix.platform.intel }} + run: | + # Download the key to system keyring + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + + # Add signed entry to apt sources and configure the APT client to use Intel repository: + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + + # Update package list + sudo apt-get update -y + + # Install oneAPI + sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic + - name: 'Install apk packages' + if: ${{ matrix.platform.apk-packages != '' }} + run: | + ${{ matrix.platform.sudo }} apk update + ${{ matrix.platform.sudo }} apk add ${{ matrix.platform.apk-packages }} + - name: 'Install apt packages' + if: ${{ matrix.platform.apt-packages != '' }} + run: | + ${{ matrix.platform.sudo }} apt-get update + ${{ matrix.platform.sudo }} apt-get install -y ${{ matrix.platform.apt-packages }} + - name: 'Install brew packages' + if: ${{ matrix.platform.brew-packages != '' }} + run: | + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + brew update + brew install ${{ matrix.platform.brew-packages }} + + - name: 'Pollute toolchain with "bad SDL headers' + if: ${{ matrix.platform.pollute-directories != '' }} + #shell: ${{ matrix.platform.shell }} + run: | + # Create "bad" SDL headers in the toolchain. + # SDL sources should not use these. + for include in ${{ matrix.platform.pollute-directories }}; do + toolchain_directory="${include}/SDL3" + echo "Creating directory ${toolchain_directory}" + mkdir -p "${toolchain_directory}/SDL3" + for header in include/SDL3/*.h; do + dest="${toolchain_directory}/SDL3/$(basename "${header}")" + echo "Creating ${dest}" + echo '#error "System SDL headers must not be used by build system"' >"$dest" + done + done + + - name: 'Configure (CMake)' + if: ${{ !matrix.platform.no-cmake }} + #shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + ${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -GNinja \ + -Wdeprecated -Wdev -Werror \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -DSDL_WERROR=${{ matrix.platform.werror }} \ + -DSDL_EXAMPLES=${{ matrix.platform.build-tests }} \ + -DSDL_TESTS=${{ matrix.platform.build-tests }} \ + -DSDL_INSTALL_TESTS=${{ matrix.platform.build-tests }} \ + -DSDL_CLANG_TIDY=${{ matrix.platform.clang-tidy }} \ + -DSDL_DISABLE_INSTALL_DOCS=OFF \ + -DSDL_DISABLE_INSTALL_CPACK=OFF \ + -DSDL_DISABLE_INSTALL_DOCS=OFF \ + ${{ matrix.platform.cmake-arguments }} \ + -DSDL_SHARED=${{ matrix.platform.shared }} \ + -DSDL_STATIC=${{ matrix.platform.static }} \ + -DSDL_VENDOR_INFO="Github Workflow" \ + -DCMAKE_INSTALL_PREFIX=prefix \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} + - name: 'Build (CMake)' + id: build + if: ${{ !matrix.platform.no-cmake }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + cmake --build build --config ${{ matrix.platform.cmake-build-type }} --verbose -- ${{ matrix.platform.cmake-build-arguments }} + - name: 'Run build-time tests (CMake)' + id: tests + if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + set -eu + export SDL_TESTS_QUICK=1 + ctest -VV --test-dir build/ -j2 + if test "${{ runner.os }}" = "Linux"; then + # This should show us the SDL_REVISION + strings build/libSDL3.so.0 | grep SDL- + fi + - name: "Build test apk's (CMake)" + id: apks + if: ${{ steps.build.outcome == 'success' && matrix.platform.android-apks != '' }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + cmake --build build --config ${{ matrix.platform.cmake-build-type }} \ + --target \ + ${{ matrix.platform.android-apks }} \ + --verbose \ + -- ${{ matrix.platform.cmake-build-arguments }} + - name: 'Install (CMake)' + id: install + if: ${{ steps.build.outcome == 'success' }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + cmake --install build --config ${{ matrix.platform.cmake-build-type }} + echo "prefix=$(pwd)/prefix" >> $GITHUB_OUTPUT + ( cd prefix; find . ) | LC_ALL=C sort -u + - name: 'Package (CPack)' + id: package + if: ${{ steps.build.outcome == 'success' }} +# shell: ${{ matrix.platform.shell }} + run: | + # DMG creation on macOS occasionally fails, so try multiple times + # https://gitlab.kitware.com/cmake/cmake/-/issues/25671 + success=0 + max_tries=10 + for i in $(seq $max_tries); do + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target package -- ${{ matrix.platform.cmake-build-arguments }} && success=1 + if test $success = 1; then + break + fi + echo "Package creation failed. Sleep 1 second and try again." + sleep 1 + done + if test $success = 0; then + echo "Package creation failed after $max_tries attempts." + exit 1 + fi + - name: 'Verify CMake configuration files' + if: ${{ steps.install.outcome == 'success' }} +# shell: ${{ matrix.platform.shell }} + run: | + ${{ matrix.platform.source-cmd }} + ${{ matrix.platform.cmake-config-emulator }} cmake -S cmake/test -B cmake_test_build -GNinja \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -DTEST_SHARED=${{ matrix.platform.shared }} \ + -DTEST_STATIC=${{ matrix.platform.static }} \ + ${{ matrix.platform.cmake-arguments }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \ + -DCMAKE_PREFIX_PATH="${{ steps.install.outputs.prefix }}" + cmake --build cmake_test_build --verbose --config ${{ matrix.platform.cmake-build-type }} -- ${{ matrix.platform.cmake-build-arguments }} + - name: 'Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain' + if: ${{ steps.install.outcome == 'success' && matrix.platform.cc-from-cmake }} +# shell: ${{ matrix.platform.shell }} + run: | + cmake -S .github/cmake -B /tmp/cmake_extract \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} \ + -DVAR_PATH=/tmp/env.txt + cat /tmp/env.txt >> $GITHUB_ENV + - name: 'Verify sdl3.pc' +# shell: ${{ matrix.platform.shell }} + if: ${{ steps.install.outcome == 'success' && matrix.platform.test-pkg-config }} + run: | + ${{ matrix.platform.source-cmd }} + ${{ matrix.platform.cc && format('export CC="{0}"', matrix.platform.cc) || '' }} + ${{ matrix.platform.cflags && format('export CFLAGS="{0}"', matrix.platform.cflags) || '' }} + ${{ matrix.platform.ldflags && format('export LDFLAGS="{0}"', matrix.platform.ldflags) || '' }} + export PKG_CONFIG_PATH=${{ steps.install.outputs.prefix }}/lib/pkgconfig + cmake/test/test_pkgconfig.sh + - name: 'Build (cross-platform-actions, BSD)' + id: cpactions + if: ${{ matrix.platform.cpactions }} + uses: cross-platform-actions/action@v0.25.0 + with: + operating_system: ${{ matrix.platform.cpactions-os }} + architecture: ${{ matrix.platform.cpactions-arch }} + version: ${{ matrix.platform.cpactions-version }} + run: | + ${{ matrix.platform.cpactions-setup-cmd }} + ${{ matrix.platform.cpactions-install-cmd }} + cmake -S . -B build -GNinja \ + ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ + -Wdeprecated -Wdev -Werror \ + -DSDL_WERROR=${{ matrix.platform.werror }} \ + -DSDL_DISABLE_INSTALL_DOCS=OFF \ + ${{ matrix.platform.cmake-arguments }} \ + -DSDL_SHARED=${{ matrix.platform.shared }} \ + -DSDL_STATIC=${{ matrix.platform.static }} \ + -DSDL_VENDOR_INFO="Github Workflow" \ + -DCMAKE_INSTALL_PREFIX=prefix \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=${{ matrix.platform.cmake-build-type }} + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --verbose + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target package + + cmake --build build/ --config ${{ matrix.platform.cmake-build-type }} --target clean + rm -rf build/dist/_CPack_Packages + rm -rf build/CMakeFiles + rm -rf build/docs + - name: "Upload Android test apk's" + uses: actions/upload-artifact@v4 + if: ${{ always() && matrix.platform.artifact != '' && steps.apks.outcome == 'success' }} + with: + if-no-files-found: error + name: '${{ matrix.platform.artifact }}-apks' + path: build/test/*.apk + - name: Add msbuild to PATH + id: setup-msbuild + if: ${{ matrix.platform.msvc-project != '' }} + uses: microsoft/setup-msbuild@v2 + - name: Build msbuild + if: ${{ matrix.platform.msvc-project != '' }} + run: | + "$(cygpath -u '${{ steps.setup-msbuild.outputs.msbuildPath }}\msbuild.exe')" ${{ matrix.platform.msvc-project }} -m -p:BuildInParallel=true -p:Configuration=Release ${{ matrix.platform.msvc-project-flags }} + - name: 'Build (Android.mk)' + if: ${{ matrix.platform.android-mk }} + run: | + ./build-scripts/androidbuildlibs.sh + - name: 'Create Gradle project (Android)' + if: ${{ matrix.platform.android-gradle }} + run: | + for folder in build-ndk-build build-cmake; do + python build-scripts/create-android-project.py \ + --output "${folder}" \ + --variant copy \ + org.libsdl.testspriteminimal \ + test/testspriteminimal.c test/icon.h + done + echo "" + echo "Project contents:" + echo "" + find "build-ndk-build/org.libsdl.testspriteminimal" + - name: 'Build Android app (Gradle & ndk-build)' + if: ${{ matrix.platform.android-gradle }} + run: | + cd build-ndk-build/org.libsdl.testspriteminimal + ./gradlew -i assembleRelease + - name: 'Build Android app (Gradle & CMake)' + if: ${{ matrix.platform.android-gradle }} + run: | + cd build-cmake/org.libsdl.testspriteminimal + ./gradlew -i assembleRelease -PBUILD_WITH_CMAKE=1 + - name: 'Build (xcode)' + if: ${{ matrix.platform.xcode-sdk != '' }} + run: | + xcodebuild -project Xcode/SDL/SDL.xcodeproj -target SDL3 -configuration Release -sdk ${{ matrix.platform.xcode-sdk }} clean build + - name: 'Upload binary package' + uses: actions/upload-artifact@v4 + if: ${{ always() && matrix.platform.artifact != '' && (steps.package.outcome == 'success' || steps.cpactions.outcome == 'success') }} + with: + if-no-files-found: error + name: '${{ matrix.platform.artifact }}' + path: build/dist/SDL3* + - name: 'Upload minidumps' + uses: actions/upload-artifact@v4 + if: ${{ always() && steps.tests.outcome == 'failure' && (matrix.platform.platform == 'msvc' || matrix.platform.platform == 'msys2') }} + with: + if-no-files-found: ignore + name: '${{ matrix.platform.artifact }}-minidumps' + path: build/**/*.dmp diff --git a/.github/workflows/haiku.yml b/.github/workflows/haiku.yml deleted file mode 100644 index b157a0cb1..000000000 --- a/.github/workflows/haiku.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Build (Haiku) - -on: [push, pull_request] - -jobs: - haiku: - runs-on: ubuntu-latest - name: Haiku - container: haiku/cross-compiler:x86_64-r1beta4 - steps: - - uses: actions/checkout@v4 - - name: Setup dependencies - run: | - apt-get install pkg-config -y - - name: Configure Haiku environment variables - run: | - echo "CC=x86_64-unknown-haiku-gcc" >> $GITHUB_ENV - echo "CXX=x86_64-unknown-haiku-g++" >> $GITHUB_ENV - - name: Configure (CMake) - run: | - cmake -S . -B build -GNinja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_VENDOR_INFO=Github_Workflow \ - -DCMAKE_INSTALL_PREFIX=cmake_prefix \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_SYSTEM_NAME=Haiku - - name: Build (CMake) - run: | - cmake --build build/ --config Release --verbose --parallel - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV - cmake --install build/ --config Release - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_SYSTEM_NAME=Haiku - cmake --build ./cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-haiku - path: build/dist/SDL3* diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml deleted file mode 100644 index f791e89d5..000000000 --- a/.github/workflows/ios.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Build (iOS/tvOS) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: macos-latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: iOS, target: SDL3, sdk: iphoneos } - - { name: tvOS, target: SDL3, sdk: appletvos } - - steps: - - uses: actions/checkout@v4 - - name: Build - run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build diff --git a/.github/workflows/loongarch64.yml b/.github/workflows/loongarch64.yml deleted file mode 100644 index 174e9d483..000000000 --- a/.github/workflows/loongarch64.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Build (LoongArch64) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - loongarch64: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - platform: - - { toolchain-version: 2022.09.06 } - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - sudo apt-get update -y - sudo apt-get install -y --no-install-recommends cmake ninja-build pkg-config tar wget - - - uses: actions/cache/restore@v4 - id: restore-cache - with: - path: /opt/cross-tools - key: loongarch64-${{ matrix.platform.toolchain-version }} - - - name: Download LoongArch64 gcc+glibc toolchain - if: ${{ !steps.restore-cache.outputs.cache-hit }} - run: | - url="https://github.com/loongson/build-tools/releases/download/${{ matrix.platform.toolchain-version }}/loongarch64-clfs-6.3-cross-tools-gcc-glibc.tar.xz" - - wget "$url" -O /tmp/toolchain.tar.xz - - mkdir -p /opt - tar -C /opt -x -f /tmp/toolchain.tar.xz - - - uses: actions/cache/save@v3 - if: ${{ !steps.restore-cache.outputs.cache-hit }} - with: - path: /opt/cross-tools - key: loongarch64-${{ matrix.platform.toolchain-version }} - - - name: Set-up Loongarch64 build environment - run: | - echo "/opt/cross-tools/bin" >> $GITHUB_PATH - echo "CC=loongarch64-unknown-linux-gnu-gcc" >> $GITHUB_ENV - echo "CXX=loongarch64-unknown-linux-gnu-g++" >> $GITHUB_ENV - - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: | - cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DTEST_SHARED=TRUE \ - -DTEST_STATIC=TRUE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-loongarch64 - path: build/dist/SDL3* diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index f562d640c..000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,188 +0,0 @@ -name: Build - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: ${{ matrix.platform.os }} - - defaults: - run: - shell: ${{ matrix.platform.shell }} - - strategy: - fail-fast: false - matrix: - platform: - - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-mingw32', no-perl: true } - - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-mingw64' } - - { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-msys2-clang32', no-perl: true } - - { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-msys2-clang64' } - - { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64, cmake: '-DSDLTEST_PROCDUMP=ON', artifact: 'SDL-msys2-ucrt64' } - - { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh, artifact: 'SDL-ubuntu20.04' } - - { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true, - source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'} - - { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF', - source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; '} - - { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh, artifact: 'SDL-ubuntu22.04' } - - { name: MacOS (Framework) (x86_64), os: macos-12, shell: sh, cmake-platform: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cmake: '-DSDL_FRAMEWORK=ON -DSDL_CLANG_TIDY=OFF', skip_test_pkgconfig: true, artifact: 'SDL-macos-framework', no-static: true } - - { name: MacOS (Framework) (arm64), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cmake: '-DSDL_FRAMEWORK=ON -DSDL_CLANG_TIDY=OFF', skip_test_pkgconfig: true, no-static: true } - - { name: MacOS (GNU prefix), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_OSX_ARCHITECTURES="arm64"', cmake: '-DCLANG_TIDY_BINARY="$(brew --prefix llvm)/bin/clang-tidy"', artifact: 'SDL-macos-arm64-gnu' } - - { name: iOS (GNU prefix), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cross-build: true, skip_test_pkgconfig: true, artifact: 'SDL-ios-gnu' } - - { name: tvOS (GNU prefix), os: macos-latest, shell: sh, cmake-platform: '-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"', cross-build: true, skip_test_pkgconfig: true, artifact: 'SDL-tvos-gnu' } - - steps: - - name: Set up MSYS2 - if: matrix.platform.shell == 'msys2 {0}' - uses: msys2/setup-msys2@v2 - with: - msystem: ${{ matrix.platform.msystem }} - install: >- - ${{ matrix.platform.msys-env }}-cc - ${{ matrix.platform.msys-env }}-cmake - ${{ matrix.platform.msys-env }}-ninja - ${{ (!matrix.platform.no-perl && format('{0}-perl', matrix.platform.msys-env)) || '' }} - ${{ matrix.platform.msys-env }}-pkg-config - ${{ matrix.platform.msys-env }}-clang-tools-extra - - - name: Setup Linux dependencies - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install build-essential git \ - pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ - libaudio-dev libjack-dev libsndio-dev libusb-1.0-0-dev libx11-dev libxext-dev \ - libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \ - libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ - libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev - - - name: Setup extra Ubuntu 22.04 dependencies - if: matrix.platform.os == 'ubuntu-22.04' - run: | - sudo apt-get install libpipewire-0.3-dev libdecor-0-dev - - - name: Setup Macos dependencies - if: runner.os == 'macOS' - run: | - export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - brew update - brew install \ - ninja \ - pkg-config \ - llvm - - - name: Setup Intel oneAPI - if: matrix.platform.intel - run: | - # Download the key to system keyring - wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ - | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null - - # Add signed entry to apt sources and configure the APT client to use Intel repository: - echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list - - # Update package list - sudo apt-get update -y - - # Install oneAPI - sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic - - - uses: actions/checkout@v4 - - name: Check that versioning is consistent - # We only need to run this once: arbitrarily use the Linux/CMake build - if: "runner.os == 'Linux'" - run: ./build-scripts/test-versioning.sh - - name: Configure (CMake) - run: | - ${{ matrix.platform.source_cmd }} - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_WERROR=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DSDL_CLANG_TIDY=ON \ - -DSDL_DISABLE_INSTALL_DOCS=${{ !matrix.platform.no-perl }} \ - -DCMAKE_INSTALL_PREFIX=cmake_prefix \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DCMAKE_BUILD_TYPE=Release \ - ${{ matrix.platform.cmake-platform }} \ - ${{ matrix.platform.cmake }} - - name: Build (CMake) - id: build - run: | - ${{ matrix.platform.source_cmd }} - cmake --build build/ --config Release --verbose --parallel - - name: Run build-time tests (CMake) - id: tests - if: ${{ !matrix.platform.cross-build }} - run: | - ${{ matrix.platform.source_cmd }} - set -eu - export SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ -j2 - if test "${{ runner.os }}" = "Linux"; then - # This should show us the SDL_REVISION - strings build/libSDL3.so.0 | grep SDL- - fi - - name: Install (CMake) - run: | - ${{ matrix.platform.source_cmd }} - set -eu - cmake --install build/ --config Release - ( cd cmake_prefix; find . ) | LC_ALL=C sort -u - - name: Package (CPack) - if: ${{ always() && steps.build.outcome == 'success' }} - run: | - # DMG creation on macOS occasionally fails, so try multiple times - # https://gitlab.kitware.com/cmake/cmake/-/issues/25671 - success=0 - max_tries=10 - for i in $(seq $max_tries); do - cmake --build build/ --config Release --target package && success=1 - if test $success = 1; then - break - fi - echo "Package creation failed. Sleep 1 second and try again." - sleep 1 - done - if test $success = 0; then - echo "Package creation failed after $max_tries attempts." - exit 1 - fi - - name: Verify CMake configuration files - run: | - ${{ matrix.platform.source_cmd }} - cmake -S cmake/test -B cmake_config_build -G Ninja \ - ${{ matrix.platform.cmake-platform }} \ - -DTEST_SHARED=ON \ - -DTEST_STATIC=${{ !matrix.platform.no-static }} \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=$(echo "${{ github.workspace }}/cmake_prefix" | sed -e 's#\\#/#g') - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - if: ${{ !matrix.platform.skip_test_pkgconfig }} - run: | - ${{ matrix.platform.source_cmd }} - export PKG_CONFIG_PATH=$(echo "${{ github.workspace }}/cmake_prefix/lib/pkgconfig" | sed -e 's#\\#/#g') - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - if: ${{ always() && steps.tests.outcome == 'failure' }} - with: - if-no-files-found: ignore - name: '${{ matrix.platform.artifact }}-minidumps' - path: build/**/*.dmp - - uses: actions/upload-artifact@v4 - if: ${{ always() && matrix.platform.artifact != '' && steps.build.outcome == 'success' }} - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml deleted file mode 100644 index 6554d47ac..000000000 --- a/.github/workflows/msvc.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Build (MSVC) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: windows-latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: 'Windows (x64)', vcvars: 'x64', artifact: 'SDL-VC-x64', project: 'VisualC/SDL.sln', projectflags: '/p:Platform=x64', } - - { name: 'Windows (x86)', vcvars: 'x64_x86', artifact: 'SDL-VC-x86', project: 'VisualC/SDL.sln', projectflags: '/p:Platform=Win32', } - - { name: 'Windows (clang-cl x64)', vcvars: 'x64', artifact: 'SDL-clang-cl-x64', cmake-args: '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl', cppflags: '/clang:-m64', ldflags: '/MACHINE:X64', } - - { name: 'Windows (clang-cl x86)', vcvars: 'x86', artifact: 'SDL-clang-cl-x86', cmake-args: '-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl', cppflags: '/clang:-m32', ldflags: '/MACHINE:X86', } - - { name: 'Windows (ARM)', vcvars: 'x64_arm', artifact: 'SDL-VC-arm32', notests: true, } - - { name: 'Windows (ARM64)', vcvars: 'x64_arm64', artifact: 'SDL-VC-arm64', notests: true, } - - { name: 'UWP (x64)', vcvars: 'x64', artifact: 'SDL-VC-UWP', notests: true, cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF', - project: 'VisualC-WinRT/SDL-UWP.sln', projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0', } - - steps: - - uses: actions/checkout@v4 - - name: Set up ninja - uses: ./.github/actions/setup-ninja - - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: ${{ matrix.platform.vcvars }} - - name: Set up libusb - uses: ./.github/actions/setup-msvc-libusb-action - if: ${{ matrix.platform.libusb-arch != '' }} - id: libusb - with: - arch: ${{ matrix.platform.libusb-arch }} - - 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) - cmakelists_txt = textwrap.dedent(f"""\ - # MSVC runtime library flags are selected by an abstraction - set(CMAKE_POLICY_DEFAULT_CMP0091 "NEW" CACHE STRING "MSVC runtime library flags are selected by an abstraction") - # MSVC debug information format flags are selected by an abstraction - set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction") - cmake_minimum_required(VERSION 3.0...3.25) - project(sdl_user) - # Always build .PDB symbol file - set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format" FORCE) - set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables" FORCE) - set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries" FORCE) - if(WINDOWS_STORE) # WINDOWS_STORE is available AFTER project() - # UWP only supports dynamic runtime - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL" CACHE STRING "MSVC runtime libary" FORCE) - else() - # Use static runtime library - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>" CACHE STRING "MSVC runtime libary" FORCE) - endif() - enable_testing() - add_subdirectory("{ srcdir }" SDL) - """) - print(cmakelists_txt) - with open(f"{ builddir }/CMakeLists.txt", "w") as f: - f.write(cmakelists_txt) - - name: Configure (CMake) - run: cmake -S build -B build -GNinja ` - -Wdeprecated -Wdev -Werror ` - -DCMAKE_BUILD_TYPE=Release ` - -DSDL_WERROR=ON ` - -DSDL_SHARED=ON ` - -DSDL_STATIC=ON ` - -DSDL_TESTS=ON ` - -DSDL_EXAMPLES=ON \ - -DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_STATIC_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DSDL_INSTALL_TESTS=ON ` - -DSDL_VENDOR_INFO="Github Workflow" ` - -DSDL_DISABLE_INSTALL=OFF ` - -DSDL_DISABLE_INSTALL_CPACK=OFF ` - -DSDL_DISABLE_INSTALL_DOCS=OFF ` - -DSDLTEST_PROCDUMP=ON ` - -DLibUSB_ROOT="${{ steps.libusb.outputs.root }}" ` - ${{ matrix.platform.cmake-args }} ` - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - id: build - run: | - cmake --build build/ --config Release --verbose --parallel - - name: Run build-time tests - id: tests - if: ${{ !matrix.platform.notests }} - run: | - $env:SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ -C Release -j2 - - name: Install (CMake) - run: | - echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV - cmake --install build/ - - name: Package (CPack) - if: ${{ always() && steps.build.outcome == 'success' }} - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -GNinja ` - -DCMAKE_BUILD_TYPE=Release ` - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} ` - -DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" ` - -DCMAKE_EXE_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_SHARED_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - -DCMAKE_STATIC_LINKER_FLAGS="${{ matrix.platform.ldflags }}" ` - ${{ matrix.platform.cmake-args }} - cmake --build cmake_config_build --config Release - - name: Add msbuild to PATH - if: ${{ matrix.platform.project != '' }} - uses: microsoft/setup-msbuild@v2 - - name: Build msbuild - if: ${{ matrix.platform.project != '' }} - run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }} - - uses: actions/upload-artifact@v4 - if: ${{ always() && steps.tests.outcome == 'failure' }} - with: - if-no-files-found: ignore - name: '${{ matrix.platform.artifact }}-minidumps' - path: build/**/*.dmp - - uses: actions/upload-artifact@v4 - if: ${{ always() && steps.build.outcome == 'success' }} - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml deleted file mode 100644 index 17025fe6e..000000000 --- a/.github/workflows/n3ds.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Build (Nintendo 3DS) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - n3ds: - runs-on: ubuntu-latest - container: - image: devkitpro/devkitarm:latest - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - apt update - apt install ninja-build - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: | - cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain - run: | - cmake -S .github/cmake -B /tmp/cmake_extract \ - -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DVAR_PATH=/tmp/n3ds_env.txt - cat /tmp/n3ds_env.txt >> $GITHUB_ENV - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-n3ds - path: build/dist/SDL3* diff --git a/.github/workflows/ppc64le.yml b/.github/workflows/ppc64le.yml deleted file mode 100644 index dc3b9de84..000000000 --- a/.github/workflows/ppc64le.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build (PowerPC64) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - ppc64le: - runs-on: ubuntu-latest - container: - image: dockcross/linux-ppc64le:latest - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - apt-get update -y - apt-get install -y cmake ninja-build - - name: Configure (CMake) - run: | - # FIXME: Enable SDL_WERROR - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DSDL_SHARED=ON \ - -DSDL_STATIC=ON \ - -DSDL_WERROR=OFF \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: | - cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DTEST_SHARED=TRUE \ - -DTEST_STATIC=TRUE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-ppc64le - path: build/dist/SDL3* diff --git a/.github/workflows/ps2.yml b/.github/workflows/ps2.yml deleted file mode 100644 index cb5a3c86c..000000000 --- a/.github/workflows/ps2.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Build (Sony Playstation 2) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - ps2: - runs-on: ubuntu-latest - container: ps2dev/ps2dev:latest - steps: - - uses: actions/checkout@v4 - - name: Setup dependencies - run: | - apk update - apk add cmake gmp mpc1 mpfr4 ninja pkgconf make git - - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_INSTALL_PREFIX=cmake_prefix \ - -DCMAKE_BUILD_TYPE=Release - - name: Build (CMake) - run: cmake --build build --config Release --verbose - - name: Install (CMake) - run: | - set -eu - cmake --install build/ --config Release - echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV - ( cd cmake_prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export CC=mips64r5900el-ps2-elf-gcc - export LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib" - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-ps2 - path: build/dist/SDL3* diff --git a/.github/workflows/psp.yml b/.github/workflows/psp.yml deleted file mode 100644 index 26fbb4489..000000000 --- a/.github/workflows/psp.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Build (Sony Playstation Portable) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - psp: - runs-on: ubuntu-latest - container: pspdev/pspdev:latest - steps: - - uses: actions/checkout@v4 - - name: Setup dependencies - run: | - apk update - apk add cmake gmp mpc1 mpfr4 make pkgconf - - name: Pollute PSP SDK with "bad" SDL headers - run: | - # Create "bad" SDL headers in the PSP SDK. - # SDL sources should not use these. - infixes=". psp psp/sdk" - for infix in $infixes; do - directory="$PSPDEV/$infix/include/SDL3" - echo "Creating directory $directory" - mkdir -p "$directory" - for include in include/SDL3/*.h; do - dest="$PSPDEV/$infix/include/SDL3/$(basename "$include")" - echo "Creating $dest" - echo '#error "System SDL headers must not be used by build system"' >"$dest" - done - done - - name: Configure (CMake) - run: | - cmake -S . -B build \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: cmake --build build --config Release --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build --config Release - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build \ - -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DTEST_SHARED=FALSE \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export CC=psp-gcc - export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-psp - path: build/dist/SDL3* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9cd89c696..21bf742e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -561,11 +561,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.10' - - name: 'Setup Android NDK' - uses: nttld/setup-ndk@v1 - with: - local-cache: true - ndk-version: r21e - uses: actions/setup-java@v4 with: distribution: 'temurin' diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml deleted file mode 100644 index 6c521995d..000000000 --- a/.github/workflows/riscos.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build (RISC OS) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: ${{ matrix.platform.name }} - runs-on: ubuntu-latest - container: riscosdotinfo/riscos-gccsdk-4.7:latest - - strategy: - fail-fast: false - matrix: - platform: - - { name: CMake } - - steps: - - name: Setup dependencies - run: apt-get update && apt-get install -y cmake ninja-build - - uses: actions/checkout@v4 - - name: Configure (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \ - -DRISCOS:BOOL=ON \ - -DSDL_GCC_ATOMICS=OFF \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DSDL_VENDOR_INFO="Github Workflow" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake - - name: Build (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: cmake --build build --verbose - - name: Install (CMake) - if: ${{ contains(matrix.platform.name, 'CMake') }} - run: | - echo "SDL3_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV - cmake --install build/ - ( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DTEST_SHARED=OFF \ - -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release \ - ${{ matrix.platform.test_args }} - cmake --build cmake_config_build --verbose - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: SDL-riscos - path: build/dist/SDL3* diff --git a/.github/workflows/visionos.yml.disabled b/.github/workflows/visionos.yml.disabled deleted file mode 100644 index d02a74f84..000000000 --- a/.github/workflows/visionos.yml.disabled +++ /dev/null @@ -1,22 +0,0 @@ -name: Build (visionOS) - -# FIXME: Enable this workflow once CMake 3.28 becomes available on GitHub -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - Build: - name: visionOS - runs-on: macos-latest - - steps: - - uses: actions/checkout@v4 - - name: Configure - run: | - cmake -B build -GXcode -DCMAKE_SYSTEM_NAME=visionOS - - name: Build - run: | - cmake --build build diff --git a/.github/workflows/vita.yml b/.github/workflows/vita.yml deleted file mode 100644 index 036c93908..000000000 --- a/.github/workflows/vita.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Build (Sony Playstation Vita) - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -defaults: - run: - shell: sh - -jobs: - vita: - name: ${{ matrix.platform.name }} - runs-on: ubuntu-latest - container: - image: vitasdk/vitasdk:latest - strategy: - fail-fast: false - matrix: - platform: - - { name: Vita (GLES w/ pib), pib: true, version: 1.1.4, artifact: SDL-vita-pib } - - { name: Vita (GLES w/ PVR_PSP2 + gles4vita), pvr: true, version: 3.9, artifact: SDL-vita-pvr } - - steps: - - uses: actions/checkout@v4 - - name: Install build requirements - run: | - apk update - apk add cmake ninja pkgconf bash tar - - - uses: actions/cache/restore@v4 - id: restore-cache - with: - path: /vita/dependencies - key: ${{ matrix.platform.artifact }}-${{ matrix.platform.version }} - - - name: Download PVR_PSP2 (GLES) - if: ${{ !!matrix.platform.pvr && !steps.restore-cache.outputs.cache-hit }} - run: | - pvr_psp2_version=${{ matrix.platform.version }} - - mkdir -p /vita/dependencies/include - mkdir -p /vita/dependencies/lib - - # Configure PVR_PSP2 headers - wget https://github.com/GrapheneCt/PVR_PSP2/archive/refs/tags/v$pvr_psp2_version.zip -P/tmp - unzip /tmp/v$pvr_psp2_version.zip -d/tmp - cp -r /tmp/PVR_PSP2-$pvr_psp2_version/include/* /vita/dependencies/include - rm /tmp/v$pvr_psp2_version.zip - - # include guard of PVR_PSP2's khrplatform.h does not match the usual one - sed -i -e s/__drvkhrplatform_h_/__khrplatform_h_/ /vita/dependencies/include/KHR/khrplatform.h - - # Configure PVR_PSP2 stub libraries - wget https://github.com/GrapheneCt/PVR_PSP2/releases/download/v$pvr_psp2_version/vitasdk_stubs.zip -P/tmp - unzip /tmp/vitasdk_stubs.zip -d/tmp/pvr_psp2_stubs - find /tmp/pvr_psp2_stubs -type f -name "*.a" -exec cp {} /vita/dependencies/lib \; - rm /tmp/vitasdk_stubs.zip - rm -rf /tmp/pvr_psp2_stubs - - - name: Download gl4es4vita (OpenGL) - if: ${{ !!matrix.platform.pib && !steps.restore-cache.outputs.cache-hit }} - run: | - gl4es4vita_version=${{ matrix.platform.version }} - - mkdir -p /vita/dependencies/include - mkdir -p /vita/dependencies/lib - - # Configure gl4es4vita headers - wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/include.zip -P/tmp - unzip -o /tmp/include.zip -d/vita/dependencies/include - rm /tmp/include.zip - - # Configure gl4es4vita stub libraries - wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp - unzip /tmp/vitasdk_stubs.zip -d/vita/dependencies/lib - - - uses: actions/cache/save@v4 - if: ${{ !steps.restore-cache.outputs.cache-hit }} - with: - path: /vita/dependencies - key: ${{ matrix.platform.artifact }}-${{ matrix.platform.version }} - - - name: Copy PVR_PSP2 (GLES) or gl4es4vita (OpenGL) to vita toolchain dir - run: | - cp -rv /vita/dependencies/* ${VITASDK}/arm-vita-eabi - - - name: Fix vita.toolchain.cmake - run: | - # cache PKG_CONFIG_PATH - sed -i -E 's/set\( PKG_CONFIG_EXECUTABLE "\$\{VITASDK}\/bin\/arm-vita-eabi-pkg-config" )/set( PKG_CONFIG_EXECUTABLE "${VITASDK}\/bin\/arm-vita-eabi-pkg-config" CACHE PATH "Path of pkg-config executable" )/' ${VITASDK}/share/vita.toolchain.cmake - - - name: Configure (CMake) - run: | - cmake -S . -B build -G Ninja \ - -Wdeprecated -Wdev -Werror \ - -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ - -DVIDEO_VITA_PIB=${{ !!matrix.platform.pib }} \ - -DVIDEO_VITA_PVR=${{ !!matrix.platform.pvr }} \ - -DSDL_ARMNEON=ON \ - -DSDL_ARMSIMD=ON \ - -DSDL_WERROR=ON \ - -DSDL_TESTS=ON \ - -DSDL_INSTALL_TESTS=ON \ - -DSDL_EXAMPLES=ON \ - -DSDL_DISABLE_INSTALL_DOCS=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix - - name: Build (CMake) - run: cmake --build build --verbose - - name: Install (CMake) - run: | - echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV - cmake --install build/ - ( cd prefix; find ) | LC_ALL=C sort -u - - name: Package (CPack) - run: | - cmake --build build/ --config Release --target package - - name: Verify CMake configuration files - run: | - cmake -S cmake/test -B cmake_config_build -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ - -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ - -DCMAKE_BUILD_TYPE=Release - cmake --build cmake_config_build --verbose - - name: Verify sdl3.pc - run: | - export CC=arm-vita-eabi-gcc - export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig - cmake/test/test_pkgconfig.sh - - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: ${{ matrix.platform.artifact }} - path: build/dist/SDL3* diff --git a/cmake/sdlcpu.cmake b/cmake/sdlcpu.cmake index 69142bc83..c077fc075 100644 --- a/cmake/sdlcpu.cmake +++ b/cmake/sdlcpu.cmake @@ -79,6 +79,8 @@ ${src_main} include(CMakePushCheckState) + set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") + cmake_push_check_state(RESET) try_compile(SDL_CPU_CHECK_ALL "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch"