cmake: add CPack support for creating binary archives

main
Anonymous Maarten 2023-01-29 06:12:40 +01:00 committed by Anonymous Maarten
parent 64c97906c9
commit 53d434fd24
14 changed files with 350 additions and 172 deletions

View File

@ -16,7 +16,7 @@ jobs:
matrix: matrix:
platform: platform:
- { name: Android.mk } - { name: Android.mk }
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" } - { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64" }
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -57,6 +57,10 @@ jobs:
cmake --install build --config Release cmake --install build --config Release
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
( cd prefix; find ) | LC_ALL=C sort -u ( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
if: ${{ matrix.platform.name == 'CMake' }}
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files - name: Verify CMake configuration files
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ matrix.platform.name == 'CMake' }}
run: | run: |
@ -73,3 +77,9 @@ jobs:
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 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 export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
if: ${{ matrix.platform.name == 'CMake' }}
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*

View File

@ -18,7 +18,7 @@ jobs:
run: | run: |
sudo apt-get -y update sudo apt-get -y update
sudo apt-get install -y ninja-build sudo apt-get install -y ninja-build
- name: Configure CMake - name: Configure (CMake)
run: | run: |
emcmake cmake -S . -B build \ emcmake cmake -S . -B build \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
@ -28,7 +28,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix \ -DCMAKE_INSTALL_PREFIX=prefix \
-GNinja -GNinja
- name: Build - name: Build (CMake)
run: cmake --build build/ --verbose run: cmake --build build/ --verbose
- name: Run build-time tests - name: Run build-time tests
run: | run: |
@ -36,10 +36,13 @@ jobs:
export SDL_TESTS_QUICK=1 export SDL_TESTS_QUICK=1
# FIXME: enable Emscripten build time tests # FIXME: enable Emscripten build time tests
# ctest -VV --test-dir build/ # ctest -VV --test-dir build/
- name: Install - name: Install (CMake)
run: | run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/ cmake --install build/
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files - name: Verify CMake configuration files
run: | run: |
emcmake cmake -S cmake/test -B cmake_config_build \ emcmake cmake -S cmake/test -B cmake_config_build \
@ -48,3 +51,8 @@ jobs:
-DTEST_SHARED=FALSE \ -DTEST_SHARED=FALSE \
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
cmake --build cmake_config_build --verbose cmake --build cmake_config_build --verbose
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-emscripten
path: build/dist/SDL3*

View File

@ -18,14 +18,16 @@ jobs:
run: | run: |
container-init & timeout 600 vmshell exit 0 container-init & timeout 600 vmshell exit 0
- name: Setup Haiku dependencies - name: Setup Haiku dependencies
run: vmshell pkgman install -y cmd:cmake cmd:gcc cmd:ld cmd:ninja cmd:pkg_config haiku_devel devel:libgl devel:libglu run: |
vmshell pkgman install -y cmd:cmake cmd:gcc cmd:ld cmd:ninja cmd:pkg_config haiku_devel devel:libgl devel:libglu
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Copy project to VM - name: Copy project to VM
run: | run: |
vmshell mkdir ./src/ vmshell mkdir ./src/
tar -cf - ./ | vmshell tar -xf - -C ./src/ tar -cf - ./ | vmshell tar -xf - -C ./src/
- name: Configure (CMake) - name: Configure (CMake)
run: vmshell cmake -S src -B build -GNinja \ run: |
vmshell cmake -S src -B build -GNinja \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
-DSDL_TESTS=ON \ -DSDL_TESTS=ON \
-DSDL_WERROR=ON \ -DSDL_WERROR=ON \
@ -44,6 +46,9 @@ jobs:
- name: Install (CMake) - name: Install (CMake)
run: | run: |
vmshell cmake --install ./build/ --config Release vmshell cmake --install ./build/ --config Release
- name: Package (CPack)
run: |
vmshell cmake --build build/ --config Release --target package
- name: Verify CMake configuration files - name: Verify CMake configuration files
run: | run: |
vmshell cmake -S ./src/cmake/test -B cmake_config_build -G Ninja \ vmshell cmake -S ./src/cmake/test -B cmake_config_build -G Ninja \
@ -53,3 +58,11 @@ jobs:
- name: Verify sdl3.pc - name: Verify sdl3.pc
run: | run: |
vmshell CC=c++ PKG_CONFIG_PATH=\$PWD/cmake_prefix/lib/pkgconfig src/cmake/test/test_pkgconfig.sh vmshell CC=c++ PKG_CONFIG_PATH=\$PWD/cmake_prefix/lib/pkgconfig src/cmake/test/test_pkgconfig.sh
- name: Copy package from VM
run: |
vmshell tar -cf - build/dist/ | tar -xf - -C ./
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-haiku
path: build/dist/SDL3*

View File

