Compare commits

..
Author SHA1 Message Date
Sam Lantinga f070c83a60 Updated to version 2.26.2 for release 2023-01-03 06:45:18 -08:00
Sam Lantinga d992d4f23e Fixed keyboard scancode mapping for parenthesis
(thanks to @meyraud705 for tracking down the root cause!)

Fixes https://github.com/libsdl-org/SDL/issues/6787
Closes https://github.com/libsdl-org/SDL/pull/6937

(cherry picked from commit e1bd5bd071)
(cherry picked from commit 74229d4a41)
2022-12-29 14:56:14 -08:00
Sam Lantinga 81975cc2d0 Fixed getting the VID/PID of a virtual joystick
(cherry picked from commit e40a96155f)
(cherry picked from commit 29a4c5ebc2)
2022-12-28 12:53:07 -08:00
Sam Lantinga 278c78e34c Make sure we match the same way when adding a mapping and looking up a mapping
Fixes https://github.com/libsdl-org/SDL/issues/6898

(cherry picked from commit 3db9112ef4)
2022-12-28 10:00:00 +03:00
Ozkan Sezer 2462262e0c SDL_thread.h: fix SDL_CreateThreadWithStackSize macro for OS/2
(cherry-picked from commit 738442b82a)
2022-12-27 00:15:37 +03:00
Ozkan Sezer 162f8e6ee7 SDL_thread.h: fix beginthread param of SDL_CreateThreadWithStackSize for win32
(cherry-picked from commit 29ba5f5d64)
2022-12-27 00:15:37 +03:00
Vincent Hamm d0f8e63ed6 Fix SDL_CreateThreadWithStackSize not passing staacksize with win32 static api 2022-12-27 00:15:37 +03:00
Sam Lantinga 690e2f21f2 Don't send Razer devices the Sony third-party query feature report
Some of them lock up or reset, and the vast majority of devices are not actually game controllers.

Fixes https://github.com/libsdl-org/SDL/issues/6733

(cherry picked from commit 83b29f9ce1)
2022-12-20 00:28:00 +03:00
Sylvain Becker 52176e25e1 DBus: add a reference to the connection
Fixed bug #6712
2022-12-14 17:58:57 +01:00
Ryan C. Gordon 40698ee33c wasapi: Fixed incorrect assertions.
Fixes #6795.
(cherry-picked from commit 12486e144b)
2022-12-13 14:00:20 +03:00
Sam Lantinga 6b5610752b Don't try to open the Razer Huntsman Elite keyboard as a controller
(cherry picked from commit 817454cfe6)
2022-12-13 01:20:11 -08:00
Sam Lantinga 2d86b4ef76 Removed check for _HAVE_STDINT_H, which nobody defines
Fixes https://github.com/libsdl-org/SDL/issues/6619

(cherry picked from commit e29c0661cc)
2022-12-01 12:54:59 -08:00
Sam Lantinga f17058b562 Updated to version 2.26.1 for release 2022-12-01 11:54:51 -08:00
Sam Lantinga 2879f2aeba Fixed crash if GetRectDisplayIndex() is called before SDL_VideoInit()
(cherry picked from commit d87048fd5a)
2022-11-30 14:49:39 -08:00
Anonymous Maarten 45c7d838d4 cmake: use target_link_libraries to pass -Wl,--undefined=WinMain
(cherry-picked from commit e2060de714)
2022-11-29 21:15:22 +03:00
Markus Mittendrein 79373c5a5c SDL_ResampleAudio: Fix float accumulation error
While 78f97108f9 reduced the accumulation error, it was still big enough to cause distortions.
Fixes #6196.

(cherry picked from commit 8145212103)
2022-11-27 21:15:38 -05:00
Joshua Root f4080637c4 Fix build with Xcode < 7
The _Nullable attribute is not available in older versions.

(cherry picked from commit 9a64aa6f95)
2022-11-26 20:37:12 -08:00
Sam Lantinga 92057e683e Temporary hack to address performance issues in https://github.com/libsdl-org/SDL/issues/6581#issuecomment-1327987916 (thanks @icculus!)
(cherry picked from commit 9c8369e097)
2022-11-26 13:11:41 -08:00
Ryan C. Gordon 5edd6846db cocoa: Patched to compile on macOS SDK < 10.10.
Fixes #6586.

(cherry picked from commit fa5adcafd5)
2022-11-26 14:00:59 -05:00
Michael Fitzmayer 859cb13ef8 Add bitdraw.h, remove non-working stub class
(cherry picked from commit 67f31a19a8)
2022-11-24 13:13:34 -08:00
Anonymous Maarten b97d2ed6c5 cmake: add X11 include dir to check dirs 2022-11-24 20:59:56 +01:00
Sylvain Becker c76a31341c SDL_mfijoystick.m: remove VLA, so that projects can be built with error on vla 2022-11-24 16:08:38 +01:00
Frank Praznik 00731eb011 wayland: Fix build when not using the shared Wayland libraries
Explicitly include the Wayland protocol headers when statically linking against the Wayland libraries or older system headers might be used instead of the local versions.

(cherry picked from commit 836eb22442)
2022-11-24 03:01:49 -08:00
Joshua Root bf70a37606 vulkan_metal.h: Make compatible with ObjC ARC
Fixes #6598

(cherry picked from commit 239423e205)
2022-11-23 17:39:41 -08:00
Frank Praznik da1bddd27c wayland: Fix libdecor_dispatch signature
The function returns an int, not a bool.

(cherry picked from commit f47169fcba)
2022-11-23 15:18:06 -08:00
Joshua Root 9925ee52d7 SDL_mfijoystick.m: fix build with Xcode < 9
Fixes #6601.

(cherry picked from commit 53ca1f7702)
2022-11-23 12:48:34 -08:00
Joshua Root 66620bd108 Check build-time SDK in LoadMainMenuNibIfAvailable
Fixes building against OS X 10.7 SDK.

(cherry picked from commit f8cebeea59)
2022-11-23 12:28:57 -08:00
Joshua Root 72823dd0cd SDL_cocoaopengl.h: ensure CVDisplayLinkRef is defined
The typedef seems to be pulled in coincidentally with newer SDKs, but
older ones need to import the header explicitly.

(cherry picked from commit d2910904fb)
2022-11-23 12:22:55 -08:00
Sam Lantinga 479e972e56 Removed G29 from controller_type.c
We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games.

(cherry picked from commit dce6ed56d7)
2022-11-22 10:58:01 -08:00
Sam Lantinga 3bf150e900 Revert "Added Linux mappings for the Logitech G29 in PS3 and PS4 modes"
This reverts commit 33a68f575f.

We don't want the G29 to show up as a gamepad, Steam will create a virtual Xbox controller for it, which breaks racing games.

(cherry picked from commit e3d430b83e)
2022-11-22 10:57:58 -08:00
Anonymous Maarten a8dd7a10fa android.mk: LOCAL_EXPORT_C_INCLUDES does not need to add include subfolder 2022-11-22 18:36:46 +01:00
1185 changed files with 272492 additions and 64721 deletions

No files matched your search

