Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into SDL3_Saitek_Rudder_Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
tsky1971 committed Jul 20, 2024
2 parents 2c4428a + 71d2662 commit 4244554
Show file tree
Hide file tree
Showing 637 changed files with 40,376 additions and 36,611 deletions.
70 changes: 70 additions & 0 deletions .github/actions/setup-msvc-libusb-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: 'Setup libusb for MSBC'
description: 'Greet someone'
inputs:
version:
description: 'libusb version'
required: true
default: '1.0.27'
arch:
description: "libusb architecture (x86 or x64)"
rqeuired: true
outputs:
root:
description: "libusb root directory"
value: ${{ steps.final.outputs.root }}
runs:
using: 'composite'
steps:
- name: 'Restore cached libusb-${{ inputs.version }}.7z'
id: cache-restore
uses: actions/cache/restore@v4
with:
path: 'C:\temp\libusb-${{ inputs.version }}.7z'
key: libusb-msvc-${{ inputs.version }}
- name: 'Download libusb ${{ inputs.version }}'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/libusb/libusb/releases/download/v${{ inputs.version }}/libusb-${{ inputs.version }}.7z" -OutFile "C:\temp\libusb-${{ inputs.version }}.7z"
- name: 'Cache libusb-${{ inputs.version }}.7z'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
path: 'C:\temp\libusb-${{ inputs.version }}.7z'
key: libusb-msvc-${{ inputs.version }}
- name: 'Extract libusb'
shell: pwsh
run: |
7z "-oC:\temp\libusb-${{ inputs.version }}" x "C:\temp\libusb-${{ inputs.version }}.7z"
- name: 'Set output vars'
id: final
shell: pwsh
run: |
if ('${{ inputs.arch }}' -eq 'x86') {
$archdir = "MS32";
} elseif ('${{ inputs.arch }}' -eq 'x64') {
$archdir = "MS64";
} else {
write-host "Invalid arch=${{ inputs.arch }}"
exit 1
}
$libusb_incdir = "C:\temp\libusb-${{ inputs.version }}\include";
$libusb_libdir = "C:\temp\libusb-${{ inputs.version }}\VS2022\${archdir}\dll";
$libusb_header = "${libusb_incdir}\libusb.h";
$libusb_implib = "${libusb_libdir}\libusb-1.0.lib";
$libusb_dll = "${libusb_libdir}\libusb-1.0.dll";
if (!(Test-Path "${libusb_header}")) {
write-host "${libusb_header} does not exist!"
exit 1
}
if (!(Test-Path "${libusb_implib}")){
write-host "${libusb_implib} does not exist!"
exit 1
}
if (!(Test-Path "${libusb_dll}")) {
write-host "${libusb_dll} does not exist!"
exit 1
}
echo "root=${libusb_incdir};${libusb_libdir}" >> $env:GITHUB_OUTPUT
62 changes: 62 additions & 0 deletions .github/actions/setup-ninja/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Setup ninja'
description: 'Setup ninja'
inputs:
version:
description: 'Ninja version'
default: '1.12.1'
runs:
using: 'composite'
steps:
- name: 'Calculate variables'
id: calc
shell: sh
run: |
case "${{ runner.os }}-${{ runner.arch }}" in
"Linux-X86" | "Linux-X64")
archive="ninja-linux.zip"
;;
"Linux-ARM64")
archive="ninja-linux-aarch64.zip"
;;
"macOS-X86" | "macOS-X64" | "macOS-ARM64")
archive="ninja-mac.zip"
;;
"Windows-X86" | "Windows-X64")
archive="ninja-win.zip"
;;
"Windows-ARM64")
archive="ninja-winarm64.zip"
;;
*)
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
exit 1;
;;
esac
echo "archive=${archive}" >> ${GITHUB_OUTPUT}
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
id: cache-restore
uses: actions/cache/restore@main
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Cache ${{ steps.calc.outputs.archive }}'
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/cache/save@main
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Extract libusb'
shell: pwsh
run: |
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Set output variables'
id: final
shell: pwsh
run: |
echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH
6 changes: 5 additions & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ jobs:
- name: Create Gradle project
if: ${{ matrix.platform.gradle }}
run: |
build-scripts/androidbuild.sh org.libsdl.testspriteminimal test/testspriteminimal.c test/icon.h
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 ""
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cpactions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: FreeBSD, os: freebsd, os-version: 13.2, os-arch: x86-64, artifact: SDL-freebsd-x64,
- { 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: 9.3, os-arch: x86-64, artifact: SDL-netbsd-x64,
- { 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.23.0
uses: cross-platform-actions/action@v0.25.0
with:
operating_system: ${{ matrix.platform.os }}
architecture: ${{ matrix.platform.os-arch }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ jobs:
with:
if-no-files-found: ignore
name: '${{ matrix.platform.artifact }}-minidumps'
path: build/minidumps/*
path: build/**/*.dmp
- uses: actions/upload-artifact@v4
if: ${{ always() && matrix.platform.artifact != '' && steps.build.outcome == 'success' }}
with:
Expand Down
74 changes: 54 additions & 20 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64', artifact: 'SDL-VC-x64' }
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' }
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64, artifact: 'SDL-clang-cl-x64' }
- { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' }
- { name: Windows (ARM), flags: -A ARM, artifact: 'SDL-VC-arm32', notests: true }
- { name: Windows (ARM64), flags: -A ARM64, artifact: 'SDL-VC-arm64', notests: true }
- { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0", nowerror: true, notests: true,
project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0', artifact: 'SDL-VC-UWP' }
- { 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: |
Expand All @@ -35,38 +46,55 @@ jobs:
builddir = f"{ srcdir }/build"
os.makedirs(builddir)
cmakelists_txt = textwrap.dedent(f"""\
# Always build .PDB symbol file
# 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")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format")
set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables")
set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries")
cmake_minimum_required(VERSION 3.0...3.25)
project(sdl_user)
# 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$<$<CONFIG:Debug>:Debug>DLL" CACHE STRING "MSVC runtime libary" FORCE)
else()
# Use static runtime library
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>: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 `
run: cmake -S build -B build -GNinja `
-Wdeprecated -Wdev -Werror `
-DSDL_WERROR=${{ !matrix.platform.nowerror }} `
-DCMAKE_BUILD_TYPE=Release `
-DSDL_WERROR=ON `
-DSDL_SHARED=ON `
-DSDL_STATIC=ON `
-DSDL_TESTS=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 `
${{ matrix.platform.flags }} `
-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 --parallel
cmake --build build/ --config Release --verbose --parallel
- name: Run build-time tests
id: tests
if: ${{ !matrix.platform.notests }}
Expand All @@ -80,12 +108,18 @@ jobs:
- name: Package (CPack)
if: ${{ always() && steps.build.outcome == 'success' }}
run: |
cmake --build build/ --config Release --target PACKAGE
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build `
cmake -S cmake/test -B cmake_config_build -GNinja `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} `
${{ matrix.platform.flags }}
-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 != '' }}
Expand All @@ -98,7 +132,7 @@ jobs:
with:
if-no-files-found: ignore
name: '${{ matrix.platform.artifact }}-minidumps'
path: build/minidumps/*
path: build/**/*.dmp
- uses: actions/upload-artifact@v4
if: ${{ always() && steps.build.outcome == 'success' }}
with:
Expand Down
Loading

0 comments on commit 4244554

Please sign in to comment.