@ -19,15 +19,15 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, artifact: 'mingw32'} - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686, artifact: 'SDL-mingw32' }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, artifact: 'mingw64' } - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64, artifact: 'SDL-mingw64' }
- { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, artifact: 'clang32' } - { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686, artifact: 'SDL-msys2-clang32' }
- { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64, artifact: 'clang64' } - { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64, artifact: 'SDL-msys2-clang64' }
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64, artifact: 'ucrt64' } - { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64, artifact: 'SDL-msys2-ucrt64' }
- { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh, artifact: 'ubuntu20.04' } - { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh, artifact: 'SDL-ubuntu20.04' }
- { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh, artifact: 'ubuntu22.04' } - { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh, artifact: 'SDL-ubuntu22.04' }
- { name: MacOS (Framework), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DSDL_FRAMEWORK=ON', skip_test_pkgconfig: true, artifact: 'macos-framework' } - { name: MacOS (Framework), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DSDL_FRAMEWORK=ON', skip_test_pkgconfig: true, artifact: 'SDL-macos-framework' }
- { name: MacOS (GNU prefix), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64"', artifact: 'macos-gnu' } - { name: MacOS (GNU prefix), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64"', artifact: 'SDL-macos-gnu' }
steps: steps:
- name: Set up MSYS2 - name: Set up MSYS2
@ -95,6 +95,9 @@ jobs:
set -eu set -eu
cmake --install build/ --config Release cmake --install build/ --config Release
( cd cmake_prefix; find . ) | LC_ALL=C sort -u ( 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 - name: Verify CMake configuration files
run: | run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \ cmake -S cmake/test -B cmake_config_build -G Ninja \
@ -110,5 +113,6 @@ jobs:
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }} name: ${{ matrix.platform.artifact }}
path: cmake_prefix/ path: build/dist/SDL3*

View File