+4 -5
View File
@@ -16,8 +16,8 @@ AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine AlwaysBreakTemplateDeclarations: MultiLine
@@ -35,7 +35,7 @@ BraceWrapping:
AfterUnion: true AfterUnion: true
AfterExternBlock: false AfterExternBlock: false
BeforeElse: false BeforeElse: false
BeforeWhile: false BeforeWhile: true
IndentBraces: false IndentBraces: false
SplitEmptyFunction: true SplitEmptyFunction: true
SplitEmptyRecord: true SplitEmptyRecord: true
@@ -62,8 +62,7 @@ IndentGotoLabels: true
IndentPPDirectives: None IndentPPDirectives: None
IndentExternBlock: NoIndent IndentExternBlock: NoIndent
PointerAlignment: Right SpaceAfterCStyleCast: true
SpaceAfterCStyleCast: false
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false SpacesInConditionalStatement: false
SpacesInContainerLiterals: true SpacesInContainerLiterals: true
-2
View File
@@ -7,8 +7,6 @@ root = true
[*.{c,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}] [*.{c,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}]
indent_size = 4 indent_size = 4
indent_style = space indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}] [*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}]
indent_size = 2 indent_size = 2
-16
View File
@@ -1,16 +0,0 @@
cmake_minimum_required(VERSION 3.0)
project(ci_utils C CXX)
set(txt "CC=${CMAKE_C_COMPILER}
CXX=${CMAKE_CXX_COMPILER}
CFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_C_STANDARD_LIBRARIES}
")
message("${txt}")
set(VAR_PATH "/tmp/env.txt" CACHE PATH "Where to write environment file")
message(STATUS "Writing CC/CXX/CFLAGS/CXXFLAGS/LDFLAGS environment to ${VAR_PATH}")
file(WRITE "${VAR_PATH}" "${txt}")
+1 -1
View File
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v12 - uses: mymindstorm/setup-emsdk@v10
with: with:
version: 2.0.32 version: 2.0.32
- name: Install ninja - name: Install ninja
+12 -42
View File
@@ -15,22 +15,17 @@ 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 } - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 } - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
- { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 } - { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
- { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 } - { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 } - { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
- { name: Ubuntu 20.04 (CMake), os: ubuntu-20.04, shell: sh } - { name: Ubuntu 20.04 (CMake), os: ubuntu-20.04, shell: sh }
- { name: Ubuntu 20.04 (autotools), os: ubuntu-20.04, shell: sh, autotools: true } - { name: Ubuntu 20.04 (autotools), os: ubuntu-20.04, shell: sh, autotools: true }
- { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel: true, - { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
source_cmd: 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;'} - { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
- { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake: '-DSDL_CLANG_TIDY=OFF', - { name: MacOS (CMake), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
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: MacOS (autotools), os: macos-latest, shell: sh, autotools: true }
- { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
- { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
- { name: MacOS (CMake), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
- { name: MacOS (autotools), os: macos-latest, shell: sh, autotools: true }
steps: steps:
- name: Set up MSYS2 - name: Set up MSYS2
@@ -64,21 +59,7 @@ jobs:
if: runner.os == 'macOS' if: runner.os == 'macOS'
run: | run: |
brew install \ brew install \
ninja \ ninja
pkg-config
- name: Setup Intel oneAPI
if: matrix.platform.intel
run: |
# Setup oneAPI repo
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update -y
# Install oneAPI
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Check that versioning is consistent - name: Check that versioning is consistent
# We only need to run this once: arbitrarily use the Linux/CMake build # We only need to run this once: arbitrarily use the Linux/CMake build
@@ -87,7 +68,6 @@ jobs:
- name: Configure (CMake) - name: Configure (CMake)
if: "! matrix.platform.autotools" if: "! matrix.platform.autotools"
run: | run: |
${{ matrix.platform.source_cmd }}
cmake -S . -B build -G Ninja \ cmake -S . -B build -G Ninja \
-DSDL_TESTS=ON \ -DSDL_TESTS=ON \
-DSDL_WERROR=ON \ -DSDL_WERROR=ON \
@@ -99,12 +79,10 @@ jobs:
- name: Build (CMake) - name: Build (CMake)
if: "! matrix.platform.autotools" if: "! matrix.platform.autotools"
run: | run: |
${{ matrix.platform.source_cmd }}
cmake --build build/ --config Release --verbose --parallel cmake --build build/ --config Release --verbose --parallel
- name: Run build-time tests (CMake) - name: Run build-time tests (CMake)
if: "! matrix.platform.autotools" if: "! matrix.platform.autotools"
run: | run: |
${{ matrix.platform.source_cmd }}
set -eu set -eu
export SDL_TESTS_QUICK=1 export SDL_TESTS_QUICK=1
ctest -VV --test-dir build/ ctest -VV --test-dir build/
@@ -122,7 +100,6 @@ jobs:
- name: Configure (Autotools) - name: Configure (Autotools)
if: matrix.platform.autotools if: matrix.platform.autotools
run: | run: |
${{ matrix.platform.source_cmd }}
set -eu set -eu
rm -fr build-autotools rm -fr build-autotools
mkdir build-autotools mkdir build-autotools
@@ -154,7 +131,6 @@ jobs:
- name: Build (Autotools) - name: Build (Autotools)
if: matrix.platform.autotools if: matrix.platform.autotools
run: | run: |
${{ matrix.platform.source_cmd }}
set -eu set -eu
parallel="$(getconf _NPROCESSORS_ONLN)" parallel="$(getconf _NPROCESSORS_ONLN)"
make -j"${parallel}" -C build-autotools V=1 make -j"${parallel}" -C build-autotools V=1
@@ -164,7 +140,6 @@ jobs:
- name: Run build-time tests (Autotools) - name: Run build-time tests (Autotools)
if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }} if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }}
run: | run: |
${{ matrix.platform.source_cmd }}
set -eu set -eu
curdir="$(pwd)" curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)" parallel="$(getconf _NPROCESSORS_ONLN)"
@@ -177,7 +152,6 @@ jobs:
- name: Install (Autotools) - name: Install (Autotools)
if: matrix.platform.autotools if: matrix.platform.autotools
run: | run: |
${{ matrix.platform.source_cmd }}
set -eu set -eu
curdir="$(pwd)" curdir="$(pwd)"
parallel="$(getconf _NPROCESSORS_ONLN)" parallel="$(getconf _NPROCESSORS_ONLN)"
@@ -189,19 +163,16 @@ jobs:
echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV
- name: Verify CMake configuration files - name: Verify CMake configuration files
run: | run: |
${{ matrix.platform.source_cmd }}
cmake -S cmake/test -B cmake_config_build -G Ninja \ cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
cmake --build cmake_config_build --verbose cmake --build cmake_config_build --verbose
- name: Verify sdl2-config - name: Verify sdl2-config
run: | run: |
${{ matrix.platform.source_cmd }}
export PATH=${{ env.SDL2_DIR }}/bin:$PATH export PATH=${{ env.SDL2_DIR }}/bin:$PATH
cmake/test/test_sdlconfig.sh cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc - name: Verify sdl2.pc
run: | run: |
${{ matrix.platform.source_cmd }}
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
- name: Distcheck (Autotools) - name: Distcheck (Autotools)
@@ -219,7 +190,6 @@ jobs:
- name: Run installed-tests (Autotools) - name: Run installed-tests (Autotools)
if: "runner.os == 'Linux' && matrix.platform.autotools" if: "runner.os == 'Linux' && matrix.platform.autotools"
run: | run: |
${{ matrix.platform.source_cmd }}
set -eu set -eu
parallel="$(getconf _NPROCESSORS_ONLN)" parallel="$(getconf _NPROCESSORS_ONLN)"
sudo make -j"${parallel}" -C build-autotools install sudo make -j"${parallel}" -C build-autotools install
+2 -15
View File
@@ -38,18 +38,5 @@ jobs:
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release
cmake --build cmake_config_build --verbose cmake --build cmake_config_build --verbose
- name: Extract CC/CXX/CFLAGS/CXXFLAGS from CMake toolchain # Not running test_pkgconfig.sh and test_sdlconfig.sh
run: | # as invoking the compiler manually is not supported
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 sdl2-config
run: |
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc
run: |
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh
+2 -2
View File
@@ -50,13 +50,13 @@ jobs:
- name: Verify sdl2-config - name: Verify sdl2-config
run: | run: |
export CC=mips64r5900el-ps2-elf-gcc export CC=mips64r5900el-ps2-elf-gcc
export LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
export PATH=${{ env.SDL2_DIR }}/bin:$PATH export PATH=${{ env.SDL2_DIR }}/bin:$PATH
export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
cmake/test/test_sdlconfig.sh cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc - name: Verify sdl2.pc
run: | run: |
export CC=mips64r5900el-ps2-elf-gcc export CC=mips64r5900el-ps2-elf-gcc
export LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib" export EXTRA_LDFLAGS="-L$PS2DEV/ps2sdk/ee/lib -L$PS2DEV/gsKit/lib -L$PS2DEV/ps2sdk/ports/lib"
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
+2 -2
View File
@@ -39,12 +39,12 @@ jobs:
- name: Verify sdl2-config - name: Verify sdl2-config
run: | run: |
export CC=psp-gcc export CC=psp-gcc
export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
export PATH=${{ env.SDL2_DIR }}/bin:$PATH export PATH=${{ env.SDL2_DIR }}/bin:$PATH
export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
cmake/test/test_sdlconfig.sh cmake/test/test_sdlconfig.sh
- name: Verify sdl2.pc - name: Verify sdl2.pc
run: | run: |
export CC=psp-gcc export CC=psp-gcc
export LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib"
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
-42
View File
@@ -8,61 +8,19 @@ defaults:
jobs: jobs:
vita: vita:
name: ${{ matrix.platform.name }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: vitasdk/vitasdk:latest image: vitasdk/vitasdk:latest
strategy:
fail-fast: false
matrix:
platform:
- { name: GLES (pib), os: windows-latest, pib: true }
- { name: GLES (PVR_PSP2 + gl4es4vita), os: windows-latest, pvr: true }
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install build requirements - name: Install build requirements
run: | run: |
apk update apk update
apk add cmake ninja pkgconf bash apk add cmake ninja pkgconf bash
- name: Configure PVR_PSP2 (GLES)
if: ${{ !!matrix.platform.pvr }}
run: |
pvr_psp2_version=3.9
# 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/* ${VITASDK}/arm-vita-eabi/include
rm /tmp/v$pvr_psp2_version.zip
# 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 {} ${VITASDK}/arm-vita-eabi/lib \;
rm /tmp/vitasdk_stubs.zip
rm -rf /tmp/pvr_psp2_stubs
- name: Configure gl4es4vita (OpenGL)
if: ${{ !!matrix.platform.pvr }}
run: |
gl4es4vita_version=1.1.4
# 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${VITASDK}/arm-vita-eabi/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${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 \
-DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \
-DVIDEO_VITA_PIB=${{ !!matrix.platform.pib }} \
-DVIDEO_VITA_PVR=${{ !!matrix.platform.pvr }} \
-DSDL_WERROR=ON \ -DSDL_WERROR=ON \
-DSDL_TESTS=ON \ -DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \
-6
View File
@@ -62,11 +62,6 @@ cmake-build-*
xcuserdata xcuserdata
*.xcworkspace *.xcworkspace
# for QtCreator
CMakeLists.txt.user
build*/
*.pro.user*
# for Visual C++ # for Visual C++
.vs .vs
Debug Debug
@@ -178,7 +173,6 @@ test/testyuv
test/torturethread test/torturethread
builddir/ builddir/
!build-scripts/
debian/*.debhelper.log debian/*.debhelper.log
debian/*.substvars debian/*.substvars
debian/*.tar.gz debian/*.tar.gz
+4 -6
View File
@@ -1,8 +1,7 @@
projectfullname = SDL2 projectfullname = SDL_mixer
projectshortname = SDL2 projectshortname = SDL_mixer
incsubdir = include incsubdir = include
wikisubdir = SDL2 wikisubdir =
readmesubdir = docs
apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_) apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_)
mainincludefname = SDL.h mainincludefname = SDL.h
versionfname = include/SDL_version.h versionfname = include/SDL_version.h
@@ -11,7 +10,6 @@ versionminorregex = \A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z
versionpatchregex = \A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z versionpatchregex = \A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z
selectheaderregex = \ASDL.*?\.h\Z selectheaderregex = \ASDL.*?\.h\Z
projecturl = https://libsdl.org/ projecturl = https://libsdl.org/
wikiurl = https://wiki.libsdl.org/SDL2 wikiurl = https://wiki.libsdl.org
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0 warn_about_missing = 0
wikipreamble = (This is the legacy documentation for stable SDL2, the current stable version; [SDL3](https://wiki.libsdl.org/SDL3/) is the current development version.)
+1 -2
View File
@@ -63,6 +63,7 @@ LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \ LOCAL_CFLAGS += \
-Wall -Wextra \ -Wall -Wextra \
-Wdocumentation \ -Wdocumentation \
-Wdocumentation-unknown-command \
-Wmissing-prototypes \ -Wmissing-prototypes \
-Wunreachable-code-break \ -Wunreachable-code-break \
-Wunneeded-internal-declaration \ -Wunneeded-internal-declaration \
@@ -77,8 +78,6 @@ LOCAL_CFLAGS += \
# Warnings we haven't fixed (yet) # Warnings we haven't fixed (yet)
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
LOCAL_CXXFLAGS += -std=gnu++11
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
LOCAL_LDFLAGS := -Wl,--no-undefined LOCAL_LDFLAGS := -Wl,--no-undefined
+172 -236
View File
@@ -2,7 +2,7 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the SDL source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there") message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the SDL source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
endif() endif()
cmake_minimum_required(VERSION 3.0.0...3.5) cmake_minimum_required(VERSION 3.0.0)
project(SDL2 C CXX) project(SDL2 C CXX)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
@@ -18,9 +18,6 @@ endif()
set(EXTRA_LIBS) set(EXTRA_LIBS)
set(EXTRA_LDFLAGS) set(EXTRA_LDFLAGS)
set(CMAKE_DEPENDS)
set(PKGCONFIG_DEPENDS)
# This is a virtual "library" that just exists to collect up compiler and # This is a virtual "library" that just exists to collect up compiler and
# linker options that used to be global to this CMake project. When you # linker options that used to be global to this CMake project. When you
# specify it as part of a real library's target_link_libraries(), that # specify it as part of a real library's target_link_libraries(), that
@@ -30,10 +27,16 @@ set(PKGCONFIG_DEPENDS)
add_library(sdl-build-options INTERFACE) add_library(sdl-build-options INTERFACE)
if(WINDOWS_STORE) if(WINDOWS_STORE)
cmake_minimum_required(VERSION 3.11.0)
target_compile_definitions(sdl-build-options INTERFACE "-DSDL_BUILDING_WINRT=1") target_compile_definitions(sdl-build-options INTERFACE "-DSDL_BUILDING_WINRT=1")
target_compile_options(sdl-build-options INTERFACE "-ZW") target_compile_options(sdl-build-options INTERFACE "-ZW")
endif() endif()
# Build in parallel under Visual Studio. Not enabled by default.
if(MSVC)
target_compile_options(sdl-build-options INTERFACE "/MP")
endif()
# CMake 3.0 expands the "if(${A})" in "set(OFF 1);set(A OFF);if(${A})" to "if(1)" # CMake 3.0 expands the "if(${A})" in "set(OFF 1);set(A OFF);if(${A})" to "if(1)"
# CMake 3.24+ emits a warning when not set. # CMake 3.24+ emits a warning when not set.
unset(OFF) unset(OFF)
@@ -71,7 +74,6 @@ find_package(PkgConfig)
list(APPEND CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake")
include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) include(${SDL2_SOURCE_DIR}/cmake/macros.cmake)
include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
include(${SDL2_SOURCE_DIR}/cmake/sdlplatform.cmake)
include(${SDL2_SOURCE_DIR}/cmake/CheckCPUArchitecture.cmake) include(${SDL2_SOURCE_DIR}/cmake/CheckCPUArchitecture.cmake)
# Enable large file support on 32-bit glibc, so that we can access files # Enable large file support on 32-bit glibc, so that we can access files
@@ -83,7 +85,7 @@ endif()
# See docs/release_checklist.md # See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2) set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 28) set(SDL_MINOR_VERSION 26)
set(SDL_MICRO_VERSION 2) set(SDL_MICRO_VERSION 2)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
@@ -133,12 +135,8 @@ set(SDL_GENERATED_HEADERS)
#message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}") #message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}")
check_cpu_architecture(x86 SDL_CPU_X86) # General settings & flags
check_cpu_architecture(x64 SDL_CPU_X64) set(LIBRARY_OUTPUT_DIRECTORY "build")
check_cpu_architecture(arm32 SDL_CPU_ARM32)
check_cpu_architecture(arm64 SDL_CPU_ARM64)
check_cpu_architecture(loongarch64 SDL_CPU_LOONGARCH64)
# Check for 64 or 32 bit # Check for 64 or 32 bit
set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P}) set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P})
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -154,7 +152,56 @@ if(NOT LIBTYPE)
endif() endif()
# Get the platform # Get the platform
SDL_DetectCMakePlatform() if(WIN32)
if(NOT WINDOWS)
set(WINDOWS TRUE)
endif()
elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(LINUX TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(FREEBSD TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
set(NETBSD TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(OPENBSD TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
set(GNU TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
set(BSDI TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(FREEBSD TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
set(SYSV5 TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
set(SOLARIS TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
set(HPUX TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
set(AIX TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
set(MINIX TRUE)
endif()
elseif(APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(DARWIN TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(MACOSX TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(TVOS TRUE)
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(IOS TRUE)
endif()
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
message_error("BeOS support has been removed as of SDL 2.0.2.")
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
set(HAIKU TRUE)
elseif(NINTENDO_3DS)
set(N3DS TRUE)
endif()
# Don't mistake osx for unix # Don't mistake osx for unix
if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT RISCOS) if(UNIX AND NOT ANDROID AND NOT APPLE AND NOT RISCOS)
@@ -207,7 +254,7 @@ else()
endif() endif()
# Compiler info # Compiler info
if(CMAKE_C_COMPILER_ID MATCHES "Clang|IntelLLVM") if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(USE_CLANG TRUE) set(USE_CLANG TRUE)
set(OPT_DEF_ASM TRUE) set(OPT_DEF_ASM TRUE)
# Visual Studio 2019 v16.2 added support for Clang/LLVM. # Visual Studio 2019 v16.2 added support for Clang/LLVM.
@@ -221,18 +268,20 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+ elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+
set(OPT_DEF_ASM TRUE) set(OPT_DEF_ASM TRUE)
#set(CMAKE_C_FLAGS "/ZI /WX- / #set(CMAKE_C_FLAGS "/ZI /WX- /
elseif(CMAKE_C_COMPILER_ID MATCHES "^Intel$")
set(OPT_DEF_ASM TRUE)
set(USE_INTELCC TRUE)
else() else()
set(OPT_DEF_ASM FALSE) set(OPT_DEF_ASM FALSE)
endif() endif()
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG)
set(OPT_DEF_GCC_ATOMICS ON) set(OPT_DEF_GCC_ATOMICS ON)
endif() endif()
# Default option knobs # Default option knobs
if(APPLE OR ARCH_64 OR MSVC_CLANG)
if(NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm")
set(OPT_DEF_SSEMATH ON)
endif()
endif()
if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS) if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS)
set(OPT_DEF_LIBC ON) set(OPT_DEF_LIBC ON)
endif() endif()
@@ -245,11 +294,6 @@ if(NOT ("$ENV{CFLAGS}" STREQUAL ""))
endif() endif()
endif() endif()
# Build in parallel under Visual Studio. Not enabled by default.
if(MSVC AND NOT USE_CLANG)
target_compile_options(sdl-build-options INTERFACE "/MP")
endif()
if(MSVC) if(MSVC)
option(SDL_FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) option(SDL_FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
if(SDL_FORCE_STATIC_VCRT) if(SDL_FORCE_STATIC_VCRT)
@@ -292,8 +336,6 @@ if(WINDOWS)
set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif() endif()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_GNU_SOURCE=1")
# Emscripten toolchain has a nonempty default value for this, and the checks # Emscripten toolchain has a nonempty default value for this, and the checks
# in this file need to change that, so remember the original value, and # in this file need to change that, so remember the original value, and
# restore back to that afterwards. For check_function_exists() to work in # restore back to that afterwards. For check_function_exists() to work in
@@ -327,6 +369,7 @@ endif()
# All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so
# you only need to have a platform override them if they are disabling. # you only need to have a platform override them if they are disabling.
set(OPT_DEF_ASM TRUE)
if(EMSCRIPTEN) if(EMSCRIPTEN)
# Set up default values for the currently supported set of subsystems: # Set up default values for the currently supported set of subsystems:
# Emscripten/Javascript does not have assembly support, a dynamic library # Emscripten/Javascript does not have assembly support, a dynamic library
@@ -390,21 +433,18 @@ set_option(SDL2_DISABLE_UNINSTALL "Disable uninstallation of SDL2" 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")
#set_option(SDL_DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) #set_option(SDL_DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON)
set_option(SDL_ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM})
dep_option(SDL_SSEMATH "Allow GCC to use SSE floating point math" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_SSE "Use SSE assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_SSE2 "Use SSE2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_SSE3 "Use SSE3 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY" OFF)
dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
dep_option(SDL_ARMNEON "Use NEON assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
dep_option(SDL_LSX "Use LSX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_LOONGARCH64" OFF)
dep_option(SDL_LASX "Use LASX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_LOONGARCH64" OFF)
set_option(SDL_LIBC "Use the system C library" ${OPT_DEF_LIBC}) set_option(SDL_LIBC "Use the system C library" ${OPT_DEF_LIBC})
set_option(SDL_GCC_ATOMICS "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS}) set_option(SDL_GCC_ATOMICS "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS})
set_option(SDL_ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM})
set_option(SDL_SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH})
set_option(SDL_MMX "Use MMX assembly routines" ${OPT_DEF_ASM})
set_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM})
set_option(SDL_SSE "Use SSE assembly routines" ${OPT_DEF_ASM})
set_option(SDL_SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH})
set_option(SDL_SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH})
set_option(SDL_ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM})
set_option(SDL_ARMSIMD "use SIMD assembly blitters on ARM" OFF)
set_option(SDL_ARMNEON "use NEON assembly blitters on ARM" OFF)
dep_option(SDL_DBUS "Enable D-Bus support" ON ${UNIX_SYS} OFF) dep_option(SDL_DBUS "Enable D-Bus support" ON ${UNIX_SYS} OFF)
set_option(SDL_DISKAUDIO "Support the disk writer audio driver" ON) set_option(SDL_DISKAUDIO "Support the disk writer audio driver" ON)
set_option(SDL_DUMMYAUDIO "Support the dummy audio driver" ON) set_option(SDL_DUMMYAUDIO "Support the dummy audio driver" ON)
@@ -471,7 +511,6 @@ set_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON)
dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" OFF SDL_HIDAPI OFF) dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" OFF SDL_HIDAPI OFF)
dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF) dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF)
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF)
set_option(SDL_LIBUDEV "Enable libudev support" ON)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "") option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "")
set_option(SDL_CCACHE "Use Ccache to speed up build" ON) set_option(SDL_CCACHE "Use Ccache to speed up build" ON)
@@ -488,6 +527,26 @@ set_option(SDL_INSTALL_TESTS "Install test-cases" OFF)
set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}") set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}")
if(SDL_WERROR)
if(MSVC)
cmake_push_check_state(RESET)
check_c_compiler_flag(/WX HAVE_WX)
if(HAVE_WX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
endif()
elseif(USE_GCC OR USE_CLANG)
cmake_push_check_state(RESET)
check_c_compiler_flag(-Werror HAVE_WERROR)
if(HAVE_WERROR)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -Werror")
endif()
cmake_pop_check_state()
endif()
endif()
if(SDL_HIDAPI) if(SDL_HIDAPI)
if(HIDAPI_ONLY_LIBUSB) if(HIDAPI_ONLY_LIBUSB)
set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE) set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
@@ -526,15 +585,6 @@ file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/video/*.c ${SDL2_SOURCE_DIR}/src/video/*.c
${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)
if(USE_INTELCC)
# warning #39: division by zero
# warning #239: floating point underflow
# warning #264: floating-point value does not fit in required floating-point type
set_property(SOURCE "${SDL2_SOURCE_DIR}/src/libm/e_exp.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -wd239 -wd264")
set_property(SOURCE "${SDL2_SOURCE_DIR}/src/libm/e_log.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -wd39")
set_property(SOURCE "${SDL2_SOURCE_DIR}/src/libm/e_log10.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -wd39")
endif()
set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 1) set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 1)
if(SDL_ASSERTIONS MATCHES "^(auto|)$") if(SDL_ASSERTIONS MATCHES "^(auto|)$")
@@ -563,7 +613,7 @@ if(NOT SDL_FOREGROUNDING_SIGNAL STREQUAL "OFF")
endif() endif()
# Compiler option evaluation # Compiler option evaluation
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG)
# Check for -Wall first, so later things can override pieces of it. # Check for -Wall first, so later things can override pieces of it.
# Note: clang-cl treats -Wall as -Weverything (which is very loud), # Note: clang-cl treats -Wall as -Weverything (which is very loud),
# /W3 as -Wall, and /W4 as -Wall -Wextra. So: /W3 is enough. # /W3 as -Wall, and /W4 as -Wall -Wextra. So: /W3 is enough.
@@ -620,6 +670,11 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC)
endif() endif()
endif() endif()
set(CMAKE_REQUIRED_FLAGS "-mpreferred-stack-boundary=2")
check_c_source_compiles("int x = 0; int main(int argc, char **argv) { return 0; }"
HAVE_GCC_PREFERRED_STACK_BOUNDARY)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "-fvisibility=hidden -Werror") set(CMAKE_REQUIRED_FLAGS "-fvisibility=hidden -Werror")
check_c_source_compiles(" check_c_source_compiles("
#if !defined(__GNUC__) || __GNUC__ < 4 #if !defined(__GNUC__) || __GNUC__ < 4
@@ -636,11 +691,6 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC)
list(APPEND EXTRA_CFLAGS "-Wshadow") list(APPEND EXTRA_CFLAGS "-Wshadow")
endif() endif()
check_c_compiler_flag(-Wunused-local-typedefs HAVE_GCC_WUNUSED_LOCAL_TYPEDEFS)
if(HAVE_GCC_WUNUSED_LOCAL_TYPEDEFS)
list(APPEND EXTRA_CFLAGS "-Wno-unused-local-typedefs")
endif()
if(APPLE) if(APPLE)
cmake_push_check_state(RESET) cmake_push_check_state(RESET)
# FIXME: don't use deprecated declarations # FIXME: don't use deprecated declarations
@@ -701,7 +751,7 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
endif() endif()
if(SDL_ASSEMBLY) if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG OR USE_INTELCC) if(USE_GCC OR USE_CLANG)
# TODO: Those all seem to be quite GCC specific - needs to be # TODO: Those all seem to be quite GCC specific - needs to be
# reworked for better compiler support # reworked for better compiler support
set(HAVE_ASSEMBLY TRUE) set(HAVE_ASSEMBLY TRUE)
@@ -785,9 +835,8 @@ if(SDL_ASSEMBLY)
#ifndef __SSE2__ #ifndef __SSE2__
#error Assembler CPP flag not enabled #error Assembler CPP flag not enabled
#endif #endif
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_SSE2) int main(int argc, char **argv) { return 0; }" HAVE_SSE2)
if(CPU_SUPPORTS_SSE2) if(HAVE_SSE2)
set(HAVE_SSE2 TRUE)
list(APPEND EXTRA_CFLAGS "-msse2") list(APPEND EXTRA_CFLAGS "-msse2")
endif() endif()
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
@@ -809,9 +858,8 @@ if(SDL_ASSEMBLY)
#ifndef __SSE3__ #ifndef __SSE3__
#error Assembler CPP flag not enabled #error Assembler CPP flag not enabled
#endif #endif
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_SSE3) int main(int argc, char **argv) { return 0; }" HAVE_SSE3)
if(CPU_SUPPORTS_SSE3) if(HAVE_SSE3)
set(HAVE_SSE3 TRUE)
list(APPEND EXTRA_CFLAGS "-msse3") list(APPEND EXTRA_CFLAGS "-msse3")
endif() endif()
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
@@ -844,9 +892,9 @@ if(SDL_ASSEMBLY)
vector unsigned int vzero() { vector unsigned int vzero() {
return vec_splat_u32(0); return vec_splat_u32(0);
} }
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_ALTIVEC) int main(int argc, char **argv) { return 0; }" HAVE_ALTIVEC)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
if(CPU_SUPPORTS_ALTIVEC OR HAVE_ALTIVEC_H_HDR) if(HAVE_ALTIVEC OR HAVE_ALTIVEC_H_HDR)
set(HAVE_ALTIVEC TRUE) # if only HAVE_ALTIVEC_H_HDR is set set(HAVE_ALTIVEC TRUE) # if only HAVE_ALTIVEC_H_HDR is set
list(APPEND EXTRA_CFLAGS "-maltivec") list(APPEND EXTRA_CFLAGS "-maltivec")
set(SDL_ALTIVEC_BLITTERS 1) set(SDL_ALTIVEC_BLITTERS 1)
@@ -856,39 +904,6 @@ if(SDL_ASSEMBLY)
endif() endif()
endif() endif()
if(SDL_LSX)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS "-mlsx")
check_c_source_compiles("
#ifndef __loongarch_sx
#error Assembler CPP flag not enabled
#endif
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_LSX)
check_include_file("lsxintrin.h" HAVE_LSXINTRIN_H)
cmake_pop_check_state()
if(CPU_SUPPORTS_LSX AND HAVE_LSXINTRIN_H)
list(APPEND EXTRA_CFLAGS "-mlsx")
set(HAVE_LSX TRUE)
endif()
endif()
if(SDL_LASX)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS "-mlasx")
check_c_source_compiles("
#ifndef __loongarch_asx
#error Assembler CPP flag not enabled
#endif
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_LASX)
check_include_file("lasxintrin.h" HAVE_LASXINTRIN_H)
cmake_pop_check_state()
if(CPU_SUPPORTS_LASX AND HAVE_LASXINTRIN_H)
list(APPEND EXTRA_CFLAGS "-mlasx")
set(HAVE_LASX TRUE)
endif()
endif()
if(SDL_ARMSIMD) if(SDL_ARMSIMD)
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
@@ -947,22 +962,12 @@ if(SDL_ASSEMBLY)
# TODO: SDL_cpuinfo.h needs to support the user's configuration wish # TODO: SDL_cpuinfo.h needs to support the user's configuration wish
# for MSVC - right now it is always activated # for MSVC - right now it is always activated
if(NOT ARCH_64) if(NOT ARCH_64)
if(SDL_MMX) set(HAVE_MMX TRUE)
set(HAVE_MMX TRUE) set(HAVE_3DNOW TRUE)
endif()
if(SDL_3DNOW)
set(HAVE_3DNOW TRUE)
endif()
endif()
if(SDL_SSE)
set(HAVE_SSE TRUE)
endif()
if(SDL_SSE2)
set(HAVE_SSE2 TRUE)
endif()
if(SDL_SSE3)
set(HAVE_SSE3 TRUE)
endif() endif()
set(HAVE_SSE TRUE)
set(HAVE_SSE2 TRUE)
set(HAVE_SSE3 TRUE)
check_include_file("immintrin.h" HAVE_IMMINTRIN_H) check_include_file("immintrin.h" HAVE_IMMINTRIN_H)
endif() endif()
endif() endif()
@@ -1062,8 +1067,7 @@ if(SDL_LIBC)
check_library_exists(m pow "" HAVE_LIBM) check_library_exists(m pow "" HAVE_LIBM)
if(HAVE_LIBM) if(HAVE_LIBM)
set(CMAKE_REQUIRED_LIBRARIES m) set(CMAKE_REQUIRED_LIBRARIES m)
endif() foreach(_FN
foreach(_FN
atan atan2 atanf atan2f ceil ceilf copysign copysignf cos cosf atan atan2 atanf atan2f ceil ceilf copysign copysignf cos cosf
exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f
lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt
@@ -1071,8 +1075,7 @@ if(SDL_LIBC)
string(TOUPPER ${_FN} _UPPER) string(TOUPPER ${_FN} _UPPER)
set(_HAVEVAR "HAVE_${_UPPER}") set(_HAVEVAR "HAVE_${_UPPER}")
check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR}) check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR})
endforeach() endforeach()
if(HAVE_LIBM)
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
if(NOT VITA) if(NOT VITA)
list(APPEND EXTRA_LIBS m) list(APPEND EXTRA_LIBS m)
@@ -1114,10 +1117,6 @@ else()
set(HAVE_STDARG_H 1) set(HAVE_STDARG_H 1)
set(HAVE_STDDEF_H 1) set(HAVE_STDDEF_H 1)
check_include_file(stdint.h HAVE_STDINT_H) check_include_file(stdint.h HAVE_STDINT_H)
if(MSVC AND USE_CLANG)
check_c_compiler_flag("/Q_no-use-libirc" HAS_Q_NO_USE_LIBIRC )
endif()
endif() endif()
endif() endif()
@@ -1486,18 +1485,6 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
ioctl(0, KDENABIO, 1); ioctl(0, KDENABIO, 1);
return 0; return 0;
}" HAVE_INPUT_KBIO) }" HAVE_INPUT_KBIO)
elseif(OPENBSD OR NETBSD)
check_c_source_compiles("
#include <sys/time.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsksymdef.h>
#include <dev/wscons/wsksymvar.h>
#include <sys/ioctl.h>
int main(int argc, char **argv) {
struct wskbd_map_data data;
ioctl(0, WSKBDIO_GETMAP, &data);
return 0;
}" HAVE_INPUT_WSCONS)
endif() endif()
if(HAVE_INPUT_EVENTS) if(HAVE_INPUT_EVENTS)
@@ -1519,11 +1506,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
set(SDL_INPUT_FBSDKBIO 1) set(SDL_INPUT_FBSDKBIO 1)
endif() endif()
if(HAVE_INPUT_WSCONS) check_include_file("libudev.h" HAVE_LIBUDEV_H)
set(SDL_INPUT_WSCONS 1)
endif()
CheckLibUDev()
check_include_file("sys/inotify.h" HAVE_SYS_INOTIFY_H) check_include_file("sys/inotify.h" HAVE_SYS_INOTIFY_H)
check_symbol_exists(inotify_init "sys/inotify.h" HAVE_INOTIFY_INIT) check_symbol_exists(inotify_init "sys/inotify.h" HAVE_INOTIFY_INIT)
check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1) check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1)
@@ -1633,14 +1616,14 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
CheckPTHREAD() CheckPTHREAD()
if(SDL_CLOCK_GETTIME) if(SDL_CLOCK_GETTIME)
check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME_LIBC) check_library_exists(rt clock_gettime "" FOUND_CLOCK_GETTIME_LIBRT)
if(FOUND_CLOCK_GETTIME_LIBC) if(FOUND_CLOCK_GETTIME_LIBRT)
list(APPEND EXTRA_LIBS rt)
set(HAVE_CLOCK_GETTIME 1) set(HAVE_CLOCK_GETTIME 1)
else() else()
check_library_exists(rt clock_gettime "" FOUND_CLOCK_GETTIME_LIBRT) check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME_LIBC)
if(FOUND_CLOCK_GETTIME_LIBRT) if(FOUND_CLOCK_GETTIME_LIBC)
set(HAVE_CLOCK_GETTIME 1) set(HAVE_CLOCK_GETTIME 1)
list(APPEND EXTRA_LIBS rt)
endif() endif()
endif() endif()
endif() endif()
@@ -1720,7 +1703,7 @@ elseif(WINDOWS)
if(MSVC AND NOT SDL_LIBC) if(MSVC AND NOT SDL_LIBC)
# Prevent codegen that would use the VC runtime libraries. # Prevent codegen that would use the VC runtime libraries.
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-;/Gs1048576") set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-")
if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE")
endif() endif()
@@ -1761,7 +1744,7 @@ elseif(WINDOWS)
check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(ddraw.h HAVE_DDRAW_H)
check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dsound.h HAVE_DSOUND_H)
check_include_file(dinput.h HAVE_DINPUT_H) check_include_file(dinput.h HAVE_DINPUT_H)
if(WINDOWS_STORE OR SDL_CPU_ARM32) if(WINDOWS_STORE OR CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
set(HAVE_DINPUT_H 0) set(HAVE_DINPUT_H 0)
endif() endif()
check_include_file(dxgi.h HAVE_DXGI_H) check_include_file(dxgi.h HAVE_DXGI_H)
@@ -1921,7 +1904,7 @@ elseif(WINDOWS)
# Libraries for Win32 native and MinGW # Libraries for Win32 native and MinGW
if(NOT WINDOWS_STORE) if(NOT WINDOWS_STORE)
list(APPEND EXTRA_LIBS kernel32 user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32) list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
endif() endif()
if(WINDOWS_STORE) if(WINDOWS_STORE)
@@ -2501,9 +2484,6 @@ elseif(VITA)
set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_OPENGL_ES2 1)
list(APPEND EXTRA_LIBS list(APPEND EXTRA_LIBS
pib pib
libScePiglet_stub_weak
taihen_stub_weak
SceShaccCg_stub_weak
) )
set(HAVE_VIDEO_VITA_PIB ON) set(HAVE_VIDEO_VITA_PIB ON)
set(SDL_VIDEO_VITA_PIB 1) set(SDL_VIDEO_VITA_PIB 1)
@@ -2516,6 +2496,7 @@ elseif(VITA)
check_include_file(gpu_es4/psp2_pvr_hint.h HAVE_PVR_H) check_include_file(gpu_es4/psp2_pvr_hint.h HAVE_PVR_H)
if(HAVE_PVR_H) if(HAVE_PVR_H)
target_compile_definitions(sdl-build-options INTERFACE "-D__psp2__") target_compile_definitions(sdl-build-options INTERFACE "-D__psp2__")
check_include_file(gl4esinit.h HAVE_GL4ES_H)
set(SDL_VIDEO_OPENGL_EGL 1) set(SDL_VIDEO_OPENGL_EGL 1)
set(HAVE_OPENGLES TRUE) set(HAVE_OPENGLES TRUE)
set(SDL_VIDEO_OPENGL_ES 1) set(SDL_VIDEO_OPENGL_ES 1)
@@ -2526,21 +2507,17 @@ elseif(VITA)
list(APPEND EXTRA_LIBS list(APPEND EXTRA_LIBS
libgpu_es4_ext_stub_weak libgpu_es4_ext_stub_weak
libIMGEGL_stub_weak libIMGEGL_stub_weak
SceIme_stub
) )
set(HAVE_VIDEO_VITA_PVR ON) set(HAVE_VIDEO_VITA_PVR ON)
set(SDL_VIDEO_VITA_PVR 1) set(SDL_VIDEO_VITA_PVR 1)
if(SDL_OPENGL) if(HAVE_GL4ES_H)
check_include_file(gl4esinit.h HAVE_GL4ES_H) set(HAVE_OPENGL TRUE)
if(HAVE_GL4ES_H) set(SDL_VIDEO_OPENGL 1)
set(HAVE_OPENGL TRUE) set(SDL_VIDEO_RENDER_OGL 1)
set(SDL_VIDEO_OPENGL 1) list(APPEND EXTRA_LIBS libGL_stub)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_VITA_PVR_OGL 1)
list(APPEND EXTRA_LIBS libGL_stub)
set(SDL_VIDEO_VITA_PVR_OGL 1)
endif()
endif() endif()
else() else()
@@ -2570,6 +2547,19 @@ elseif(VITA)
SceProcessmgr_stub SceProcessmgr_stub
m m
) )
if(HAVE_VITA_PIB)
list(PREPEND EXTRA_LIBS
pib
libScePiglet_stub
SceShaccCg_stub
taihen_stub
)
endif()
if(HAVE_VITA_PVR)
list(PREPEND EXTRA_LIBS
SceIme_stub
)
endif()
endif() endif()
set(HAVE_ARMSIMD TRUE) set(HAVE_ARMSIMD TRUE)
@@ -2652,7 +2642,7 @@ elseif(PSP)
) )
if(NOT SDL2_DISABLE_SDL2MAIN) if(NOT SDL2_DISABLE_SDL2MAIN)
list(INSERT SDL_LIBS 0 "-lSDL2main") list(INSERT SDL_LIBS 0 "-lSDL2main")
endif() endif(NOT SDL2_DISABLE_SDL2MAIN)
elseif(PS2) elseif(PS2)
list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I$ENV{PS2SDK}/ports/include" "-I$ENV{PS2DEV}/gsKit/include") list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I$ENV{PS2SDK}/ports/include" "-I$ENV{PS2DEV}/gsKit/include")
@@ -2850,17 +2840,6 @@ elseif(N3DS)
else() else()
message_error("SDL_FILE must be enabled to build on N3DS") message_error("SDL_FILE must be enabled to build on N3DS")
endif() endif()
if(NOT SDL2_DISABLE_SDL2MAIN)
list(INSERT SDL_LIBS 0 "-lSDL2main")
endif()
foreach(lib ${CMAKE_C_STANDARD_LIBRARIES})
if(lib MATCHES "^-l")
string(SUBSTRING "${lib}" 2 -1 lib)
endif()
list(APPEND EXTRA_LIBS ${lib})
endforeach()
endif() endif()
if(HAVE_VULKAN AND NOT SDL_LOADSO) if(HAVE_VULKAN AND NOT SDL_LOADSO)
@@ -2947,26 +2926,6 @@ if(NOT SDLMAIN_SOURCES)
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c)
endif() endif()
if(SDL_WERROR)
if(MSVC)
cmake_push_check_state(RESET)
check_c_compiler_flag(/WX HAVE_WX)
if(HAVE_WX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
endif()
elseif(USE_GCC OR USE_CLANG OR USE_INTELCC)
cmake_push_check_state(RESET)
check_c_compiler_flag(-Werror HAVE_WERROR)
if(HAVE_WERROR)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -Werror")
endif()
cmake_pop_check_state()
endif()
endif()
# Append the -MMD -MT flags # Append the -MMD -MT flags
# if(DEPENDENCY_TRACKING) # if(DEPENDENCY_TRACKING)
# if(COMPILER_IS_GNUCC) # if(COMPILER_IS_GNUCC)
@@ -2983,7 +2942,7 @@ string(TOLOWER "${CMAKE_BUILD_TYPE}" lower_build_type)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include-config-${lower_build_type}") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/include-config-${lower_build_type}")
# 3. generate SDL_config in an build_type-dependent folder (which should be first in the include search path) # 3. generate SDL_config in an build_type-dependent folder (which should be first in the include search path)
file(GENERATE file(GENERATE
OUTPUT "${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL2/SDL_config.h" OUTPUT "${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL_config.h"
INPUT "${SDL2_BINARY_DIR}/SDL_config.h.intermediate") INPUT "${SDL2_BINARY_DIR}/SDL_config.h.intermediate")
# Prepare the flags and remove duplicates # Prepare the flags and remove duplicates
@@ -3034,9 +2993,9 @@ else()
endif() endif()
configure_file("${SDL2_SOURCE_DIR}/include/SDL_revision.h.cmake" configure_file("${SDL2_SOURCE_DIR}/include/SDL_revision.h.cmake"
"${SDL2_BINARY_DIR}/include/SDL2/SDL_revision.h") "${SDL2_BINARY_DIR}/include/SDL_revision.h")
# Copy all non-generated headers to "${SDL2_BINARY_DIR}/include/SDL2" # Copy all non-generated headers to "${SDL2_BINARY_DIR}/include"
# This is done to avoid the inclusion of a pre-generated SDL_config.h # This is done to avoid the inclusion of a pre-generated SDL_config.h
file(GLOB SDL2_INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) file(GLOB SDL2_INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h)
set(SDL2_COPIED_INCLUDE_FILES) set(SDL2_COPIED_INCLUDE_FILES)
@@ -3045,7 +3004,7 @@ foreach(_hdr IN LISTS SDL2_INCLUDE_FILES)
list(REMOVE_ITEM SDL2_INCLUDE_FILES "${_hdr}") list(REMOVE_ITEM SDL2_INCLUDE_FILES "${_hdr}")
else() else()
get_filename_component(_name "${_hdr}" NAME) get_filename_component(_name "${_hdr}" NAME)
set(_bin_hdr "${SDL2_BINARY_DIR}/include/SDL2/${_name}") set(_bin_hdr "${SDL2_BINARY_DIR}/include/${_name}")
list(APPEND SDL2_COPIED_INCLUDE_FILES "${_bin_hdr}") list(APPEND SDL2_COPIED_INCLUDE_FILES "${_bin_hdr}")
add_custom_command(OUTPUT "${_bin_hdr}" add_custom_command(OUTPUT "${_bin_hdr}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_hdr}" "${_bin_hdr}" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_hdr}" "${_bin_hdr}"
@@ -3100,7 +3059,6 @@ string(REGEX REPLACE "-lSDL2( |$)" "-l${sdl_static_libname} " SDL_STATIC_LIBS "$
if(NOT SDL_SHARED) if(NOT SDL_SHARED)
string(REGEX REPLACE "-lSDL2( |$)" "-l${sdl_static_libname} " SDL_LIBS "${SDL_LIBS}") string(REGEX REPLACE "-lSDL2( |$)" "-l${sdl_static_libname} " SDL_LIBS "${SDL_LIBS}")
endif() endif()
listtostr(PKGCONFIG_DEPENDS PKGCONFIG_DEPENDS)
if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL2") if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL2")
message(STATUS "\"pkg-config --static --libs sdl2\" will return invalid information") message(STATUS "\"pkg-config --static --libs sdl2\" will return invalid information")
@@ -3181,7 +3139,7 @@ if (SDL_ASAN)
endif() endif()
endif() endif()
if(SDL_CCACHE AND NOT CMAKE_VERSION VERSION_LESS 3.4) if(SDL_CCACHE)
cmake_minimum_required(VERSION 3.4) cmake_minimum_required(VERSION 3.4)
find_program(CCACHE_BINARY ccache) find_program(CCACHE_BINARY ccache)
if(CCACHE_BINARY) if(CCACHE_BINARY)
@@ -3192,8 +3150,6 @@ if(SDL_CCACHE AND NOT CMAKE_VERSION VERSION_LESS 3.4)
else() else()
set(HAVE_CCACHE OFF) set(HAVE_CCACHE OFF)
endif() endif()
else()
set(HAVE_CCACHE OFF)
endif() endif()
if(SDL_TESTS) if(SDL_TESTS)
@@ -3279,11 +3235,7 @@ if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN)
add_dependencies(SDL2main sdl_headers_copy) add_dependencies(SDL2main sdl_headers_copy)
# alias target for in-tree builds # alias target for in-tree builds
add_library(SDL2::SDL2main ALIAS SDL2main) add_library(SDL2::SDL2main ALIAS SDL2main)
target_include_directories(SDL2main BEFORE target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include" PRIVATE "${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>")
PRIVATE "${SDL2_BINARY_DIR}/include"
PRIVATE "${SDL2_BINARY_DIR}/include/SDL2"
PRIVATE "${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL2"
)
target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>) target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
if (WIN32) if (WIN32)
target_link_libraries(SDL2main PRIVATE shell32) target_link_libraries(SDL2main PRIVATE shell32)
@@ -3298,8 +3250,6 @@ if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN)
if (NOT ANDROID) if (NOT ANDROID)
set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif() endif()
set_property(TARGET SDL2main APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "SDL_VERSION")
set_property(TARGET SDL2main PROPERTY INTERFACE_SDL_VERSION "SDL2")
endif() endif()
if(ANDROID) if(ANDROID)
@@ -3317,7 +3267,7 @@ endif()
if(APPLE) if(APPLE)
foreach(SOURCE_FILE ${SOURCE_FILES}) foreach(SOURCE_FILE ${SOURCE_FILES})
get_filename_component(FILE_EXTENSION ${SOURCE_FILE} EXT) get_filename_component(FILE_EXTENSION ${SOURCE_FILE} EXT)
if(FILE_EXTENSION STREQUAL ".m") if(FILE_EXTENSION STREQUAL "m")
set_property(SOURCE ${SOURCE_FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " -x objective-c") set_property(SOURCE ${SOURCE_FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " -x objective-c")
endif() endif()
endforeach() endforeach()
@@ -3329,15 +3279,12 @@ if(SDL_SHARED)
# alias target for in-tree builds # alias target for in-tree builds
add_library(SDL2::SDL2 ALIAS SDL2) add_library(SDL2::SDL2 ALIAS SDL2)
set_target_properties(SDL2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) set_target_properties(SDL2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
set_target_properties(SDL2 PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
if(NOT SDL_LIBC) if(NOT SDL_LIBC)
if(SDL_CPU_X86) check_cpu_architecture(x86 HAS_X86)
if(HAS_X86)
# FIXME: should be added for all architectures (missing symbols for ARM) # FIXME: should be added for all architectures (missing symbols for ARM)
target_link_libraries(SDL2 PRIVATE "-nodefaultlib:MSVCRT") target_link_libraries(SDL2 PRIVATE "-nodefaultlib:MSVCRT")
endif() endif()
if(HAS_Q_NO_USE_LIBIRC)
target_compile_options(SDL2 PRIVATE /Q_no-use-libirc)
endif()
endif() endif()
if(APPLE) if(APPLE)
# FIXME: Remove SOVERSION in SDL3 # FIXME: Remove SOVERSION in SDL3
@@ -3364,22 +3311,21 @@ if(SDL_SHARED)
OUTPUT_NAME "SDL2") OUTPUT_NAME "SDL2")
endif() endif()
# Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB.
if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT SDL_CPU_ARM32) if(MSVC AND NOT SDL_LIBC AND NOT MSVC_CLANG AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
# Don't try to link with the default set of libraries. # Don't try to link with the default set of libraries.
if(NOT WINDOWS_STORE) if(NOT WINDOWS_STORE)
set_property(TARGET SDL2 APPEND_STRING PROPERTY LINK_FLAGS " /NODEFAULTLIB") set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
endif() endif()
set_property(TARGET SDL2 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " /NODEFAULTLIB") set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
endif() endif()
# FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS # FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS
target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD} ${CMAKE_DEPENDS}) target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD})
target_include_directories(SDL2 PUBLIC target_include_directories(SDL2 PUBLIC
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL2>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>")
)
# This picks up all the compiler options and such we've accumulated up to here. # This picks up all the compiler options and such we've accumulated up to here.
target_link_libraries(SDL2 PRIVATE $<BUILD_INTERFACE:sdl-build-options>) target_link_libraries(SDL2 PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
if(MINGW OR CYGWIN) if(MINGW OR CYGWIN)
@@ -3391,10 +3337,8 @@ if(SDL_SHARED)
set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif() endif()
# Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library
set_property(TARGET SDL2 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED)
set_property(TARGET SDL2 PROPERTY INTERFACE_SDL2_SHARED TRUE) set_property(TARGET SDL2 PROPERTY INTERFACE_SDL2_SHARED TRUE)
set_property(TARGET SDL2 APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "SDL_VERSION") set_property(TARGET SDL2 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED)
set_property(TARGET SDL2 PROPERTY INTERFACE_SDL_VERSION "SDL2")
endif() endif()
if(SDL_STATIC) if(SDL_STATIC)
@@ -3408,24 +3352,20 @@ if(SDL_STATIC)
target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB) target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB)
# TODO: Win32 platforms keep the same suffix .lib for import and static # TODO: Win32 platforms keep the same suffix .lib for import and static
# libraries - do we need to consider this? # libraries - do we need to consider this?
target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${CMAKE_DEPENDS}) target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2-static PUBLIC target_include_directories(SDL2-static PUBLIC
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL2>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>")
)
# This picks up all the compiler options and such we've accumulated up to here. # This picks up all the compiler options and such we've accumulated up to here.
target_link_libraries(SDL2-static PRIVATE $<BUILD_INTERFACE:sdl-build-options>) target_link_libraries(SDL2-static PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
if(NOT ANDROID) if(NOT ANDROID)
set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif() endif()
# Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library
set_property(TARGET SDL2-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED)
set_property(TARGET SDL2-static PROPERTY INTERFACE_SDL2_SHARED FALSE) set_property(TARGET SDL2-static PROPERTY INTERFACE_SDL2_SHARED FALSE)
set_property(TARGET SDL2-static APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "SDL_VERSION") set_property(TARGET SDL2-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED)
set_property(TARGET SDL2-static PROPERTY INTERFACE_SDL_VERSION "SDL2")
endif() endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MAJOR_VERSION=${SDL_MAJOR_VERSION}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MAJOR_VERSION=${SDL_MAJOR_VERSION}")
@@ -3443,13 +3383,10 @@ if(SDL_TEST)
EXPORT_NAME SDL2test) EXPORT_NAME SDL2test)
target_include_directories(SDL2_test PUBLIC target_include_directories(SDL2_test PUBLIC
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL2>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>") "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>")
target_link_libraries(SDL2_test PRIVATE ${EXTRA_TEST_LIBS}) target_link_libraries(SDL2_test PRIVATE ${EXTRA_TEST_LIBS})
set_property(TARGET SDL2_test APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "SDL_VERSION")
set_property(TARGET SDL2_test PROPERTY INTERFACE_SDL_VERSION "SDL2")
endif() endif()
##### Installation targets ##### ##### Installation targets #####
@@ -3554,7 +3491,6 @@ if(NOT SDL2_DISABLE_INSTALL)
FILES FILES
${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake
${SDL2_SOURCE_DIR}/cmake/sdlfind.cmake
DESTINATION "${SDL_INSTALL_CMAKEDIR}" DESTINATION "${SDL_INSTALL_CMAKEDIR}"
COMPONENT Devel COMPONENT Devel
) )
@@ -3562,8 +3498,8 @@ if(NOT SDL2_DISABLE_INSTALL)
install( install(
FILES FILES
${SDL2_INCLUDE_FILES} ${SDL2_INCLUDE_FILES}
"${SDL2_BINARY_DIR}/include/SDL2/SDL_revision.h" "${SDL2_BINARY_DIR}/include/SDL_revision.h"
"${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL2/SDL_config.h" "${SDL2_BINARY_DIR}/include-config-$<LOWER_CASE:$<CONFIG>>/SDL_config.h"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2)
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -2
View File
@@ -27,7 +27,6 @@ LDFLAGS = @BUILD_LDFLAGS@
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
LIBTOOL = @LIBTOOL@ LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
FGREP = @FGREP@
AR = @AR@ AR = @AR@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
RC = @RC@ RC = @RC@
@@ -131,7 +130,7 @@ HDRS = \
begin_code.h \ begin_code.h \
close_code.h close_code.h
SDLTEST_HDRS = $(shell ls $(srcdir)/include | $(FGREP) SDL_test) SDLTEST_HDRS = $(shell ls $(srcdir)/include | fgrep SDL_test)
LT_AGE = @LT_AGE@ LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@ LT_CURRENT = @LT_CURRENT@
+2 -2
View File
@@ -1,7 +1,7 @@
# Makefile to build the SDL library # Makefile to build the SDL library
CPPFLAGS = -I./include INCLUDE = -I./include
CFLAGS = -g -O2 CFLAGS = -g -O2 $(INCLUDE)
AR = ar AR = ar
RANLIB = ranlib RANLIB = ranlib
+1 -1
View File
@@ -14,7 +14,7 @@
LIBNAME = SDL2 LIBNAME = SDL2
MAJOR_VERSION = 2 MAJOR_VERSION = 2
MINOR_VERSION = 28 MINOR_VERSION = 26
MICRO_VERSION = 2 MICRO_VERSION = 2
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2 DESCRIPTION = Simple DirectMedia Layer 2
+1 -1
View File
@@ -5,7 +5,7 @@
LIBNAME = SDL2 LIBNAME = SDL2
MAJOR_VERSION = 2 MAJOR_VERSION = 2
MINOR_VERSION = 28 MINOR_VERSION = 26
MICRO_VERSION = 2 MICRO_VERSION = 2
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
-12
View File
@@ -30,18 +30,6 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake")
set(SDL2_SDL2test_FOUND TRUE) set(SDL2_SDL2test_FOUND TRUE)
endif() endif()
include("${CMAKE_CURRENT_LIST_DIR}/sdlfind.cmake")
set(SDL_ALSA @SDL_ALSA@)
set(SDL_ALSA_SHARED @SDL_ALSA_SHARED@)
if(SDL_ALSA AND NOT SDL_ALSA_SHARED AND TARGET SDL2::SDL2-static)
sdlFindALSA()
endif()
unset(SDL_ALSA)
unset(SDL_ALSA_SHARED)
check_required_components(SDL2) check_required_components(SDL2)
# Create SDL2::SDL2 alias for static-only builds # Create SDL2::SDL2 alias for static-only builds
+7 -8
View File
@@ -1,5 +1,5 @@
/* /*
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -239,17 +239,17 @@ LoadSprite(const char *file)
/* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */
sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h);
if (!sprites[i]) { if (!sprites[i]) {
return -1; return (-1);
} }
if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError());
SDL_DestroyTexture(sprites[i]); SDL_DestroyTexture(sprites[i]);
return -1; return (-1);
} }
} }
/* We're ready to roll. :) */ /* We're ready to roll. :) */
return 0; return (0);
} }
void void
@@ -364,9 +364,8 @@ loop()
#endif #endif
} }
for (i = 0; i < state->num_windows; ++i) { for (i = 0; i < state->num_windows; ++i) {
if (state->windows[i] == NULL) { if (state->windows[i] == NULL)
continue; continue;
}
DrawSprites(state->renderers[i], sprites[i]); DrawSprites(state->renderers[i], sprites[i]);
} }
} }
@@ -383,7 +382,7 @@ main(int argc, char *argv[])
/* Initialize test framework */ /* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO); state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO);
if (state == NULL) { if (!state) {
return 1; return 1;
} }
@@ -446,7 +445,7 @@ main(int argc, char *argv[])
/* Create the windows, initialize the renderers, and load the textures */ /* Create the windows, initialize the renderers, and load the textures */
sprites = sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites)); (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
if (sprites == NULL) { if (!sprites) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
quit(2); quit(2);
} }
-1
View File
@@ -137,7 +137,6 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat> <DebugInformationFormat>OldStyle</DebugInformationFormat>
<OmitDefaultLibName>true</OmitDefaultLibName> <OmitDefaultLibName>true</OmitDefaultLibName>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -68,8 +68,6 @@ if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}")
IMPORTED_LOCATION "${_sdl2_dll_library}" IMPORTED_LOCATION "${_sdl2_dll_library}"
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
INTERFACE_SDL2_SHARED "ON" INTERFACE_SDL2_SHARED "ON"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
) )
endif() endif()
set(SDL2_SDL2_FOUND TRUE) set(SDL2_SDL2_FOUND TRUE)
@@ -86,8 +84,6 @@ if(EXISTS "${_sdl2main_library}")
set_target_properties(SDL2::SDL2main set_target_properties(SDL2::SDL2main
PROPERTIES PROPERTIES
IMPORTED_LOCATION "${_sdl2main_library}" IMPORTED_LOCATION "${_sdl2main_library}"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
) )
endif() endif()
set(SDL2_SDL2main_FOUND TRUE) set(SDL2_SDL2main_FOUND TRUE)
@@ -104,8 +100,6 @@ if(EXISTS "${_sdl2test_library}")
PROPERTIES PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
IMPORTED_LOCATION "${_sdl2test_library}" IMPORTED_LOCATION "${_sdl2test_library}"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
) )
endif() endif()
set(SDL2_SDL2test_FOUND TRUE) set(SDL2_SDL2test_FOUND TRUE)
-17
View File
@@ -1,23 +1,6 @@
This is a list of major changes in SDL's version history. This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
2.28.2:
---------------------------------------------------------------------------
General:
* Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers
---------------------------------------------------------------------------
2.28.0:
---------------------------------------------------------------------------
General:
* Added SDL_HasWindowSurface() and SDL_DestroyWindowSurface() to switch between the window surface and rendering APIs
* Added a display event SDL_DISPLAYEVENT_MOVED which is sent when the primary monitor changes or displays change position relative to each other
* Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
2.26.0: 2.26.0:
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
+2 -2
View File
@@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer)
/* create ship texture from surface */ /* create ship texture from surface */
ship = SDL_CreateTextureFromSurface(renderer, bmp_surface); ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (ship == NULL) { if (!ship) {
fatalError("could not create ship texture"); fatalError("could not create ship texture");
} }
SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND); SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
@@ -145,7 +145,7 @@ initializeTextures(SDL_Renderer *renderer)
} }
/* create space texture from surface */ /* create space texture from surface */
space = SDL_CreateTextureFromSurface(renderer, bmp_surface); space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (space == NULL) { if (!space) {
fatalError("could not create space texture"); fatalError("could not create space texture");
} }
SDL_FreeSurface(bmp_surface); SDL_FreeSurface(bmp_surface);
+9 -16
View File
@@ -84,16 +84,14 @@ stepParticles(double deltaTime)
/* is the particle actually active, or is it marked for deletion? */ /* is the particle actually active, or is it marked for deletion? */
if (curr->isActive) { if (curr->isActive) {
/* is the particle off the screen? */ /* is the particle off the screen? */
if (curr->y > screen_h) { if (curr->y > screen_h)
curr->isActive = 0; curr->isActive = 0;
} else if (curr->y < 0) { else if (curr->y < 0)
curr->isActive = 0; curr->isActive = 0;
} if (curr->x > screen_w)
if (curr->x > screen_w) {
curr->isActive = 0; curr->isActive = 0;
} else if (curr->x < 0) { else if (curr->x < 0)
curr->isActive = 0; curr->isActive = 0;
}
/* step velocity, then step position */ /* step velocity, then step position */
curr->yvel += ACCEL * deltaMilliseconds; curr->yvel += ACCEL * deltaMilliseconds;
@@ -135,17 +133,15 @@ stepParticles(double deltaTime)
} }
/* if we're a dust particle, shrink our size */ /* if we're a dust particle, shrink our size */
if (curr->type == dust) { if (curr->type == dust)
curr->size -= deltaMilliseconds * 0.010f; curr->size -= deltaMilliseconds * 0.010f;
}
} }
/* if we're still active, pack ourselves in the array next /* if we're still active, pack ourselves in the array next
to the last active guy (pack the array tightly) */ to the last active guy (pack the array tightly) */
if (curr->isActive) { if (curr->isActive)
*(slot++) = *curr; *(slot++) = *curr;
}
} /* endif (curr->isActive) */ } /* endif (curr->isActive) */
curr++; curr++;
} }
@@ -192,9 +188,8 @@ explodeEmitter(struct particle *emitter)
int i; int i;
for (i = 0; i < 200; i++) { for (i = 0; i < 200; i++) {
if (num_active_particles >= MAX_PARTICLES) { if (num_active_particles >= MAX_PARTICLES)
return; return;
}
/* come up with a random angle and speed for new particle */ /* come up with a random angle and speed for new particle */
float theta = randomFloat(0, 2.0f * 3.141592); float theta = randomFloat(0, 2.0f * 3.141592);
@@ -231,9 +226,8 @@ void
spawnTrailFromEmitter(struct particle *emitter) spawnTrailFromEmitter(struct particle *emitter)
{ {
if (num_active_particles >= MAX_PARTICLES) { if (num_active_particles >= MAX_PARTICLES)
return; return;
}
/* select the particle at the slot at the end of our array */ /* select the particle at the slot at the end of our array */
struct particle *p = &particles[num_active_particles]; struct particle *p = &particles[num_active_particles];
@@ -268,9 +262,8 @@ void
spawnEmitterParticle(GLfloat x, GLfloat y) spawnEmitterParticle(GLfloat x, GLfloat y)
{ {
if (num_active_particles >= MAX_PARTICLES) { if (num_active_particles >= MAX_PARTICLES)
return; return;
}
/* find particle at endpoint of array */ /* find particle at endpoint of array */
struct particle *p = &particles[num_active_particles]; struct particle *p = &particles[num_active_particles];
+1 -1
View File
@@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer)
/* convert RGBA surface to texture */ /* convert RGBA surface to texture */
texture = SDL_CreateTextureFromSurface(renderer, bmp_surface); texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (texture == NULL) { if (!texture) {
fatalError("could not create texture"); fatalError("could not create texture");
} }
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
+2 -2
View File
@@ -165,7 +165,7 @@ loadFont(void)
{ {
SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp"); SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp");
if (surface == NULL) { if (!surface) {
printf("Error loading bitmap: %s\n", SDL_GetError()); printf("Error loading bitmap: %s\n", SDL_GetError());
return 0; return 0;
} else { } else {
@@ -183,7 +183,7 @@ loadFont(void)
SDL_BlitSurface(surface, NULL, converted, NULL); SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */ /* create our texture */
texture = SDL_CreateTextureFromSurface(renderer, converted); texture = SDL_CreateTextureFromSurface(renderer, converted);
if (texture == NULL) { if (!texture) {
printf("texture creation failed: %s\n", SDL_GetError()); printf("texture creation failed: %s\n", SDL_GetError());
} else { } else {
/* set blend mode for our texture */ /* set blend mode for our texture */
+2 -2
View File
@@ -207,9 +207,9 @@ playSound(struct sound *s)
break; break;
} }
/* if this channel's sound is older than the oldest so far, set it to oldest */ /* if this channel's sound is older than the oldest so far, set it to oldest */
if (mixer.channels[i].timestamp < mixer.channels[oldest_channel].timestamp) { if (mixer.channels[i].timestamp <
mixer.channels[oldest_channel].timestamp)
oldest_channel = i; oldest_channel = i;
}
} }
/* no empty channels, take the oldest one */ /* no empty channels, take the oldest one */
+2 -2
View File
@@ -58,11 +58,11 @@ main(int argc, char *argv[])
/* create window and renderer */ /* create window and renderer */
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI); window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
if (window == NULL) { if (!window) {
fatalError("Could not initialize Window"); fatalError("Could not initialize Window");
} }
renderer = SDL_CreateRenderer(window, -1, 0); renderer = SDL_CreateRenderer(window, -1, 0);
if (renderer == NULL) { if (!renderer) {
fatalError("Could not create renderer"); fatalError("Could not create renderer");
} }
+1 -1
View File
@@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer)
brush = brush =
SDL_CreateTextureFromSurface(renderer, bmp_surface); SDL_CreateTextureFromSurface(renderer, bmp_surface);
SDL_FreeSurface(bmp_surface); SDL_FreeSurface(bmp_surface);
if (brush == NULL) { if (!brush) {
fatalError("could not create brush texture"); fatalError("could not create brush texture");
} }
/* additive blending -- laying strokes on top of eachother makes them brighter */ /* additive blending -- laying strokes on top of eachother makes them brighter */
+2 -2
View File
@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.28.2</string> <string>2.26.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>SDLX</string> <string>SDLX</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2.28.2</string> <string>2.26.2</string>
</dict> </dict>
</plist> </plist>
+12 -12
View File
@@ -9528,8 +9528,8 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES; DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 2801.0.0; DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
DYLIB_CURRENT_VERSION = 2801.2.0; DYLIB_CURRENT_VERSION = 2601.2.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES; GCC_ALTIVEC_EXTENSIONS = YES;
@@ -9558,7 +9558,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@loader_path/Frameworks", "@loader_path/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.11; MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2;
PRODUCT_NAME = SDL2; PRODUCT_NAME = SDL2;
STRIP_STYLE = "non-global"; STRIP_STYLE = "non-global";
@@ -9570,7 +9570,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO; CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.28.2; MARKETING_VERSION = 2.0.17;
OTHER_LDFLAGS = "-liconv"; OTHER_LDFLAGS = "-liconv";
}; };
name = Release; name = Release;
@@ -9613,8 +9613,8 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 2801.0.0; DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
DYLIB_CURRENT_VERSION = 2801.2.0; DYLIB_CURRENT_VERSION = 2601.2.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@@ -9643,7 +9643,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@loader_path/Frameworks", "@loader_path/Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.11; MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = NO; ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2;
PRODUCT_NAME = SDL2; PRODUCT_NAME = SDL2;
@@ -9656,7 +9656,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO; CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.28.2; MARKETING_VERSION = 2.0.17;
OTHER_LDFLAGS = "-liconv"; OTHER_LDFLAGS = "-liconv";
}; };
name = Debug; name = Debug;
@@ -9862,8 +9862,8 @@
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 2801.0.0; DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
DYLIB_CURRENT_VERSION = 2801.2.0; DYLIB_CURRENT_VERSION = 2601.2.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
@@ -9914,8 +9914,8 @@
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 2801.0.0; DYLIB_COMPATIBILITY_VERSION = 2601.0.0;
DYLIB_CURRENT_VERSION = 2801.2.0; DYLIB_CURRENT_VERSION = 2601.2.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
+1 -1
View File
@@ -1,4 +1,4 @@
Title SDL 2.28.2 Title SDL 2.0.0
Version 1 Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org) Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks DefaultLocation /Library/Frameworks
@@ -57,8 +57,6 @@ if(NOT TARGET SDL2::SDL2)
INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL2" INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL2"
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
INTERFACE_SDL2_SHARED "ON" INTERFACE_SDL2_SHARED "ON"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
) )
endif() endif()
set(SDL2_SDL2_FOUND TRUE) set(SDL2_SDL2_FOUND TRUE)
+1 -1
View File
@@ -1,6 +1,6 @@
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -186,7 +186,7 @@ class HIDDeviceBLESteamController extends BluetoothGattCallback implements HIDDe
// Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead // Because on Chromebooks we show up as a dual-mode device, it will attempt to connect TRANSPORT_AUTO, which will use TRANSPORT_BREDR instead
// of TRANSPORT_LE. Let's force ourselves to connect low energy. // of TRANSPORT_LE. Let's force ourselves to connect low energy.
private BluetoothGatt connectGatt(boolean managed) { private BluetoothGatt connectGatt(boolean managed) {
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) { if (Build.VERSION.SDK_INT >= 23) {
try { try {
return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE); return mDevice.connectGatt(mManager.getContext(), managed, this, TRANSPORT_LE);
} catch (Exception e) { } catch (Exception e) {
@@ -251,8 +251,6 @@ public class HIDDeviceManager {
0x20d6, // PowerA 0x20d6, // PowerA
0x24c6, // PowerA 0x24c6, // PowerA
0x2c22, // Qanba 0x2c22, // Qanba
0x2dc8, // 8BitDo
0x9886, // ASTRO Gaming
}; };
if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC && if (usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_VENDOR_SPEC &&
@@ -273,16 +271,14 @@ public class HIDDeviceManager {
final int XB1_IFACE_SUBCLASS = 71; final int XB1_IFACE_SUBCLASS = 71;
final int XB1_IFACE_PROTOCOL = 208; final int XB1_IFACE_PROTOCOL = 208;
final int[] SUPPORTED_VENDORS = { final int[] SUPPORTED_VENDORS = {
0x044f, // Thrustmaster
0x045e, // Microsoft 0x045e, // Microsoft
0x0738, // Mad Catz 0x0738, // Mad Catz
0x0e6f, // PDP 0x0e6f, // PDP
0x0f0d, // Hori 0x0f0d, // Hori
0x10f5, // Turtle Beach
0x1532, // Razer Wildcat 0x1532, // Razer Wildcat
0x20d6, // PowerA 0x20d6, // PowerA
0x24c6, // PowerA 0x24c6, // PowerA
0x2dc8, // 8BitDo 0x2dc8, /* 8BitDo */
0x2e24, // Hyperkin 0x2e24, // Hyperkin
}; };
@@ -357,13 +353,13 @@ public class HIDDeviceManager {
private void initializeBluetooth() { private void initializeBluetooth() {
Log.d(TAG, "Initializing Bluetooth"); Log.d(TAG, "Initializing Bluetooth");
if (Build.VERSION.SDK_INT <= 30 /* Android 11.0 (R) */ && if (Build.VERSION.SDK_INT <= 30 &&
mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) { mContext.getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, mContext.getPackageName()) != PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH"); Log.d(TAG, "Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH");
return; return;
} }
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18 /* Android 4.3 (JELLY_BEAN_MR2) */)) { if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) || (Build.VERSION.SDK_INT < 18)) {
Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE"); Log.d(TAG, "Couldn't initialize Bluetooth, this version of Android does not support Bluetooth LE");
return; return;
} }
@@ -577,7 +573,7 @@ public class HIDDeviceManager {
try { try {
final int FLAG_MUTABLE = 0x02000000; // PendingIntent.FLAG_MUTABLE, but don't require SDK 31 final int FLAG_MUTABLE = 0x02000000; // PendingIntent.FLAG_MUTABLE, but don't require SDK 31
int flags; int flags;
if (Build.VERSION.SDK_INT >= 31 /* Android 12.0 (S) */) { if (Build.VERSION.SDK_INT >= 31) {
flags = FLAG_MUTABLE; flags = FLAG_MUTABLE;
} else { } else {
flags = 0; flags = 0;
@@ -52,7 +52,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override @Override
public String getSerialNumber() { public String getSerialNumber() {
String result = null; String result = null;
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) { if (Build.VERSION.SDK_INT >= 21) {
try { try {
result = mDevice.getSerialNumber(); result = mDevice.getSerialNumber();
} }
@@ -74,7 +74,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override @Override
public String getManufacturerName() { public String getManufacturerName() {
String result = null; String result = null;
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) { if (Build.VERSION.SDK_INT >= 21) {
result = mDevice.getManufacturerName(); result = mDevice.getManufacturerName();
} }
if (result == null) { if (result == null) {
@@ -86,7 +86,7 @@ class HIDDeviceUSB implements HIDDevice {
@Override @Override
public String getProductName() { public String getProductName() {
String result = null; String result = null;
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) { if (Build.VERSION.SDK_INT >= 21) {
result = mDevice.getProductName(); result = mDevice.getProductName();
} }
if (result == null) { if (result == null) {
@@ -29,7 +29,6 @@ public class SDL {
// This function stores the current activity (SDL or not) // This function stores the current activity (SDL or not)
public static void setContext(Context context) { public static void setContext(Context context) {
SDLAudioManager.setContext(context);
mContext = context; mContext = context;
} }
@@ -60,7 +60,7 @@ import java.util.Locale;
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL"; private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 28; private static final int SDL_MINOR_VERSION = 26;
private static final int SDL_MICRO_VERSION = 2; private static final int SDL_MICRO_VERSION = 2;
/* /*
// Display InputType.SOURCE/CLASS of events and devices // Display InputType.SOURCE/CLASS of events and devices
@@ -93,7 +93,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class; s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
if (Build.VERSION.SDK_INT >= 23) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
tst = InputDevice.SOURCE_BLUETOOTH_STYLUS; tst = InputDevice.SOURCE_BLUETOOTH_STYLUS;
if ((s & tst) == tst) src += " BLUETOOTH_STYLUS"; if ((s & tst) == tst) src += " BLUETOOTH_STYLUS";
s2 &= ~tst; s2 &= ~tst;
@@ -107,7 +107,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if ((s & tst) == tst) src += " GAMEPAD"; if ((s & tst) == tst) src += " GAMEPAD";
s2 &= ~tst; s2 &= ~tst;
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
tst = InputDevice.SOURCE_HDMI; tst = InputDevice.SOURCE_HDMI;
if ((s & tst) == tst) src += " HDMI"; if ((s & tst) == tst) src += " HDMI";
s2 &= ~tst; s2 &= ~tst;
@@ -146,7 +146,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if ((s & tst) == tst) src += " TOUCHSCREEN"; if ((s & tst) == tst) src += " TOUCHSCREEN";
s2 &= ~tst; s2 &= ~tst;
if (Build.VERSION.SDK_INT >= 18) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
tst = InputDevice.SOURCE_TOUCH_NAVIGATION; tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
if ((s & tst) == tst) src += " TOUCH_NAVIGATION"; if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
s2 &= ~tst; s2 &= ~tst;
@@ -170,7 +170,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
*/ */
public static boolean mIsResumedCalled, mHasFocus; public static boolean mIsResumedCalled, mHasFocus;
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */); public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24);
// Cursor types // Cursor types
// private static final int SDL_SYSTEM_CURSOR_NONE = -1; // private static final int SDL_SYSTEM_CURSOR_NONE = -1;
@@ -224,9 +224,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
protected static SDLGenericMotionListener_API12 getMotionListener() { protected static SDLGenericMotionListener_API12 getMotionListener() {
if (mMotionListener == null) { if (mMotionListener == null) {
if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) { if (Build.VERSION.SDK_INT >= 26) {
mMotionListener = new SDLGenericMotionListener_API26(); mMotionListener = new SDLGenericMotionListener_API26();
} else if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { } else if (Build.VERSION.SDK_INT >= 24) {
mMotionListener = new SDLGenericMotionListener_API24(); mMotionListener = new SDLGenericMotionListener_API24();
} else { } else {
mMotionListener = new SDLGenericMotionListener_API12(); mMotionListener = new SDLGenericMotionListener_API12();
@@ -393,7 +393,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mHIDDeviceManager = HIDDeviceManager.acquire(this); mHIDDeviceManager = HIDDeviceManager.acquire(this);
// Set up the surface // Set up the surface
mSurface = createSDLSurface(this); mSurface = createSDLSurface(getApplication());
mLayout = new RelativeLayout(this); mLayout = new RelativeLayout(this);
mLayout.addView(mSurface); mLayout.addView(mSurface);
@@ -404,7 +404,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
SDLActivity.onNativeOrientationChanged(mCurrentOrientation); SDLActivity.onNativeOrientationChanged(mCurrentOrientation);
try { try {
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) { if (Build.VERSION.SDK_INT < 24) {
mCurrentLocale = getContext().getResources().getConfiguration().locale; mCurrentLocale = getContext().getResources().getConfiguration().locale;
} else { } else {
mCurrentLocale = getContext().getResources().getConfiguration().getLocales().get(0); mCurrentLocale = getContext().getResources().getConfiguration().getLocales().get(0);
@@ -588,8 +588,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mHIDDeviceManager = null; mHIDDeviceManager = null;
} }
SDLAudioManager.release(this);
if (SDLActivity.mBrokenLibraries) { if (SDLActivity.mBrokenLibraries) {
super.onDestroy(); super.onDestroy();
return; return;
@@ -768,7 +766,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
} }
break; break;
case COMMAND_CHANGE_WINDOW_STYLE: case COMMAND_CHANGE_WINDOW_STYLE:
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) { if (Build.VERSION.SDK_INT >= 19) {
if (context instanceof Activity) { if (context instanceof Activity) {
Window window = ((Activity) context).getWindow(); Window window = ((Activity) context).getWindow();
if (window != null) { if (window != null) {
@@ -843,7 +841,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
msg.obj = data; msg.obj = data;
boolean result = commandHandler.sendMessage(msg); boolean result = commandHandler.sendMessage(msg);
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) { if (Build.VERSION.SDK_INT >= 19) {
if (command == COMMAND_CHANGE_WINDOW_STYLE) { if (command == COMMAND_CHANGE_WINDOW_STYLE) {
// Ensure we don't return until the resize has actually happened, // Ensure we don't return until the resize has actually happened,
// or 500ms have passed. // or 500ms have passed.
@@ -971,18 +969,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* If set, hint "explicitly controls which UI orientations are allowed". */ /* If set, hint "explicitly controls which UI orientations are allowed". */
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) { if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else if (hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) { } else if (hint.contains("LandscapeRight")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else if (hint.contains("LandscapeLeft")) {
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
} }
/* exact match to 'Portrait' to distinguish with PortraitUpsideDown */ if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait");
if (contains_Portrait && hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
} else if (contains_Portrait) { } else if (hint.contains("Portrait")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
} else if (hint.contains("PortraitUpsideDown")) { } else if (hint.contains("PortraitUpsideDown")) {
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
@@ -1095,7 +1090,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// thus SDK version 27. If we are in DeX mode and not API 27 or higher, as a result, // thus SDK version 27. If we are in DeX mode and not API 27 or higher, as a result,
// we should stick to relative mode. // we should stick to relative mode.
// //
if (Build.VERSION.SDK_INT < 27 /* Android 8.1 (O_MR1) */ && isDeXMode()) { if ((Build.VERSION.SDK_INT < 27) && isDeXMode()) {
return false; return false;
} }
@@ -1185,7 +1180,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI. * This method is called by SDL using JNI.
*/ */
public static boolean isDeXMode() { public static boolean isDeXMode() {
if (Build.VERSION.SDK_INT < 24 /* Android 7.0 (N) */) { if (Build.VERSION.SDK_INT < 24) {
return false; return false;
} }
try { try {
@@ -1622,7 +1617,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private final Runnable rehideSystemUi = new Runnable() { private final Runnable rehideSystemUi = new Runnable() {
@Override @Override
public void run() { public void run() {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) { if (Build.VERSION.SDK_INT >= 19) {
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN | int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
@@ -1675,7 +1670,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888); Bitmap bitmap = Bitmap.createBitmap(colors, width, height, Bitmap.Config.ARGB_8888);
++mLastCursorID; ++mLastCursorID;
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { if (Build.VERSION.SDK_INT >= 24) {
try { try {
mCursors.put(mLastCursorID, PointerIcon.create(bitmap, hotSpotX, hotSpotY)); mCursors.put(mLastCursorID, PointerIcon.create(bitmap, hotSpotX, hotSpotY));
} catch (Exception e) { } catch (Exception e) {
@@ -1691,7 +1686,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI. * This method is called by SDL using JNI.
*/ */
public static void destroyCustomCursor(int cursorID) { public static void destroyCustomCursor(int cursorID) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { if (Build.VERSION.SDK_INT >= 24) {
try { try {
mCursors.remove(cursorID); mCursors.remove(cursorID);
} catch (Exception e) { } catch (Exception e) {
@@ -1705,7 +1700,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
*/ */
public static boolean setCustomCursor(int cursorID) { public static boolean setCustomCursor(int cursorID) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { if (Build.VERSION.SDK_INT >= 24) {
try { try {
mSurface.setPointerIcon(mCursors.get(cursorID)); mSurface.setPointerIcon(mCursors.get(cursorID));
} catch (Exception e) { } catch (Exception e) {
@@ -1760,7 +1755,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
cursor_type = 1002; //PointerIcon.TYPE_HAND; cursor_type = 1002; //PointerIcon.TYPE_HAND;
break; break;
} }
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { if (Build.VERSION.SDK_INT >= 24) {
try { try {
mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type)); mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type));
} catch (Exception e) { } catch (Exception e) {
@@ -1774,7 +1769,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
* This method is called by SDL using JNI. * This method is called by SDL using JNI.
*/ */
public static void requestPermission(String permission, int requestCode) { public static void requestPermission(String permission, int requestCode) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) { if (Build.VERSION.SDK_INT < 23) {
nativePermissionResult(requestCode, true); nativePermissionResult(requestCode, true);
return; return;
} }
@@ -1803,7 +1798,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
i.setData(Uri.parse(url)); i.setData(Uri.parse(url));
int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK; int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) { if (Build.VERSION.SDK_INT >= 21) {
flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT; flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
} else { } else {
flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET; flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
@@ -2007,18 +2002,6 @@ class SDLInputConnection extends BaseInputConnection {
@Override @Override
public boolean deleteSurroundingText(int beforeLength, int afterLength) { public boolean deleteSurroundingText(int beforeLength, int afterLength) {
if (Build.VERSION.SDK_INT <= 29 /* Android 10.0 (Q) */) {
// Workaround to capture backspace key. Ref: http://stackoverflow.com/questions>/14560344/android-backspace-in-webview-baseinputconnection
// and https://bugzilla.libsdl.org/show_bug.cgi?id=2265
if (beforeLength > 0 && afterLength == 0) {
// backspace(s)
while (beforeLength-- > 0) {
nativeGenerateScancodeForUnichar('\b');
}
return true;
}
}
if (!super.deleteSurroundingText(beforeLength, afterLength)) { if (!super.deleteSurroundingText(beforeLength, afterLength)) {
return false; return false;
} }
@@ -1,8 +1,5 @@
package org.libsdl.app; package org.libsdl.app;
import android.content.Context;
import android.media.AudioDeviceCallback;
import android.media.AudioDeviceInfo;
import android.media.AudioFormat; import android.media.AudioFormat;
import android.media.AudioManager; import android.media.AudioManager;
import android.media.AudioRecord; import android.media.AudioRecord;
@@ -11,67 +8,34 @@ import android.media.MediaRecorder;
import android.os.Build; import android.os.Build;
import android.util.Log; import android.util.Log;
import java.util.Arrays; public class SDLAudioManager
{
public class SDLAudioManager {
protected static final String TAG = "SDLAudio"; protected static final String TAG = "SDLAudio";
protected static AudioTrack mAudioTrack; protected static AudioTrack mAudioTrack;
protected static AudioRecord mAudioRecord; protected static AudioRecord mAudioRecord;
protected static Context mContext;
private static final int[] NO_DEVICES = {};
private static AudioDeviceCallback mAudioDeviceCallback;
public static void initialize() { public static void initialize() {
mAudioTrack = null; mAudioTrack = null;
mAudioRecord = null; mAudioRecord = null;
mAudioDeviceCallback = null;
if(Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */)
{
mAudioDeviceCallback = new AudioDeviceCallback() {
@Override
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
Arrays.stream(addedDevices).forEach(deviceInfo -> addAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
}
@Override
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
Arrays.stream(removedDevices).forEach(deviceInfo -> removeAudioDevice(deviceInfo.isSink(), deviceInfo.getId()));
}
};
}
}
public static void setContext(Context context) {
mContext = context;
if (context != null) {
registerAudioDeviceCallback();
}
}
public static void release(Context context) {
unregisterAudioDeviceCallback(context);
} }
// Audio // Audio
protected static String getAudioFormatString(int audioFormat) { protected static String getAudioFormatString(int audioFormat) {
switch (audioFormat) { switch (audioFormat) {
case AudioFormat.ENCODING_PCM_8BIT: case AudioFormat.ENCODING_PCM_8BIT:
return "8-bit"; return "8-bit";
case AudioFormat.ENCODING_PCM_16BIT: case AudioFormat.ENCODING_PCM_16BIT:
return "16-bit"; return "16-bit";
case AudioFormat.ENCODING_PCM_FLOAT: case AudioFormat.ENCODING_PCM_FLOAT:
return "float"; return "float";
default: default:
return Integer.toString(audioFormat); return Integer.toString(audioFormat);
} }
} }
protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) { protected static int[] open(boolean isCapture, int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
int channelConfig; int channelConfig;
int sampleSize; int sampleSize;
int frameSize; int frameSize;
@@ -79,14 +43,14 @@ public class SDLAudioManager {
Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz"); Log.v(TAG, "Opening " + (isCapture ? "capture" : "playback") + ", requested " + desiredFrames + " frames of " + desiredChannels + " channel " + getAudioFormatString(audioFormat) + " audio at " + sampleRate + " Hz");
/* On older devices let's use known good settings */ /* On older devices let's use known good settings */
if (Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) { if (Build.VERSION.SDK_INT < 21) {
if (desiredChannels > 2) { if (desiredChannels > 2) {
desiredChannels = 2; desiredChannels = 2;
} }
} }
/* AudioTrack has sample rate limitation of 48000 (fixed in 5.0.2) */ /* AudioTrack has sample rate limitation of 48000 (fixed in 5.0.2) */
if (Build.VERSION.SDK_INT < 22 /* Android 5.1 (LOLLIPOP_MR1) */) { if (Build.VERSION.SDK_INT < 22) {
if (sampleRate < 8000) { if (sampleRate < 8000) {
sampleRate = 8000; sampleRate = 8000;
} else if (sampleRate > 48000) { } else if (sampleRate > 48000) {
@@ -95,7 +59,7 @@ public class SDLAudioManager {
} }
if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) { if (audioFormat == AudioFormat.ENCODING_PCM_FLOAT) {
int minSDKVersion = (isCapture ? 23 /* Android 6.0 (M) */ : 21 /* Android 5.0 (LOLLIPOP) */); int minSDKVersion = (isCapture ? 23 : 21);
if (Build.VERSION.SDK_INT < minSDKVersion) { if (Build.VERSION.SDK_INT < minSDKVersion) {
audioFormat = AudioFormat.ENCODING_PCM_16BIT; audioFormat = AudioFormat.ENCODING_PCM_16BIT;
} }
@@ -156,7 +120,7 @@ public class SDLAudioManager {
channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER; channelConfig = AudioFormat.CHANNEL_OUT_5POINT1 | AudioFormat.CHANNEL_OUT_BACK_CENTER;
break; break;
case 8: case 8:
if (Build.VERSION.SDK_INT >= 23 /* Android 6.0 (M) */) { if (Build.VERSION.SDK_INT >= 23) {
channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
} else { } else {
Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround"); Log.v(TAG, "Requested " + desiredChannels + " channels, getting 5.1 surround");
@@ -237,10 +201,6 @@ public class SDLAudioManager {
return null; return null;
} }
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
mAudioRecord.setPreferredDevice(getOutputAudioDeviceInfo(deviceId));
}
mAudioRecord.startRecording(); mAudioRecord.startRecording();
} }
@@ -264,10 +224,6 @@ public class SDLAudioManager {
return null; return null;
} }
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */ && deviceId != 0) {
mAudioTrack.setPreferredDevice(getInputAudioDeviceInfo(deviceId));
}
mAudioTrack.play(); mAudioTrack.play();
} }
@@ -282,73 +238,11 @@ public class SDLAudioManager {
return results; return results;
} }
private static AudioDeviceInfo getInputAudioDeviceInfo(int deviceId) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS))
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
.findFirst()
.orElse(null);
} else {
return null;
}
}
private static AudioDeviceInfo getOutputAudioDeviceInfo(int deviceId) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS))
.filter(deviceInfo -> deviceInfo.getId() == deviceId)
.findFirst()
.orElse(null);
} else {
return null;
}
}
private static void registerAudioDeviceCallback() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
audioManager.registerAudioDeviceCallback(mAudioDeviceCallback, null);
}
}
private static void unregisterAudioDeviceCallback(Context context) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.unregisterAudioDeviceCallback(mAudioDeviceCallback);
}
}
/** /**
* This method is called by SDL using JNI. * This method is called by SDL using JNI.
*/ */
public static int[] getAudioOutputDevices() { public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames);
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
} else {
return NO_DEVICES;
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] getAudioInputDevices() {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return Arrays.stream(audioManager.getDevices(AudioManager.GET_DEVICES_INPUTS)).mapToInt(AudioDeviceInfo::getId).toArray();
} else {
return NO_DEVICES;
}
}
/**
* This method is called by SDL using JNI.
*/
public static int[] audioOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) {
return open(false, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId);
} }
/** /**
@@ -360,11 +254,6 @@ public class SDLAudioManager {
return; return;
} }
if (android.os.Build.VERSION.SDK_INT < 21 /* Android 5.0 (LOLLIPOP) */) {
Log.e(TAG, "Attempted to make an incompatible audio call with uninitialized audio! (floating-point output is supported since Android 5.0 Lollipop)");
return;
}
for (int i = 0; i < buffer.length;) { for (int i = 0; i < buffer.length;) {
int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING); int result = mAudioTrack.write(buffer, i, buffer.length - i, AudioTrack.WRITE_BLOCKING);
if (result > 0) { if (result > 0) {
@@ -437,22 +326,18 @@ public class SDLAudioManager {
/** /**
* This method is called by SDL using JNI. * This method is called by SDL using JNI.
*/ */
public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames, int deviceId) { public static int[] captureOpen(int sampleRate, int audioFormat, int desiredChannels, int desiredFrames) {
return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames, deviceId); return open(true, sampleRate, audioFormat, desiredChannels, desiredFrames);
} }
/** This method is called by SDL using JNI. */ /** This method is called by SDL using JNI. */
public static int captureReadFloatBuffer(float[] buffer, boolean blocking) { public static int captureReadFloatBuffer(float[] buffer, boolean blocking) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) { return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
return 0;
} else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
}
} }
/** This method is called by SDL using JNI. */ /** This method is called by SDL using JNI. */
public static int captureReadShortBuffer(short[] buffer, boolean blocking) { public static int captureReadShortBuffer(short[] buffer, boolean blocking) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) { if (Build.VERSION.SDK_INT < 23) {
return mAudioRecord.read(buffer, 0, buffer.length); return mAudioRecord.read(buffer, 0, buffer.length);
} else { } else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -461,7 +346,7 @@ public class SDLAudioManager {
/** This method is called by SDL using JNI. */ /** This method is called by SDL using JNI. */
public static int captureReadByteBuffer(byte[] buffer, boolean blocking) { public static int captureReadByteBuffer(byte[] buffer, boolean blocking) {
if (Build.VERSION.SDK_INT < 23 /* Android 6.0 (M) */) { if (Build.VERSION.SDK_INT < 23) {
return mAudioRecord.read(buffer, 0, buffer.length); return mAudioRecord.read(buffer, 0, buffer.length);
} else { } else {
return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING); return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
@@ -506,9 +391,4 @@ public class SDLAudioManager {
} }
public static native int nativeSetupJNI(); public static native int nativeSetupJNI();
public static native void removeAudioDevice(boolean isCapture, int deviceId);
public static native void addAudioDevice(boolean isCapture, int deviceId);
} }
@@ -24,7 +24,7 @@ public class SDLControllerManager
public static native int nativeAddJoystick(int device_id, String name, String desc, public static native int nativeAddJoystick(int device_id, String name, String desc,
int vendor_id, int product_id, int vendor_id, int product_id,
boolean is_accelerometer, int button_mask, boolean is_accelerometer, int button_mask,
int naxes, int axis_mask, int nhats, int nballs); int naxes, int nhats, int nballs);
public static native int nativeRemoveJoystick(int device_id); public static native int nativeRemoveJoystick(int device_id);
public static native int nativeAddHaptic(int device_id, String name); public static native int nativeAddHaptic(int device_id, String name);
public static native int nativeRemoveHaptic(int device_id); public static native int nativeRemoveHaptic(int device_id);
@@ -42,7 +42,7 @@ public class SDLControllerManager
public static void initialize() { public static void initialize() {
if (mJoystickHandler == null) { if (mJoystickHandler == null) {
if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) { if (Build.VERSION.SDK_INT >= 19) {
mJoystickHandler = new SDLJoystickHandler_API19(); mJoystickHandler = new SDLJoystickHandler_API19();
} else { } else {
mJoystickHandler = new SDLJoystickHandler_API16(); mJoystickHandler = new SDLJoystickHandler_API16();
@@ -50,7 +50,7 @@ public class SDLControllerManager
} }
if (mHapticHandler == null) { if (mHapticHandler == null) {
if (Build.VERSION.SDK_INT >= 26 /* Android 8.0 (O) */) { if (Build.VERSION.SDK_INT >= 26) {
mHapticHandler = new SDLHapticHandler_API26(); mHapticHandler = new SDLHapticHandler_API26();
} else { } else {
mHapticHandler = new SDLHapticHandler(); mHapticHandler = new SDLHapticHandler();
@@ -168,32 +168,6 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
arg1Axis = MotionEvent.AXIS_GAS; arg1Axis = MotionEvent.AXIS_GAS;
} }
// Make sure the AXIS_Z is sorted between AXIS_RY and AXIS_RZ.
// This is because the usual pairing are:
// - AXIS_X + AXIS_Y (left stick).
// - AXIS_RX, AXIS_RY (sometimes the right stick, sometimes triggers).
// - AXIS_Z, AXIS_RZ (sometimes the right stick, sometimes triggers).
// This sorts the axes in the above order, which tends to be correct
// for Xbox-ish game pads that have the right stick on RX/RY and the
// triggers on Z/RZ.
//
// Gamepads that don't have AXIS_Z/AXIS_RZ but use
// AXIS_LTRIGGER/AXIS_RTRIGGER are unaffected by this.
//
// References:
// - https://developer.android.com/develop/ui/views/touch-and-input/game-controllers/controller-input
// - https://www.kernel.org/doc/html/latest/input/gamepad.html
if (arg0Axis == MotionEvent.AXIS_Z) {
arg0Axis = MotionEvent.AXIS_RZ - 1;
} else if (arg0Axis > MotionEvent.AXIS_Z && arg0Axis < MotionEvent.AXIS_RZ) {
--arg0Axis;
}
if (arg1Axis == MotionEvent.AXIS_Z) {
arg1Axis = MotionEvent.AXIS_RZ - 1;
} else if (arg1Axis > MotionEvent.AXIS_Z && arg1Axis < MotionEvent.AXIS_RZ) {
--arg1Axis;
}
return arg0Axis - arg1Axis; return arg0Axis - arg1Axis;
} }
} }
@@ -236,7 +210,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
mJoysticks.add(joystick); mJoysticks.add(joystick);
SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc, SDLControllerManager.nativeAddJoystick(joystick.device_id, joystick.name, joystick.desc,
getVendorId(joystickDevice), getProductId(joystickDevice), false, getVendorId(joystickDevice), getProductId(joystickDevice), false,
getButtonMask(joystickDevice), joystick.axes.size(), getAxisMask(joystick.axes), joystick.hats.size()/2, 0); getButtonMask(joystickDevice), joystick.axes.size(), joystick.hats.size()/2, 0);
} }
} }
} }
@@ -317,9 +291,6 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
public int getVendorId(InputDevice joystickDevice) { public int getVendorId(InputDevice joystickDevice) {
return 0; return 0;
} }
public int getAxisMask(List<InputDevice.MotionRange> ranges) {
return -1;
}
public int getButtonMask(InputDevice joystickDevice) { public int getButtonMask(InputDevice joystickDevice) {
return -1; return -1;
} }
@@ -337,43 +308,6 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
return joystickDevice.getVendorId(); return joystickDevice.getVendorId();
} }
@Override
public int getAxisMask(List<InputDevice.MotionRange> ranges) {
// For compatibility, keep computing the axis mask like before,
// only really distinguishing 2, 4 and 6 axes.
int axis_mask = 0;
if (ranges.size() >= 2) {
// ((1 << SDL_GAMEPAD_AXIS_LEFTX) | (1 << SDL_GAMEPAD_AXIS_LEFTY))
axis_mask |= 0x0003;
}
if (ranges.size() >= 4) {
// ((1 << SDL_GAMEPAD_AXIS_RIGHTX) | (1 << SDL_GAMEPAD_AXIS_RIGHTY))
axis_mask |= 0x000c;
}
if (ranges.size() >= 6) {
// ((1 << SDL_GAMEPAD_AXIS_LEFT_TRIGGER) | (1 << SDL_GAMEPAD_AXIS_RIGHT_TRIGGER))
axis_mask |= 0x0030;
}
// Also add an indicator bit for whether the sorting order has changed.
// This serves to disable outdated gamecontrollerdb.txt mappings.
boolean have_z = false;
boolean have_past_z_before_rz = false;
for (InputDevice.MotionRange range : ranges) {
int axis = range.getAxis();
if (axis == MotionEvent.AXIS_Z) {
have_z = true;
} else if (axis > MotionEvent.AXIS_Z && axis < MotionEvent.AXIS_RZ) {
have_past_z_before_rz = true;
}
}
if (have_z && have_past_z_before_rz) {
// If both these exist, the compare() function changed sorting order.
// Set a bit to indicate this fact.
axis_mask |= 0x8000;
}
return axis_mask;
}
@Override @Override
public int getButtonMask(InputDevice joystickDevice) { public int getButtonMask(InputDevice joystickDevice) {
int button_mask = 0; int button_mask = 0;
@@ -809,7 +743,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
@Override @Override
public boolean supportsRelativeMouse() { public boolean supportsRelativeMouse() {
return (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */); return (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27));
} }
@Override @Override
@@ -819,7 +753,7 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
@Override @Override
public boolean setRelativeMouseEnabled(boolean enabled) { public boolean setRelativeMouseEnabled(boolean enabled) {
if (!SDLActivity.isDeXMode() || Build.VERSION.SDK_INT >= 27 /* Android 8.1 (O_MR1) */) { if (!SDLActivity.isDeXMode() || (Build.VERSION.SDK_INT >= 27)) {
if (enabled) { if (enabled) {
SDLActivity.getContentView().requestPointerCapture(); SDLActivity.getContentView().requestPointerCapture();
} else { } else {
@@ -116,7 +116,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
int nDeviceHeight = height; int nDeviceHeight = height;
try try
{ {
if (Build.VERSION.SDK_INT >= 17 /* Android 4.2 (JELLY_BEAN_MR1) */) { if (Build.VERSION.SDK_INT >= 17) {
DisplayMetrics realMetrics = new DisplayMetrics(); DisplayMetrics realMetrics = new DisplayMetrics();
mDisplay.getRealMetrics( realMetrics ); mDisplay.getRealMetrics( realMetrics );
nDeviceWidth = realMetrics.widthPixels; nDeviceWidth = realMetrics.widthPixels;
@@ -163,7 +163,7 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
// Don't skip in MultiWindow. // Don't skip in MultiWindow.
if (skip) { if (skip) {
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) { if (Build.VERSION.SDK_INT >= 24) {
if (SDLActivity.mSingleton.isInMultiWindowMode()) { if (SDLActivity.mSingleton.isInMultiWindowMode()) {
Log.v("SDL", "Don't skip in Multi-Window"); Log.v("SDL", "Don't skip in Multi-Window");
skip = false; skip = false;
+2 -2
View File
@@ -126,8 +126,8 @@ if $cygwin ; then
# Now convert the arguments - kludge to limit ourselves to /bin/sh # Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0 i=0
for arg in "$@" ; do for arg in "$@" ; do
CHECK=`echo "$arg"|grep -E -c "$OURCYGPATTERN" -` CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|grep -E -c "^-"` ### Determine if an option CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
# #
# Build the Android libraries without needing a project # Build the Android libraries without needing a project
# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.) # (AndroidManifest.xml, jni/{Application,Android}.mk, etc.)
-32
View File
@@ -1,32 +0,0 @@
#!/bin/sh
cd "$(dirname $0)/../src"
echo "Running clang-format in $(pwd)"
find . -regex '.*\.[chm]p*' -exec clang-format -i {} \;
# Revert third-party code
git checkout \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
libm \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
video/arm \
video/khronos \
video/x11/edid-parse.c \
video/yuv2rgb
clang-format -i hidapi/SDL_hidapi.c
# Revert generated code
git checkout dynapi/SDL_dynapi_overrides.h
git checkout dynapi/SDL_dynapi_procs.h
git checkout render/metal/SDL_shaders_metal_*.h
echo "clang-format complete!"
+1 -1
View File
@@ -1075,7 +1075,7 @@ case $cpu-$vendor in
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
cpu=i586 cpu=i586
;; ;;
pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*)
cpu=i686 cpu=i686
;; ;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -395,7 +395,7 @@ int main(void)
printf( printf(
"/*\n" "/*\n"
" Simple DirectMedia Layer\n" " Simple DirectMedia Layer\n"
" Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>\n" " Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>\n"
"\n" "\n"
" This software is provided 'as-is', without any express or implied\n" " This software is provided 'as-is', without any express or implied\n"
" warranty. In no event will the authors be held liable for any damages\n" " warranty. In no event will the authors be held liable for any damages\n"
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -113,7 +113,7 @@ int main(void)
printf( printf(
"/*\n" "/*\n"
" Simple DirectMedia Layer\n" " Simple DirectMedia Layer\n"
" Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>\n" " Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>\n"
"\n" "\n"
" This software is provided 'as-is', without any express or implied\n" " This software is provided 'as-is', without any express or implied\n"
" warranty. In no event will the authors be held liable for any damages\n" " warranty. In no event will the authors be held liable for any damages\n"
-21
View File
@@ -4,8 +4,6 @@
set -eu set -eu
cd `dirname $0`/..
ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h) ref_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h)
ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h) ref_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h)
ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h) ref_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h)
@@ -141,25 +139,6 @@ else
not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version" not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version"
fi fi
version=$(sed -Ene 's/Title SDL (.*)/\1/p' Xcode/SDL/pkg-support/SDL.info)
if [ "$ref_version" = "$version" ]; then
ok "SDL.info Title $version"
else
not_ok "SDL.info Title $version disagrees with SDL_version.h $ref_version"
fi
marketing=$(sed -Ene 's/.*MARKETING_VERSION = (.*);/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
ref="$ref_version
$ref_version"
if [ "$ref" = "$marketing" ]; then
ok "project.pbxproj MARKETING_VERSION is consistent"
else
not_ok "project.pbxproj MARKETING_VERSION is inconsistent, expected $ref, got $marketing"
fi
# For simplicity this assumes we'll never break ABI before SDL 3. # For simplicity this assumes we'll never break ABI before SDL 3.
dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj) dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj)
-4
View File
@@ -30,10 +30,6 @@ echo "Updating version to '$NEWVERSION' ..."
# !!! FIXME: This first one is a kinda scary search/replace that might fail later if another X.Y.Z version is added to the file. # !!! FIXME: This first one is a kinda scary search/replace that might fail later if another X.Y.Z version is added to the file.
perl -w -pi -e 's/(\<string\>)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/Info-Framework.plist perl -w -pi -e 's/(\<string\>)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/Info-Framework.plist
perl -w -pi -e 's/(Title SDL )\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/pkg-support/SDL.info
perl -w -pi -e 's/(MARKETING_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$NEWVERSION'/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
DYVER=`expr $MINOR \* 100 + 1` DYVER=`expr $MINOR \* 100 + 1`
perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj
+22 -274
View File
@@ -10,7 +10,6 @@ my $projectfullname = 'Simple Directmedia Layer';
my $projectshortname = 'SDL'; my $projectshortname = 'SDL';
my $wikisubdir = ''; my $wikisubdir = '';
my $incsubdir = 'include'; my $incsubdir = 'include';
my $readmesubdir = undef;
my $apiprefixregex = undef; my $apiprefixregex = undef;
my $versionfname = 'include/SDL_version.h'; my $versionfname = 'include/SDL_version.h';
my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z'; my $versionmajorregex = '\A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z';
@@ -23,12 +22,10 @@ my $wikiurl = 'https://wiki.libsdl.org';
my $bugreporturl = 'https://github.com/libsdl-org/sdlwiki/issues/new'; my $bugreporturl = 'https://github.com/libsdl-org/sdlwiki/issues/new';
my $srcpath = undef; my $srcpath = undef;
my $wikipath = undef; my $wikipath = undef;
my $wikireadmesubdir = 'README';
my $warn_about_missing = 0; my $warn_about_missing = 0;
my $copy_direction = 0; my $copy_direction = 0;
my $optionsfname = undef; my $optionsfname = undef;
my $wikipreamble = undef; my $wikipreamble = undef;
my $changeformat = undef;
foreach (@ARGV) { foreach (@ARGV) {
$warn_about_missing = 1, next if $_ eq '--warn-about-missing'; $warn_about_missing = 1, next if $_ eq '--warn-about-missing';
@@ -39,9 +36,6 @@ foreach (@ARGV) {
if (/\A--options=(.*)\Z/) { if (/\A--options=(.*)\Z/) {
$optionsfname = $1; $optionsfname = $1;
next; next;
} elsif (/\A--changeformat=(.*)\Z/) {
$changeformat = $1;
next;
} }
$srcpath = $_, next if not defined $srcpath; $srcpath = $_, next if not defined $srcpath;
$wikipath = $_, next if not defined $wikipath; $wikipath = $_, next if not defined $wikipath;
@@ -73,7 +67,6 @@ if (defined $optionsfname) {
$projectshortname = $val, next if $key eq 'projectshortname'; $projectshortname = $val, next if $key eq 'projectshortname';
$wikisubdir = $val, next if $key eq 'wikisubdir'; $wikisubdir = $val, next if $key eq 'wikisubdir';
$incsubdir = $val, next if $key eq 'incsubdir'; $incsubdir = $val, next if $key eq 'incsubdir';
$readmesubdir = $val, next if $key eq 'readmesubdir';
$versionmajorregex = $val, next if $key eq 'versionmajorregex'; $versionmajorregex = $val, next if $key eq 'versionmajorregex';
$versionminorregex = $val, next if $key eq 'versionminorregex'; $versionminorregex = $val, next if $key eq 'versionminorregex';
$versionpatchregex = $val, next if $key eq 'versionpatchregex'; $versionpatchregex = $val, next if $key eq 'versionpatchregex';
@@ -138,7 +131,6 @@ sub wordwrap_with_bullet_indent { # don't call this directly.
my $usual_prefix = ' ' x $bulletlen; my $usual_prefix = ' ' x $bulletlen;
foreach (@wrappedlines) { foreach (@wrappedlines) {
s/\s*\Z//;
$retval .= "$prefix$_\n"; $retval .= "$prefix$_\n";
$prefix = $usual_prefix; $prefix = $usual_prefix;
} }
@@ -263,30 +255,10 @@ sub wikify_chunk {
$str .= "<syntaxhighlight lang='$codelang'>$code<\/syntaxhighlight>"; $str .= "<syntaxhighlight lang='$codelang'>$code<\/syntaxhighlight>";
} }
} elsif ($wikitype eq 'md') { } elsif ($wikitype eq 'md') {
# convert `code` things first, so they aren't mistaken for other markdown items.
my $codedstr = '';
while ($str =~ s/\A(.*?)(\`.*?\`)//ms) {
my $codeblock = $2;
$codedstr .= wikify_chunk($wikitype, $1, undef, undef);
if (defined $apiprefixregex) {
# Convert obvious API things to wikilinks, even inside `code` blocks,
# BUT ONLY IF the entire code block is the API thing,
# So something like "just call `SDL_Whatever`" will become
# "just call [`SDL_Whatever`](SDL_Whatever)", but
# "just call `SDL_Whatever(7)`" will not. It's just the safest
# way to do this without resorting to wrapping things in html <code> tags.
$codeblock =~ s/\A\`($apiprefixregex[a-zA-Z0-9_]+)\`\Z/[`$1`]($1)/gms;
}
$codedstr .= $codeblock;
}
# Convert obvious API things to wikilinks. # Convert obvious API things to wikilinks.
if (defined $apiprefixregex) { if (defined $apiprefixregex) {
$str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[$1]($1)/gms; $str =~ s/\b($apiprefixregex[a-zA-Z0-9_]+)/[$1]($1)/gms;
} }
$str = $codedstr . $str;
if (defined $code) { if (defined $code) {
$str .= "```$codelang$code```"; $str .= "```$codelang$code```";
} }
@@ -353,11 +325,6 @@ sub dewikify_chunk {
# bullets # bullets
$str =~ s/^\* /- /gm; $str =~ s/^\* /- /gm;
} elsif ($wikitype eq 'md') {
# Dump obvious wikilinks. The rest can just passthrough.
if (defined $apiprefixregex) {
$str =~ s/\[(\`?$apiprefixregex[a-zA-Z0-9_]+\`?)\]\($apiprefixregex[a-zA-Z0-9_]+\)/$1/gms;
}
} }
if (defined $code) { if (defined $code) {
@@ -388,30 +355,6 @@ sub dewikify_chunk {
# bullets # bullets
$str =~ s/^\* /\n\\\(bu /gm; $str =~ s/^\* /\n\\\(bu /gm;
} elsif ($wikitype eq 'md') {
# Dump obvious wikilinks.
if (defined $apiprefixregex) {
$str =~ s/\[(\`?$apiprefixregex[a-zA-Z0-9_]+\`?)\]\($apiprefixregex[a-zA-Z0-9_]+\)/\n.BR $1\n/gms;
}
# links
$str =~ s/\[(.*?)]\((https?\:\/\/.*?)\)/\n.URL "$2" "$1"\n/g;
# <code></code> is also popular. :/
$str =~ s/\s*\`(.*?)\`\s*/\n.BR $1\n/gms;
# bold+italic
$str =~ s/\s*\*\*\*(.*?)\*\*\*\s*/\n.BI $1\n/gms;
# bold
$str =~ s/\s*\*\*(.*?)\*\*\s*/\n.B $1\n/gms;
# italic
$str =~ s/\s*\*(.*?)\*\s*/\n.I $1\n/gms;
# bullets
$str =~ s/^\- /\n\\\(bu /gm;
} else { } else {
die("Unexpected wikitype when converting to manpages\n"); # !!! FIXME: need to handle Markdown wiki pages. die("Unexpected wikitype when converting to manpages\n"); # !!! FIXME: need to handle Markdown wiki pages.
} }
@@ -456,23 +399,6 @@ sub dewikify {
return $retval; return $retval;
} }
sub filecopy {
my $src = shift;
my $dst = shift;
my $endline = shift;
$endline = "\n" if not defined $endline;
open(COPYIN, '<', $src) or die("Failed to open '$src' for reading: $!\n");
open(COPYOUT, '>', $dst) or die("Failed to open '$dst' for writing: $!\n");
while (<COPYIN>) {
chomp;
s/[ \t\r\n]*\Z//;
print COPYOUT "$_$endline";
}
close(COPYOUT);
close(COPYIN);
}
sub usage { sub usage {
die("USAGE: $0 <source code git clone path> <wiki git clone path> [--copy-to-headers|--copy-to-wiki|--copy-to-manpages] [--warn-about-missing]\n\n"); die("USAGE: $0 <source code git clone path> <wiki git clone path> [--copy-to-headers|--copy-to-wiki|--copy-to-manpages] [--warn-about-missing]\n\n");
} }
@@ -489,7 +415,6 @@ my @standard_wiki_sections = (
'Function Parameters', 'Function Parameters',
'Return Value', 'Return Value',
'Remarks', 'Remarks',
'Thread Safety',
'Version', 'Version',
'Code Examples', 'Code Examples',
'Related Functions' 'Related Functions'
@@ -513,15 +438,9 @@ my %headerfuncshasdoxygen = (); # $headerfuncschunk{"SDL_OpenAudio"} -> 1 if t
my $incpath = "$srcpath"; my $incpath = "$srcpath";
$incpath .= "/$incsubdir" if $incsubdir ne ''; $incpath .= "/$incsubdir" if $incsubdir ne '';
my $wikireadmepath = "$wikipath/$wikireadmesubdir";
my $readmepath = undef;
if (defined $readmesubdir) {
$readmepath = "$srcpath/$readmesubdir";
}
opendir(DH, $incpath) or die("Can't opendir '$incpath': $!\n"); opendir(DH, $incpath) or die("Can't opendir '$incpath': $!\n");
while (my $d = readdir(DH)) { while (readdir(DH)) {
my $dent = $d; my $dent = $_;
next if not $dent =~ /$selectheaderregex/; # just selected headers. next if not $dent =~ /$selectheaderregex/; # just selected headers.
open(FH, '<', "$incpath/$dent") or die("Can't open '$incpath/$dent': $!\n"); open(FH, '<', "$incpath/$dent") or die("Can't open '$incpath/$dent': $!\n");
@@ -669,8 +588,8 @@ my %wikitypes = (); # contains string of wiki page extension, like $wikitypes{"
my %wikifuncs = (); # contains references to hash of strings, each string being the full contents of a section of a wiki page, like $wikifuncs{"SDL_OpenAudio"}{"Remarks"}. my %wikifuncs = (); # contains references to hash of strings, each string being the full contents of a section of a wiki page, like $wikifuncs{"SDL_OpenAudio"}{"Remarks"}.
my %wikisectionorder = (); # contains references to array, each array item being a key to a wikipage section in the correct order, like $wikisectionorder{"SDL_OpenAudio"}[2] == 'Remarks' my %wikisectionorder = (); # contains references to array, each array item being a key to a wikipage section in the correct order, like $wikisectionorder{"SDL_OpenAudio"}[2] == 'Remarks'
opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n"); opendir(DH, $wikipath) or die("Can't opendir '$wikipath': $!\n");
while (my $d = readdir(DH)) { while (readdir(DH)) {
my $dent = $d; my $dent = $_;
my $type = ''; my $type = '';
if ($dent =~ /\.(md|mediawiki)\Z/) { if ($dent =~ /\.(md|mediawiki)\Z/) {
$type = $1; $type = $1;
@@ -807,14 +726,13 @@ if ($copy_direction == 1) { # --copy-to-headers
next if not defined $wikifuncs{$fn}; # don't have a page for that function, skip it. next if not defined $wikifuncs{$fn}; # don't have a page for that function, skip it.
my $wikitype = $wikitypes{$fn}; my $wikitype = $wikitypes{$fn};
my $sectionsref = $wikifuncs{$fn}; my $sectionsref = $wikifuncs{$fn};
my $remarks = $sectionsref->{'Remarks'}; my $remarks = %$sectionsref{'Remarks'};
my $params = $sectionsref->{'Function Parameters'}; my $params = %$sectionsref{'Function Parameters'};
my $returns = $sectionsref->{'Return Value'}; my $returns = %$sectionsref{'Return Value'};
my $threadsafety = $sectionsref->{'Thread Safety'}; my $version = %$sectionsref{'Version'};
my $version = $sectionsref->{'Version'}; my $related = %$sectionsref{'Related Functions'};
my $related = $sectionsref->{'Related Functions'}; my $deprecated = %$sectionsref{'Deprecated'};
my $deprecated = $sectionsref->{'Deprecated'}; my $brief = %$sectionsref{'[Brief]'};
my $brief = $sectionsref->{'[Brief]'};
my $addblank = 0; my $addblank = 0;
my $str = ''; my $str = '';
@@ -879,33 +797,6 @@ if ($copy_direction == 1) { # --copy-to-headers
$str .= "${whitespace}$_\n"; $str .= "${whitespace}$_\n";
} }
} }
} elsif ($wikitype eq 'md') {
my $l;
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\|\s*\|\s*\Z/);
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\-*\s*\|\s*\-*\s*\|\s*\Z/);
while (scalar(@lines) >= 1) {
$l = shift @lines;
if ($l =~ /\A\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*\Z/) {
my $name = $1;
my $desc = $2;
$name =~ s/\A\*\*(.*?)\*\*/$1/;
$name =~ s/\A\'\'\'(.*?)\'\'\'/$1/;
#print STDERR "FN: $fn NAME: $name DESC: $desc\n";
my $whitespacelen = length($name) + 8;
my $whitespace = ' ' x $whitespacelen;
$desc = wordwrap($desc, -$whitespacelen);
my @desclines = split /\n/, $desc;
my $firstline = shift @desclines;
$str .= "\\param $name $firstline\n";
foreach (@desclines) {
$str .= "${whitespace}$_\n";
}
} else {
last; # we seem to have run out of table.
}
}
} else { } else {
die("write me"); die("write me");
} }
@@ -930,21 +821,6 @@ if ($copy_direction == 1) { # --copy-to-headers
} }
} }
if (defined $threadsafety) {
# !!! FIXME: lots of code duplication in all of these.
$str .= "\n" if $addblank; $addblank = 1;
my $v = dewikify($wikitype, $threadsafety);
my $whitespacelen = length("\\threadsafety") + 1;
my $whitespace = ' ' x $whitespacelen;
$v = wordwrap($v, -$whitespacelen);
my @desclines = split /\n/, $v;
my $firstline = shift @desclines;
$str .= "\\threadsafety $firstline\n";
foreach (@desclines) {
$str .= "${whitespace}$_\n";
}
}
if (defined $version) { if (defined $version) {
# !!! FIXME: lots of code duplication in all of these. # !!! FIXME: lots of code duplication in all of these.
$str .= "\n" if $addblank; $addblank = 1; $str .= "\n" if $addblank; $addblank = 1;
@@ -969,7 +845,6 @@ if ($copy_direction == 1) { # --copy-to-headers
s/\A(\:|\* )//; s/\A(\:|\* )//;
s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func" s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain. s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain.
s/\[(.*?)\]\(.*?\)/$1/; # in case some wikilinks remain.
s/\A\/*//; s/\A\/*//;
$str .= "\\sa $_\n"; $str .= "\\sa $_\n";
} }
@@ -1030,32 +905,11 @@ if ($copy_direction == 1) { # --copy-to-headers
rename($path, "$incpath/$header") or die("Can't rename '$path' to '$incpath/$header': $!\n"); rename($path, "$incpath/$header") or die("Can't rename '$path' to '$incpath/$header': $!\n");
} }
if (defined $readmepath) {
if ( -d $wikireadmepath ) {
mkdir($readmepath); # just in case
opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
while (readdir(DH)) {
my $dent = $_;
if ($dent =~ /\A(.*?)\.md\Z/) { # we only bridge Markdown files here.
next if $1 eq 'FrontPage';
filecopy("$wikireadmepath/$dent", "$readmepath/README-$dent", "\r\n");
}
}
closedir(DH);
}
}
} elsif ($copy_direction == -1) { # --copy-to-wiki } elsif ($copy_direction == -1) { # --copy-to-wiki
if (defined $changeformat) {
$dewikify_mode = $changeformat;
$wordwrap_mode = $changeformat;
}
foreach (keys %headerfuncs) { foreach (keys %headerfuncs) {
my $fn = $_; my $fn = $_;
next if not $headerfuncshasdoxygen{$fn}; next if not $headerfuncshasdoxygen{$fn};
my $origwikitype = defined $wikitypes{$fn} ? $wikitypes{$fn} : 'md'; # default to MarkDown for new stuff. my $wikitype = defined $wikitypes{$fn} ? $wikitypes{$fn} : 'mediawiki'; # default to MediaWiki for new stuff FOR NOW.
my $wikitype = (defined $changeformat) ? $changeformat : $origwikitype;
die("Unexpected wikitype '$wikitype'\n") if (($wikitype ne 'mediawiki') and ($wikitype ne 'md') and ($wikitype ne 'manpage')); die("Unexpected wikitype '$wikitype'\n") if (($wikitype ne 'mediawiki') and ($wikitype ne 'md') and ($wikitype ne 'manpage'));
#print("$fn\n"); next; #print("$fn\n"); next;
@@ -1193,21 +1047,6 @@ if ($copy_direction == 1) { # --copy-to-headers
} }
$desc =~ s/[\s\n]+\Z//ms; $desc =~ s/[\s\n]+\Z//ms;
$sections{'Version'} = wordwrap(wikify($wikitype, $desc)) . "\n"; $sections{'Version'} = wordwrap(wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\threadsafety\s+(.*)\Z/) {
my $desc = $1;
while (@doxygenlines) {
my $subline = $doxygenlines[0];
$subline =~ s/\A\s*//;
last if $subline =~ /\A\\/; # some sort of doxygen command, assume we're past this thing.
shift @doxygenlines; # dump this line from the array; we're using it.
if ($subline eq '') { # empty line, make sure it keeps the newline char.
$desc .= "\n";
} else {
$desc .= " $subline";
}
}
$desc =~ s/[\s\n]+\Z//ms;
$sections{'Thread Safety'} = wordwrap(wikify($wikitype, $desc)) . "\n";
} elsif ($l =~ /\A\\sa\s+(.*)\Z/) { } elsif ($l =~ /\A\\sa\s+(.*)\Z/) {
my $sa = $1; my $sa = $1;
$sa =~ s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func" $sa =~ s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
@@ -1286,25 +1125,8 @@ if ($copy_direction == 1) { # --copy-to-headers
push @$wikisectionorderref, '[footer]'; push @$wikisectionorderref, '[footer]';
} }
# If changing format, convert things that otherwise are passed through unmolested.
if (defined $changeformat) {
if (($dewikify_mode eq 'md') and ($origwikitype eq 'mediawiki')) {
$$sectionsref{'[footer]'} =~ s/\[\[(Category[a-zA-Z0-9_]+)\]\]/[$1]($1)/g;
} elsif (($dewikify_mode eq 'mediawiki') and ($origwikitype eq 'md')) {
$$sectionsref{'[footer]'} =~ s/\[(Category[a-zA-Z0-9_]+)\]\(.*?\)/[[$1]]/g;
}
foreach (keys %only_wiki_sections) {
my $sect = $_;
if (defined $$sectionsref{$sect}) {
$$sectionsref{$sect} = wikify($wikitype, dewikify($origwikitype, $$sectionsref{$sect}));
}
}
}
# !!! FIXME: This won't be CategoryAPI if we eventually handle things other than functions. # !!! FIXME: This won't be CategoryAPI if we eventually handle things other than functions.
my $footer = $$sectionsref{'[footer]'}; my $footer = $$sectionsref{'[footer]'};
if ($wikitype eq 'mediawiki') { if ($wikitype eq 'mediawiki') {
$footer =~ s/\[\[CategoryAPI\]\],?\s*//g; $footer =~ s/\[\[CategoryAPI\]\],?\s*//g;
$footer = '[[CategoryAPI]]' . (($footer eq '') ? "\n" : ", $footer"); $footer = '[[CategoryAPI]]' . (($footer eq '') ? "\n" : ", $footer");
@@ -1315,11 +1137,10 @@ if ($copy_direction == 1) { # --copy-to-headers
$$sectionsref{'[footer]'} = $footer; $$sectionsref{'[footer]'} = $footer;
if (defined $wikipreamble) { if (defined $wikipreamble) {
my $wikified_preamble = wikify($wikitype, $wikipreamble);
if ($wikitype eq 'mediawiki') { if ($wikitype eq 'mediawiki') {
print FH "====== $wikified_preamble ======\n"; print FH "====== $wikipreamble ======\n";
} elsif ($wikitype eq 'md') { } elsif ($wikitype eq 'md') {
print FH "###### $wikified_preamble\n"; print FH "###### $wikipreamble\n";
} else { die("Unexpected wikitype '$wikitype'\n"); } } else { die("Unexpected wikitype '$wikitype'\n"); }
} }
@@ -1364,51 +1185,9 @@ if ($copy_direction == 1) { # --copy-to-headers
print FH "\n\n"; print FH "\n\n";
close(FH); close(FH);
if (defined $changeformat and ($origwikitype ne $wikitype)) {
system("cd '$wikipath' ; git mv '$_.${origwikitype}' '$_.${wikitype}'");
unlink("$wikipath/$_.${origwikitype}");
}
rename($path, "$wikipath/$_.${wikitype}") or die("Can't rename '$path' to '$wikipath/$_.${wikitype}': $!\n"); rename($path, "$wikipath/$_.${wikitype}") or die("Can't rename '$path' to '$wikipath/$_.${wikitype}': $!\n");
} }
if (defined $readmepath) {
if ( -d $readmepath ) {
mkdir($wikireadmepath); # just in case
opendir(DH, $readmepath) or die("Can't opendir '$readmepath': $!\n");
while (my $d = readdir(DH)) {
my $dent = $d;
if ($dent =~ /\AREADME\-(.*?\.md)\Z/) { # we only bridge Markdown files here.
my $wikifname = $1;
next if $wikifname eq 'FrontPage.md';
filecopy("$readmepath/$dent", "$wikireadmepath/$wikifname", "\n");
}
}
closedir(DH);
my @pages = ();
opendir(DH, $wikireadmepath) or die("Can't opendir '$wikireadmepath': $!\n");
while (my $d = readdir(DH)) {
my $dent = $d;
if ($dent =~ /\A(.*?)\.(mediawiki|md)\Z/) {
my $wikiname = $1;
next if $wikiname eq 'FrontPage';
push @pages, $wikiname;
}
}
closedir(DH);
open(FH, '>', "$wikireadmepath/FrontPage.md") or die("Can't open '$wikireadmepath/FrontPage.md': $!\n");
print FH "# All READMEs available here\n\n";
foreach (sort @pages) {
my $wikiname = $_;
print FH "- [$wikiname]($wikiname)\n";
}
close(FH);
}
}
} elsif ($copy_direction == -2) { # --copy-to-manpages } elsif ($copy_direction == -2) { # --copy-to-manpages
# This only takes from the wiki data, since it has sections we omit from the headers, like code examples. # This only takes from the wiki data, since it has sections we omit from the headers, like code examples.
@@ -1456,15 +1235,14 @@ if ($copy_direction == 1) { # --copy-to-headers
next if not defined $wikifuncs{$fn}; # don't have a page for that function, skip it. next if not defined $wikifuncs{$fn}; # don't have a page for that function, skip it.
my $wikitype = $wikitypes{$fn}; my $wikitype = $wikitypes{$fn};
my $sectionsref = $wikifuncs{$fn}; my $sectionsref = $wikifuncs{$fn};
my $remarks = $sectionsref->{'Remarks'}; my $remarks = %$sectionsref{'Remarks'};
my $params = $sectionsref->{'Function Parameters'}; my $params = %$sectionsref{'Function Parameters'};
my $returns = $sectionsref->{'Return Value'}; my $returns = %$sectionsref{'Return Value'};
my $version = $sectionsref->{'Version'}; my $version = %$sectionsref{'Version'};
my $threadsafety = $sectionsref->{'Thread Safety'}; my $related = %$sectionsref{'Related Functions'};
my $related = $sectionsref->{'Related Functions'}; my $examples = %$sectionsref{'Code Examples'};
my $examples = $sectionsref->{'Code Examples'}; my $deprecated = %$sectionsref{'Deprecated'};
my $deprecated = $sectionsref->{'Deprecated'}; my $brief = %$sectionsref{'[Brief]'};
my $brief = $sectionsref->{'[Brief]'};
my $decl = $headerdecls{$fn}; my $decl = $headerdecls{$fn};
my $str = ''; my $str = '';
@@ -1551,28 +1329,6 @@ if ($copy_direction == 1) { # --copy-to-headers
$str .= ".I $name\n"; $str .= ".I $name\n";
$str .= "$desc\n"; $str .= "$desc\n";
} }
} elsif ($wikitype eq 'md') {
my $l;
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\|\s*\|\s*\Z/);
$l = shift @lines;
die("Unexpected data parsing Markdown table") if (not $l =~ /\A\s*\|\s*\-*\s*\|\s*\-*\s*\|\s*\Z/);
while (scalar(@lines) >= 1) {
$l = shift @lines;
if ($l =~ /\A\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*\Z/) {
my $name = $1;
my $desc = $2;
$name =~ s/\A\*\*(.*?)\*\*/$1/;
$name =~ s/\A\'\'\'(.*?)\'\'\'/$1/;
$desc = dewikify($wikitype, $desc);
$str .= ".TP\n";
$str .= ".I $name\n";
$str .= "$desc\n";
} else {
last; # we seem to have run out of table.
}
}
} else { } else {
die("write me"); die("write me");
} }
@@ -1590,11 +1346,6 @@ if ($copy_direction == 1) { # --copy-to-headers
$dewikify_manpage_code_indent = 1; $dewikify_manpage_code_indent = 1;
} }
if (defined $threadsafety) {
$str .= ".SH THREAD SAFETY\n";
$str .= dewikify($wikitype, $threadsafety) . "\n";
}
if (defined $version) { if (defined $version) {
$str .= ".SH AVAILABILITY\n"; $str .= ".SH AVAILABILITY\n";
$str .= dewikify($wikitype, $version) . "\n"; $str .= dewikify($wikitype, $version) . "\n";
@@ -1610,11 +1361,8 @@ if ($copy_direction == 1) { # --copy-to-headers
s/\A(\:|\* )//; s/\A(\:|\* )//;
s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func" s/\(\)\Z//; # Convert "SDL_Func()" to "SDL_Func"
s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain. s/\[\[(.*?)\]\]/$1/; # in case some wikilinks remain.
s/\[(.*?)\]\(.*?\)/$1/; # in case some wikilinks remain.
s/\A\*\s*\Z//;
s/\A\/*//; s/\A\/*//;
s/\A\.BR\s+//; # dewikify added this, but we want to handle it. s/\A\.BR\s+//; # dewikify added this, but we want to handle it.
s/\A\.I\s+//; # dewikify added this, but we want to handle it.
s/\A\s+//; s/\A\s+//;
s/\s+\Z//; s/\s+\Z//;
next if $_ eq ''; next if $_ eq '';
-2
View File
@@ -32,8 +32,6 @@ function(check_cpu_architecture ARCH VARIABLE)
_internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE}) _internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE})
elseif(ARCH STREQUAL "arm64") elseif(ARCH STREQUAL "arm64")
_internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE}) _internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE})
elseif(ARCH STREQUAL "loongarch64")
_internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE})
else() else()
message(WARNING "Unknown CPU architectures (${ARCH}).") message(WARNING "Unknown CPU architectures (${ARCH}).")
set(${VARIABLE} FALSE) set(${VARIABLE} FALSE)
+4 -6
View File
@@ -29,7 +29,7 @@ ENDMACRO()
# Message Output # Message Output
macro(MESSAGE_WARN _TEXT) macro(MESSAGE_WARN _TEXT)
message(WARNING "${_TEXT}") message(STATUS "*** WARNING: ${_TEXT}")
endmacro() endmacro()
macro(MESSAGE_ERROR _TEXT) macro(MESSAGE_ERROR _TEXT)
@@ -64,7 +64,7 @@ macro(MESSAGE_TESTED_OPTION _NAME)
message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_STRIPPEDNAME}}") message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_STRIPPEDNAME}}")
endmacro() endmacro()
function(LISTTOSTR _LIST _OUTPUT) macro(LISTTOSTR _LIST _OUTPUT)
if(${ARGC} EQUAL 3) if(${ARGC} EQUAL 3)
# prefix for each element # prefix for each element
set(_LPREFIX ${ARGV2}) set(_LPREFIX ${ARGV2})
@@ -73,12 +73,10 @@ function(LISTTOSTR _LIST _OUTPUT)
endif() endif()
# Do not use string(REPLACE ";" " ") here to avoid messing up list # Do not use string(REPLACE ";" " ") here to avoid messing up list
# entries # entries
set(res)
foreach(_ITEM ${${_LIST}}) foreach(_ITEM ${${_LIST}})
set(res "${res} ${_LPREFIX}${_ITEM}") set(${_OUTPUT} "${${_OUTPUT}} ${_LPREFIX}${_ITEM}")
endforeach() endforeach()
set(${_OUTPUT} "${res}" PARENT_SCOPE) endmacro()
endfunction()
macro(LISTTOSTRREV _LIST _OUTPUT) macro(LISTTOSTRREV _LIST _OUTPUT)
if(${ARGC} EQUAL 3) if(${ARGC} EQUAL 3)
+19 -61
View File
@@ -1,5 +1,4 @@
include(CMakeParseArguments) include(CMakeParseArguments)
include(${SDL2_SOURCE_DIR}/cmake/sdlfind.cmake)
macro(FindLibraryAndSONAME _LIB) macro(FindLibraryAndSONAME _LIB)
cmake_parse_arguments(FLAS "" "" "LIBDIRS" ${ARGN}) cmake_parse_arguments(FLAS "" "" "LIBDIRS" ${ARGN})
@@ -7,13 +6,6 @@ macro(FindLibraryAndSONAME _LIB)
string(REGEX REPLACE "\\-" "_" _LNAME "${_UPPERLNAME}") string(REGEX REPLACE "\\-" "_" _LNAME "${_UPPERLNAME}")
find_library(${_LNAME}_LIB ${_LIB} PATHS ${FLAS_LIBDIRS}) find_library(${_LNAME}_LIB ${_LIB} PATHS ${FLAS_LIBDIRS})
if(${_LNAME}_LIB MATCHES ".*\\${CMAKE_SHARED_LIBRARY_SUFFIX}.*" AND NOT ${_LNAME}_LIB MATCHES ".*\\${CMAKE_STATIC_LIBRARY_SUFFIX}.*")
set(${_LNAME}_SHARED TRUE)
else()
set(${_LNAME}_SHARED FALSE)
endif()
if(${_LNAME}_LIB) if(${_LNAME}_LIB)
# reduce the library name for shared linking # reduce the library name for shared linking
@@ -91,35 +83,26 @@ endmacro()
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckALSA) macro(CheckALSA)
if(SDL_ALSA) if(SDL_ALSA)
sdlFindALSA() CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H)
if(ALSA_FOUND) if(HAVE_ASOUNDLIB_H)
file(GLOB ALSA_SOURCES "${SDL2_SOURCE_DIR}/src/audio/alsa/*.c") CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND)
endif()
if(HAVE_LIBASOUND)
set(HAVE_ALSA TRUE)
file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
list(APPEND SOURCE_FILES ${ALSA_SOURCES}) list(APPEND SOURCE_FILES ${ALSA_SOURCES})
set(SDL_AUDIO_DRIVER_ALSA 1) set(SDL_AUDIO_DRIVER_ALSA 1)
set(HAVE_ALSA TRUE) if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO)
set(HAVE_ALSA_SHARED FALSE) message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
if(SDL_ALSA_SHARED)
if(HAVE_SDL_LOADSO)
FindLibraryAndSONAME("asound")
if(ASOUND_LIB AND ASOUND_SHARED)
target_include_directories(sdl-build-options INTERFACE $<TARGET_PROPERTY:ALSA::ALSA,INTERFACE_INCLUDE_DIRECTORIES>)
set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
set(HAVE_ALSA_SHARED TRUE)
else()
message(WARNING "Unable to find asound shared object")
endif()
else()
message(WARNING "You must have SDL_LoadObject() support for dynamic ALSA loading")
endif()
endif() endif()
if(NOT HAVE_ALSA_SHARED) FindLibraryAndSONAME("asound")
list(APPEND CMAKE_DEPENDS ALSA::ALSA) if(SDL_ALSA_SHARED AND ASOUND_LIB AND HAVE_SDL_LOADSO)
list(APPEND PKGCONFIG_DEPENDS alsa) set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
set(HAVE_ALSA_SHARED TRUE)
else()
list(APPEND EXTRA_LIBS asound)
endif() endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
else()
set(HAVE_ALSA FALSE)
message(WARNING "Unable to found the alsa development library")
endif() endif()
endif() endif()
endmacro() endmacro()
@@ -734,17 +717,6 @@ macro(CheckWayland)
else() else()
list(APPEND EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES}) list(APPEND EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES})
endif() endif()
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS ${PKG_LIBDECOR_CFLAGS})
list(APPEND CMAKE_REQUIRED_INCLUDES ${PKG_LIBDECOR_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${PKG_LIBDECOR_LINK_LIBRARIES})
check_symbol_exists(libdecor_frame_get_max_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE)
check_symbol_exists(libdecor_frame_get_min_content_size "libdecor.h" HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
if(HAVE_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE AND HAVE_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE)
set(SDL_HAVE_LIBDECOR_GET_MIN_MAX 1)
endif()
cmake_pop_check_state()
endif() endif()
endif() endif()
@@ -977,6 +949,7 @@ macro(CheckPTHREAD)
list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS}) list(APPEND SDL_CFLAGS ${PTHREAD_CFLAGS})
check_c_source_compiles(" check_c_source_compiles("
#define _GNU_SOURCE 1
#include <pthread.h> #include <pthread.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
@@ -987,6 +960,7 @@ macro(CheckPTHREAD)
set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1) set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
else() else()
check_c_source_compiles(" check_c_source_compiles("
#define _GNU_SOURCE 1
#include <pthread.h> #include <pthread.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
@@ -1017,13 +991,10 @@ macro(CheckPTHREAD)
check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H) check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
if (HAVE_PTHREAD_H) if (HAVE_PTHREAD_H)
check_c_source_compiles(" check_c_source_compiles("
#define _GNU_SOURCE 1
#include <pthread.h> #include <pthread.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifdef __APPLE__ pthread_setname_np(pthread_self(), \"\");
pthread_setname_np(\"\");
#else
pthread_setname_np(pthread_self(),\"\");
#endif
return 0; return 0;
}" HAVE_PTHREAD_SETNAME_NP) }" HAVE_PTHREAD_SETNAME_NP)
if (HAVE_PTHREAD_NP_H) if (HAVE_PTHREAD_NP_H)
@@ -1323,16 +1294,3 @@ macro(CheckKMSDRM)
endif() endif()
endif() endif()
endmacro() endmacro()
macro(CheckLibUDev)
if(SDL_LIBUDEV)
check_include_file("libudev.h" have_libudev_header)
if(have_libudev_header)
set(HAVE_LIBUDEV_H TRUE)
FindLibraryAndSONAME(udev)
if(UDEV_LIB_SONAME)
set(SDL_UDEV_DYNAMIC "\"${UDEV_LIB_SONAME}\"")
endif()
endif()
endif()
endmacro()
-9
View File
@@ -1,9 +0,0 @@
macro(sdlFindALSA)
find_package(ALSA MODULE)
if(ALSA_FOUND AND (NOT TARGET ALSA::ALSA) )
add_Library(ALSA::ALSA UNKNOWN IMPORTED)
set_property(TARGET ALSA::ALSA PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS})
set_property(TARGET ALSA::ALSA APPEND PROPERTY IMPORTED_LOCATION ${ALSA_LIBRARY})
endif()
endmacro()
-57
View File
@@ -1,57 +0,0 @@
macro(SDL_DetectCMakePlatform)
set(SDL_CMAKE_PLATFORM )
# Get the platform
if(WIN32)
set(SDL_CMAKE_PLATFORM WINDOWS)
elseif(UNIX AND NOT APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
set(SDL_CMAKE_PLATFORM LINUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(SDL_CMAKE_PLATFORM FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
set(SDL_CMAKE_PLATFORM NETBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(SDL_CMAKE_PLATFORM OPENBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
set(SDL_CMAKE_PLATFORM GNU)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
set(SDL_CMAKE_PLATFORM BSDI)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(SDL_CMAKE_PLATFORM FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
set(SDL_CMAKE_PLATFORM SYSV5)
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
set(SDL_CMAKE_PLATFORM SOLARIS)
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
set(SDL_CMAKE_PLATFORM HPUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
set(SDL_CMAKE_PLATFORM AIX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
set(SDL_CMAKE_PLATFORM MINIX)
endif()
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 "BeOS.*")
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)
elseif(OS2)
set(SDL_CMAKE_PLATFORM OS2)
endif()
if(SDL_CMAKE_PLATFORM)
set(${SDL_CMAKE_PLATFORM} TRUE)
endif()
endmacro()
+13 -13
View File
@@ -13,7 +13,7 @@ case "$machine" in
*android* ) *android* )
EXEPREFIX="lib" EXEPREFIX="lib"
EXESUFFIX=".so" EXESUFFIX=".so"
LDFLAGS="$LDFLAGS -shared" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
;; ;;
* ) * )
EXEPREFIX="" EXEPREFIX=""
@@ -25,20 +25,20 @@ set -e
# Get the canonical path of the folder containing this script # Get the canonical path of the folder containing this script
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
SDL_CFLAGS="$( pkg-config sdl2 --cflags )" CFLAGS="$( pkg-config sdl2 --cflags )"
SDL_LDFLAGS="$( pkg-config sdl2 --libs )" LDFLAGS="$( pkg-config sdl2 --libs )"
SDL_STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )" STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $SDL_CFLAGS $CFLAGS" compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_pkgconfig.c.o $CFLAGS $EXTRA_CFLAGS"
link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS" link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS" static_link_cmd="$CC main_gui_pkgconfig.c.o -o ${EXEPREFIX}main_gui_pkgconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
echo "-- CC: $CC" echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS" echo "-- CFLAGS: $CFLAGS"
echo "-- LDFLASG: $LDFLAGS" echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo "-- SDL_CFLAGS: $SDL_CFLAGS" echo "-- LDFLASG: $LDFLAGS"
echo "-- SDL_LDFLAGS: $SDL_LDFLAGS" echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS"
echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS" echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo "-- COMPILE: $compile_cmd" echo "-- COMPILE: $compile_cmd"
echo "-- LINK: $link_cmd" echo "-- LINK: $link_cmd"
+13 -13
View File
@@ -13,7 +13,7 @@ case "$machine" in
*android* ) *android* )
EXEPREFIX="lib" EXEPREFIX="lib"
EXESUFFIX=".so" EXESUFFIX=".so"
LDFLAGS="$LDFLAGS -shared" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -shared"
;; ;;
* ) * )
EXEPREFIX="" EXEPREFIX=""
@@ -25,20 +25,20 @@ set -e
# Get the canonical path of the folder containing this script # Get the canonical path of the folder containing this script
testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
SDL_CFLAGS="$( sdl2-config --cflags )" CFLAGS="$( sdl2-config --cflags )"
SDL_LDFLAGS="$( sdl2-config --libs )" LDFLAGS="$( sdl2-config --libs )"
SDL_STATIC_LDFLAGS="$( sdl2-config --static-libs )" STATIC_LDFLAGS="$( sdl2-config --static-libs )"
compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $SDL_CFLAGS" compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $EXTRA_CFLAGS"
link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS" link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $LDFLAGS $EXTRA_LDFLAGS"
static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS" static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $STATIC_LDFLAGS $EXTRA_LDFLAGS"
echo "-- CC: $CC" echo "-- CC: $CC"
echo "-- CFLAGS: $CFLAGS" echo "-- CFLAGS: $CFLAGS"
echo "-- LDFLAGS: $LDFLAGS" echo "-- EXTRA_CFLAGS: $EXTRA_CFLAGS"
echo "-- SDL_CFLAGS: $SDL_CFLAGS" echo "-- LDFLAGS: $LDFLAGS"
echo "-- SDL_LDFLAGS: $SDL_LDFLAGS" echo "-- STATIC_LDFLAGS: $STATIC_LDFLAGS"
echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS" echo "-- EXTRA_LDFLAGS: $EXTRA_LDFLAGS"
echo "-- COMPILE: $compile_cmd" echo "-- COMPILE: $compile_cmd"
echo "-- LINK: $link_cmd" echo "-- LINK: $link_cmd"
Vendored
+93 -334
View File
@@ -677,7 +677,6 @@ ENABLE_STATIC_TRUE
ENABLE_SHARED_FALSE ENABLE_SHARED_FALSE
ENABLE_SHARED_TRUE ENABLE_SHARED_TRUE
PKGCONFIG_LIBS_PRIV PKGCONFIG_LIBS_PRIV
PKGCONFIG_DEPENDS
SDL_RLD_FLAGS SDL_RLD_FLAGS
SDL_STATIC_LIBS SDL_STATIC_LIBS
SDL_LIBS SDL_LIBS
@@ -2449,58 +2448,6 @@ printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_member } # ac_fn_c_check_member
# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR
# ------------------------------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR.
ac_fn_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
as_decl_name=`echo $2|sed 's/ *(.*//'`
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
printf %s "checking whether $as_decl_name is declared... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else $as_nop
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
eval ac_save_FLAGS=\$$6
as_fn_append $6 " $5"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main (void)
{
#ifndef $as_decl_name
#ifdef __cplusplus
(void) $as_decl_use;
#else
(void) $as_decl_name;
#endif
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
eval $6=\$ac_save_FLAGS
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_check_decl
ac_configure_args_raw= ac_configure_args_raw=
for ac_arg for ac_arg
do do
@@ -3506,7 +3453,7 @@ orig_CFLAGS="$CFLAGS"
# See docs/release_checklist.md # See docs/release_checklist.md
SDL_MAJOR_VERSION=2 SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=28 SDL_MINOR_VERSION=26
SDL_MICRO_VERSION=2 SDL_MICRO_VERSION=2
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
@@ -17705,79 +17652,6 @@ printf "%s\n" "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP" EGREP="$ac_cv_path_EGREP"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
printf %s "checking for fgrep... " >&6; }
if test ${ac_cv_path_FGREP+y}
then :
printf %s "(cached) " >&6
else $as_nop
if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
then ac_cv_path_FGREP="$GREP -F"
else
if test -z "$FGREP"; then
ac_path_FGREP_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_prog in fgrep
do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext"
as_fn_executable_p "$ac_path_FGREP" || continue
# Check for GNU ac_path_FGREP and select it if it is found.
# Check for GNU $ac_path_FGREP
case `"$ac_path_FGREP" --version 2>&1` in
*GNU*)
ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
*)
ac_count=0
printf %s 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
printf "%s\n" 'FGREP' >> "conftest.nl"
"$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_FGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_FGREP="$ac_path_FGREP"
ac_path_FGREP_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_FGREP_found && break 3
done
done
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_FGREP"; then
as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_FGREP=$FGREP
fi
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
printf "%s\n" "$ac_cv_path_FGREP" >&6; }
FGREP="$ac_cv_path_FGREP"
# Find a good install program. We prefer a C program (faster), # Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or # so one script is as good as another. But avoid the broken or
@@ -18418,8 +18292,8 @@ base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
find_lib() find_lib()
{ {
gcc_bin_path=`$CC -print-search-dirs 2>/dev/null | $FGREP programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'` gcc_bin_path=`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`
gcc_lib_path=`$CC -print-search-dirs 2>/dev/null | $FGREP libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'` gcc_lib_path=`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`
env_lib_path=`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'` env_lib_path=`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`
if test "$cross_compiling" = yes; then if test "$cross_compiling" = yes; then
host_lib_path="" host_lib_path=""
@@ -23026,6 +22900,41 @@ printf "%s\n" "$have_gcc_no_strict_aliasing" >&6; }
fi fi
} }
CheckStackBoundary()
{
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mpreferred-stack-boundary option" >&5
printf %s "checking for GCC -mpreferred-stack-boundary option... " >&6; }
have_gcc_preferred_stack_boundary=no
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int x = 0;
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
have_gcc_preferred_stack_boundary=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_preferred_stack_boundary" >&5
printf "%s\n" "$have_gcc_preferred_stack_boundary" >&6; }
CFLAGS="$save_CFLAGS"
if test x$have_gcc_preferred_stack_boundary = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
fi
}
CheckWerror() CheckWerror()
{ {
# Check whether --enable-werror was given. # Check whether --enable-werror was given.
@@ -23190,41 +23099,6 @@ printf "%s\n" "$need_gcc_Wno_multichar" >&6; }
fi fi
} }
CheckUnusedLocalTypedefs()
{
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wunused-local-typedefs option" >&5
printf %s "checking for GCC -Wunused-local-typedefs option... " >&6; }
have_gcc_unused_local_typedefs=no
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -Wunused-local-typedefs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int x = 0;
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
have_gcc_unused_local_typedefs=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_unused_local_typedefs" >&5
printf "%s\n" "$have_gcc_unused_local_typedefs" >&6; }
CFLAGS="$save_CFLAGS"
if test x$have_gcc_unused_local_typedefs = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-unused-local-typedefs"
fi
}
CheckWayland() CheckWayland()
{ {
# Check whether --enable-video-wayland was given. # Check whether --enable-video-wayland was given.
@@ -23455,122 +23329,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR \"$decor_lib\""
else else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi fi
saved_cflags=$CFLAGS
CFLAGS="$CFLAGS $DECOR_CFLAGS"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_save_CFLAGS=$CFLAGS
ac_cv_c_undeclared_builtin_options='cannot detect'
for ac_arg in '' -fno-builtin; do
CFLAGS="$ac_save_CFLAGS $ac_arg"
# This test program should *not* compile successfully.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
(void) strchr;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
else $as_nop
# This test program should compile successfully.
# No library function is consistently available on
# freestanding implementations, so test against a dummy
# declaration. Include always-available headers on the
# off chance that they somehow elicit warnings.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <float.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
extern void ac_decl (int, char *);
int
main (void)
{
(void) ac_decl (0, (char *) 0);
(void) ac_decl;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
if test x"$ac_arg" = x
then :
ac_cv_c_undeclared_builtin_options='none needed'
else $as_nop
ac_cv_c_undeclared_builtin_options=$ac_arg
fi
break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
done
CFLAGS=$ac_save_CFLAGS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5
printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; }
case $ac_cv_c_undeclared_builtin_options in #(
'cannot detect') :
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot make $CC report undeclared builtins
See \`config.log' for more details" "$LINENO" 5; } ;; #(
'none needed') :
ac_c_undeclared_builtin_options='' ;; #(
*) :
ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;;
esac
ac_fn_check_decl "$LINENO" "libdecor_frame_get_min_content_size" "ac_cv_have_decl_libdecor_frame_get_min_content_size" "#include <libdecor.h>
" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_libdecor_frame_get_min_content_size" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_LIBDECOR_FRAME_GET_MIN_CONTENT_SIZE $ac_have_decl" >>confdefs.h
if test $ac_have_decl = 1
then :
libdecor_get_min_max=yes
fi
ac_fn_check_decl "$LINENO" "libdecor_frame_get_max_content_size" "ac_cv_have_decl_libdecor_frame_get_max_content_size" "#include <libdecor.h>
" "$ac_c_undeclared_builtin_options" "CFLAGS"
if test "x$ac_cv_have_decl_libdecor_frame_get_max_content_size" = xyes
then :
ac_have_decl=1
else $as_nop
ac_have_decl=0
fi
printf "%s\n" "#define HAVE_DECL_LIBDECOR_FRAME_GET_MAX_CONTENT_SIZE $ac_have_decl" >>confdefs.h
if test $ac_have_decl = 1
then :
libdecor_get_min_max=yes
fi
if test x$libdecor_get_min_max = xyes; then
printf "%s\n" "#define SDL_HAVE_LIBDECOR_GET_MIN_MAX 1" >>confdefs.h
fi
CFLAGS="$saved_cflags"
fi fi
fi fi
fi fi
@@ -27439,6 +27197,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wince" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_wince" >&5
printf "%s\n" "$have_wince" >&6; } printf "%s\n" "$have_wince" >&6; }
# This fixes Windows stack alignment with newer GCC
CheckStackBoundary
# headers needed elsewhere # headers needed elsewhere
ac_fn_c_check_header_compile "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default" ac_fn_c_check_header_compile "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default"
if test "x$ac_cv_header_tpcshrd_h" = xyes if test "x$ac_cv_header_tpcshrd_h" = xyes
@@ -28247,7 +28008,7 @@ fi
enable_hidapi_libusb=yes enable_hidapi_libusb=yes
require_hidapi_libusb=yes require_hidapi_libusb=yes
;; ;;
*-*-os2* ) *-*-os2* )
enable_hidapi_libusb=yes enable_hidapi_libusb=yes
;; ;;
esac esac
@@ -28401,52 +28162,7 @@ else $as_nop
fi fi
if test x$enable_clock_gettime = xyes; then if test x$enable_clock_gettime = xyes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
printf %s "checking for clock_gettime in -lc... " >&6; }
if test ${ac_cv_lib_c_clock_gettime+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lc $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char clock_gettime ();
int
main (void)
{
return clock_gettime ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_c_clock_gettime=yes
else $as_nop
ac_cv_lib_c_clock_gettime=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5
printf "%s\n" "$ac_cv_lib_c_clock_gettime" >&6; }
if test "x$ac_cv_lib_c_clock_gettime" = xyes
then :
have_clock_gettime=yes
fi
if test x$have_clock_gettime = xyes; then
printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
printf %s "checking for clock_gettime in -lrt... " >&6; } printf %s "checking for clock_gettime in -lrt... " >&6; }
if test ${ac_cv_lib_rt_clock_gettime+y} if test ${ac_cv_lib_rt_clock_gettime+y}
then : then :
@@ -28486,11 +28202,57 @@ then :
have_clock_gettime=yes have_clock_gettime=yes
fi fi
if test x$have_clock_gettime = xyes; then if test x$have_clock_gettime = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lc" >&5
printf %s "checking for clock_gettime in -lc... " >&6; }
if test ${ac_cv_lib_c_clock_gettime+y}
then :
printf %s "(cached) " >&6
else $as_nop
ac_check_lib_save_LIBS=$LIBS
LIBS="-lc $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char clock_gettime ();
int
main (void)
{
return clock_gettime ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_c_clock_gettime=yes
else $as_nop
ac_cv_lib_c_clock_gettime=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_clock_gettime" >&5
printf "%s\n" "$ac_cv_lib_c_clock_gettime" >&6; }
if test "x$ac_cv_lib_c_clock_gettime" = xyes
then :
have_clock_gettime=yes
fi
if test x$have_clock_gettime = xyes; then
printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
fi fi
fi fi
fi fi
@@ -28568,7 +28330,6 @@ printf "%s\n" "#define SDL_JOYSTICK_VIRTUAL 1" >>confdefs.h
} }
CheckWarnAll CheckWarnAll
CheckUnusedLocalTypedefs
CheckNoStrictAliasing CheckNoStrictAliasing
CheckEventSignals CheckEventSignals
@@ -29640,7 +29401,7 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/video/os2/*.c" SOURCES="$SOURCES $srcdir/src/video/os2/*.c"
have_video=yes have_video=yes
SUMMARY_video="${SUMMARY_video} OS/2" SUMMARY_video="${SUMMARY_video} os/2"
fi fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
@@ -29649,7 +29410,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" SOURCES="$SOURCES $srcdir/src/audio/os2/*.c"
have_audio=yes have_audio=yes
SUMMARY_audio="${SUMMARY_audio} OS/2" SUMMARY_audio="${SUMMARY_audio} os/2"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2"
fi fi
# Set up files for the thread library # Set up files for the thread library
@@ -30039,8 +29800,6 @@ done
PKGCONFIG_DEPENDS=""
if test x$enable_shared = xyes; then if test x$enable_shared = xyes; then
PKGCONFIG_LIBS_PRIV=" PKGCONFIG_LIBS_PRIV="
Libs.private:" Libs.private:"
+35 -44
View File
@@ -12,7 +12,7 @@ orig_CFLAGS="$CFLAGS"
dnl Set various version strings - taken gratefully from the GTk sources dnl Set various version strings - taken gratefully from the GTk sources
# See docs/release_checklist.md # See docs/release_checklist.md
SDL_MAJOR_VERSION=2 SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=28 SDL_MINOR_VERSION=26
SDL_MICRO_VERSION=2 SDL_MICRO_VERSION=2
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
@@ -62,7 +62,6 @@ AC_PROG_AWK
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_PROG_EGREP AC_PROG_EGREP
AC_PROG_FGREP
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
@@ -181,8 +180,8 @@ base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
dnl Function to find a library in the compiler search path dnl Function to find a library in the compiler search path
find_lib() find_lib()
{ {
gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | $FGREP programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | $FGREP libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`] env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
if test "$cross_compiling" = yes; then if test "$cross_compiling" = yes; then
host_lib_path="" host_lib_path=""
@@ -1558,6 +1557,26 @@ CheckNoStrictAliasing()
fi fi
} }
dnl See if GCC's -mpreferred-stack-boundary is supported.
dnl Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
CheckStackBoundary()
{
AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
have_gcc_preferred_stack_boundary=no
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
int x = 0;
]],[])], [have_gcc_preferred_stack_boundary=yes],[])
AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
CFLAGS="$save_CFLAGS"
if test x$have_gcc_preferred_stack_boundary = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
fi
}
dnl See if GCC's -Werror is supported. dnl See if GCC's -Werror is supported.
CheckWerror() CheckWerror()
{ {
@@ -1654,27 +1673,6 @@ dnl Haiku headers use multicharacter constants all over the place. Ignore these
fi fi
} }
dnl See if GCC's -Wunused-local-typedefs is supported and disable it
dnl because it triggers on gcc 4.8.4 for compile time asserts inside
dnl of functions.
CheckUnusedLocalTypedefs()
{
AC_MSG_CHECKING(for GCC -Wunused-local-typedefs option)
have_gcc_unused_local_typedefs=no
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -Wunused-local-typedefs"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
int x = 0;
]],[])], [have_gcc_unused_local_typedefs=yes],[])
AC_MSG_RESULT($have_gcc_unused_local_typedefs)
CFLAGS="$save_CFLAGS"
if test x$have_gcc_unused_local_typedefs = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-unused-local-typedefs"
fi
}
dnl Check for Wayland dnl Check for Wayland
CheckWayland() CheckWayland()
{ {
@@ -1788,14 +1786,6 @@ dnl See if libdecor is available
else else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi fi
saved_cflags=$CFLAGS
CFLAGS="$CFLAGS $DECOR_CFLAGS"
AC_CHECK_DECLS([libdecor_frame_get_min_content_size, libdecor_frame_get_max_content_size], [libdecor_get_min_max=yes], [ ], [[#include <libdecor.h>]])
if test x$libdecor_get_min_max = xyes; then
AC_DEFINE(SDL_HAVE_LIBDECOR_GET_MIN_MAX, 1, [ ])
fi
CFLAGS="$saved_cflags"
fi fi
fi fi
fi fi
@@ -3286,6 +3276,9 @@ CheckWINDOWS()
],[]) ],[])
AC_MSG_RESULT($have_wince) AC_MSG_RESULT($have_wince)
# This fixes Windows stack alignment with newer GCC
CheckStackBoundary
# headers needed elsewhere # headers needed elsewhere
AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes) AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes)
if test x$have_tpcshrd_h = xyes; then if test x$have_tpcshrd_h = xyes; then
@@ -3614,7 +3607,7 @@ CheckHIDAPI()
enable_hidapi_libusb=yes enable_hidapi_libusb=yes
require_hidapi_libusb=yes require_hidapi_libusb=yes
;; ;;
*-*-os2* ) *-*-os2* )
enable_hidapi_libusb=yes enable_hidapi_libusb=yes
;; ;;
esac esac
@@ -3679,14 +3672,15 @@ CheckClockGettime()
[AS_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=yes]])], [AS_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=yes]])],
, enable_clock_gettime=yes) , enable_clock_gettime=yes)
if test x$enable_clock_gettime = xyes; then if test x$enable_clock_gettime = xyes; then
AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes) AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
if test x$have_clock_gettime = xyes; then if test x$have_clock_gettime = xyes; then
AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ]) AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
else else
AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes) AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
if test x$have_clock_gettime = xyes; then if test x$have_clock_gettime = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt" AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ]) EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
fi fi
fi fi
fi fi
@@ -3744,7 +3738,6 @@ CheckVirtualJoystick()
dnl Do this on all platforms, before everything else (other things might want to override it). dnl Do this on all platforms, before everything else (other things might want to override it).
CheckWarnAll CheckWarnAll
CheckUnusedLocalTypedefs
CheckNoStrictAliasing CheckNoStrictAliasing
dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow. dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow.
@@ -4625,14 +4618,14 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ]) AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ])
SOURCES="$SOURCES $srcdir/src/video/os2/*.c" SOURCES="$SOURCES $srcdir/src/video/os2/*.c"
have_video=yes have_video=yes
SUMMARY_video="${SUMMARY_video} OS/2" SUMMARY_video="${SUMMARY_video} os/2"
fi fi
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_OS2, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_OS2, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" SOURCES="$SOURCES $srcdir/src/audio/os2/*.c"
have_audio=yes have_audio=yes
SUMMARY_audio="${SUMMARY_audio} OS/2" SUMMARY_audio="${SUMMARY_audio} os/2"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2"
fi fi
# Set up files for the thread library # Set up files for the thread library
@@ -4867,8 +4860,6 @@ AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS) AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_STATIC_LIBS) AC_SUBST(SDL_STATIC_LIBS)
AC_SUBST(SDL_RLD_FLAGS) AC_SUBST(SDL_RLD_FLAGS)
PKGCONFIG_DEPENDS=""
AC_SUBST(PKGCONFIG_DEPENDS)
if test x$enable_shared = xyes; then if test x$enable_shared = xyes; then
PKGCONFIG_LIBS_PRIV=" PKGCONFIG_LIBS_PRIV="
Libs.private:" Libs.private:"
+7 -15
View File
@@ -68,22 +68,14 @@ Finally, a word of caution: re running androidbuild.sh wipes any changes you may
done in the build directory for the app! done in the build directory for the app!
For more complex projects, follow these instructions: For more complex projects, follow these instructions:
1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT). 1. Copy the android-project directory wherever you want to keep your projects
and rename it to the name of your project.
2. Move or symlink this SDL directory into the "<project>/app/jni" directory
3. Edit "<project>/app/jni/src/Android.mk" to include your source files
(The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.) 4a. If you want to use Android Studio, simply open your <project> directory and start building.
2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory
(This is needed as the source of SDL has to be compiled by the Android compiler)
3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files.
(They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration)
4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building.
4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device 4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
@@ -91,9 +83,9 @@ For more complex projects, follow these instructions:
If you already have a project that uses CMake, the instructions change somewhat: If you already have a project that uses CMake, the instructions change somewhat:
1. Do points 1 and 2 from the instruction above. 1. Do points 1 and 2 from the instruction above.
2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build 2. Edit "<project>/app/build.gradle" to comment out or remove sections containing ndk-build
and uncomment the cmake sections. Add arguments to the CMake invocation as needed. and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to 3. Edit "<project>/app/jni/CMakeLists.txt" to include your project (it defaults to
adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)" as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
in your CMakeLists.txt file. Also be aware that you should use add_library() instead of in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
-1
View File
@@ -25,4 +25,3 @@ cmake --install build
- SDL2main should be used to ensure ROMFS is enabled. - SDL2main should be used to ensure ROMFS is enabled.
- By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function. - By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
- `SDL_GetBasePath` returns the romfs root instead of the executable's directory. - `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
- The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.
+1 -1
View File
@@ -3,7 +3,7 @@ Simple DirectMedia Layer 2 for OS/2 & eComStation
SDL port for OS/2, authored by Andrey Vasilkin <digi@os2.snc.ru>, 2016 SDL port for OS/2, authored by Andrey Vasilkin <digi@os2.snc.ru>, 2016
OpenGL not supported by this port. OpenGL and audio capture not supported by this port.
Additional optional environment variables: Additional optional environment variables:
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+10 -4
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -125,10 +125,12 @@ typedef struct SDL_AssertData
const struct SDL_AssertData *next; const struct SDL_AssertData *next;
} SDL_AssertData; } SDL_AssertData;
#if (SDL_ASSERT_LEVEL > 0)
/* Never call this directly. Use the SDL_assert* macros. */ /* Never call this directly. Use the SDL_assert* macros. */
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
const char *, const char *,
const char *, int) const char *, int)
#if defined(__clang__) #if defined(__clang__)
#if __has_feature(attribute_analyzer_noreturn) #if __has_feature(attribute_analyzer_noreturn)
/* this tells Clang's static analysis that we're a custom assert function, /* this tells Clang's static analysis that we're a custom assert function,
@@ -149,7 +151,9 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
#define SDL_enabled_assert(condition) \ #define SDL_enabled_assert(condition) \
do { \ do { \
while ( !(condition) ) { \ while ( !(condition) ) { \
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \ static struct SDL_AssertData sdl_assert_data = { \
0, 0, #condition, 0, 0, 0, 0 \
}; \
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \ continue; /* go again. */ \
@@ -160,6 +164,8 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
} \ } \
} while (SDL_NULL_WHILE_LOOP_CONDITION) } while (SDL_NULL_WHILE_LOOP_CONDITION)
#endif /* enabled assertions support code */
/* Enable various levels of assertions. */ /* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ #if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
# define SDL_assert(condition) SDL_disabled_assert(condition) # define SDL_assert(condition) SDL_disabled_assert(condition)
+4 -3
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -240,7 +240,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ /* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) #if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ #define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__) #elif (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory") #define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
#elif (defined(__powerpc__) || defined(__powerpc64__)) #elif (defined(__powerpc__) || defined(__powerpc64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27"); #define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
@@ -249,8 +249,9 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
#define SDL_CPUPauseInstruction() __yield() #define SDL_CPUPauseInstruction() __yield()
#elif defined(__WATCOMC__) && defined(__386__) #elif defined(__WATCOMC__) && defined(__386__)
/* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */
extern __inline void SDL_CPUPauseInstruction(void); extern __inline void SDL_CPUPauseInstruction(void);
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause" #pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h"
#else #else
#define SDL_CPUPauseInstruction() #define SDL_CPUPauseInstruction()
#endif #endif
+8 -8
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -169,13 +169,13 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
* The calculated values in this structure are calculated by SDL_OpenAudio(). * The calculated values in this structure are calculated by SDL_OpenAudio().
* *
* For multi-channel audio, the default SDL channel mapping is: * For multi-channel audio, the default SDL channel mapping is:
* 2: FL FR (stereo) * 2: FL FR (stereo)
* 3: FL FR LFE (2.1 surround) * 3: FL FR LFE (2.1 surround)
* 4: FL FR BL BR (quad) * 4: FL FR BL BR (quad)
* 5: FL FR LFE BL BR (4.1 surround) * 5: FL FR LFE BL BR (4.1 surround)
* 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
* 7: FL FR FC LFE BC SL SR (6.1 surround) * 7: FL FR FC LFE BC SL SR (6.1 surround)
* 8: FL FR FC LFE BL BR SL SR (7.1 surround) * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
*/ */
typedef struct SDL_AudioSpec typedef struct SDL_AudioSpec
{ {
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -52,7 +52,7 @@ typedef enum
dstA = dstA */ dstA = dstA */
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
dstA = dstA */ dstA = (srcA * dstA) + (dstA * (1-srcA)) */
SDL_BLENDMODE_INVALID = 0x7FFFFFFF SDL_BLENDMODE_INVALID = 0x7FFFFFFF
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -5
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -332,7 +332,6 @@
#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@ #cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
#cmakedefine SDL_INPUT_FBSDKBIO @SDL_INPUT_FBSDKBIO@ #cmakedefine SDL_INPUT_FBSDKBIO @SDL_INPUT_FBSDKBIO@
#cmakedefine SDL_INPUT_WSCONS @SDL_INPUT_WSCONS@
#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@ #cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ #cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
#cmakedefine SDL_JOYSTICK_WGI @SDL_JOYSTICK_WGI@ #cmakedefine SDL_JOYSTICK_WGI @SDL_JOYSTICK_WGI@
@@ -360,7 +359,6 @@
#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@ #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@
#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@ #cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@
#cmakedefine SDL_LIBUSB_DYNAMIC @SDL_LIBUSB_DYNAMIC@ #cmakedefine SDL_LIBUSB_DYNAMIC @SDL_LIBUSB_DYNAMIC@
#cmakedefine SDL_UDEV_DYNAMIC @SDL_UDEV_DYNAMIC@
/* Enable various sensor drivers */ /* Enable various sensor drivers */
#cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@ #cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@
@@ -541,8 +539,6 @@
#cmakedefine SDL_VIDEO_VITA_PVR @SDL_VIDEO_VITA_PVR@ #cmakedefine SDL_VIDEO_VITA_PVR @SDL_VIDEO_VITA_PVR@
#cmakedefine SDL_VIDEO_VITA_PVR_OGL @SDL_VIDEO_VITA_PVR_OGL@ #cmakedefine SDL_VIDEO_VITA_PVR_OGL @SDL_VIDEO_VITA_PVR_OGL@
#cmakedefine SDL_HAVE_LIBDECOR_GET_MIN_MAX @SDL_HAVE_LIBDECOR_GET_MIN_MAX@
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_) #if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */ /* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600) #if defined(_MSC_VER) && (_MSC_VER < 1600)
+1 -4
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -491,7 +491,4 @@
/* Enable dynamic libsamplerate support */ /* Enable dynamic libsamplerate support */
#undef SDL_LIBSAMPLERATE_DYNAMIC #undef SDL_LIBSAMPLERATE_DYNAMIC
/* Libdecor get min/max content size functions */
#undef SDL_HAVE_LIBDECOR_GET_MIN_MAX
#endif /* SDL_config_h_ */ #endif /* SDL_config_h_ */
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+7 -12
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -209,21 +209,16 @@
#define SDL_VIDEO_DRIVER_DUMMY 1 #define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1 #define SDL_VIDEO_DRIVER_WINDOWS 1
/* #ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif*/
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
#define SDL_VIDEO_RENDER_D3D11 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H) #if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
#define SDL_VIDEO_RENDER_D3D12 1 #define SDL_VIDEO_RENDER_D3D12 1
#endif #endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
/* Enable system power support */ /* Enable system power support */
/*#define SDL_POWER_WINDOWS 1*/ /*#define SDL_POWER_WINDOWS 1*/
#define SDL_POWER_HARDWIRED 1 #define SDL_POWER_HARDWIRED 1
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+4 -4
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -140,7 +140,7 @@ extern "C" {
#if HAS_BUILTIN_BSWAP16 #if HAS_BUILTIN_BSWAP16
#define SDL_Swap16(x) __builtin_bswap16(x) #define SDL_Swap16(x) __builtin_bswap16(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#pragma intrinsic(_byteswap_ushort) #pragma intrinsic(_byteswap_ushort)
#define SDL_Swap16(x) _byteswap_ushort(x) #define SDL_Swap16(x) _byteswap_ushort(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP #elif defined(__i386__) && !HAS_BROKEN_BSWAP
@@ -189,7 +189,7 @@ SDL_Swap16(Uint16 x)
#if HAS_BUILTIN_BSWAP32 #if HAS_BUILTIN_BSWAP32
#define SDL_Swap32(x) __builtin_bswap32(x) #define SDL_Swap32(x) __builtin_bswap32(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#pragma intrinsic(_byteswap_ulong) #pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x) #define SDL_Swap32(x) _byteswap_ulong(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP #elif defined(__i386__) && !HAS_BROKEN_BSWAP
@@ -241,7 +241,7 @@ SDL_Swap32(Uint32 x)
#if HAS_BUILTIN_BSWAP64 #if HAS_BUILTIN_BSWAP64
#define SDL_Swap64(x) __builtin_bswap64(x) #define SDL_Swap64(x) __builtin_bswap64(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL) #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define SDL_Swap64(x) _byteswap_uint64(x) #define SDL_Swap64(x) _byteswap_uint64(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP #elif defined(__i386__) && !HAS_BROKEN_BSWAP
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+5 -5
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -724,10 +724,10 @@ typedef enum
SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT,
SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */ SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */
SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 (upper left, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 */
SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 (upper right, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 */
SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 (lower left, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 */
SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 (lower right, facing the back) */ SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 */
SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */ SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */
SDL_CONTROLLER_BUTTON_MAX SDL_CONTROLLER_BUTTON_MAX
} SDL_GameControllerButton; } SDL_GameControllerButton;
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
+1 -45
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -377,17 +377,6 @@ extern "C" {
*/ */
#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" #define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
/**
* \brief A variable that controls whether the on-screen keyboard should be shown when text input is active
*
* The variable can be set to the following values:
* "0" - Do not show the on-screen keyboard
* "1" - Show the on-screen keyboard
*
* The default value is "1". This hint must be set before text input is activated.
*/
#define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD"
/** /**
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
* *
@@ -1007,15 +996,6 @@ extern "C" {
*/ */
#define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD" #define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD"
/**
* \brief A variable controlling whether Windows.Gaming.Input should be used for controller handling.
*
* This variable can be set to the following values:
* "0" - WGI is not used
* "1" - WGI is used (the default)
*/
#define SDL_HINT_JOYSTICK_WGI "SDL_JOYSTICK_WGI"
/** /**
* \brief Determines whether SDL enforces that DRM master is required in order * \brief Determines whether SDL enforces that DRM master is required in order
* to initialize the KMSDRM video backend. * to initialize the KMSDRM video backend.
@@ -1330,8 +1310,6 @@ extern "C" {
* *
* This variable can be one of the following values: * This variable can be one of the following values:
* "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape"
*
* Since SDL 2.0.22 this variable accepts a comma-separated list of values above.
*/ */
#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" #define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION"
@@ -1976,28 +1954,6 @@ extern "C" {
*/ */
#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING"
/**
* \brief Controls whether menus can be opened with their keyboard shortcut (Alt+mnemonic).
*
* If the mnemonics are enabled, then menus can be opened by pressing the Alt
* key and the corresponding mnemonic (for example, Alt+F opens the File menu).
* However, in case an invalid mnemonic is pressed, Windows makes an audible
* beep to convey that nothing happened. This is true even if the window has
* no menu at all!
*
* Because most SDL applications don't have menus, and some want to use the Alt
* key for other purposes, SDL disables mnemonics (and the beeping) by default.
*
* Note: This also affects keyboard events: with mnemonics enabled, when a
* menu is opened from the keyboard, you will not receive a KEYUP event for
* the mnemonic key, and *might* not receive one for Alt.
*
* This variable can be set to the following values:
* "0" - Alt+mnemonic does nothing, no beeping. (default)
* "1" - Alt+mnemonic opens menus, invalid mnemonics produce a beep.
*/
#define SDL_HINT_WINDOWS_ENABLE_MENU_MNEMONICS "SDL_WINDOWS_ENABLE_MENU_MNEMONICS"
/** /**
* \brief A variable controlling whether the windows message loop is processed by SDL * \brief A variable controlling whether the windows message loop is processed by SDL
* *
+6 -9
View File
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -44,7 +44,6 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_guid.h" #include "SDL_guid.h"
#include "SDL_mutex.h"
#include "begin_code.h" #include "begin_code.h"
/* Set up for C function definitions, even when using C++ */ /* Set up for C function definitions, even when using C++ */
@@ -67,9 +66,6 @@ extern "C" {
/** /**
* The joystick structure used to identify an SDL joystick * The joystick structure used to identify an SDL joystick
*/ */
#ifdef SDL_THREAD_SAFETY_ANALYSIS
extern SDL_mutex *SDL_joystick_lock;
#endif
struct _SDL_Joystick; struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick;
@@ -135,7 +131,7 @@ typedef enum
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
*/ */
extern DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock); extern DECLSPEC void SDLCALL SDL_LockJoysticks(void);
/** /**
@@ -150,7 +146,7 @@ extern DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lo
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
*/ */
extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joystick_lock); extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void);
/** /**
* Count the number of joysticks attached to the system. * Count the number of joysticks attached to the system.
@@ -288,12 +284,13 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_in
/** /**
* Get the instance ID of a joystick. * Get the instance ID of a joystick.
* *
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened. If the index is out of
* range, this function will return -1.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system * on the system
* \returns the instance id of the selected joystick. If called on an invalid * \returns the instance id of the selected joystick. If called on an invalid
* index, this function returns -1. * index, this function returns zero
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
Loaded 100 of 1185 files, more files were not shown because too many files have changed in this diff. Show more