@ -15,16 +15,16 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64' } - { 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' } - { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32', artifact: 'SDL-VC-x86' }
- { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON } - { name: Windows static VCRT (x64), flags: -A x64 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x64' }
- { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON } - { name: Windows static VCRT (x86), flags: -A Win32 -DSDL_FORCE_STATIC_VCRT=ON, artifact: 'SDL-VC-static-VCRT-x86' }
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64 } - { 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 } - { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32, artifact: 'SDL-clang-cl-x86' }
- { name: Windows (ARM), flags: -A ARM } - { name: Windows (ARM), flags: -A ARM, artifact: 'SDL-VC-arm32' }
- { name: Windows (ARM64), flags: -A ARM64 } - { name: Windows (ARM64), flags: -A ARM64, artifact: 'SDL-VC-arm64' }
- { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, nowerror: true, - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, nowerror: true,
project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' } project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0', artifact: 'SDL-VC-UWP' }
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -50,6 +50,7 @@ jobs:
-DSDL_INSTALL_TESTS=ON ` -DSDL_INSTALL_TESTS=ON `
-DSDL_VENDOR_INFO="Github Workflow" ` -DSDL_VENDOR_INFO="Github Workflow" `
-DSDL_DISABLE_INSTALL=OFF ` -DSDL_DISABLE_INSTALL=OFF `
-DSDL_DISABLE_INSTALL_CPACK=OFF `
${{ matrix.platform.flags }} ` ${{ matrix.platform.flags }} `
-DCMAKE_INSTALL_PREFIX=prefix -DCMAKE_INSTALL_PREFIX=prefix
- name: Build (CMake) - name: Build (CMake)
@ -63,6 +64,9 @@ jobs:
run: | run: |
echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
cmake --install build/ cmake --install build/
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target PACKAGE
- name: Verify CMake configuration files - name: Verify CMake configuration files
if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP
run: | run: |
@ -77,3 +81,8 @@ jobs:
- name: Build msbuild - name: Build msbuild
if: ${{ matrix.platform.project != '' }} if: ${{ matrix.platform.project != '' }}
run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }} run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*

View File

@ -17,7 +17,7 @@ jobs:
run: | run: |
apt update apt update
apt install ninja-build apt install ninja-build
- name: Configure CMake - name: Configure (CMake)
run: | run: |
cmake -S . -B build -G Ninja \ cmake -S . -B build -G Ninja \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
@ -28,13 +28,17 @@ jobs:
-DSDL_VENDOR_INFO="Github Workflow" \ -DSDL_VENDOR_INFO="Github Workflow" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix -DCMAKE_INSTALL_PREFIX=prefix
- name: Build - name: Build (CMake)
run: cmake --build build --verbose run: |
- name: Install CMake cmake --build build --verbose
- name: Install (CMake)
run: | run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/ cmake --install build/
( cd prefix; find ) | LC_ALL=C sort -u ( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files - name: Verify CMake configuration files
run: | run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \ cmake -S cmake/test -B cmake_config_build -G Ninja \
@ -54,3 +58,8 @@ jobs:
run: | run: |
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-n3ds
path: build/dist/SDL3*

View File

@ -34,7 +34,7 @@ jobs:
-DSDL_TESTS=ON \ -DSDL_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=cmake_prefix \ -DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release
- name: Build - name: Build (CMake)
run: cmake --build build --config Release --verbose --parallel run: cmake --build build --config Release --verbose --parallel
- name: Install (CMake) - name: Install (CMake)
run: | run: |
@ -42,6 +42,9 @@ jobs:
cmake --install build/ --config Release cmake --install build/ --config Release
echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
( cd cmake_prefix; find ) | LC_ALL=C sort -u ( 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 - name: Verify CMake configuration files
run: | run: |
@ -70,3 +73,8 @@ jobs:
name: tests-${{ steps.slug.outputs.sha8 }} name: tests-${{ steps.slug.outputs.sha8 }}
path: | path: |
build/test build/test
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-ps2
path: build/dist/SDL3*

View File

@ -16,7 +16,7 @@ jobs:
run: | run: |
apk update apk update
apk add cmake gmp mpc1 mpfr4 make pkgconf apk add cmake gmp mpc1 mpfr4 make pkgconf
- name: Configure CMake - name: Configure (CMake)
run: | run: |
cmake -S . -B build \ cmake -S . -B build \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
@ -26,13 +26,16 @@ jobs:
-DSDL_INSTALL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix -DCMAKE_INSTALL_PREFIX=prefix
- name: Build - name: Build (CMake)
run: cmake --build build --config Release --verbose run: cmake --build build --config Release --verbose
- name: Install - name: Install (CMake)
run: | run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build --config Release cmake --install build --config Release
( cd prefix; find ) | LC_ALL=C sort -u ( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files - name: Verify CMake configuration files
run: | run: |
cmake -S cmake/test -B cmake_config_build \ cmake -S cmake/test -B cmake_config_build \
@ -47,3 +50,8 @@ jobs:
export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-psp
path: build/dist/SDL3*

View File

@ -44,6 +44,9 @@ jobs:
echo "SDL3_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV echo "SDL3_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV
cmake --install build/ cmake --install build/
( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u ( 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 - name: Verify CMake configuration files
run: | run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \ cmake -S cmake/test -B cmake_config_build -G Ninja \
@ -52,3 +55,8 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.test_args }} ${{ matrix.platform.test_args }}
cmake --build cmake_config_build --verbose cmake --build cmake_config_build --verbose
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-riscos
path: build/dist/SDL3*

View File

@ -20,8 +20,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: GLES (pib), os: windows-latest, pib: true } - { name: Vita (GLES w/ pib), os: windows-latest, pib: true, artifact: SDL-vita-pib }
- { name: GLES (PVR_PSP2 + gl4es4vita), os: windows-latest, pvr: true } - { name: Vita (GLES w/ PVR_PSP2 + gles4vita), os: windows-latest, pvr: true, artifact: SDL-vita-pvr }
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -65,7 +65,7 @@ jobs:
wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp wget https://github.com/SonicMastr/gl4es4vita/releases/download/v$gl4es4vita_version-vita/vitasdk_stubs.zip -P/tmp
unzip /tmp/vitasdk_stubs.zip -d${VITASDK}/arm-vita-eabi/lib unzip /tmp/vitasdk_stubs.zip -d${VITASDK}/arm-vita-eabi/lib
- name: Configure CMake - name: Configure (CMake)
run: | run: |
cmake -S . -B build -G Ninja \ cmake -S . -B build -G Ninja \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
@ -77,13 +77,16 @@ jobs:
-DSDL_INSTALL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix -DCMAKE_INSTALL_PREFIX=prefix
- name: Build - name: Build (CMake)
run: cmake --build build --verbose run: cmake --build build --verbose
- name: Install CMake - name: Install (CMake)
run: | run: |
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
cmake --install build/ cmake --install build/
( cd prefix; find ) | LC_ALL=C sort -u ( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack)
run: |
cmake --build build/ --config Release --target package
- name: Verify CMake configuration files - name: Verify CMake configuration files
run: | run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \ cmake -S cmake/test -B cmake_config_build -G Ninja \
@ -97,3 +100,8 @@ jobs:
export CC=arm-vita-eabi-gcc export CC=arm-vita-eabi-gcc
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3*

View File

@ -50,6 +50,13 @@ jobs:
run: | run: |
cmake -S . -B build -GNinja \ cmake -S . -B build -GNinja \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
-DCMAKE_BUILD_TYPE=Release \
-DSDL_CHECK_REQUIRED_INCLUDES="/usr/local/include" \ -DSDL_CHECK_REQUIRED_INCLUDES="/usr/local/include" \
-DSDL_CHECK_REQUIRED_LINK_OPTIONS="-L/usr/local/lib" -DSDL_CHECK_REQUIRED_LINK_OPTIONS="-L/usr/local/lib"
cmake --build build --verbose -- -j`sysctl -n hw.ncpu` cmake --build build/ --config Release --verbose -- -j`sysctl -n hw.ncpu`
cmake --build build/ --config Release --target package
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: SDL-freebsd
path: build/dist/SDL3*

View File

@ -104,6 +104,8 @@ set(SDL_DYLIB_COMPAT_VERSION "${SDL_DYLIB_COMPAT_VERSION_MAJOR}.${SDL_DYLIB_COMP
#message("SDL_SO_VERSION=${SDL_SO_VERSION} SDL_DYLIB_CURRENT_VERSION=${SDL_DYLIB_CURRENT_VERSION} SDL_DYLIB_COMPAT_VERSION=${SDL_DYLIB_COMPAT_VERSION}") #message("SDL_SO_VERSION=${SDL_SO_VERSION} SDL_DYLIB_CURRENT_VERSION=${SDL_DYLIB_CURRENT_VERSION} SDL_DYLIB_COMPAT_VERSION=${SDL_DYLIB_COMPAT_VERSION}")
set(SDL_FRAMEWORK_VERSION "A")
SDL_DetectCPUArchitecture() SDL_DetectCPUArchitecture()
# Check for 64 or 32 bit # Check for 64 or 32 bit
@ -357,6 +359,7 @@ endforeach()
# Allow some projects to be built conditionally. # Allow some projects to be built conditionally.
set_option(SDL_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT}) set_option(SDL_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT})
cmake_dependent_option(SDL_DISABLE_INSTALL_CPACK "Create binary SDL3 archive using CPack" ${SDL3_SUBPROJECT} "NOT SDL_DISABLE_INSTALL" OFF)
set_option(SDL_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF) set_option(SDL_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF)
option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
@ -3149,7 +3152,7 @@ if(SDL_SHARED)
if(SDL_FRAMEWORK) if(SDL_FRAMEWORK)
set_target_properties(SDL3 PROPERTIES set_target_properties(SDL3 PROPERTIES
PUBLIC_HEADER "${SDL3_INCLUDE_FILES}" PUBLIC_HEADER "${SDL3_INCLUDE_FILES}"
FRAMEWORK_VERSION "A" FRAMEWORK_VERSION "${SDL_FRAMEWORK_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3" MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3"
RESOURCE "${SDL_FRAMEWORK_RESOURCES}" RESOURCE "${SDL_FRAMEWORK_RESOURCES}"
) )
@ -3217,7 +3220,7 @@ if(SDL_STATIC)
) )
if(SDL_FRAMEWORK) if(SDL_FRAMEWORK)
set_target_properties(SDL3-static PROPERTIES set_target_properties(SDL3-static PROPERTIES
FRAMEWORK_VERSION "A" FRAMEWORK_VERSION "${SDL_FRAMEWORK_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3-static" MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3-static"
RESOURCE "${SDL_FRAMEWORK_RESOURCES}" RESOURCE "${SDL_FRAMEWORK_RESOURCES}"
) )
@ -3263,7 +3266,7 @@ if(SDL_TEST)
) )
if(SDL_FRAMEWORK) if(SDL_FRAMEWORK)
set_target_properties(SDL3_test PROPERTIES set_target_properties(SDL3_test PROPERTIES
FRAMEWORK_VERSION "A" FRAMEWORK_VERSION "${SDL_FRAMEWORK_VERSION}"
MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3_test" MACOSX_FRAMEWORK_IDENTIFIER "org.libsdl.SDL3_test"
RESOURCE "${SDL_FRAMEWORK_RESOURCES}" RESOURCE "${SDL_FRAMEWORK_RESOURCES}"
) )
@ -3297,50 +3300,46 @@ if(NOT SDL_DISABLE_INSTALL)
if(WINDOWS AND NOT MINGW) if(WINDOWS AND NOT MINGW)
set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}") set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}")
set(LICENSES_PREFIX "licenses/SDL3") set(SDL_INSTALL_LICENSEDIR "licenses/SDL3")
set(RESOURCES_PREFIX ".") set(SDL_INSTALL_HEADERSDIR "${CMAKE_INSTALL_INCLUDEDIR}/SDL3")
set(PUBLIC_HEADER_PREFIX "${CMAKE_INSTALL_INCLUDEDIR}/SDL3")
elseif(SDL_FRAMEWORK) elseif(SDL_FRAMEWORK)
set(SDL_INSTALL_CMAKEDIR "SDL3.framework/Resources/CMake") set(SDL_INSTALL_CMAKEDIR "SDL3.framework/Versions/${SDL_FRAMEWORK_VERSION}/Resources/CMake")
set(LICENSES_PREFIX "Resources") set(SDL_INSTALL_LICENSEDIR "Resources")
set(RESOURCES_PREFIX "Resources") set(SDL_INSTALL_HEADERSDIR "Headers")
set(PUBLIC_HEADER_PREFIX "Headers")
else() else()
set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}/SDL3") set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_ROOT}/SDL3")
set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") set(SDL_INSTALL_LICENSEDIR "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}")
set(RESOURCES_PREFIX ".") set(SDL_INSTALL_HEADERSDIR "${CMAKE_INSTALL_INCLUDEDIR}/SDL3")
set(PUBLIC_HEADER_PREFIX "${CMAKE_INSTALL_INCLUDEDIR}/SDL3")
endif() endif()
##### Installation targets ##### if(SDL_FRAMEWORK)
set(SDL_SDL_INSTALL_RESOURCEDIR "SDL3.framework/Resources")
set(SDL_SDL_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_RESOURCEDIR}/CMake")
set(SDL_SDL_INSTALL_REAL_RESOURCEDIR "SDL3.framework/Versions/${SDL_FRAMEWORK_VERSION}/Resources")
set(SDL_SDL_INSTALL_REAL_CMAKEDIR "${SDL_SDL_INSTALL_REAL_RESOURCEDIR}/CMake")
install(TARGETS SDL3_Headers EXPORT SDL3headersTargets) # - Install other SDL3*Config.cmake files in SDL3*.framework/Resources/CMake
# - The *_RELATIVE_CMAKEDIR variables are the symlinked folders visible from outside
set(SDL_SDLstatic_INSTALL_RESOURCEDIR "SDL3-static.framework/Resources")
set(SDL_SDLstatic_INSTALL_CMAKEDIR "${SDL_SDLstatic_INSTALL_RESOURCEDIR}/CMake")
set(SDL_SDLstatic_INSTALL_CMAKEFILENAME "SDL3-staticConfig.cmake")
if(SDL_SHARED) set(SDL_SDLtest_INSTALL_RESOURCEDIR "SDL3_test.framework/Resources")
install(TARGETS SDL3 EXPORT SDL3Targets set(SDL_SDLtest_INSTALL_CMAKEDIR "${SDL_SDLtest_INSTALL_RESOURCEDIR}/CMake")
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" set(SDL_SDLtest_INSTALL_CMAKEFILENAME "SDL3_testConfig.cmake")
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" else()
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" set(SDL_SDL_INSTALL_RESOURCEDIR ".")
FRAMEWORK DESTINATION "." set(SDL_SDL_INSTALL_CMAKEDIR ${SDL_INSTALL_CMAKEDIR})
PUBLIC_HEADER DESTINATION "${PUBLIC_HEADER_PREFIX}" set(SDL_SDL_INSTALL_REAL_CMAKEDIR ${SDL_INSTALL_CMAKEDIR})
RESOURCE DESTINATION "${RESOURCES_PREFIX}"
)
endif()
if(SDL_STATIC) # Install SDL3*Targets.cmake files in lib/cmake/SDL3
install(TARGETS SDL3-static EXPORT SDL3staticTargets set(SDL_SDLstatic_INSTALL_RESOURCEDIR ".")
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" set(SDL_SDLstatic_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_CMAKEDIR}")
FRAMEWORK DESTINATION "." set(SDL_SDLstatic_INSTALL_CMAKEFILENAME "SDL3staticTargets.cmake")
RESOURCE DESTINATION "${RESOURCES_PREFIX}"
)
endif()
if(SDL_TEST) set(SDL_SDLtest_INSTALL_RESOURCEDIR ".")
install(TARGETS SDL3_test EXPORT SDL3testTargets set(SDL_SDLtest_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_CMAKEDIR}")
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" set(SDL_SDLtest_INSTALL_CMAKEFILENAME "SDL3_testTargets.cmake")
FRAMEWORK DESTINATION "."
RESOURCE DESTINATION "${RESOURCES_PREFIX}"
)
endif() endif()
##### sdl3.pc ##### ##### sdl3.pc #####
@ -3382,37 +3381,48 @@ if(NOT SDL_DISABLE_INSTALL)
install(FILES ${SDL3_BINARY_DIR}/sdl3.pc DESTINATION "${SDL_PKGCONFIG_INSTALLDIR}") install(FILES ${SDL3_BINARY_DIR}/sdl3.pc DESTINATION "${SDL_PKGCONFIG_INSTALLDIR}")
endif() endif()
##### Installation targets #####()
install(TARGETS SDL3_Headers EXPORT SDL3headersTargets)
if(SDL_SHARED)
install(TARGETS SDL3 EXPORT SDL3Targets
PUBLIC_HEADER DESTINATION "${SDL_INSTALL_HEADERSDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
FRAMEWORK DESTINATION "."
RESOURCE DESTINATION "${SDL_SDL_INSTALL_RESOURCEDIR}"
)
endif()
if(SDL_STATIC)
install(TARGETS SDL3-static EXPORT SDL3staticTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
FRAMEWORK DESTINATION "."
RESOURCE DESTINATION "${SDL_SDLstatic_INSTALL_RESOURCEDIR}"
)
endif()
if(SDL_TEST)
install(TARGETS SDL3_test EXPORT SDL3testTargets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
FRAMEWORK DESTINATION "."
RESOURCE DESTINATION "${SDL_SDLtest_INSTALL_RESOURCEDIR}"
)
endif()
##### CMake Export files ##### ##### CMake Export files #####
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
configure_package_config_file(cmake/SDL3Config.cmake.in SDL3Config.cmake configure_package_config_file(cmake/SDL3Config.cmake.in SDL3Config.cmake
PATH_VARS CMAKE_INSTALL_PREFIX PATH_VARS CMAKE_INSTALL_PREFIX
INSTALL_DESTINATION "${SDL_INSTALL_CMAKEDIR}" INSTALL_DESTINATION "${SDL_SDL_INSTALL_CMAKEDIR}"
) )
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake" write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion COMPATIBILITY AnyNewerVersion
) )
if(SDL_FRAMEWORK)
set(SDL_SDL_INSTALL_CMAKEDIR "SDL3.framework/Resources/CMake")
# Install SDL3*Config.cmake files in SDL3*.framework/Resources/CMake
set(SDL_SDLstatic_INSTALL_CMAKEDIR "SDL3-static.framework/Resources/CMake")
set(SDL_SDLstatic_INSTALL_CMAKEFILE "SDL3-staticConfig.cmake")
set(SDL_SDLtest_INSTALL_CMAKEDIR "SDL3_test.framework/Resources/CMake")
set(SDL_SDLtest_INSTALL_CMAKEFILE "SDL3_testConfig.cmake")
else()
set(SDL_SDL_INSTALL_CMAKEDIR ${SDL_INSTALL_CMAKEDIR})
# Install SDL3*Targets.cmake files in lib/cmake/SDL3
set(SDL_SDLstatic_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_CMAKEDIR}")
set(SDL_SDLstatic_INSTALL_CMAKEFILE "SDL3staticTargets.cmake")
set(SDL_SDLtest_INSTALL_CMAKEDIR "${SDL_SDL_INSTALL_CMAKEDIR}")
set(SDL_SDLtest_INSTALL_CMAKEFILE "SDL3_testTargets.cmake")
endif()
install(EXPORT SDL3headersTargets install(EXPORT SDL3headersTargets
FILE "SDL3headersTargets.cmake" FILE "SDL3headersTargets.cmake"
NAMESPACE SDL3:: NAMESPACE SDL3::
@ -3429,7 +3439,7 @@ if(NOT SDL_DISABLE_INSTALL)
if(SDL_STATIC) if(SDL_STATIC)
install(EXPORT SDL3staticTargets install(EXPORT SDL3staticTargets
FILE "${SDL_SDLstatic_INSTALL_CMAKEFILE}" FILE "${SDL_SDLstatic_INSTALL_CMAKEFILENAME}"
NAMESPACE SDL3:: NAMESPACE SDL3::
DESTINATION "${SDL_SDLstatic_INSTALL_CMAKEDIR}" DESTINATION "${SDL_SDLstatic_INSTALL_CMAKEDIR}"
) )
@ -3437,35 +3447,46 @@ if(NOT SDL_DISABLE_INSTALL)
if(SDL_TEST) if(SDL_TEST)
install(EXPORT SDL3testTargets install(EXPORT SDL3testTargets
FILE "${SDL_SDLtest_INSTALL_CMAKEFILE}" FILE "${SDL_SDLtest_INSTALL_CMAKEFILENAME}"
NAMESPACE SDL3:: NAMESPACE SDL3::
DESTINATION "${SDL_SDLtest_INSTALL_CMAKEDIR}" DESTINATION "${SDL_SDLtest_INSTALL_CMAKEDIR}"
) )
endif() endif()
install( install(FILES
FILES
${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake
${SDL3_SOURCE_DIR}/cmake/sdlfind.cmake ${SDL3_SOURCE_DIR}/cmake/sdlfind.cmake
DESTINATION "${SDL_SDL_INSTALL_CMAKEDIR}" DESTINATION "${SDL_SDL_INSTALL_REAL_CMAKEDIR}"
COMPONENT Devel
) )
if(NOT SDL_FRAMEWORK) if(NOT SDL_FRAMEWORK)
install( install(FILES ${SDL3_INCLUDE_FILES}
FILES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
${SDL3_INCLUDE_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL3
) )
if(SDL_TEST) if(SDL_TEST)
install( install(FILES ${SDL3_TEST_INCLUDE_FILES}
FILES ${SDL3_TEST_INCLUDE_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL3"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL3
) )
endif() endif()
install(FILES "LICENSE.txt" DESTINATION "${LICENSES_PREFIX}") install(FILES "LICENSE.txt" DESTINATION "${SDL_INSTALL_LICENSEDIR}")
endif()
if(NOT SDL_DISABLE_INSTALL_CPACK)
if(SDL_FRAMEWORK)
set(CPACK_GENERATOR "DragNDrop")
elseif(MSVC)
set(CPACK_GENERATOR "ZIP")
else()
set(CPACK_GENERATOR "TGZ")
endif()
configure_file(cmake/CPackProjectConfig.cmake.in CPackProjectConfig.cmake @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${SDL3_BINARY_DIR}/CPackProjectConfig.cmake")
# CPACK_SOURCE_PACKAGE_FILE_NAME must end with "-src" (so we can block creating a source archive)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "SDL${PROJECT_VERSION_MAJOR}-${PROJECT_VERSION}-src")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/dist")
include(CPack)
endif() endif()
endif() endif()

View File

@ -0,0 +1,36 @@
if(CPACK_PACKAGE_FILE_NAME MATCHES ".*-src$")
message(FATAL_ERROR "Creating source archives for SDL @PROJECT_VERSION@ is not supported.")
endif()
set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
set(SDL_CMAKE_PLATFORM "@SDL_CMAKE_PLATFORM@")
set(SDL_CPU_NAMES "@SDL_CPU_NAMES@")
list(SORT SDL_CPU_NAMES)
string(REPLACE ";" "-" SDL_CPU_NAMES_WITH_DASHES "${SDL_CPU_NAMES}")
if(SDL_CPU_NAMES_WITH_DASHES)
set(SDL_CPU_NAMES_WITH_DASHES "-${SDL_CPU_NAMES_WITH_DASHES}")
endif()
string(TOLOWER "${SDL_CMAKE_PLATFORM}" lower_sdl_cmake_platform)
string(TOLOWER "${SDL_CPU_NAMES}" lower_sdl_cpu_names)
if(lower_sdl_cmake_platform STREQUAL lower_sdl_cpu_names)
set(SDL_CPU_NAMES_WITH_DASHES)
endif()
set(MSVC @MSVC@)
set(MINGW @MINGW@)
if(MSVC)
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-VC")
elseif(MINGW)
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-mingw")
endif()
set(CPACK_PACKAGE_FILE_NAME "SDL@PROJECT_VERSION_MAJOR@-@PROJECT_VERSION@-${SDL_CMAKE_PLATFORM}${SDL_CPU_NAMES_WITH_DASHES}")
if(CPACK_GENERATOR STREQUAL "DragNDrop")
set(CPACK_DMG_VOLUME_NAME "SDL@PROJECT_VERSION_MAJOR@ @PROJECT_VERSION@")
# FIXME: use pre-built/create .DS_Store through AppleScript (CPACK_DMG_DS_STORE/CPACK_DMG_DS_STORE_SETUP_SCRIPT)
set(CPACK_DMG_DS_STORE "${PROJECT_SOURCE_DIR}/Xcode/SDL/pkg-support/resources/SDL_DS_Store")
endif()

View File

@ -2,75 +2,104 @@ macro(SDL_DetectCMakePlatform)
set(SDL_CMAKE_PLATFORM ) set(SDL_CMAKE_PLATFORM )
# Get the platform # Get the platform
if(WIN32) if(WIN32)
set(SDL_CMAKE_PLATFORM WINDOWS) set(SDL_CMAKE_PLATFORM Windows)
elseif(UNIX AND NOT APPLE) elseif(PSP)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux") set(SDL_CMAKE_PLATFORM psp)
set(SDL_CMAKE_PLATFORM LINUX) elseif(APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(SDL_CMAKE_PLATFORM Darwin)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(SDL_CMAKE_PLATFORM MacosX)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(SDL_CMAKE_PLATFORM tvOS)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
# !!! FIXME: remove the version check when we start requiring >= 3.14.0
if(CMAKE_VERSION VERSION_LESS 3.14)
set(SDL_CMAKE_PLATFORM iOS)
endif()
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
set(SDL_CMAKE_PLATFORM Haiku)
elseif(NINTENDO_3DS)
set(SDL_CMAKE_PLATFORM n3ds)
elseif(PS2)
set(SDL_CMAKE_PLATFORM ps2)
elseif(VITA)
set(SDL_CMAKE_PLATFORM Vita)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(SDL_CMAKE_PLATFORM Linux)
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*") elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(SDL_CMAKE_PLATFORM FREEBSD) set(SDL_CMAKE_PLATFORM FreeBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*") elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
set(SDL_CMAKE_PLATFORM NETBSD) set(SDL_CMAKE_PLATFORM NetBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*") elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(SDL_CMAKE_PLATFORM OPENBSD) set(SDL_CMAKE_PLATFORM OpenBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*") elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
set(SDL_CMAKE_PLATFORM GNU) set(SDL_CMAKE_PLATFORM GNU)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*") elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
set(SDL_CMAKE_PLATFORM BSDI) set(SDL_CMAKE_PLATFORM BSDi)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD") elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(SDL_CMAKE_PLATFORM FREEBSD) set(SDL_CMAKE_PLATFORM FreeBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*") elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
set(SDL_CMAKE_PLATFORM SYSV5) set(SDL_CMAKE_PLATFORM SYSV5)
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*") elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
set(SDL_CMAKE_PLATFORM SOLARIS) set(SDL_CMAKE_PLATFORM Solaris)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*") elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
set(SDL_CMAKE_PLATFORM HPUX) set(SDL_CMAKE_PLATFORM HPUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*") elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
set(SDL_CMAKE_PLATFORM AIX) set(SDL_CMAKE_PLATFORM AIX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*") elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
set(SDL_CMAKE_PLATFORM MINIX) set(SDL_CMAKE_PLATFORM Minix)
endif() elseif(CMAKE_SYSTEM_NAME MATCHES "Android.*")
elseif(APPLE) set(SDL_CMAKE_PLATFORM Android)
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(SDL_CMAKE_PLATFORM DARWIN)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(SDL_CMAKE_PLATFORM MACOSX)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(SDL_CMAKE_PLATFORM TVOS)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
# !!! FIXME: remove the version check when we start requiring >= 3.14.0
if(CMAKE_VERSION VERSION_LESS 3.14)
set(SDL_CMAKE_PLATFORM IOS)
endif()
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*") elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
message_error("BeOS support has been removed as of SDL 2.0.2.") message_error("BeOS support has been removed as of SDL 2.0.2.")
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
set(SDL_CMAKE_PLATFORM HAIKU)
elseif(NINTENDO_3DS)
set(SDL_CMAKE_PLATFORM N3DS)
endif() endif()
if(SDL_CMAKE_PLATFORM) if(SDL_CMAKE_PLATFORM)
set(${SDL_CMAKE_PLATFORM} TRUE) string(TOUPPER "${SDL_CMAKE_PLATFORM}" _upper_platform)
set(${_upper_platform} TRUE)
else()
set(SDL_CMAKE_PLATFORM} "unknown")
endif() endif()
endmacro() endmacro()
function(SDL_DetectCPUArchitecture) function(SDL_DetectCPUArchitecture)
set(archs x86 x64 arm32 arm64 loongarch64) set(sdl_cpu_names)
set(found FALSE) if(APPLE AND CMAKE_OSX_ARCHITECTURES)
foreach(arch ${archs}) foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
string(TOUPPER "${arch}" arch_upper) if(osx_arch STREQUAL "x86_64")
set(var_name "SDL_CPU_${arch_upper}") list(APPEND sdl_cpu_names "x64")
if(found) elseif(osx_arch STREQUAL "arm64")
set(${var_name} 0 PARENT_SCOPE) list(APPEND sdl_cpu_names "arm64")
else()
check_cpu_architecture(${arch} ${var_name})
set(found ${${var_name}})
set(${var_name} ${${var_name}} PARENT_SCOPE)
set(SDL_CPU_NAME ${arch})
endif() endif()
endforeach() endforeach()
if(NOT found)
message(AUTHOR_WARNING "Unknown architecture (failed archs=${archs})")
set(SDL_CPU_NAME "(unknown)")
endif() endif()
set(sdl_known_archs x86 x64 arm32 arm64 loongarch64)
if(NOT sdl_cpu_names)
set(found FALSE)
foreach(sdl_known_arch ${sdl_known_archs})
if(NOT found)
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
check_cpu_architecture(${sdl_known_arch} ${var_name})
if(${var_name})
list(APPEND sdl_cpu_names ${sdl_known_arch})
set(found TRUE)
endif()
endif()
endforeach()
endif()
foreach(sdl_known_arch ${sdl_known_archs})
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
if(sdl_cpu_names MATCHES "(^|;)${sdl_known_arch}($|;)") # FIXME: use if(IN_LIST)
set(${var_name} 1 PARENT_SCOPE)
else()
set(${var_name} 0 PARENT_SCOPE)
endif()
endforeach()
set(SDL_CPU_NAMES ${sdl_cpu_names} PARENT_SCOPE)
endfunction() endfunction()