diff --git a/.editorconfig b/.editorconfig index 636c544533..5f3849ca43 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,7 +16,7 @@ indent_style = space indent_size = 4 indent_style = space -[{CMakeLists.txt,sdl2-config*.cmake.in,cmake/*.cmake}] +[{CMakeLists.txt,sdl3-config*.cmake.in,cmake/*.cmake}] indent_size = 2 indent_style = space diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 5c83312be4..0cfda01d11 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -15,7 +15,7 @@ jobs: - { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: nttld/setup-ndk@v1 id: setup_ndk with: @@ -34,9 +34,11 @@ jobs: run: | cmake -B build \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ + -DSDL_WERROR=ON \ -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ -DANDROID_ABI=${{ matrix.platform.android_abi }} \ -DSDL_STATIC_PIC=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DCMAKE_INSTALL_PREFIX=prefix \ -DCMAKE_BUILD_TYPE=Release \ -GNinja @@ -48,7 +50,7 @@ jobs: if: ${{ matrix.platform.name == 'CMake' }} run: | cmake --install build --config Release - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV ( cd prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files if: ${{ matrix.platform.name == 'CMake' }} @@ -58,22 +60,22 @@ jobs: -DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \ -DANDROID_ABI=${{ matrix.platform.android_abi }} \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config if: ${{ matrix.platform.name == 'CMake' }} run: | export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc if: ${{ matrix.platform.name == 'CMake' }} run: | export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh - name: Verify Android.mk if: ${{ matrix.platform.name == 'CMake' }} run: | - export NDK_MODULE_PATH=${{ env.SDL2_DIR }}/share/ndk-modules + export NDK_MODULE_PATH=${{ env.SDL3_DIR }}/share/ndk-modules ndk-build -C ${{ github.workspace }}/cmake/test APP_PLATFORM=android-${{ matrix.platform.android_platform }} APP_ABI=${{ matrix.platform.android_abi }} NDK_OUT=$PWD NDK_LIBS_OUT=$PWD V=1 diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 06aee9e3a5..0a5cd7bc17 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -6,32 +6,40 @@ jobs: emscripten: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: mymindstorm/setup-emsdk@v10 with: - version: 2.0.31 + version: 2.0.32 + - name: Install ninja + run: | + sudo apt-get -y update + sudo apt-get install -y ninja-build - name: Configure CMake run: | emcmake cmake -S . -B build \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=prefix + -DCMAKE_INSTALL_PREFIX=prefix \ + -GNinja - name: Build run: cmake --build build/ --verbose - name: Run build-time tests run: | set -eu export SDL_TESTS_QUICK=1 - ctest -VV --test-dir build/ + # FIXME: enable Emscripten build time tests + # ctest -VV --test-dir build/ - name: Install run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV cmake --install build/ - name: Verify CMake configuration files run: | emcmake cmake -S cmake/test -B cmake_config_build \ -DCMAKE_BUILD_TYPE=Release \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} cmake --build cmake_config_build --verbose diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 45bbe3c51c..6034ce071b 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -15,6 +15,6 @@ jobs: - { name: tvOS, target: Static Library-tvOS, sdk: appletvos } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6837aee9cb..916b62182b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,7 +60,7 @@ jobs: run: | brew install \ ninja - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check that versioning is consistent # We only need to run this once: arbitrarily use the Linux/CMake build if: "runner.os == 'Linux' && ! matrix.platform.autotools" @@ -70,7 +70,9 @@ jobs: run: | cmake -S . -B build -G Ninja \ -DSDL_TESTS=ON \ + -DSDL_WERROR=ON \ -DSDL_INSTALL_TESTS=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DCMAKE_INSTALL_PREFIX=cmake_prefix \ -DCMAKE_BUILD_TYPE=Release \ ${{ matrix.platform.cmake }} @@ -84,13 +86,17 @@ jobs: set -eu export SDL_TESTS_QUICK=1 ctest -VV --test-dir build/ + if test "${{ runner.os }}" = "Linux"; then + # This should show us the SDL_REVISION + strings build/libSDL3-3.0.so.0 | grep SDL- + fi - name: Install (CMake) if: "! matrix.platform.autotools" run: | set -eu cmake --install build/ --config Release - echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV - ( cd cmake_prefix; find ) | LC_ALL=C sort -u + echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV + ( cd cmake_prefix; find . ) | LC_ALL=C sort -u - name: Configure (Autotools) if: matrix.platform.autotools run: | @@ -101,6 +107,8 @@ jobs: ( cd build-autotools ${{ github.workspace }}/configure \ + --enable-vendor-info="Github Workflow" \ + --enable-werror \ --prefix=${{ github.workspace }}/autotools_prefix \ ) if test "${{ runner.os }}" != "macOS" ; then @@ -110,12 +118,13 @@ jobs: mkdir -p build-autotools/test cd build-autotools/test ${{ github.workspace }}/test/configure \ + --enable-werror \ --x-includes=/usr/include \ --x-libraries="/usr/lib/${multiarch}" \ --prefix=${{ github.workspace }}/autotools_prefix \ SDL_CFLAGS="-I${curdir}/include" \ - SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \ - ac_cv_lib_SDL2_ttf_TTF_Init=no \ + SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL3" \ + ac_cv_lib_SDL3_ttf_TTF_Init=no \ ${NULL+} ) fi @@ -136,6 +145,10 @@ jobs: parallel="$(getconf _NPROCESSORS_ONLN)" export SDL_TESTS_QUICK=1 make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs" + if test "${{ runner.os }}" = "Linux"; then + # This should show us the SDL_REVISION + strings "${curdir}/build-autotools/build/.libs/libSDL3-3.0.so.0" | grep SDL- + fi - name: Install (Autotools) if: matrix.platform.autotools run: | @@ -147,20 +160,20 @@ jobs: make -j"${parallel}" -C build-autotools/test install V=1 fi ( cd autotools_prefix; find . ) | LC_ALL=C sort -u - echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV - name: Verify CMake configuration files run: | cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh - name: Distcheck (Autotools) if: matrix.platform.autotools @@ -171,9 +184,9 @@ jobs: # Similar to Automake `make distcheck`: check that the tarball # release is sufficient to do a new build mkdir distcheck - tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz - ( cd distcheck/SDL2-* && ./configure ) - make -j"${parallel}" -C distcheck/SDL2-* + tar -C distcheck -zxf build-autotools/SDL3-*.tar.gz + ( cd distcheck/SDL3-* && ./configure ) + make -j"${parallel}" -C distcheck/SDL3-* - name: Run installed-tests (Autotools) if: "runner.os == 'Linux' && matrix.platform.autotools" run: | @@ -190,4 +203,4 @@ jobs: LD_LIBRARY_PATH=/usr/local/lib \ SDL_AUDIODRIVER=dummy \ SDL_VIDEODRIVER=dummy \ - ginsttest-runner --tap SDL2 + ginsttest-runner --tap SDL3 diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 9be53548cd..01d95485da 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -19,11 +19,11 @@ jobs: - { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32 } - { name: Windows (ARM), flags: -A ARM } - { name: Windows (ARM64), flags: -A ARM64 } - - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, + - { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TESTS=OFF, nowerror: true, project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Create CMake project using SDL as a subproject shell: python run: | @@ -40,9 +40,11 @@ jobs: """)) - name: Configure (CMake) run: cmake -S build -B build ` + -DSDL_WERROR=${{ !matrix.platform.nowerror }} ` -DSDL_TESTS=ON ` -DSDL_INSTALL_TESTS=ON ` - -DSDL2_DISABLE_INSTALL=OFF ` + -DSDL_VENDOR_INFO="Github Workflow" ` + -DSDL3_DISABLE_INSTALL=OFF ` ${{ matrix.platform.flags }} ` -DCMAKE_INSTALL_PREFIX=prefix - name: Build (CMake) @@ -54,19 +56,19 @@ jobs: ctest -VV --test-dir build/ -C Release - name: Install (CMake) run: | - echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV + echo "SDL3_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV cmake --install build/ - name: Verify CMake configuration files if: ${{ !contains(matrix.platform.name, 'UWP') }} # FIXME: cmake/test/CMakeLists.txt should support UWP run: | cmake -S cmake/test -B cmake_config_build ` - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} ` + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} ` ${{ matrix.platform.flags }} cmake --build cmake_config_build --config Release - name: Add msbuild to PATH if: ${{ matrix.platform.project != '' }} - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v1.1.3 - name: Build msbuild if: ${{ matrix.platform.project != '' }} run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }} diff --git a/.github/workflows/n3ds.yml b/.github/workflows/n3ds.yml new file mode 100644 index 0000000000..b7d7d9d11c --- /dev/null +++ b/.github/workflows/n3ds.yml @@ -0,0 +1,42 @@ +name: Build (Nintendo 3DS) + +on: [push, pull_request] + +jobs: + n3ds: + runs-on: ubuntu-latest + container: + image: devkitpro/devkitarm:latest + steps: + - uses: actions/checkout@v3 + - name: Install build requirements + run: | + apt update + apt install ninja-build + - name: Configure CMake + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ + -DSDL_WERROR=ON \ + -DSDL_TESTS=ON \ + -DSDL_INSTALL_TESTS=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=prefix + - name: Build + run: cmake --build build --verbose + - name: Install CMake + run: | + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV + cmake --install build/ + ( cd prefix; find ) | LC_ALL=C sort -u + - name: Verify CMake configuration files + run: | + cmake -S cmake/test -B cmake_config_build -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE=${DEVKITPRO}/cmake/3DS.cmake \ + -DTEST_SHARED=FALSE \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ + -DCMAKE_BUILD_TYPE=Release + cmake --build cmake_config_build --verbose + # Not running test_pkgconfig.sh and test_sdlconfig.sh + # as invoking the compiler manually is not supported diff --git a/.github/workflows/ps2.yaml b/.github/workflows/ps2.yaml index 04be4ad108..e36905aa89 100644 --- a/.github/workflows/ps2.yaml +++ b/.github/workflows/ps2.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: ps2dev/ps2dev:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dependencies run: | apk update @@ -24,8 +24,9 @@ jobs: - name: Configure (CMake) run: | - cmake -S . -B build -G Ninja\ + cmake -S . -B build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DCMAKE_INSTALL_PREFIX=cmake_prefix \ -DCMAKE_BUILD_TYPE=Release @@ -35,7 +36,7 @@ jobs: run: | set -eu cmake --install build/ --config Release - echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV ( cd cmake_prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files @@ -43,20 +44,20 @@ jobs: cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake \ -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DCMAKE_BUILD_TYPE=Release cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | export CC=mips64r5900el-ps2-elf-gcc - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_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 - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | export CC=mips64r5900el-ps2-elf-gcc 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.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh - name: Get short SHA diff --git a/.github/workflows/psp.yaml b/.github/workflows/psp.yaml index 9a92677305..80c42c92a7 100644 --- a/.github/workflows/psp.yaml +++ b/.github/workflows/psp.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: pspdev/pspdev:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup dependencies run: | apk update @@ -16,6 +16,7 @@ jobs: run: | cmake -S . -B build \ -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ @@ -24,26 +25,26 @@ jobs: run: cmake --build build --config Release - name: Install run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV cmake --install build --config Release ( cd prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files run: | cmake -S cmake/test -B cmake_config_build \ -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DTEST_SHARED=FALSE \ -DCMAKE_BUILD_TYPE=Release cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | export CC=psp-gcc - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | export CC=psp-gcc - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig export EXTRA_LDFLAGS="-L$PSPDEV/lib -L$PSPDEV/psp/lib -L$PSPDEV/psp/sdk/lib" cmake/test/test_pkgconfig.sh diff --git a/.github/workflows/riscos.yml b/.github/workflows/riscos.yml index 1791c9504e..2f4aca27d7 100644 --- a/.github/workflows/riscos.yml +++ b/.github/workflows/riscos.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Setup dependencies run: apt-get update && apt-get install -y cmake ninja-build - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Configure (autotools) if: ${{ contains(matrix.platform.name, 'autotools') }} run: | @@ -34,7 +34,7 @@ jobs: - name: Install (autotools) if: ${{ contains(matrix.platform.name, 'autotools') }} run: | - echo "SDL2_DIR=${{ github.workspace }}/prefix_autotools" >> $GITHUB_ENV + echo "SDL3_DIR=${{ github.workspace }}/prefix_autotools" >> $GITHUB_ENV make -C build_autotools install ( cd ${{ github.workspace }}/prefix_autotools; find ) | LC_ALL=C sort -u - name: Configure (CMake) @@ -46,6 +46,7 @@ jobs: -DSDL_GCC_ATOMICS=OFF \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ + -DSDL_VENDOR_INFO="Github Workflow" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/prefix_cmake - name: Build (CMake) @@ -54,14 +55,14 @@ jobs: - name: Install (CMake) if: ${{ contains(matrix.platform.name, 'CMake') }} run: | - echo "SDL2_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV + echo "SDL3_DIR=${{ github.workspace }}/prefix_cmake" >> $GITHUB_ENV cmake --install build/ ( cd ${{ github.workspace }}/prefix_cmake; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files run: | cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=/home/riscos/env/toolchain-riscos.cmake \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DCMAKE_BUILD_TYPE=Release \ ${{ matrix.platform.test_args }} cmake --build cmake_config_build --verbose diff --git a/.github/workflows/vita.yaml b/.github/workflows/vita.yaml index 9b27370ba8..a73114d046 100644 --- a/.github/workflows/vita.yaml +++ b/.github/workflows/vita.yaml @@ -12,15 +12,16 @@ jobs: container: image: vitasdk/vitasdk:latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install build requirements run: | apk update - apk add cmake ninja pkgconf + apk add cmake ninja pkgconf bash - name: Configure CMake run: | cmake -S . -B build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ + -DSDL_WERROR=ON \ -DSDL_TESTS=ON \ -DSDL_INSTALL_TESTS=ON \ -DCMAKE_BUILD_TYPE=Release \ @@ -29,7 +30,7 @@ jobs: run: cmake --build build --verbose - name: Install CMake run: | - echo "SDL2_DIR=$(pwd)/prefix" >> $GITHUB_ENV + echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV cmake --install build/ ( cd prefix; find ) | LC_ALL=C sort -u - name: Verify CMake configuration files @@ -37,16 +38,16 @@ jobs: cmake -S cmake/test -B cmake_config_build -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake \ -DTEST_SHARED=FALSE \ - -DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }} \ + -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} \ -DCMAKE_BUILD_TYPE=Release cmake --build cmake_config_build --verbose - - name: Verify sdl2-config + - name: Verify sdl3-config run: | export CC=arm-vita-eabi-gcc - export PATH=${{ env.SDL2_DIR }}/bin:$PATH + export PATH=${{ env.SDL3_DIR }}/bin:$PATH cmake/test/test_sdlconfig.sh - - name: Verify sdl2.pc + - name: Verify sdl3.pc run: | export CC=arm-vita-eabi-gcc - export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig + export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig cmake/test/test_pkgconfig.sh diff --git a/.github/workflows/vmactions.yml b/.github/workflows/vmactions.yml index 414b056f84..9d6fdffe83 100644 --- a/.github/workflows/vmactions.yml +++ b/.github/workflows/vmactions.yml @@ -7,7 +7,7 @@ jobs: runs-on: macos-12 name: FreeBSD steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build uses: vmactions/freebsd-vm@v0 with: @@ -33,7 +33,6 @@ jobs: libinotify \ alsa-lib \ jackit \ - nas \ pipewire \ pulseaudio \ sndio \ diff --git a/.github/workflows/watcom.yml b/.github/workflows/watcom.yml deleted file mode 100644 index ead7c4724f..0000000000 --- a/.github/workflows/watcom.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build (OpenWatcom) - -on: [push, pull_request] - -jobs: - os2: - name: ${{ matrix.platform.name }} - runs-on: windows-latest - - strategy: - matrix: - platform: - - { name: Windows, makefile: Makefile.w32 } - - { name: OS/2, makefile: Makefile.os2 } - - steps: - - uses: actions/checkout@v2 - - uses: open-watcom/setup-watcom@v0 - - name: Build SDL2 - run: | - wmake -f ${{ matrix.platform.makefile }} - - name: Build tests - run: | - cd test && wmake -f ${{ matrix.platform.makefile }} - cd .. - - name: Run tests - if: "matrix.platform.makefile == 'Makefile.w32'" - run: | - cd test && wmake -f ${{ matrix.platform.makefile }} check-quick - cd .. - - name: distclean - run: | - wmake -f ${{ matrix.platform.makefile }} distclean - cd test && wmake -f ${{ matrix.platform.makefile }} distclean - cd .. diff --git a/.gitignore b/.gitignore index 5d5849b1ec..099b15322d 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ build gen Build buildbot +/VERSION.txt *.so *.so.* @@ -87,15 +88,6 @@ VisualC/tests/testscale/icon.bmp VisualC/tests/testscale/sample.bmp VisualC/tests/testsprite2/icon.bmp VisualC/tests/testyuv/testyuv.bmp -VisualC/visualtest/icon.bmp -VisualC/visualtest/testquit.actions -VisualC/visualtest/testquit.config -VisualC/visualtest/testquit.exe -VisualC/visualtest/testquit.parameters -VisualC/visualtest/testsprite2.exe -VisualC/visualtest/testsprite2_sample.actions -VisualC/visualtest/testsprite2_sample.config -VisualC/visualtest/testsprite2_sample.parameters VisualC-GDK/**/Layout # for Android diff --git a/.wikiheaders-options b/.wikiheaders-options index 31ccd43353..294da2d3ee 100644 --- a/.wikiheaders-options +++ b/.wikiheaders-options @@ -1,5 +1,5 @@ -projectfullname = SDL_mixer -projectshortname = SDL_mixer +projectfullname = SDL +projectshortname = SDL incsubdir = include wikisubdir = apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_) @@ -13,3 +13,4 @@ projecturl = https://libsdl.org/ wikiurl = https://wiki.libsdl.org bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new warn_about_missing = 0 +wikipreamble = (This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!) diff --git a/Android.mk b/Android.mk index ce67ae2d77..3107e7d7a2 100644 --- a/Android.mk +++ b/Android.mk @@ -8,7 +8,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := SDL2 +LOCAL_MODULE := SDL3 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include @@ -75,7 +75,6 @@ LOCAL_CFLAGS += \ -Wstrict-prototypes \ -Wkeyword-macro \ - # Warnings we haven't fixed (yet) LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare @@ -91,15 +90,16 @@ LOCAL_STATIC_LIBRARIES := cpufeatures include $(BUILD_SHARED_LIBRARY) + ########################### # # SDL static library # ########################### -LOCAL_MODULE := SDL2_static +LOCAL_MODULE := SDL3_static -LOCAL_MODULE_FILENAME := libSDL2 +LOCAL_MODULE_FILENAME := libSDL3 LOCAL_LDLIBS := @@ -109,6 +109,7 @@ LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid include $(BUILD_STATIC_LIBRARY) + ########################### # # SDL main static library @@ -119,9 +120,9 @@ include $(CLEAR_VARS) LOCAL_C_INCLUDES := $(LOCAL_PATH)/include -LOCAL_MODULE := SDL2_main +LOCAL_MODULE := SDL3_main -LOCAL_MODULE_FILENAME := libSDL2main +LOCAL_MODULE_FILENAME := libSDL3main include $(BUILD_STATIC_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59ec6bfb85..57b3210162 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,12 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) endif() cmake_minimum_required(VERSION 3.0.0) -project(SDL2 C CXX) +project(SDL3 C CXX) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) - set(SDL2_SUBPROJECT OFF) + set(SDL3_SUBPROJECT OFF) else() - set(SDL2_SUBPROJECT ON) + set(SDL3_SUBPROJECT ON) endif() if (HAIKU) @@ -35,7 +35,7 @@ endif() # Build in parallel under Visual Studio. Not enabled by default. if(MSVC) target_compile_options(sdl-build-options INTERFACE "/MP") -endif(MSVC) +endif() # 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. @@ -46,7 +46,7 @@ if(POLICY CMP0054) endif() # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property -# !!! FIXME: for the SDL2 shared library (so you get an +# !!! FIXME: for the SDL shared library (so you get an # !!! FIXME: install_name ("soname") of "@rpath/libSDL-whatever.dylib" # !!! FIXME: instead of "/usr/local/lib/libSDL-whatever.dylib"), but I'm # !!! FIXME: punting for now and leaving the existing behavior. Until this @@ -58,6 +58,7 @@ endif() include(CheckLibraryExists) include(CheckIncludeFiles) include(CheckIncludeFile) +include(CheckLanguage) include(CheckSymbolExists) include(CheckCSourceCompiles) include(CheckCSourceRuns) @@ -66,12 +67,14 @@ include(CheckCXXCompilerFlag) include(CheckStructHasMember) include(CMakeDependentOption) include(CMakePushCheckState) -include(FindPkgConfig) include(GNUInstallDirs) -list(APPEND CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake") -include(${SDL2_SOURCE_DIR}/cmake/macros.cmake) -include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) +find_package(PkgConfig) + +list(APPEND CMAKE_MODULE_PATH "${SDL3_SOURCE_DIR}/cmake") +include(${SDL3_SOURCE_DIR}/cmake/macros.cmake) +include(${SDL3_SOURCE_DIR}/cmake/sdlchecks.cmake) +include(${SDL3_SOURCE_DIR}/cmake/CheckCPUArchitecture.cmake) # Enable large file support on 32-bit glibc, so that we can access files # with large inode numbers @@ -81,8 +84,8 @@ if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4) endif() # See docs/release_checklist.md -set(SDL_MAJOR_VERSION 2) -set(SDL_MINOR_VERSION 25) +set(SDL_MAJOR_VERSION 3) +set(SDL_MINOR_VERSION 0) set(SDL_MICRO_VERSION 0) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") @@ -95,15 +98,15 @@ mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX) # Calculate a libtool-like version number math(EXPR SDL_BINARY_AGE "${SDL_MINOR_VERSION} * 100 + ${SDL_MICRO_VERSION}") if(SDL_MINOR_VERSION MATCHES "[02468]$") - # Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 + # Stable branch, 3.24.1 -> libSDL3-3.0.so.0.2400.1 set(SDL_INTERFACE_AGE ${SDL_MICRO_VERSION}) else() - # Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 + # Development branch, 3.23.1 -> libSDL3-3.0.so.0.2301.0 set(SDL_INTERFACE_AGE 0) endif() # Increment this if there is an incompatible change - but if that happens, -# we should rename the library from SDL2 to SDL3, at which point this would +# we should rename the library from SDL3 to SDL4, at which point this would # reset to 0 anyway. set(LT_MAJOR "0") @@ -111,10 +114,10 @@ math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}") set(LT_REVISION "${SDL_INTERFACE_AGE}") # For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. +# version twice: libSDL3-3.0.so.0. # TODO: in SDL 3, set the OUTPUT_NAME to plain SDL3, which will simplify # it to libSDL3.so.0 -set(LT_RELEASE "2.0") +set(LT_RELEASE "3.0") set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}") # The following should match the versions in the Xcode project file. @@ -143,7 +146,7 @@ else() set(ARCH_64 FALSE) set(PROCESSOR_ARCH "x86") endif() -set(LIBNAME SDL2) +set(LIBNAME SDL3) if(NOT LIBTYPE) set(LIBTYPE SHARED) endif() @@ -196,6 +199,8 @@ 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 @@ -277,7 +282,7 @@ if(APPLE OR ARCH_64 OR MSVC_CLANG) 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) +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) endif() @@ -320,9 +325,9 @@ if(MSVC) endif() endif() -# Those are used for pkg-config and friends, so that the sdl2.pc, sdl2-config, +# Those are used for pkg-config and friends, so that the sdl3.pc, sdl3-config, # etc. are created correctly. -set(SDL_LIBS "-lSDL2") +set(SDL_LIBS "-lSDL3") set(SDL_CFLAGS ) # When building shared lib for Windows with MinGW, @@ -353,13 +358,13 @@ endif() # General includes target_compile_definitions(sdl-build-options INTERFACE "-DUSING_GENERATED_CONFIG_H") -target_include_directories(sdl-build-options BEFORE INTERFACE "${SDL2_BINARY_DIR}/include" "${SDL2_BINARY_DIR}/include-config-$>") +target_include_directories(sdl-build-options BEFORE INTERFACE "${SDL3_BINARY_DIR}/include" "${SDL3_BINARY_DIR}/include-config-$>") # Note: The clang toolset for Visual Studio does not support the '-idirafter' option. if(USE_GCC OR (USE_CLANG AND NOT MSVC_CLANG)) # !!! FIXME: do we _need_ to mess with CMAKE_C_FLAGS here? - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter \"${SDL2_SOURCE_DIR}/src/video/khronos\"") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter \"${SDL3_SOURCE_DIR}/src/video/khronos\"") else() - target_include_directories(sdl-build-options INTERFACE "${SDL2_SOURCE_DIR}/src/video/khronos") + target_include_directories(sdl-build-options INTERFACE "${SDL3_SOURCE_DIR}/src/video/khronos") endif() # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so @@ -378,10 +383,9 @@ if(EMSCRIPTEN) set(SDL_ATOMIC_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF) - set(SDL_TEST_ENABLED_BY_DEFAULT OFF) endif() -if(VITA OR PSP OR PS2) +if(VITA OR PSP OR PS2 OR N3DS) set(SDL_SHARED_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) endif() @@ -423,9 +427,9 @@ foreach(_SUB ${SDL_SUBSYSTEMS}) endforeach() # Allow some projects to be built conditionally. -set_option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" OFF) -set_option(SDL2_DISABLE_INSTALL "Disable installation of SDL2" ${SDL2_SUBPROJECT}) -set_option(SDL2_DISABLE_UNINSTALL "Disable uninstallation of SDL2" OFF) +set_option(SDL3_DISABLE_SDL3MAIN "Disable building/installation of SDL3main" OFF) +set_option(SDL3_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT}) +set_option(SDL3_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF) 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) @@ -444,10 +448,9 @@ set_option(SDL_ARMNEON "use NEON assembly blitters on ARM" 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_DUMMYAUDIO "Support the dummy audio driver" ON) -set_option(SDL_DIRECTFB "Use DirectFB video driver" OFF) -dep_option(SDL_DIRECTFB_SHARED "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF) set_option(SDL_DUMMYVIDEO "Use dummy video driver" ON) dep_option(SDL_IBUS "Enable IBus support" ON ${UNIX_SYS} OFF) +set_option(SDL_SYSTEM_ICONV "Use iconv() from system-installed libraries" ON) set_option(SDL_OPENGL "Include OpenGL support" ON) set_option(SDL_OPENGLES "Include OpenGL ES support" ON) set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT}) @@ -457,20 +460,12 @@ set_option(SDL_ALSA "Support the ALSA audio API" ${UNIX_SYS}) dep_option(SDL_ALSA_SHARED "Dynamically load ALSA audio support" ON "SDL_ALSA" OFF) set_option(SDL_JACK "Support the JACK audio API" ${UNIX_SYS}) dep_option(SDL_JACK_SHARED "Dynamically load JACK audio support" ON "SDL_JACK" OFF) -set_option(SDL_ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS}) -dep_option(SDL_ESD_SHARED "Dynamically load ESD audio support" ON "SDL_ESD" OFF) set_option(SDL_PIPEWIRE "Use Pipewire audio" ${UNIX_SYS}) dep_option(SDL_PIPEWIRE_SHARED "Dynamically load Pipewire support" ON "SDL_PIPEWIRE" OFF) set_option(SDL_PULSEAUDIO "Use PulseAudio" ${UNIX_SYS}) dep_option(SDL_PULSEAUDIO_SHARED "Dynamically load PulseAudio support" ON "SDL_PULSEAUDIO" OFF) -set_option(SDL_ARTS "Support the Analog Real Time Synthesizer" ${UNIX_SYS}) -dep_option(SDL_ARTS_SHARED "Dynamically load aRts audio support" ON "SDL_ARTS" OFF) -set_option(SDL_NAS "Support the NAS audio API" ${UNIX_SYS}) -dep_option(SDL_NAS_SHARED "Dynamically load NAS audio support" ON "SDL_NAS" OFF) set_option(SDL_SNDIO "Support the sndio audio API" ${UNIX_SYS}) dep_option(SDL_SNDIO_SHARED "Dynamically load the sndio audio API" ON "SDL_SNDIO" OFF) -set_option(SDL_FUSIONSOUND "Use FusionSound audio driver" OFF) -dep_option(SDL_FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "SDL_FUSIONSOUND" OFF) set_option(SDL_LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS}) dep_option(SDL_LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "SDL_LIBSAMPLERATE" OFF) set_option(SDL_RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) @@ -507,10 +502,14 @@ dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" O 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) 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" "") +set_option(SDL_CCACHE "Use Ccache to speed up build" ON) + +option(SDL_WERROR "Enable -Werror" OFF) option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_ENABLED_BY_DEFAULT}) option(SDL_STATIC "Build a static version of the library" ${SDL_STATIC_ENABLED_BY_DEFAULT}) -option(SDL_TEST "Build the SDL2_test library" ${SDL_TEST_ENABLED_BY_DEFAULT}) +option(SDL_TEST "Build the SDL3_test library" ${SDL_TEST_ENABLED_BY_DEFAULT}) dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" "${CMAKE_POSITION_INDEPENDENT_CODE}" "SDL_STATIC" OFF) dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST OFF) @@ -518,6 +517,26 @@ set_option(SDL_INSTALL_TESTS "Install test-cases" OFF) 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(HIDAPI_ONLY_LIBUSB) set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE) @@ -533,28 +552,28 @@ endif() # General source files file(GLOB SOURCE_FILES - ${SDL2_SOURCE_DIR}/src/*.c - ${SDL2_SOURCE_DIR}/src/atomic/*.c - ${SDL2_SOURCE_DIR}/src/audio/*.c - ${SDL2_SOURCE_DIR}/src/cpuinfo/*.c - ${SDL2_SOURCE_DIR}/src/dynapi/*.c - ${SDL2_SOURCE_DIR}/src/events/*.c - ${SDL2_SOURCE_DIR}/src/file/*.c - ${SDL2_SOURCE_DIR}/src/joystick/*.c - ${SDL2_SOURCE_DIR}/src/haptic/*.c - ${SDL2_SOURCE_DIR}/src/hidapi/*.c - ${SDL2_SOURCE_DIR}/src/libm/*.c - ${SDL2_SOURCE_DIR}/src/locale/*.c - ${SDL2_SOURCE_DIR}/src/misc/*.c - ${SDL2_SOURCE_DIR}/src/power/*.c - ${SDL2_SOURCE_DIR}/src/render/*.c - ${SDL2_SOURCE_DIR}/src/render/*/*.c - ${SDL2_SOURCE_DIR}/src/sensor/*.c - ${SDL2_SOURCE_DIR}/src/stdlib/*.c - ${SDL2_SOURCE_DIR}/src/thread/*.c - ${SDL2_SOURCE_DIR}/src/timer/*.c - ${SDL2_SOURCE_DIR}/src/video/*.c - ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) + ${SDL3_SOURCE_DIR}/src/*.c + ${SDL3_SOURCE_DIR}/src/atomic/*.c + ${SDL3_SOURCE_DIR}/src/audio/*.c + ${SDL3_SOURCE_DIR}/src/cpuinfo/*.c + ${SDL3_SOURCE_DIR}/src/dynapi/*.c + ${SDL3_SOURCE_DIR}/src/events/*.c + ${SDL3_SOURCE_DIR}/src/file/*.c + ${SDL3_SOURCE_DIR}/src/joystick/*.c + ${SDL3_SOURCE_DIR}/src/haptic/*.c + ${SDL3_SOURCE_DIR}/src/hidapi/*.c + ${SDL3_SOURCE_DIR}/src/libm/*.c + ${SDL3_SOURCE_DIR}/src/locale/*.c + ${SDL3_SOURCE_DIR}/src/misc/*.c + ${SDL3_SOURCE_DIR}/src/power/*.c + ${SDL3_SOURCE_DIR}/src/render/*.c + ${SDL3_SOURCE_DIR}/src/render/*/*.c + ${SDL3_SOURCE_DIR}/src/sensor/*.c + ${SDL3_SOURCE_DIR}/src/stdlib/*.c + ${SDL3_SOURCE_DIR}/src/thread/*.c + ${SDL3_SOURCE_DIR}/src/timer/*.c + ${SDL3_SOURCE_DIR}/src/video/*.c + ${SDL3_SOURCE_DIR}/src/video/yuv2rgb/*.c) set(SDL_DEFAULT_ASSERT_LEVEL_CONFIGURED 1) @@ -605,9 +624,11 @@ if(USE_GCC OR USE_CLANG) check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) - check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) - if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) - list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + if(SDL_WERROR) + check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT) + list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement") + endif() endif() list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement") endif() @@ -661,8 +682,15 @@ if(USE_GCC OR USE_CLANG) endif() if(APPLE) + cmake_push_check_state(RESET) + # FIXME: don't use deprecated declarations + check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) + if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS) + target_compile_options(sdl-build-options INTERFACE "-Wno-error=deprecated-declarations") + endif() + cmake_pop_check_state() + # FIXME: use generator expression instead of appending to EXTRA_LDFLAGS_BUILD - list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-undefined,error") list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-current_version,${DYLIB_CURRENT_VERSION}") elseif(NOT OPENBSD) @@ -674,6 +702,18 @@ if(USE_GCC OR USE_CLANG) endif() endif() + if(MINGW) + # See if GCC's -gdwarf-4 is supported + # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows + cmake_push_check_state(RESET) + check_c_compiler_flag("-gdwarf-4" HAVE_GDWARF_4) + if(HAVE_GDWARF_4) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-4") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-4") + endif() + cmake_pop_check_state() + endif() + # Force color diagnostics when one of these conditions are met if(DEFINED ENV{CI} OR DEFINED ENV{USE_CCACHE} OR CMAKE_GENERATOR MATCHES Ninja) if(EMSCRIPTEN OR (USE_GCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)) @@ -694,10 +734,10 @@ if(MSVC) endif() endif() -if(MSVC) +if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") # Due to a limitation of Microsoft's LTO implementation, LTO must be disabled for memcpy and memset. # The same applies to various functions normally belonging in the C library (for x86 architecture). - set_property(SOURCE src/stdlib/SDL_mslibc.c APPEND PROPERTY COMPILE_FLAGS /GL-) + set_property(SOURCE src/stdlib/SDL_mslibc.c APPEND_STRING PROPERTY COMPILE_FLAGS " /GL-") endif() if(SDL_ASSEMBLY) @@ -874,7 +914,7 @@ if(SDL_ASSEMBLY) if(ARMSIMD_FOUND) set(HAVE_ARMSIMD TRUE) set(SDL_ARM_SIMD_BLITTERS 1) - file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) + file(GLOB ARMSIMD_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) set(WARN_ABOUT_ARM_SIMD_ASM_MIT TRUE) endif() @@ -902,7 +942,7 @@ if(SDL_ASSEMBLY) if(ARMNEON_FOUND) set(HAVE_ARMNEON TRUE) set(SDL_ARM_NEON_BLITTERS 1) - file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) + file(GLOB ARMNEON_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) set(WARN_ABOUT_ARM_NEON_ASM_MIT TRUE) endif() @@ -949,18 +989,38 @@ if(SDL_LIBC) endforeach() set(HAVE_ALLOCA 1) check_symbol_exists(M_PI math.h HAVE_M_PI) - target_compile_definitions(sdl-build-options INTERFACE "-D_USE_MATH_DEFINES") # needed for M_PI set(STDC_HEADERS 1) else() set(HAVE_LIBC TRUE) - check_include_file(sys/types.h HAVE_SYS_TYPES_H) - foreach(_HEADER - stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h - strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h) + set(headers_to_check + ctype.h + float.h + iconv.h + inttypes.h + limits.h + malloc.h + math.h + memory.h + signal.h + stdarg.h + stddef.h + stdint.h + stdio.h + stdlib.h + string.h + strings.h + sys/types.h + wchar.h + ) + if(NOT EMSCRIPTEN) + list(APPEND headers_to_check libunwind.h) + endif() + foreach(_HEADER ${headers_to_check}) string(TOUPPER "HAVE_${_HEADER}" _UPPER) - string(REPLACE "." "_" _HAVE_H ${_UPPER}) + string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER}) check_include_file("${_HEADER}" ${_HAVE_H}) endforeach() + check_include_file(linux/input.h HAVE_LINUX_INPUT_H) set(STDC_HEADER_NAMES "stddef.h;stdarg.h;stdlib.h;string.h;stdio.h;wchar.h;float.h") check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS) @@ -974,7 +1034,7 @@ if(SDL_LIBC) bsearch qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull - atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp + atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr wcscmp _wcsdup wcsdup wcslcat wcslcpy wcslen wcsncmp wcsstr wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp sscanf vsscanf vsnprintf fopen64 fseeko fseeko64 _Exit @@ -1011,14 +1071,18 @@ if(SDL_LIBC) endif() endif() - check_library_exists(iconv iconv_open "" HAVE_LIBICONV) - if(HAVE_LIBICONV) - list(APPEND EXTRA_LIBS iconv) - set(HAVE_ICONV 1) - else() - check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV) - if(HAVE_BUILTIN_ICONV) + if(SDL_SYSTEM_ICONV) + check_library_exists(iconv iconv_open "" HAVE_LIBICONV) + if(HAVE_LIBICONV) + list(APPEND EXTRA_LIBS iconv) set(HAVE_ICONV 1) + set(HAVE_SYSTEM_ICONV TRUE) + else() + check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV) + if(HAVE_BUILTIN_ICONV) + set(HAVE_ICONV 1) + set(HAVE_SYSTEM_ICONV TRUE) + endif() endif() endif() @@ -1066,14 +1130,14 @@ if(SDL_AUDIO) # CheckDummyAudio/CheckDiskAudio - valid for all platforms if(SDL_DUMMYAUDIO) set(SDL_AUDIO_DRIVER_DUMMY 1) - file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) + file(GLOB DUMMYAUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/dummy/*.c) list(APPEND SOURCE_FILES ${DUMMYAUDIO_SOURCES}) set(HAVE_DUMMYAUDIO TRUE) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_DISKAUDIO) set(SDL_AUDIO_DRIVER_DISK 1) - file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c) + file(GLOB DISKAUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/disk/*.c) list(APPEND SOURCE_FILES ${DISKAUDIO_SOURCES}) set(HAVE_DISKAUDIO TRUE) set(HAVE_SDL_AUDIO TRUE) @@ -1086,7 +1150,7 @@ if(UNIX OR APPLE) CheckDLOPEN() if(SDL_LOADSO AND HAVE_DLOPEN) set(SDL_LOADSO_DLOPEN 1) - file(GLOB DLOPEN_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) + file(GLOB DLOPEN_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c) list(APPEND SOURCE_FILES ${DLOPEN_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() @@ -1100,7 +1164,7 @@ if(SDL_JOYSTICK) if(SDL_VIRTUAL_JOYSTICK) set(HAVE_VIRTUAL_JOYSTICK TRUE) set(SDL_JOYSTICK_VIRTUAL 1) - file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/virtual/*.c) + file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/virtual/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_VIRTUAL_SOURCES}) endif() endif() @@ -1108,14 +1172,14 @@ endif() if(SDL_VIDEO) if(SDL_DUMMYVIDEO) set(SDL_VIDEO_DRIVER_DUMMY 1) - file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) + file(GLOB VIDEO_DUMMY_SOURCES ${SDL3_SOURCE_DIR}/src/video/dummy/*.c) list(APPEND SOURCE_FILES ${VIDEO_DUMMY_SOURCES}) set(HAVE_DUMMYVIDEO TRUE) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_OFFSCREEN) set(SDL_VIDEO_DRIVER_OFFSCREEN 1) - file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c) + file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL3_SOURCE_DIR}/src/video/offscreen/*.c) list(APPEND SOURCE_FILES ${VIDEO_OFFSCREEN_SOURCES}) set(HAVE_OFFSCREEN TRUE) set(HAVE_SDL_VIDEO TRUE) @@ -1124,12 +1188,12 @@ endif() # Platform-specific options and settings if(ANDROID) - file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) + file(GLOB ANDROID_CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) set_property(SOURCE "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-declaration-after-statement") if(SDL_MISC) - file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) + file(GLOB ANDROID_MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() @@ -1138,40 +1202,43 @@ if(ANDROID) # There seems to be no better way currently to set the ARM mode. # see: https://issuetracker.google.com/issues/62264618 # Another option would be to set ARM mode to all compiled files + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument") check_c_compiler_flag(-marm HAVE_ARM_MODE) if(HAVE_ARM_MODE) - set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) + set_property(SOURCE "${SDL3_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") endif() + cmake_pop_check_state() - file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c) + file(GLOB ANDROID_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/android/*.c) list(APPEND SDLMAIN_SOURCES ${ANDROID_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_ANDROID 1) - file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c) + file(GLOB ANDROID_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_AUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_OPENSLES 1) - file(GLOB OPENSLES_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/openslES/*.c) + file(GLOB OPENSLES_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/openslES/*.c) list(APPEND SOURCE_FILES ${OPENSLES_AUDIO_SOURCES}) list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} OpenSLES) set(SDL_AUDIO_DRIVER_AAUDIO 1) - file(GLOB AAUDIO_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/aaudio/*.c) + file(GLOB AAUDIO_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/aaudio/*.c) list(APPEND SOURCE_FILES ${AAUDIO_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_ANDROID 1) - file(GLOB ANDROID_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/android/*.c) + file(GLOB ANDROID_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_HAPTIC) set(SDL_HAPTIC_ANDROID 1) - file(GLOB ANDROID_HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/android/*.c) + file(GLOB ANDROID_HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() @@ -1180,42 +1247,42 @@ if(ANDROID) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_ANDROID 1) - file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) + file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/android/*.c ${SDL3_SOURCE_DIR}/src/joystick/steam/*.c) list(APPEND SOURCE_FILES ${ANDROID_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_DLOPEN 1) - file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) + file(GLOB LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c) list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() if(SDL_POWER) set(SDL_POWER_ANDROID 1) - file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c) + file(GLOB ANDROID_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) - file(GLOB ANDROID_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/android/*.c) + file(GLOB ANDROID_LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_ANDROID 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB ANDROID_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/android/*.c) + file(GLOB ANDROID_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_ANDROID 1) - file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c) + file(GLOB ANDROID_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/android/*.c) list(APPEND SOURCE_FILES ${ANDROID_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -1262,42 +1329,42 @@ elseif(EMSCRIPTEN) target_compile_options(sdl-build-options INTERFACE "-Wno-warn-absolute-paths") if(SDL_MISC) - file(GLOB EMSRIPTEN_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/emscripten/*.c) + file(GLOB EMSRIPTEN_MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/emscripten/*.c) list(APPEND SOURCE_FILES ${EMSRIPTEN_MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_EMSCRIPTEN 1) - file(GLOB EM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/emscripten/*.c) + file(GLOB EM_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_EMSCRIPTEN 1) - file(GLOB EM_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/emscripten/*.c) + file(GLOB EM_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_EMSCRIPTEN 1) - file(GLOB EM_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/emscripten/*.c) + file(GLOB EM_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_EMSCRIPTEN 1) - file(GLOB EM_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/emscripten/*.c) + file(GLOB EM_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/emscripten/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/emscripten/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) @@ -1307,7 +1374,7 @@ elseif(EMSCRIPTEN) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_EMSCRIPTEN 1) - file(GLOB EM_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/emscripten/*.c) + file(GLOB EM_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/emscripten/*.c) list(APPEND SOURCE_FILES ${EM_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -1322,41 +1389,30 @@ elseif(EMSCRIPTEN) CheckPTHREAD() + if(HAVE_LIBUNWIND_H) + list(APPEND EXTRA_TEST_LIBS unwind) + endif() + elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_AUDIO) - if(SYSV5 OR SOLARIS OR HPUX) - set(SDL_AUDIO_DRIVER_SUNAUDIO 1) - file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) - list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - elseif(NETBSD) + if(NETBSD) set(SDL_AUDIO_DRIVER_NETBSD 1) - file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) + file(GLOB NETBSD_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/netbsd/*.c) list(APPEND SOURCE_FILES ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) - elseif(AIX) - set(SDL_AUDIO_DRIVER_PAUDIO 1) - file(GLOB AIX_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/paudio/*.c) - list(APPEND SOURCE_FILES ${AIX_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) endif() CheckOSS() CheckALSA() CheckJACK() CheckPipewire() CheckPulseAudio() - CheckESD() - CheckARTS() - CheckNAS() CheckSNDIO() - CheckFusionSound() endif() if(SDL_VIDEO) # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! CheckRPI() CheckX11() - CheckDirectFB() # Need to check for EGL first because KMSDRM and Wayland depends on it. CheckEGL() CheckKMSDRM() @@ -1373,7 +1429,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(UNIX) - file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c) + file(GLOB CORE_UNIX_SOURCES ${SDL3_SOURCE_DIR}/src/core/unix/*.c) list(APPEND SOURCE_FILES ${CORE_UNIX_SOURCES}) check_c_source_compiles(" @@ -1411,7 +1467,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_HAPTIC AND HAVE_INPUT_EVENTS) set(SDL_HAPTIC_LINUX 1) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/linux/*.c) list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) set(HAVE_SDL_HAPTIC TRUE) endif() @@ -1479,38 +1535,38 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(HAVE_DBUS_DBUS_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_dbus.c") endif() if(SDL_USE_IME) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ime.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_ime.c") endif() if(HAVE_IBUS_IBUS_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_ibus.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_ibus.c") endif() if(HAVE_FCITX) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_fcitx.c") endif() if(HAVE_LIBUDEV_H) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_udev.c") endif() if(HAVE_INPUT_EVENTS) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") endif() if(HAVE_INPUT_KBIO) - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") endif() # Always compiled for Linux, unconditionally: - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") - list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_sandbox.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") + list(APPEND SOURCE_FILES "${SDL3_SOURCE_DIR}/src/core/linux/SDL_sandbox.c") # src/core/unix/*.c is included in a generic if(UNIX) section, elsewhere. endif() @@ -1523,9 +1579,9 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(FREEBSD OR NETBSD OR OPENBSD OR BSDI) CheckUSBHID() endif() - if(LINUX AND NOT ANDROID) + if(LINUX AND HAVE_LINUX_INPUT_H AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/linux/*.c ${SDL3_SOURCE_DIR}/src/joystick/steam/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -1552,7 +1608,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/unix/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/unix/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() @@ -1560,28 +1616,28 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_POWER) if(LINUX) set(SDL_POWER_LINUX 1) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c) + file(GLOB POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/linux/*.c) list(APPEND SOURCE_FILES ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/unix/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_UNIX 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/unix/*.c) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() @@ -1611,11 +1667,11 @@ elseif(WINDOWS) #include int main(int argc, char **argv) { return 0; }" HAVE_WIN32_CC) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) + file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/windows/*.c) list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(WINDOWS_STORE) - file(GLOB WINRT_SOURCE_FILES ${SDL2_SOURCE_DIR}/src/core/winrt/*.c ${SDL2_SOURCE_DIR}/src/core/winrt/*.cpp) + file(GLOB WINRT_SOURCE_FILES ${SDL3_SOURCE_DIR}/src/core/winrt/*.c ${SDL3_SOURCE_DIR}/src/core/winrt/*.cpp) list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES}) endif() @@ -1629,9 +1685,9 @@ elseif(WINDOWS) if(SDL_MISC) if(WINDOWS_STORE) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/winrt/*.cpp) else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/windows/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/windows/*.c) endif() list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) @@ -1709,16 +1765,9 @@ elseif(WINDOWS) check_include_file(shellscalingapi.h HAVE_SHELLSCALINGAPI_H) if(SDL_AUDIO) - if(NOT WINDOWS_STORE) - set(SDL_AUDIO_DRIVER_WINMM 1) - file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c) - list(APPEND SOURCE_FILES ${WINMM_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - endif() - if(HAVE_DSOUND_H AND NOT WINDOWS_STORE) set(SDL_AUDIO_DRIVER_DSOUND 1) - file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c) + file(GLOB DSOUND_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/directsound/*.c) list(APPEND SOURCE_FILES ${DSOUND_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() @@ -1726,9 +1775,9 @@ elseif(WINDOWS) if(SDL_WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) set(SDL_AUDIO_DRIVER_WASAPI 1) set(HAVE_WASAPI TRUE) - file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c) + file(GLOB WASAPI_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/wasapi/*.c) if(WINDOWS_STORE) - list(APPEND WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/SDL_wasapi_winrt.cpp) + list(APPEND WASAPI_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/wasapi/SDL_wasapi_winrt.cpp) endif() list(APPEND SOURCE_FILES ${WASAPI_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) @@ -1743,13 +1792,13 @@ elseif(WINDOWS) if(WINDOWS_STORE) set(SDL_VIDEO_DRIVER_WINRT 1) file(GLOB WIN_VIDEO_SOURCES - ${SDL2_SOURCE_DIR}/src/video/winrt/*.c - ${SDL2_SOURCE_DIR}/src/video/winrt/*.cpp - ${SDL2_SOURCE_DIR}/src/render/direct3d11/*.cpp + ${SDL3_SOURCE_DIR}/src/video/winrt/*.c + ${SDL3_SOURCE_DIR}/src/video/winrt/*.cpp + ${SDL3_SOURCE_DIR}/src/render/direct3d11/*.cpp ) else() set(SDL_VIDEO_DRIVER_WINDOWS 1) - file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c) + file(GLOB WIN_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/windows/*.c) endif() list(APPEND SOURCE_FILES ${WIN_VIDEO_SOURCES}) @@ -1772,38 +1821,38 @@ elseif(WINDOWS) set(SDL_THREAD_GENERIC_COND_SUFFIX 1) set(SDL_THREAD_WINDOWS 1) list(APPEND SOURCE_FILES - ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_syssem.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systhread.c - ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systls.c) + ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syscond.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syssem.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systhread.c + ${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_SENSOR AND HAVE_SENSORSAPI_H AND NOT WINDOWS_STORE) set(SDL_SENSOR_WINDOWS 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB WINDOWS_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/windows/*.c) + file(GLOB WINDOWS_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/windows/*.c) list(APPEND SOURCE_FILES ${WINDOWS_SENSOR_SOURCES}) endif() if(SDL_POWER) if(WINDOWS_STORE) set(SDL_POWER_WINRT 1) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp) else() set(SDL_POWER_WINDOWS 1) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/power/windows/SDL_syspower.c) set(HAVE_SDL_POWER TRUE) endif() endif() if(SDL_LOCALE) if(WINDOWS_STORE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/winrt/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/winrt/*.c) else() - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/windows/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/windows/*.c) endif() list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) @@ -1812,9 +1861,9 @@ elseif(WINDOWS) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_WINDOWS 1) if(WINDOWS_STORE) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/winrt/*.cpp) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/winrt/*.cpp) else() - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c) endif() list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) @@ -1836,19 +1885,19 @@ elseif(WINDOWS) if(SDL_TIMERS) set(SDL_TIMER_WINDOWS 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/windows/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_LOADSO) set(SDL_LOADSO_WINDOWS 1) - file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c) + file(GLOB LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/windows/*.c) list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) set(HAVE_SDL_LOADSO TRUE) endif() - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c) + file(GLOB CORE_SOURCES ${SDL3_SOURCE_DIR}/src/core/windows/*.c) list(APPEND SOURCE_FILES ${CORE_SOURCES}) if(SDL_VIDEO) @@ -1877,7 +1926,7 @@ elseif(WINDOWS) endif() if(SDL_JOYSTICK) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/windows/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) if(NOT WINDOWS_STORE) @@ -1900,7 +1949,7 @@ elseif(WINDOWS) if(SDL_HAPTIC) if((HAVE_DINPUT_H OR HAVE_XINPUT_H) AND NOT WINDOWS_STORE) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/windows/*.c) if(HAVE_DINPUT_H) set(SDL_HAPTIC_DINPUT 1) endif() @@ -1908,7 +1957,7 @@ elseif(WINDOWS) set(SDL_HAPTIC_XINPUT 1) endif() else() - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) endif() list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) @@ -1916,13 +1965,13 @@ elseif(WINDOWS) endif() endif() - file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc) - file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c) + file(GLOB VERSION_SOURCES ${SDL3_SOURCE_DIR}/src/main/windows/*.rc) + file(GLOB SDLMAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/windows/*.c) if(MINGW OR CYGWIN) - if(NOT SDL2_DISABLE_SDL2MAIN) + if(NOT SDL3_DISABLE_SDL3MAIN) list(APPEND SDL_CFLAGS "-Dmain=SDL_main") - list(INSERT SDL_LIBS 0 "-lSDL2main") - endif(NOT SDL2_DISABLE_SDL2MAIN) + list(INSERT SDL_LIBS 0 "-lSDL3main") + endif(NOT SDL3_DISABLE_SDL3MAIN) list(INSERT SDL_LIBS 0 "-lmingw32" "-mwindows") endif() @@ -1942,20 +1991,20 @@ elseif(APPLE) # Requires the darwin file implementation if(SDL_FILE) - file(GLOB EXTRA_SOURCES ${SDL2_SOURCE_DIR}/src/file/cocoa/*.m) + file(GLOB EXTRA_SOURCES ${SDL3_SOURCE_DIR}/src/file/cocoa/*.m) list(APPEND SOURCE_FILES ${EXTRA_SOURCES}) set(HAVE_SDL_FILE TRUE) endif() if(IOS OR TVOS) - file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) + file(GLOB SDLMAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/uikit/*.c) endif() if(SDL_MISC) if(IOS OR TVOS) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/ios/*.m) else() - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/macosx/*.m) endif() list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) @@ -1963,7 +2012,7 @@ elseif(APPLE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) - file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) + file(GLOB AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/coreaudio/*.m) list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) @@ -1976,9 +2025,9 @@ elseif(APPLE) endif() if(SDL_JOYSTICK) - file(GLOB MFI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m) + file(GLOB MFI_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/iphoneos/*.m) if(IOS OR TVOS) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/steam/*.c) set(SDL_JOYSTICK_MFI 1) if(IOS) set(SDL_FRAMEWORK_COREMOTION 1) @@ -1986,8 +2035,8 @@ elseif(APPLE) set(SDL_FRAMEWORK_GAMECONTROLLER 1) set(SDL_FRAMEWORK_COREHAPTICS 1) else() - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) - set_source_files_properties(${MFI_JOYSTICK_SOURCES} PROPERTIES COMPILE_FLAGS -fobjc-weak) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/darwin/*.c) + set_property(SOURCE ${MFI_JOYSTICK_SOURCES} APPEND_STRING PROPERTY COMPILE_FLAGS " -fobjc-weak") check_objc_source_compiles(" #include #include @@ -2022,10 +2071,10 @@ elseif(APPLE) if(SDL_HAPTIC) if (IOS OR TVOS) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) else() - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/darwin/*.c) set(SDL_HAPTIC_IOKIT 1) set(SDL_FRAMEWORK_IOKIT 1) set(SDL_FRAMEWORK_FF 1) @@ -2036,10 +2085,10 @@ elseif(APPLE) if(SDL_POWER) if (IOS OR TVOS) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m) + file(GLOB POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/uikit/*.m) set(SDL_POWER_UIKIT 1) else() - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c) + file(GLOB POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/macosx/*.c) set(SDL_POWER_MACOSX 1) set(SDL_FRAMEWORK_IOKIT 1) endif() @@ -2048,21 +2097,21 @@ elseif(APPLE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/macosx/*.m) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/macosx/*.m) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif(SDL_TIMERS) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_COCOA 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/cocoa/*.m) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() @@ -2071,7 +2120,7 @@ elseif(APPLE) if(IOS) set(SDL_SENSOR_COREMOTION 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m) + file(GLOB SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/coremotion/*.m) list(APPEND SOURCE_FILES ${SENSOR_SOURCES}) endif() endif() @@ -2085,7 +2134,7 @@ elseif(APPLE) set(SDL_FRAMEWORK_UIKIT 1) set(SDL_IPHONE_KEYBOARD 1) set(SDL_IPHONE_LAUNCHSCREEN 1) - file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m) + file(GLOB UIKITVIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/uikit/*.m) list(APPEND SOURCE_FILES ${UIKITVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) else() @@ -2133,7 +2182,7 @@ elseif(APPLE) set(HAVE_METAL TRUE) endif() if(SDL_RENDER_METAL) - file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m) + file(GLOB RENDER_METAL_SOURCES ${SDL3_SOURCE_DIR}/src/render/metal/*.m) list(APPEND SOURCE_FILES ${RENDER_METAL_SOURCES}) set(SDL_VIDEO_RENDER_METAL 1) set(HAVE_RENDER_METAL TRUE) @@ -2217,27 +2266,27 @@ elseif(APPLE) elseif(HAIKU) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_HAIKU 1) - file(GLOB HAIKU_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/haiku/*.cc) + file(GLOB HAIKU_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/haiku/*.cc) list(APPEND SOURCE_FILES ${HAIKU_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_HAIKU 1) - file(GLOB HAIKU_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/haiku/*.cc) + file(GLOB HAIKU_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/haiku/*.cc) list(APPEND SOURCE_FILES ${HAIKU_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/haiku/*.cc) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/haiku/*.cc) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_HAIKU 1) - file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.cc) + file(GLOB HAIKUVIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/haiku/*.cc) list(APPEND SOURCE_FILES ${HAIKUVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -2253,32 +2302,32 @@ elseif(HAIKU) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_HAIKU 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/haiku/*.cc) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/haiku/*.cc) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_HAIKU 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/haiku/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/haiku/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_POWER) set(SDL_POWER_HAIKU 1) - file(GLOB HAIKU_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/haiku/*.c) + file(GLOB HAIKU_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/haiku/*.c) list(APPEND SOURCE_FILES ${HAIKU_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/haiku/*.cc) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/haiku/*.cc) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() - file(GLOB MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/haiku/*.cc) + file(GLOB MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/haiku/*.cc) list(APPEND SOURCE_FILES ${MAIN_SOURCES}) CheckPTHREAD() @@ -2286,28 +2335,28 @@ elseif(HAIKU) elseif(RISCOS) if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/riscos/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_RISCOS 1) - file(GLOB RISCOSVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/riscos/*.c) + file(GLOB RISCOSVIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/riscos/*.c) list(APPEND SOURCE_FILES ${RISCOSVIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_RISCOS 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/riscos/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/riscos/*.c) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_UNIX 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/unix/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) @@ -2324,71 +2373,74 @@ elseif(RISCOS) elseif(VITA) # SDL_spinlock.c Needs to be compiled in ARM mode. + cmake_push_check_state(RESET) + set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument") check_c_compiler_flag(-marm HAVE_ARM_MODE) if(HAVE_ARM_MODE) - set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) + set_property(SOURCE "${SDL3_SOURCE_DIR}/src/atomic/SDL_spinlock.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -marm") endif() + cmake_pop_check_state() if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/vita/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/vita/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_VITA 1) - file(GLOB VITA_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/vita/*.c) + file(GLOB VITA_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/vita/*.c) list(APPEND SOURCE_FILES ${VITA_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_VITA 1) - file(GLOB VITA_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/vita/*.c) + file(GLOB VITA_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/vita/*.c) list(APPEND SOURCE_FILES ${VITA_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_VITA 1) - file(GLOB VITA_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/vita/*.c) + file(GLOB VITA_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/vita/*.c) list(APPEND SOURCE_FILES ${VITA_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_VITA 1) - file(GLOB VITA_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/vita/*.c) + file(GLOB VITA_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/vita/*.c) list(APPEND SOURCE_FILES ${VITA_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_VITA 1) list(APPEND SOURCE_FILES - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_sysmutex.c - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syssem.c - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_systhread.c - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syscond.c - ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_sysmutex.c + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_syssem.c + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_systhread.c + ${SDL3_SOURCE_DIR}/src/thread/vita/SDL_syscond.c + ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/vita/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/vita/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) set(HAVE_SDL_LOCALE TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_VITA 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/vita/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/vita/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_SENSOR) set(SDL_SENSOR_VITA 1) set(HAVE_SDL_SENSORS TRUE) - file(GLOB VITA_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/vita/*.c) + file(GLOB VITA_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/vita/*.c) list(APPEND SOURCE_FILES ${VITA_SENSOR_SOURCES}) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_VITA 1) - file(GLOB VITA_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/vita/*.c) + file(GLOB VITA_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/vita/*.c) list(APPEND SOURCE_FILES ${VITA_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) @@ -2479,126 +2531,126 @@ elseif(VITA) set(HAVE_ARMSIMD TRUE) # set(SDL_ARM_SIMD_BLITTERS 1) -# file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) +# file(GLOB ARMSIMD_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S) # list(APPEND SOURCE_FILES ${ARMSIMD_SOURCES}) set(HAVE_ARMNEON TRUE) # set(SDL_ARM_NEON_BLITTERS 1) -# file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) +# file(GLOB ARMNEON_SOURCES ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S) # list(APPEND SOURCE_FILES ${ARMNEON_SOURCES}) -# set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd-asm.S PROPERTY LANGUAGE C) -# set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon-asm.S PROPERTY LANGUAGE C) +# set_property(SOURCE ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-simd-asm.S PROPERTY LANGUAGE C) +# set_property(SOURCE ${SDL3_SOURCE_DIR}/src/video/arm/pixman-arm-neon-asm.S PROPERTY LANGUAGE C) target_compile_definitions(sdl-build-options INTERFACE "-D__VITA__") # CheckPTHREAD() elseif(PSP) - file(GLOB PSP_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/psp/*.c) + file(GLOB PSP_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/psp/*.c) list(APPEND SDLMAIN_SOURCES ${PSP_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_PSP 1) - file(GLOB PSP_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/psp/*.c) + file(GLOB PSP_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/psp/*.c) list(APPEND SOURCE_FILES ${PSP_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_PSP 1) - file(GLOB PSP_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/psp/*.c) + file(GLOB PSP_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/psp/*.c) list(APPEND SOURCE_FILES ${PSP_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_PSP 1) - file(GLOB PSP_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/psp/*.c) + file(GLOB PSP_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/psp/*.c) list(APPEND SOURCE_FILES ${PSP_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_POWER) set(SDL_POWER_PSP 1) - file(GLOB PSP_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/psp/*.c) + file(GLOB PSP_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/psp/*.c) list(APPEND SOURCE_FILES ${PSP_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_PSP 1) - file(GLOB PSP_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/psp/*.c) + file(GLOB PSP_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL3_SOURCE_DIR}/src/thread/psp/*.c) list(APPEND SOURCE_FILES ${PSP_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_PSP 1) - file(GLOB PSP_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/psp/*.c) + file(GLOB PSP_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/psp/*.c) list(APPEND SOURCE_FILES ${PSP_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_PSP 1) set(SDL_VIDEO_RENDER_PSP 1) - file(GLOB PSP_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/psp/*.c) + file(GLOB PSP_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/psp/*.c) list(APPEND SOURCE_FILES ${PSP_VIDEO_SOURCES}) set(SDL_VIDEO_OPENGL 1) set(HAVE_SDL_VIDEO TRUE) endif() list(APPEND EXTRA_LIBS - psppower - pspctrl - psphprm - pspge - pspgu - pspdisplay - pspvfpu - pspaudio - pspvram GL + pspvram + pspaudio + pspvfpu + pspdisplay + pspgu + pspge + psphprm + pspctrl + psppower ) - if(NOT SDL2_DISABLE_SDL2MAIN) - list(INSERT SDL_LIBS 0 "-lSDL2main") - endif(NOT SDL2_DISABLE_SDL2MAIN) + if(NOT SDL3_DISABLE_SDL3MAIN) + list(INSERT SDL_LIBS 0 "-lSDL3main") + endif(NOT SDL3_DISABLE_SDL3MAIN) elseif(PS2) list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I$ENV{PS2SDK}/ports/include" "-I$ENV{PS2DEV}/gsKit/include") - file(GLOB PS2_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/ps2/*.c) + file(GLOB PS2_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/ps2/*.c) set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PS2_MAIN_SOURCES}) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_PS2 1) - file(GLOB PS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/ps2/*.c) + file(GLOB PS2_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/ps2/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${PS2_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) endif() if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_PS2 1) - file(GLOB PS2_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/ps2/*.c) + file(GLOB PS2_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_PS2 1) - file(GLOB PS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/ps2/*.c) + file(GLOB PS2_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() if(SDL_THREADS) set(SDL_THREAD_PS2 1) - file(GLOB PS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c ${SDL2_SOURCE_DIR}/src/thread/ps2/*.c) + file(GLOB PS2_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c ${SDL3_SOURCE_DIR}/src/thread/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) set(SDL_TIMER_PS2 1) - file(GLOB PS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/ps2/*.c) + file(GLOB PS2_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_PS2 1) set(SDL_VIDEO_RENDER_PS2 1) - file(GLOB PS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/ps2/*.c ${SDL2_SOURCE_DIR}/src/render/ps2/*.c) + file(GLOB PS2_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/ps2/*.c ${SDL3_SOURCE_DIR}/src/render/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_VIDEO_SOURCES}) set(SDL_VIDEO_OPENGL 0) set(HAVE_SDL_VIDEO TRUE) @@ -2611,74 +2663,79 @@ elseif(PS2) ps2_drivers ) -elseif(OS2) - list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") +elseif(N3DS) + file(GLOB N3DS_MAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/n3ds/*.c) + set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${N3DS_MAIN_SOURCES}) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) - if(NOT (HAVE_ICONV AND HAVE_ICONV_H)) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/geniconv/*.c) - list(APPEND SOURCE_FILES ${CORE_SOURCES}) + if(SDL_AUDIO) + set(SDL_AUDIO_DRIVER_N3DS 1) + file(GLOB N3DS_AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_AUDIO_SOURCES}) + set(HAVE_SDL_AUDIO TRUE) + endif() + + if(SDL_FILESYSTEM) + set(SDL_FILESYSTEM_N3DS 1) + file(GLOB N3DS_FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_FILESYSTEM_SOURCES}) + set(HAVE_SDL_FILESYSTEM TRUE) + endif() + + if(SDL_JOYSTICK) + set(SDL_JOYSTICK_N3DS 1) + file(GLOB N3DS_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_JOYSTICK_SOURCES}) + set(HAVE_SDL_JOYSTICK TRUE) + endif() + + if(SDL_POWER) + set(SDL_POWER_N3DS 1) + file(GLOB N3DS_POWER_SOURCES ${SDL3_SOURCE_DIR}/src/power/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_POWER_SOURCES}) + set(HAVE_SDL_POWER TRUE) endif() if(SDL_THREADS) - set(SDL_THREAD_OS2 1) - file(GLOB OS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_THREAD_SOURCES}) + set(SDL_THREAD_N3DS 1) + file(GLOB N3DS_THREAD_SOURCES ${SDL3_SOURCE_DIR}/src/thread/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_THREAD_SOURCES} ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() if(SDL_TIMERS) - set(SDL_TIMER_UNIX 1) - file(GLOB OS2_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_TIMER_SOURCES}) + set(SDL_TIMER_N3DS 1) + file(GLOB N3DS_TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_TIMER_SOURCES}) set(HAVE_SDL_TIMERS TRUE) endif() - if(SDL_LOADSO) - set(SDL_LOADSO_OS2 1) - file(GLOB OS2_LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_LOADSO_SOURCES}) - set(HAVE_SDL_LOADSO TRUE) - endif() - - if(SDL_FILESYSTEM) - set(SDL_FILESYSTEM_OS2 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/os2/*.c) - list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) - set(HAVE_SDL_FILESYSTEM TRUE) - endif() - - if(SDL_LOCALE) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/unix/*.c) - list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) - set(HAVE_SDL_LOCALE TRUE) + if(SDL_SENSOR) + set(SDL_SENSOR_N3DS 1) + file(GLOB N3DS_SENSOR_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_SENSOR_SOURCES}) + set(HAVE_SDL_SENSORS TRUE) endif() if(SDL_VIDEO) - set(SDL_VIDEO_DRIVER_OS2 1) - file(GLOB OS2_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_VIDEO_SOURCES}) + set(SDL_VIDEO_DRIVER_N3DS 1) + file(GLOB N3DS_VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) endif() - if(SDL_AUDIO) - set(SDL_AUDIO_DRIVER_OS2 1) - file(GLOB OS2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_AUDIO_SOURCES}) - set(HAVE_SDL_AUDIO TRUE) - list(APPEND EXTRA_LIBS mmpm2) + if(SDL_LOCALE) + file(GLOB N3DS_LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_LOCALE_SOURCES}) + set(HAVE_SDL_LOCALE TRUE) endif() - if(SDL_JOYSTICK) - set(SDL_JOYSTICK_OS2 1) - file(GLOB OS2_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/os2/*.c) - list(APPEND SOURCE_FILES ${OS2_JOYSTICK_SOURCES}) - set(HAVE_SDL_JOYSTICK TRUE) - endif() - - if(SDL_HIDAPI) - CheckHIDAPI() + # Requires the n3ds file implementation + if(SDL_FILE) + file(GLOB N3DS_FILE_SOURCES ${SDL3_SOURCE_DIR}/src/file/n3ds/*.c) + list(APPEND SOURCE_FILES ${N3DS_FILE_SOURCES}) + set(HAVE_SDL_FILE TRUE) + else() + message_error("SDL_FILE must be enabled to build on N3DS") endif() endif() @@ -2701,47 +2758,47 @@ CheckLibSampleRate() # src/X/*.c does not get included. if(NOT HAVE_SDL_AUDIO) set(SDL_AUDIO_DRIVER_DUMMY 1) - file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) + file(GLOB AUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/dummy/*.c) list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) endif() if(NOT HAVE_SDL_VIDEO) set(SDL_VIDEO_DRIVER_DUMMY 1) - file(GLOB VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) + file(GLOB VIDEO_SOURCES ${SDL3_SOURCE_DIR}/src/video/dummy/*.c) list(APPEND SOURCE_FILES ${VIDEO_SOURCES}) endif() if(NOT HAVE_SDL_JOYSTICK) set(SDL_JOYSTICK_DUMMY 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/dummy/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) endif() if(NOT HAVE_SDL_HAPTIC) set(SDL_HAPTIC_DUMMY 1) - file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL3_SOURCE_DIR}/src/haptic/dummy/*.c) list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) endif() if(NOT HAVE_SDL_SENSORS) set(SDL_SENSOR_DUMMY 1) - file(GLOB SENSORS_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/dummy/*.c) + file(GLOB SENSORS_SOURCES ${SDL3_SOURCE_DIR}/src/sensor/dummy/*.c) list(APPEND SOURCE_FILES ${SENSORS_SOURCES}) endif() if(NOT HAVE_SDL_LOADSO) set(SDL_LOADSO_DUMMY 1) - file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c) + file(GLOB LOADSO_SOURCES ${SDL3_SOURCE_DIR}/src/loadso/dummy/*.c) list(APPEND SOURCE_FILES ${LOADSO_SOURCES}) endif() if(NOT HAVE_SDL_FILESYSTEM) set(SDL_FILESYSTEM_DUMMY 1) - file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c) + file(GLOB FILESYSTEM_SOURCES ${SDL3_SOURCE_DIR}/src/filesystem/dummy/*.c) list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) endif() if(NOT HAVE_SDL_LOCALE) set(SDL_LOCALE_DUMMY 1) - file(GLOB LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/dummy/*.c) + file(GLOB LOCALE_SOURCES ${SDL3_SOURCE_DIR}/src/locale/dummy/*.c) list(APPEND SOURCE_FILES ${LOCALE_SOURCES}) endif() if(NOT HAVE_SDL_MISC) set(SDL_MISC_DUMMY 1) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/dummy/*.c) + file(GLOB MISC_SOURCES ${SDL3_SOURCE_DIR}/src/misc/dummy/*.c) list(APPEND SOURCE_FILES ${MISC_SOURCES}) endif() @@ -2750,7 +2807,7 @@ if(NOT HAVE_SDL_THREADS) # The emscripten platform has been carefully vetted to work without threads if (EMSCRIPTEN) set(SDL_THREADS_DISABLED 1) - file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c) + file(GLOB THREADS_SOURCES ${SDL3_SOURCE_DIR}/src/thread/generic/*.c) list(APPEND SOURCE_FILES ${THREADS_SOURCES}) else() message_error("Threads are needed by many SDL subsystems and may not be disabled") @@ -2758,12 +2815,12 @@ if(NOT HAVE_SDL_THREADS) endif() if(NOT HAVE_SDL_TIMERS) set(SDL_TIMER_DUMMY 1) - file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/dummy/*.c) + file(GLOB TIMER_SOURCES ${SDL3_SOURCE_DIR}/src/timer/dummy/*.c) list(APPEND SOURCE_FILES ${TIMER_SOURCES}) endif() if(NOT SDLMAIN_SOURCES) - file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c) + file(GLOB SDLMAIN_SOURCES ${SDL3_SOURCE_DIR}/src/main/dummy/*.c) endif() # Append the -MMD -MT flags @@ -2775,15 +2832,15 @@ endif() # config variables may contain generator expression, so we need to generate SDL_config.h in 2 steps: # 1. replace all `#cmakedefine`'s and `@abc@` -configure_file("${SDL2_SOURCE_DIR}/include/SDL_config.h.cmake" - "${SDL2_BINARY_DIR}/SDL_config.h.intermediate") +configure_file("${SDL3_SOURCE_DIR}/include/SDL_config.h.cmake" + "${SDL3_BINARY_DIR}/SDL_config.h.intermediate") # 2. Create the "include-config-${CMAKE_BUILD_TYPE}" folder (fails on older CMake versions when it does not exist) 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}") # 3. generate SDL_config in an build_type-dependent folder (which should be first in the include search path) file(GENERATE - OUTPUT "${SDL2_BINARY_DIR}/include-config-$>/SDL_config.h" - INPUT "${SDL2_BINARY_DIR}/SDL_config.h.intermediate") + OUTPUT "${SDL3_BINARY_DIR}/include-config-$>/SDL_config.h" + INPUT "${SDL3_BINARY_DIR}/SDL_config.h.intermediate") # Prepare the flags and remove duplicates if(EXTRA_LDFLAGS) @@ -2799,103 +2856,121 @@ listtostr(EXTRA_CFLAGS _EXTRA_CFLAGS) set(EXTRA_CFLAGS ${_EXTRA_CFLAGS}) # Compat helpers for the configuration files + +if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION.txt") + file(READ "${PROJECT_SOURCE_DIR}/VERSION.txt" SDL_SOURCE_VERSION) + string(STRIP "${SDL_SOURCE_VERSION}" SDL_SOURCE_VERSION) +endif() + find_package(Git) if(Git_FOUND) execute_process(COMMAND - "${GIT_EXECUTABLE}" remote get-url origin - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE GIT_URL_STATUS - OUTPUT_VARIABLE GIT_URL - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process(COMMAND - "${GIT_EXECUTABLE}" rev-list --max-count=1 HEAD~.. - WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + "${GIT_EXECUTABLE}" describe --always --tags --long + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" RESULT_VARIABLE GIT_REVISION_STATUS OUTPUT_VARIABLE GIT_REVISION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - - if(GIT_URL_STATUS EQUAL 0 OR GIT_REVISION_STATUS EQUAL 0) - set(SDL_REVISION "${GIT_URL}@${GIT_REVISION}") - else() - set(SDL_REVISION "") - endif() else() - set(SDL_REVISION "") + set(GIT_REVISION_STATUS 1) + set(GIT_REVISION "") endif() -configure_file("${SDL2_SOURCE_DIR}/include/SDL_revision.h.cmake" - "${SDL2_BINARY_DIR}/include/SDL_revision.h") +if(SDL_SOURCE_VERSION) + set(SDL_REVISION "SDL-${SDL_SOURCE_VERSION}") +elseif(GIT_REVISION_STATUS EQUAL 0) + if(GIT_REVISION MATCHES "^[0-9a-f]+$") + # Just a truncated sha1, so prefix it with the version number + set(SDL_REVISION "SDL-${SDL_VERSION}-g${GIT_REVISION}") + else() + # e.g. release-2.24.0-542-g96361fc47 + set(SDL_REVISION "SDL-${GIT_REVISION}") + endif() +else() + set(SDL_REVISION "SDL-${SDL_VERSION}-no-vcs") +endif() -# Copy all non-generated headers to "${SDL2_BINARY_DIR}/include" +configure_file("${SDL3_SOURCE_DIR}/include/SDL_revision.h.cmake" + "${SDL3_BINARY_DIR}/include/SDL_revision.h") + +# Copy all non-generated headers to "${SDL3_BINARY_DIR}/include" # This is done to avoid the inclusion of a pre-generated SDL_config.h -file(GLOB SDL2_INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) -set(SDL2_COPIED_INCLUDE_FILES) -foreach(_hdr IN LISTS SDL2_INCLUDE_FILES) +file(GLOB SDL3_INCLUDE_FILES ${SDL3_SOURCE_DIR}/include/*.h) +set(SDL3_COPIED_INCLUDE_FILES) +foreach(_hdr IN LISTS SDL3_INCLUDE_FILES) if(_hdr MATCHES ".*(SDL_config|SDL_revision).*") - list(REMOVE_ITEM SDL2_INCLUDE_FILES "${_hdr}") + list(REMOVE_ITEM SDL3_INCLUDE_FILES "${_hdr}") else() get_filename_component(_name "${_hdr}" NAME) - set(_bin_hdr "${SDL2_BINARY_DIR}/include/${_name}") - list(APPEND SDL2_COPIED_INCLUDE_FILES "${_bin_hdr}") + set(_bin_hdr "${SDL3_BINARY_DIR}/include/${_name}") + list(APPEND SDL3_COPIED_INCLUDE_FILES "${_bin_hdr}") add_custom_command(OUTPUT "${_bin_hdr}" COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_hdr}" "${_bin_hdr}" DEPENDS "${_hdr}") endif() endforeach() -list(APPEND SDL_GENERATED_HEADERS ${SDL2_COPIED_INCLUDE_FILES}) +list(APPEND SDL_GENERATED_HEADERS ${SDL3_COPIED_INCLUDE_FILES}) -if(NOT WINDOWS OR CYGWIN OR MINGW) - - set(prefix ${CMAKE_INSTALL_PREFIX}) - file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}") - - set(exec_prefix "\${prefix}") - set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") - set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") - set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") - if(SDL_STATIC) - set(ENABLE_STATIC_TRUE "") - set(ENABLE_STATIC_FALSE "#") - else() - set(ENABLE_STATIC_TRUE "#") - set(ENABLE_STATIC_FALSE "") - endif() - if(SDL_SHARED) - set(PKGCONFIG_LIBS_PRIV " -Libs.private:") - set(ENABLE_SHARED_TRUE "") - set(ENABLE_SHARED_FALSE "#") - else() - set(PKGCONFIG_LIBS_PRIV "") - set(ENABLE_SHARED_TRUE "#") - set(ENABLE_SHARED_FALSE "") - endif() - - # Clean up the different lists - listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") - set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS}) - list(REMOVE_DUPLICATES SDL_STATIC_LIBS) - listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS) - set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) - listtostr(SDL_LIBS _SDL_LIBS) - set(SDL_LIBS ${_SDL_LIBS}) - listtostr(SDL_CFLAGS _SDL_CFLAGS "") - set(SDL_CFLAGS ${_SDL_CFLAGS}) - - # MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") - # MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") - - configure_file("${SDL2_SOURCE_DIR}/sdl2.pc.in" - "${SDL2_BINARY_DIR}/sdl2.pc" @ONLY) - configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in" - "${SDL2_BINARY_DIR}/sdl2-config") - configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in" - "${SDL2_BINARY_DIR}/sdl2-config" @ONLY) - configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in" - "${SDL2_BINARY_DIR}/SDL2.spec" @ONLY) +if(CMAKE_STATIC_LIBRARY_PREFIX STREQUAL "" AND CMAKE_STATIC_LIBRARY_SUFFIX STREQUAL ".lib") + # Avoid conflict between the dll import library and the static library + set(sdl_static_libname "SDL3-static") +else() + set(sdl_static_libname "SDL3") endif() +set(prefix ${CMAKE_INSTALL_PREFIX}) +file(RELATIVE_PATH bin_prefix_relpath "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}") + +set(exec_prefix "\${prefix}") +set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") +set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +if(SDL_STATIC) + set(ENABLE_STATIC_TRUE "") + set(ENABLE_STATIC_FALSE "#") +else() + set(ENABLE_STATIC_TRUE "#") + set(ENABLE_STATIC_FALSE "") +endif() +if(SDL_SHARED) + set(PKGCONFIG_LIBS_PRIV " +Libs.private:") + set(ENABLE_SHARED_TRUE "") + set(ENABLE_SHARED_FALSE "#") +else() + set(PKGCONFIG_LIBS_PRIV "") + set(ENABLE_SHARED_TRUE "#") + set(ENABLE_SHARED_FALSE "") +endif() + +# Clean up the different lists +listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") +set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS}) +list(REMOVE_DUPLICATES SDL_STATIC_LIBS) +listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS) +set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) +listtostr(SDL_LIBS _SDL_LIBS) +set(SDL_LIBS ${_SDL_LIBS}) +listtostr(SDL_CFLAGS _SDL_CFLAGS "") +set(SDL_CFLAGS ${_SDL_CFLAGS}) +string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_STATIC_LIBS "${SDL_STATIC_LIBS}") +if(NOT SDL_SHARED) + string(REGEX REPLACE "-lSDL3( |$)" "-l${sdl_static_libname} " SDL_LIBS "${SDL_LIBS}") +endif() + +if(SDL_STATIC AND SDL_SHARED AND NOT sdl_static_libname STREQUAL "SDL3") + message(STATUS "\"pkg-config --static --libs sdl3\" will return invalid information") +endif() + +# MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}") +# MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}") + +configure_file("${SDL3_SOURCE_DIR}/sdl3.pc.in" + "${SDL3_BINARY_DIR}/sdl3.pc" @ONLY) +configure_file("${SDL3_SOURCE_DIR}/sdl3-config.in" + "${SDL3_BINARY_DIR}/sdl3-config" @ONLY) +configure_file("${SDL3_SOURCE_DIR}/SDL3.spec.in" + "${SDL3_BINARY_DIR}/SDL3.spec" @ONLY) + macro(check_add_debug_flag FLAG SUFFIX) check_c_compiler_flag(${FLAG} HAS_C_FLAG_${SUFFIX}) if (HAS_C_FLAG_${SUFFIX}) @@ -2961,13 +3036,30 @@ if (SDL_ASAN) endif() endif() +if(SDL_CCACHE) + cmake_minimum_required(VERSION 3.4) + find_program(CCACHE_BINARY ccache) + if(CCACHE_BINARY) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_BINARY}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_BINARY}) + set(CMAKE_OBJC_COMPILER_LAUNCHER ${CCACHE_BINARY}) + set(HAVE_CCACHE ON) + else() + set(HAVE_CCACHE OFF) + endif() +endif() + +if(SDL_TESTS) + set(HAVE_TESTS ON) +endif() + # Create target that collects all all generated include files. add_custom_target(sdl_headers_copy DEPENDS ${SDL_GENERATED_HEADERS}) ##### Info output ##### message(STATUS "") -message(STATUS "SDL2 was configured with the following options:") +message(STATUS "SDL3 was configured with the following options:") message(STATUS "") message(STATUS "Platform: ${CMAKE_SYSTEM}") message(STATUS "64-bit: ${ARCH_64}") @@ -3034,27 +3126,27 @@ endif() # Ensure that the extra cflags are used at compile time set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${EXTRA_CFLAGS_BUILD}") -if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) +if(NOT WINDOWS_STORE AND NOT SDL3_DISABLE_SDL3MAIN) # Build SDLmain - add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) - add_dependencies(SDL2main sdl_headers_copy) + add_library(SDL3main STATIC ${SDLMAIN_SOURCES}) + add_dependencies(SDL3main sdl_headers_copy) # alias target for in-tree builds - add_library(SDL2::SDL2main ALIAS SDL2main) - target_include_directories(SDL2main BEFORE PRIVATE "${SDL2_BINARY_DIR}/include" PRIVATE "${SDL2_BINARY_DIR}/include-config-$>") - target_include_directories(SDL2main PUBLIC "$" $ $) + add_library(SDL3::SDL3main ALIAS SDL3main) + target_include_directories(SDL3main BEFORE PRIVATE "${SDL3_BINARY_DIR}/include" PRIVATE "${SDL3_BINARY_DIR}/include-config-$>") + target_include_directories(SDL3main PUBLIC "$" $ $) if (WIN32) - target_link_libraries(SDL2main PRIVATE shell32) + target_link_libraries(SDL3main PRIVATE shell32) endif() if(MINGW OR CYGWIN) cmake_minimum_required(VERSION 3.13) if(CMAKE_SIZEOF_VOID_P EQUAL 4) - target_link_options(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>") + target_link_options(SDL3main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>") else() - target_link_options(SDL2main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>") + target_link_options(SDL3main PUBLIC "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>") endif() endif() if (NOT ANDROID) - set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + set_target_properties(SDL3main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() endif() @@ -3070,96 +3162,105 @@ if(PS2) target_compile_options(sdl-build-options INTERFACE "-Wno-error=declaration-after-statement") endif() +if(APPLE) + foreach(SOURCE_FILE ${SOURCE_FILES}) + get_filename_component(FILE_EXTENSION ${SOURCE_FILE} EXT) + if(FILE_EXTENSION STREQUAL "m") + set_property(SOURCE ${SOURCE_FILE} APPEND_STRING PROPERTY COMPILE_FLAGS " -x objective-c") + endif() + endforeach() +endif() + if(SDL_SHARED) - add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) - add_dependencies(SDL2 sdl_headers_copy) + add_library(SDL3 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) + add_dependencies(SDL3 sdl_headers_copy) # alias target for in-tree builds - add_library(SDL2::SDL2 ALIAS SDL2) - set_target_properties(SDL2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + add_library(SDL3::SDL3 ALIAS SDL3) + set_target_properties(SDL3 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + if(NOT SDL_LIBC) + check_cpu_architecture(x86 HAS_X86) + if(HAS_X86) + # FIXME: should be added for all architectures (missing symbols for ARM) + target_link_libraries(SDL3 PRIVATE "-nodefaultlib:MSVCRT") + endif() + endif() if(APPLE) # FIXME: Remove SOVERSION in SDL3 - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES MACOSX_RPATH 1 SOVERSION 0 - OUTPUT_NAME "SDL2-${LT_RELEASE}") + OUTPUT_NAME "SDL3-${LT_RELEASE}") elseif(UNIX AND NOT ANDROID) - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES VERSION ${LT_VERSION} SOVERSION ${LT_MAJOR} - OUTPUT_NAME "SDL2-${LT_RELEASE}") + OUTPUT_NAME "SDL3-${LT_RELEASE}") else() if(WINDOWS OR CYGWIN) - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES DEFINE_SYMBOL DLL_EXPORT) - elseif(OS2) - set_target_properties(SDL2 PROPERTIES - DEFINE_SYMBOL BUILD_SDL) endif() - set_target_properties(SDL2 PROPERTIES + set_target_properties(SDL3 PROPERTIES VERSION ${SDL_VERSION} SOVERSION ${LT_REVISION} - OUTPUT_NAME "SDL2") + OUTPUT_NAME "SDL3") endif() # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. 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. if(NOT WINDOWS_STORE) - set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") - set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") + set_target_properties(SDL3 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") + set_target_properties(SDL3 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") endif() - set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") + set_target_properties(SDL3 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") endif() # 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}) - target_include_directories(SDL2 PUBLIC - "$" - "$>>" + target_link_libraries(SDL3 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD}) + target_include_directories(SDL3 PUBLIC + "$" + "$>>" "$" - "$") + "$") # This picks up all the compiler options and such we've accumulated up to here. - target_link_libraries(SDL2 PRIVATE $) + target_link_libraries(SDL3 PRIVATE $) if(MINGW OR CYGWIN) if(NOT CMAKE_VERSION VERSION_LESS "3.13") - target_link_options(SDL2 PRIVATE -static-libgcc) + target_link_options(SDL3 PRIVATE -static-libgcc) endif() endif() if(NOT ANDROID) - set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + set_target_properties(SDL3 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library - set_property(TARGET SDL2 PROPERTY INTERFACE_SDL2_SHARED TRUE) - set_property(TARGET SDL2 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) + set_property(TARGET SDL3 PROPERTY INTERFACE_SDL3_SHARED TRUE) + set_property(TARGET SDL3 APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED) endif() if(SDL_STATIC) - add_library(SDL2-static STATIC ${SOURCE_FILES}) - add_dependencies(SDL2-static sdl_headers_copy) + add_library(SDL3-static STATIC ${SOURCE_FILES}) + add_dependencies(SDL3-static sdl_headers_copy) # alias target for in-tree builds - add_library(SDL2::SDL2-static ALIAS SDL2-static) - if(MSVC OR (WATCOM AND (WIN32 OR OS2))) - # Avoid conflict between the dll import library and the static library - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2-static") - else() - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") - endif() - set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}") - target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB) + add_library(SDL3::SDL3-static ALIAS SDL3-static) + set_target_properties(SDL3-static PROPERTIES + OUTPUT_NAME "${sdl_static_libname}" + POSITION_INDEPENDENT_CODE "${SDL_STATIC_PIC}") + target_compile_definitions(SDL3-static PRIVATE SDL_STATIC_LIB) # TODO: Win32 platforms keep the same suffix .lib for import and static # libraries - do we need to consider this? - target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) - target_include_directories(SDL2-static PUBLIC - "$" - "$>>" + target_link_libraries(SDL3-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL3-static PUBLIC + "$" + "$>>" "$" - "$") + "$") # This picks up all the compiler options and such we've accumulated up to here. - target_link_libraries(SDL2-static PRIVATE $) + target_link_libraries(SDL3-static PRIVATE $) if(NOT ANDROID) - set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") + set_target_properties(SDL3-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() # Use `Compatible Interface Properties` to allow consumers to enforce a shared/static library - set_property(TARGET SDL2-static PROPERTY INTERFACE_SDL2_SHARED FALSE) - set_property(TARGET SDL2-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL2_SHARED) + set_property(TARGET SDL3-static PROPERTY INTERFACE_SDL3_SHARED FALSE) + set_property(TARGET SDL3-static APPEND PROPERTY COMPATIBLE_INTERFACE_BOOL SDL3_SHARED) endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MAJOR_VERSION=${SDL_MAJOR_VERSION}") @@ -3169,45 +3270,45 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MICRO_VERSION=${SDL_MICRO_VERSIO ##### Tests ##### if(SDL_TEST) - file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) - add_library(SDL2_test STATIC ${TEST_SOURCES}) - add_dependencies(SDL2_test sdl_headers_copy) - add_library(SDL2::SDL2test ALIAS SDL2_test) - set_target_properties(SDL2_test PROPERTIES - EXPORT_NAME SDL2test) - target_include_directories(SDL2_test PUBLIC - "$" - "$>>" + file(GLOB TEST_SOURCES ${SDL3_SOURCE_DIR}/src/test/*.c) + add_library(SDL3_test STATIC ${TEST_SOURCES}) + add_dependencies(SDL3_test sdl_headers_copy) + add_library(SDL3::SDL3test ALIAS SDL3_test) + set_target_properties(SDL3_test PROPERTIES + EXPORT_NAME SDL3test) + target_include_directories(SDL3_test PUBLIC + "$" + "$>>" "$" - "$") - target_link_libraries(SDL2_test PRIVATE ${EXTRA_TEST_LIBS}) + "$") + target_link_libraries(SDL3_test PRIVATE ${EXTRA_TEST_LIBS}) endif() ##### Installation targets ##### -if(NOT SDL2_DISABLE_INSTALL) +if(NOT SDL3_DISABLE_INSTALL) if(SDL_SHARED) - install(TARGETS SDL2 EXPORT SDL2Targets + install(TARGETS SDL3 EXPORT SDL3Targets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() - if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(TARGETS SDL2main EXPORT SDL2mainTargets + if(NOT WINDOWS_STORE AND NOT SDL3_DISABLE_SDL3MAIN) + install(TARGETS SDL3main EXPORT SDL3mainTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() if(SDL_STATIC) - install(TARGETS SDL2-static EXPORT SDL2staticTargets + install(TARGETS SDL3-static EXPORT SDL3staticTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() if(SDL_TEST) - install(TARGETS SDL2_test EXPORT SDL2testTargets + install(TARGETS SDL3_test EXPORT SDL3testTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") @@ -3215,83 +3316,86 @@ if(NOT SDL2_DISABLE_INSTALL) ##### Export files ##### if (WINDOWS AND NOT MINGW) - set(PKG_PREFIX "cmake") + set(SDL_INSTALL_CMAKEDIR_DEFAULT "cmake") + set(LICENSES_PREFIX "licenses/SDL3") else () - set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") + set(SDL_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/SDL3") + set(LICENSES_PREFIX "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") endif () + set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_DEFAULT}" CACHE STRING "Location where to install SDL3Config.cmake") include(CMakePackageConfigHelpers) - configure_package_config_file(SDL2Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake" + configure_package_config_file(SDL3Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake" PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR - INSTALL_DESTINATION ${PKG_PREFIX} + INSTALL_DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) - write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake" + write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake" VERSION ${SDL_VERSION} COMPATIBILITY AnyNewerVersion ) if(SDL_SHARED) - install(EXPORT SDL2Targets - FILE SDL2Targets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + install(EXPORT SDL3Targets + FILE SDL3Targets.cmake + NAMESPACE SDL3:: + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2Targets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2") + install(EXPORT_ANDROID_MK SDL3Targets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3") endif() endif() - if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) - install(EXPORT SDL2mainTargets - FILE SDL2mainTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + if(NOT WINDOWS_STORE AND NOT SDL3_DISABLE_SDL3MAIN) + install(EXPORT SDL3mainTargets + FILE SDL3mainTargets.cmake + NAMESPACE SDL3:: + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2mainTargets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2main") + install(EXPORT_ANDROID_MK SDL3mainTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3main") endif() endif() if(SDL_STATIC) - install(EXPORT SDL2staticTargets - FILE SDL2staticTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + install(EXPORT SDL3staticTargets + FILE SDL3staticTargets.cmake + NAMESPACE SDL3:: + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2staticTargets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2-static") + install(EXPORT_ANDROID_MK SDL3staticTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3-static") endif() endif() if(SDL_TEST) - install(EXPORT SDL2testTargets - FILE SDL2testTargets.cmake - NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + install(EXPORT SDL3testTargets + FILE SDL3testTargets.cmake + NAMESPACE SDL3:: + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) - install(EXPORT_ANDROID_MK SDL2testTargets - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL2test") + install(EXPORT_ANDROID_MK SDL3testTargets + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ndk-modules/SDL3test") endif() endif() install( FILES - ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake - DESTINATION ${PKG_PREFIX} + ${CMAKE_CURRENT_BINARY_DIR}/SDL3Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/SDL3ConfigVersion.cmake + DESTINATION "${SDL_INSTALL_CMAKEDIR}" COMPONENT Devel ) install( FILES - ${SDL2_INCLUDE_FILES} - "${SDL2_BINARY_DIR}/include/SDL_revision.h" - "${SDL2_BINARY_DIR}/include-config-$>/SDL_config.h" - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2) + ${SDL3_INCLUDE_FILES} + "${SDL3_BINARY_DIR}/include/SDL_revision.h" + "${SDL3_BINARY_DIR}/include-config-$>/SDL_config.h" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL3) string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE) if (UPPER_BUILD_TYPE MATCHES DEBUG) @@ -3300,35 +3404,35 @@ if(NOT SDL2_DISABLE_INSTALL) set(SOPOSTFIX "") endif() + install(FILES "LICENSE.txt" DESTINATION "${LICENSES_PREFIX}") + if(FREEBSD) + # FreeBSD uses ${PREFIX}/libdata/pkgconfig + install(FILES ${SDL3_BINARY_DIR}/sdl3.pc DESTINATION "libdata/pkgconfig") + else() + install(FILES ${SDL3_BINARY_DIR}/sdl3.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + endif() if(NOT (WINDOWS OR CYGWIN) OR MINGW) if(SDL_SHARED) set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc. - get_target_property(SONAME SDL2 OUTPUT_NAME) - if(NOT ANDROID AND NOT MINGW AND NOT OS2) + get_target_property(SONAME SDL3 OUTPUT_NAME) + if(NOT ANDROID AND NOT MINGW) install(CODE " execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL2${SOPOSTFIX}${SOEXT}\" - WORKING_DIRECTORY \"${SDL2_BINARY_DIR}\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") + \"lib${SONAME}${SOPOSTFIX}${SOEXT}\" \"libSDL3${SOPOSTFIX}${SOEXT}\" + WORKING_DIRECTORY \"${SDL3_BINARY_DIR}\")") + install(FILES ${SDL3_BINARY_DIR}/libSDL3${SOPOSTFIX}${SOEXT} DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif() endif() - if(FREEBSD) - # FreeBSD uses ${PREFIX}/libdata/pkgconfig - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") - else() - install(FILES ${SDL2_BINARY_DIR}/sdl2.pc - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif() - install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(PROGRAMS ${SDL3_BINARY_DIR}/sdl3-config DESTINATION "${CMAKE_INSTALL_BINDIR}") # TODO: what about the .spec file? Is it only needed for RPM creation? - install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") - install(FILES "LICENSE.txt" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME}") + install(FILES "${SDL3_SOURCE_DIR}/sdl3.m4" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/aclocal") endif() endif() ##### Uninstall target ##### -if(NOT SDL2_DISABLE_UNINSTALL) +if(NOT SDL3_DISABLE_UNINSTALL) if(NOT TARGET uninstall) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" @@ -3343,6 +3447,7 @@ endif() ##### Tests subproject (must appear after the install/uninstall targets) ##### if(SDL_TESTS) + set(HAVE_TESTS ON) enable_testing() add_subdirectory(test) endif() @@ -3350,7 +3455,7 @@ endif() ##### Fix Objective C builds ##### set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} ${CMAKE_C_FLAGS}") -# Make sure SDL2::SDL2 always exists -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 ALIAS SDL2-static) +# Make sure SDL3::SDL3 always exists +if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 ALIAS SDL3-static) endif() diff --git a/Makefile.in b/Makefile.in index 1dc78f671c..f72a044c2a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,7 +13,7 @@ datarootdir = @datarootdir@ datadir = @datadir@ auxdir = @ac_aux_dir@ distpath = $(srcdir)/.. -distdir = SDL2-@SDL_VERSION@ +distdir = SDL3-@SDL_VERSION@ distfile = $(distdir).tar.gz @SET_MAKE@ @@ -32,26 +32,27 @@ RANLIB = @RANLIB@ RC = @RC@ LINKER = @LINKER@ LIBTOOLLINKERTAG = @LIBTOOLLINKERTAG@ +SDL_VENDOR_INFO = @SDL_VENDOR_INFO@ -TARGET = libSDL2.la +TARGET = libSDL3.la OBJECTS = @OBJECTS@ GEN_HEADERS = @GEN_HEADERS@ GEN_OBJECTS = @GEN_OBJECTS@ VERSION_OBJECTS = @VERSION_OBJECTS@ -SDLMAIN_TARGET = libSDL2main.la +SDLMAIN_TARGET = libSDL3main.la SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ -SDLTEST_TARGET = libSDL2_test.la +SDLTEST_TARGET = libSDL3_test.la SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@ -INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@ +INSTALL_SDL3_CONFIG = @INSTALL_SDL3_CONFIG@ -SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols -GEN_DIST = SDL2.spec +SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl3-config.cmake.in sdl3-config-version.cmake.in sdl3-config.in sdl3.m4 sdl3.pc.in SDL3.spec.in SDL3Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols +GEN_DIST = SDL3.spec ifneq ($V,1) RUN_CMD_AR = @echo " AR " $@; @@ -152,7 +153,7 @@ $(objects)/.created: touch $@ update-revision: - $(SHELL) $(auxdir)/updaterev.sh + $(SHELL) $(auxdir)/updaterev.sh --vendor "$(SDL_VENDOR_INFO)" .PHONY: all update-revision install install-bin install-hdrs install-lib install-data uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data clean distclean dist $(OBJECTS:.lo=.d) @@ -167,21 +168,21 @@ $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS) install: all install-bin install-hdrs install-lib install-data install-bin: -ifeq ($(INSTALL_SDL2_CONFIG),TRUE) +ifeq ($(INSTALL_SDL3_CONFIG),TRUE) $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir) - $(INSTALL) -m 755 sdl2-config $(DESTDIR)$(bindir)/sdl2-config + $(INSTALL) -m 755 sdl3-config $(DESTDIR)$(bindir)/sdl3-config endif install-hdrs: update-revision - $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL2 + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL3 for file in $(HDRS) $(SDLTEST_HDRS); do \ - $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL2/$$file; \ + $(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL3/$$file; \ done - $(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL2/SDL_config.h + $(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL3/SDL_config.h if test -f include/SDL_revision.h; then \ - $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \ + $(INSTALL) -m 644 include/SDL_revision.h $(DESTDIR)$(includedir)/SDL3/SDL_revision.h; \ else \ - $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL2/SDL_revision.h; \ + $(INSTALL) -m 644 $(srcdir)/include/SDL_revision.h $(DESTDIR)$(includedir)/SDL3/SDL_revision.h; \ fi install-lib: $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) @@ -191,34 +192,34 @@ install-lib: $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLT $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) install-data: $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal - $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4 + $(INSTALL) -m 644 $(srcdir)/sdl3.m4 $(DESTDIR)$(datadir)/aclocal/sdl3.m4 $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig - $(INSTALL) -m 644 sdl2.pc $(DESTDIR)$(libdir)/pkgconfig -ifeq ($(INSTALL_SDL2_CONFIG),TRUE) - $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL2 - $(INSTALL) -m 644 sdl2-config.cmake $(DESTDIR)$(libdir)/cmake/SDL2 - $(INSTALL) -m 644 sdl2-config-version.cmake $(DESTDIR)$(libdir)/cmake/SDL2 + $(INSTALL) -m 644 sdl3.pc $(DESTDIR)$(libdir)/pkgconfig +ifeq ($(INSTALL_SDL3_CONFIG),TRUE) + $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/cmake/SDL3 + $(INSTALL) -m 644 sdl3-config.cmake $(DESTDIR)$(libdir)/cmake/SDL3 + $(INSTALL) -m 644 sdl3-config-version.cmake $(DESTDIR)$(libdir)/cmake/SDL3 endif uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-bin: - rm -f $(DESTDIR)$(bindir)/sdl2-config + rm -f $(DESTDIR)$(bindir)/sdl3-config uninstall-hdrs: for file in $(HDRS) $(SDLTEST_HDRS); do \ - rm -f $(DESTDIR)$(includedir)/SDL2/$$file; \ + rm -f $(DESTDIR)$(includedir)/SDL3/$$file; \ done - rm -f $(DESTDIR)$(includedir)/SDL2/SDL_config.h - rm -f $(DESTDIR)$(includedir)/SDL2/SDL_revision.h - -rmdir $(DESTDIR)$(includedir)/SDL2 + rm -f $(DESTDIR)$(includedir)/SDL3/SDL_config.h + rm -f $(DESTDIR)$(includedir)/SDL3/SDL_revision.h + -rmdir $(DESTDIR)$(includedir)/SDL3 uninstall-lib: $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET) rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) rm -f $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) uninstall-data: - rm -f $(DESTDIR)$(datadir)/aclocal/sdl2.m4 - rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl2.pc - rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config.cmake - rm -f $(DESTDIR)$(libdir)/cmake/SDL2/sdl2-config-version.cmake + rm -f $(DESTDIR)$(datadir)/aclocal/sdl3.m4 + rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl3.pc + rm -f $(DESTDIR)$(libdir)/cmake/SDL3/sdl3-config.cmake + rm -f $(DESTDIR)$(libdir)/cmake/SDL3/sdl3-config-version.cmake clean: rm -rf $(objects) @@ -226,7 +227,7 @@ clean: if test -f test/Makefile; then (cd test; $(MAKE) $@); fi distclean: clean - rm -f Makefile Makefile.rules sdl2-config + rm -f Makefile Makefile.rules sdl3-config rm -f config.status config.cache config.log libtool rm -rf $(srcdir)/autom4te* find $(srcdir) \( \ @@ -252,7 +253,8 @@ dist $(distfile): -name '.#*' \) \ -exec rm -f {} \; if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi - (cd $(distdir); build-scripts/updaterev.sh) + # Intentionally no vendor suffix: that's a property of the build, not the source + (cd $(distdir); $(srcdir)/build-scripts/updaterev.sh --dist) tar cvf - $(distdir) | gzip --best >$(distfile) rm -rf $(distdir) diff --git a/Makefile.minimal b/Makefile.minimal index 97ce201ea3..0a69413ddf 100644 --- a/Makefile.minimal +++ b/Makefile.minimal @@ -5,8 +5,8 @@ CFLAGS = -g -O2 $(INCLUDE) AR = ar RANLIB = ranlib -TARGET = libSDL2.a -TESTTARGET = libSDL2_test.a +TARGET = libSDL3.a +TESTTARGET = libSDL3_test.a SOURCES = \ src/*.c \ diff --git a/Makefile.os2 b/Makefile.os2 deleted file mode 100644 index b9096c9295..0000000000 --- a/Makefile.os2 +++ /dev/null @@ -1,291 +0,0 @@ -# Open Watcom makefile to build SDL2.dll for OS/2 -# wmake -f Makefile.os2 -# -# If you have GNU libiconv installed (iconv2.dll), you -# can compile against it by specifying LIBICONV=1, e.g.: -# wmake -f Makefile.os2 LIBICONV=1 -# -# If you have libusb-1.0 installed (usb100.dll, libusb.h), you -# can compile hidapi joystick support against it (experimental) -# by specifying HIDAPI=1, e.g.: -# wmake -f Makefile.os2 HIDAPI=1 - -LIBNAME = SDL2 -MAJOR_VERSION = 2 -MINOR_VERSION = 25 -MICRO_VERSION = 0 -VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) -DESCRIPTION = Simple DirectMedia Layer 2 - -LIBICONV=0 -ICONVLIB=$(LIBICONV_LIB) - -LIBHOME = . -DLLFILE = $(LIBHOME)/$(LIBNAME).dll -LIBFILE = $(LIBHOME)/$(LIBNAME).lib -LNKFILE = $(LIBNAME).lnk - -INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h" -INCPATH+= -Iinclude - -LIBM = SDL2libm.lib -TLIB = SDL2test.lib -LIBS = mmpm2.lib $(LIBM) -CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei -# Debug options: -# - debug messages from OS/2 related code to stdout: -#CFLAGS+= -DOS2DEBUG -# - debug messages from OS/2 code via SDL_LogDebug(): -#CFLAGS+= -DOS2DEBUG=2 - -# max warnings: -CFLAGS+= -wx -# newer OpenWatcom versions enable W303 by default -CFLAGS+= -wcd=303 -# the include paths : -CFLAGS+= $(INCPATH) -CFLAGS_STATIC=$(CFLAGS) -# building dll: -CFLAGS_DLL =$(CFLAGS) -CFLAGS_DLL+= -bd -# iconv: -LIBICONV_LIB=iconv2.lib -!ifeq LIBICONV 1 -CFLAGS_DLL+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -LIBS+= $(ICONVLIB) -!else -LIBS+= libuls.lib libconv.lib -!endif -# hidapi (libusb): -!ifeq HIDAPI 1 -CFLAGS_DLL+= -DHAVE_LIBUSB_H=1 -!endif -# building SDL itself (for DECLSPEC): -CFLAGS_DLL+= -DBUILD_SDL - -CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) - -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c -SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c -SRCS+= SDL_rwops.c SDL_power.c -SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c -SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & - SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & - SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & - SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & - SDL_render_sw.c SDL_rotate.c SDL_triangle.c -SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & - SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & - SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & - SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c - -SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c -SRCS+= SDL_systimer.c -SRCS+= SDL_sysloadso.c -SRCS+= SDL_sysfilesystem.c -SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c -SRCS+= SDL_dummyaudio.c SDL_diskaudio.c -SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c -SRCS+= SDL_dummysensor.c -SRCS+= SDL_locale.c SDL_syslocale.c -SRCS+= SDL_url.c SDL_sysurl.c - -SRCS+= SDL_os2.c -!ifeq LIBICONV 0 -SRCS+= geniconv.c os2cp.c os2iconv.c sys2utf8.c -!endif -SRCS+= SDL_os2audio.c -SRCS+= SDL_os2video.c SDL_os2util.c SDL_os2dive.c SDL_os2vman.c & - SDL_os2mouse.c SDL_os2messagebox.c - -SRCS+= SDL_dynapi.c - -OBJS = $(SRCS:.c=.obj) - -.extensions: -.extensions: .lib .dll .obj .c .asm - -.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; -.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; -.c: ./src/core/os2;./src/audio/os2;./src/loadso/os2;./src/filesystem/os2;./src/joystick/os2;./src/thread/os2;./src/timer/os2;./src/video/os2; -.c: ./src/core/os2/geniconv; -.c: ./src/locale/;./src/locale/unix;./src/misc;./src/misc/dummy;./src/joystick/hidapi;./src/hidapi - -all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic - -build_dll: .symbolic - @echo * Compiling dll objects - -$(DLLFILE): build_dll $(OBJS) $(LIBM) $(LIBICONV_LIB) $(LNKFILE) - @echo * Linking: $@ - wlink @$(LNKFILE) - -$(LIBFILE): $(DLLFILE) - @echo * Creating LIB file: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $* $(DLLFILE) - -.c.obj: - wcc386 $(CFLAGS_DLL) -fo=$^@ $< - -SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" - wcc386 $(CFLAGS_DLL) -fo=$^@ $< -SDL_cpuinfo.obj: SDL_cpuinfo.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_wave.obj: SDL_wave.c - wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< -SDL_blendfillrect.obj: SDL_blendfillrect.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendline.obj: SDL_blendline.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendpoint.obj: SDL_blendpoint.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_RLEaccel.obj: SDL_RLEaccel.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -!ifeq HIDAPI 1 -# c99 mode needed because of structs with flexible array members in libusb.h -SDL_hidapi.obj: SDL_hidapi.c - wcc386 $(CFLAGS_DLL) -za99 -fo=$^@ $< -!endif - -$(LIBICONV_LIB): "src/core/os2/iconv2.lbc" - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ @$< - -# SDL2libm -MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & - k_cos.c k_rem_pio2.c k_sin.c k_tan.c & - s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c -MOBJS= $(MSRCS:.c=.obj) - -.c: ./src/libm; -e_atan2.obj: e_atan2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_exp.obj: e_exp.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_fmod.obj: e_fmod.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log10.obj: e_log10.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log.obj: e_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_pow.obj: e_pow.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_rem_pio2.obj: e_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_sqrt.obj: e_sqrt.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_cos.obj: k_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_rem_pio2.obj: k_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_sin.obj: k_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_tan.obj: k_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_atan.obj: s_atan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_copysign.obj: s_copysign.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_cos.obj: s_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_fabs.obj: s_fabs.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_floor.obj: s_floor.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_scalbn.obj: s_scalbn.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_sin.obj: s_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_tan.obj: s_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_libm: .symbolic - @echo * Compiling libm objects -$(LIBM): build_libm $(MOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) - -# SDL2test -TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & - SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & - SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & - SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & - SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c -TOBJS= $(TSRCS:.c=.obj) - -.c: ./src/test; -SDL_test_assert.obj: SDL_test_assert.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_common.obj: SDL_test_common.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_compare.obj: SDL_test_compare.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_crc32.obj: SDL_test_crc32.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_font.obj: SDL_test_font.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_fuzzer.obj: SDL_test_fuzzer.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_harness.obj: SDL_test_harness.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlit.obj: SDL_test_imageBlit.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageFace.obj: SDL_test_imageFace.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_log.obj: SDL_test_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_md5.obj: SDL_test_md5.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_random.obj: SDL_test_random.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_memory.obj: SDL_test_memory.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_tlib: .symbolic - @echo * Compiling testlib objects -$(TLIB): build_tlib $(TOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) - -$(LNKFILE): - @echo * Creating linker file: $@ - @%create $@ - @%append $@ SYSTEM os2v2_dll INITINSTANCE TERMINSTANCE - @%append $@ NAME $(DLLFILE) - @for %i in ($(OBJS)) do @%append $@ FILE %i - @for %i in ($(LIBS)) do @%append $@ LIB %i - @%append $@ OPTION QUIET - @%append $@ OPTION IMPF=$(LIBHOME)/$^&.exp - @%append $@ OPTION MAP=$(LIBHOME)/$^&.map - @%append $@ OPTION DESCRIPTION '@$#libsdl org:$(VERSION)$#@$(DESCRIPTION)' - @%append $@ OPTION ELIMINATE - @%append $@ OPTION MANYAUTODATA - @%append $@ OPTION OSNAME='OS/2 and eComStation' - @%append $@ OPTION SHOWDEAD - -clean: .SYMBOLIC - @echo * Clean: $(LIBNAME) - @if exist *.obj rm *.obj - @if exist *.err rm *.err - @if exist $(LNKFILE) rm $(LNKFILE) - @if exist $(LIBM) rm $(LIBM) - @if exist $(LIBICONV_LIB) rm $(LIBICONV_LIB) - -distclean: .SYMBOLIC clean - @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp - @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist $(DLLFILE) rm $(DLLFILE) - @if exist $(TLIB) rm $(TLIB) diff --git a/Makefile.pandora b/Makefile.pandora deleted file mode 100644 index fe2249979d..0000000000 --- a/Makefile.pandora +++ /dev/null @@ -1,64 +0,0 @@ -# Makefile to build the pandora SDL library - -AR = arm-none-linux-gnueabi-ar -RANLIB = arm-none-linux-gnueabi-ranlib -CC = arm-none-linux-gnueabi-gcc -CXX = arm-none-linux-gnueabi-g++ -STRIP = arm-none-linux-gnueabi-strip - -CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \ - -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \ - -I./include -I$(PNDSDK)/usr/include - -TARGET = libSDL2.a - -SOURCES = - ./src/*.c \ - ./src/atomic/*.c \ - ./src/audio/*.c \ - ./src/audio/disk/*.c \ - ./src/audio/dsp/*.c \ - ./src/audio/dummy/*.c \ - ./src/cpuinfo/*.c \ - ./src/events/*.c \ - ./src/file/*.c \ - ./src/filesystem/unix/*.c \ - ./src/haptic/*.c \ - ./src/haptic/linux/*.c \ - ./src/hidapi/*.c \ - ./src/joystick/*.c \ - ./src/joystick/linux/*.c \ - ./src/loadso/dlopen/*.c \ - ./src/locale/*.c \ - ./src/locale/unix/*.c \ - ./src/misc/*.c \ - ./src/misc/unix/*.c \ - ./src/power/*.c \ - ./src/sensor/*.c \ - ./src/sensor/dummy/*.c \ - ./src/stdlib/*.c \ - ./src/thread/*.c \ - ./src/thread/pthread/SDL_syscond.c \ - ./src/thread/pthread/SDL_sysmutex.c \ - ./src/thread/pthread/SDL_syssem.c \ - ./src/thread/pthread/SDL_systhread.c \ - ./src/timer/*.c \ - ./src/timer/unix/*.c \ - ./src/video/*.c \ - ./src/video/yuv2rgb/*.c \ - ./src/video/dummy/*.c \ - ./src/video/x11/*.c \ - ./src/video/pandora/*.c - -OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') - -CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h) - -all: $(TARGET) - -$(TARGET): $(CONFIG_H) $(OBJECTS) - $(AR) crv $@ $^ - $(RANLIB) $@ - -clean: - rm -f $(TARGET) $(OBJECTS) diff --git a/Makefile.w32 b/Makefile.w32 deleted file mode 100644 index 22ec0cd92d..0000000000 --- a/Makefile.w32 +++ /dev/null @@ -1,275 +0,0 @@ -# Open Watcom makefile to build SDL2.dll for Win32 -# wmake -f Makefile.w32 - -LIBNAME = SDL2 -MAJOR_VERSION = 2 -MINOR_VERSION = 25 -MICRO_VERSION = 0 -VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) - -LIBHOME = . -DLLFILE = $(LIBHOME)/$(LIBNAME).dll -LIBFILE = $(LIBHOME)/$(LIBNAME).lib -EXPFILE = $(LIBHOME)/$(LIBNAME).exp -LNKFILE = $(LIBNAME).lnk - -INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h/nt/directx" -I"$(%WATCOM)/h" -INCPATH+= -Iinclude -INCPATH+= -I"src/video/khronos" - -LIBM = SDL2libm.lib -TLIB = SDL2test.lib -# user32.lib, gdi32.lib, ole32.lib and oleaut32.lib are actually -# among the default libraries in wlink.lnk for nt_dll linkage... -LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.lib setupapi.lib version.lib uuid.lib dxguid.lib $(LIBM) - -CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei -# max warnings: -CFLAGS+= -wx -# newer OpenWatcom versions enable W303 by default -CFLAGS+= -wcd=303 -# new vulkan headers result in lots of W202 warnings -CFLAGS+= -wcd=202 -# the include paths : -CFLAGS+= $(INCPATH) -CFLAGS_STATIC=$(CFLAGS) -# building dll: -CFLAGS_DLL =$(CFLAGS) -CFLAGS_DLL+= -bd -# we override the DECLSPEC define in begin_code.h, because we are using -# an exports file to remove the _cdecl '_' prefix from the symbol names -CFLAGS_DLL+= -DDECLSPEC= - -CFLAGS_DLL+= -DSDL_BUILD_MAJOR_VERSION=$(MAJOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION) -CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION) - -RCFLAGS = -q -r -bt=nt $(INCPATH) - -SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc16.c SDL_crc32.c -SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c -SRCS+= SDL_rwops.c SDL_power.c -SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c -SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & - SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & - SDL_sensor.c SDL_touch.c -SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & - SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & - SDL_render_sw.c SDL_rotate.c SDL_triangle.c -SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & - SDL_blit_copy.c SDL_blit_N.c SDL_blit_slow.c SDL_fillrect.c SDL_bmp.c & - SDL_pixels.c SDL_rect.c SDL_RLEaccel.c SDL_shape.c SDL_stretch.c & - SDL_surface.c SDL_video.c SDL_clipboard.c SDL_vulkan_utils.c SDL_egl.c - -SRCS+= SDL_syscond.c SDL_sysmutex.c SDL_syssem.c SDL_systhread.c SDL_systls.c -SRCS+= SDL_systimer.c -SRCS+= SDL_sysloadso.c -SRCS+= SDL_sysfilesystem.c -SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c -SRCS+= SDL_dummyaudio.c SDL_diskaudio.c -SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c -SRCS+= SDL_dummysensor.c -SRCS+= SDL_locale.c SDL_syslocale.c -SRCS+= SDL_url.c SDL_sysurl.c - -SRCS+= SDL_winmm.c SDL_directsound.c SDL_wasapi.c SDL_wasapi_win32.c -SRCS+= SDL_hid.c SDL_immdevice.c SDL_windows.c SDL_xinput.c -SRCS+= SDL_dinputhaptic.c SDL_windowshaptic.c SDL_xinputhaptic.c -SRCS+= SDL_dinputjoystick.c SDL_rawinputjoystick.c SDL_windowsjoystick.c SDL_windows_gaming_input.c SDL_xinputjoystick.c -SRCS+= SDL_syspower.c -SRCS+= SDL_d3dmath.c -SRCS+= SDL_render_d3d.c SDL_shaders_d3d.c -SRCS+= SDL_render_d3d11.c SDL_shaders_d3d11.c -SRCS+= SDL_render_d3d12.c SDL_shaders_d3d12.c -SRCS+= SDL_render_gl.c SDL_shaders_gl.c -SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c -SRCS+= SDL_windowssensor.c -SRCS+= SDL_syscond_cv.c -SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c - -SRCS+= SDL_dynapi.c - -RCSRCS = version.rc - -OBJS = $(SRCS:.c=.obj) -RCOBJS= $(RCSRCS:.rc=.res) - -.extensions: -.extensions: .lib .dll .obj .res .c .rc .asm - -.c: ./src;./src/dynapi;./src/audio;./src/cpuinfo;./src/events;./src/file;./src/haptic;./src/joystick;./src/power;./src/render;./src/render/software;./src/sensor;./src/stdlib;./src/thread;./src/timer;./src/video;./src/video/yuv2rgb;./src/atomic;./src/audio/disk; -.c: ./src/haptic/dummy;./src/joystick/dummy;./src/joystick/virtual;./src/audio/dummy;./src/video/dummy;./src/sensor/dummy; -.c: ./src/core/windows;./src/audio/winmm;./src/audio/directsound;./src/audio/wasapi;./src/loadso/windows;./src/filesystem/windows;./src/haptic/windows;./src/joystick/windows;./src/sensor/windows;./src/thread/windows;./src/timer/windows;./src/video/windows; -.c: ./src/locale/;./src/locale/windows;./src/misc;./src/misc/windows;./src/power/windows;./src/joystick/hidapi;./src/hidapi;./src/render/direct3d;./src/render/direct3d11;./src/render/direct3d12;./src/render/opengl;./src/render/opengles2 -.rc: ./src/main/windows - -all: $(DLLFILE) $(LIBFILE) $(TLIB) .symbolic - -build_dll: .symbolic - @echo * Compiling dll objects - -$(DLLFILE): build_dll $(OBJS) $(LIBM) $(RCOBJS) $(LNKFILE) - @echo * Linking: $@ - wlink @$(LNKFILE) - -$(LIBFILE): $(DLLFILE) - @echo * Creating LIB file: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $* @$(EXPFILE) - -.c.obj: - wcc386 $(CFLAGS_DLL) -fo=$^@ $< - -.rc.res: - wrc $(RCFLAGS) -fo=$^@ $< - -SDL_syscond.obj: "src/thread/generic/SDL_syscond.c" - wcc386 $(CFLAGS_DLL) -fo=$^@ $< -SDL_cpuinfo.obj: SDL_cpuinfo.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_wave.obj: SDL_wave.c - wcc386 $(CFLAGS_DLL) -wcd=124 -fo=$^@ $< -SDL_blendfillrect.obj: SDL_blendfillrect.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendline.obj: SDL_blendline.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_blendpoint.obj: SDL_blendpoint.c - wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< -SDL_RLEaccel.obj: SDL_RLEaccel.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< -SDL_malloc.obj: SDL_malloc.c - wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< - -# SDL2libm -MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & - k_cos.c k_rem_pio2.c k_sin.c k_tan.c & - s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c -MOBJS= $(MSRCS:.c=.obj) - -.c: ./src/libm; -e_atan2.obj: e_atan2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_exp.obj: e_exp.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_fmod.obj: e_fmod.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log10.obj: e_log10.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_log.obj: e_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_pow.obj: e_pow.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_rem_pio2.obj: e_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -e_sqrt.obj: e_sqrt.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_cos.obj: k_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_rem_pio2.obj: k_rem_pio2.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_sin.obj: k_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -k_tan.obj: k_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_atan.obj: s_atan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_copysign.obj: s_copysign.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_cos.obj: s_cos.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_fabs.obj: s_fabs.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_floor.obj: s_floor.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_scalbn.obj: s_scalbn.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_sin.obj: s_sin.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -s_tan.obj: s_tan.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_libm: .symbolic - @echo * Compiling libm objects -$(LIBM): build_libm $(MOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(MOBJS) - -# SDL2test -TSRCS = SDL_test_assert.c SDL_test_common.c SDL_test_compare.c & - SDL_test_crc32.c SDL_test_font.c SDL_test_fuzzer.c SDL_test_harness.c & - SDL_test_imageBlit.c SDL_test_imageBlitBlend.c SDL_test_imageFace.c & - SDL_test_imagePrimitives.c SDL_test_imagePrimitivesBlend.c & - SDL_test_log.c SDL_test_md5.c SDL_test_random.c SDL_test_memory.c -TOBJS= $(TSRCS:.c=.obj) - -.c: ./src/test; -SDL_test_assert.obj: SDL_test_assert.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_common.obj: SDL_test_common.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_compare.obj: SDL_test_compare.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_crc32.obj: SDL_test_crc32.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_font.obj: SDL_test_font.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_fuzzer.obj: SDL_test_fuzzer.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_harness.obj: SDL_test_harness.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlit.obj: SDL_test_imageBlit.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageBlitBlend.obj: SDL_test_imageBlitBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imageFace.obj: SDL_test_imageFace.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitives.obj: SDL_test_imagePrimitives.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_imagePrimitivesBlend.obj: SDL_test_imagePrimitivesBlend.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_log.obj: SDL_test_log.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_md5.obj: SDL_test_md5.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_random.obj: SDL_test_random.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< -SDL_test_memory.obj: SDL_test_memory.c - wcc386 $(CFLAGS_STATIC) -fo=$^@ $< - -build_tlib: .symbolic - @echo * Compiling testlib objects -$(TLIB): build_tlib $(TOBJS) - @echo * Creating: $@ - wlib -q -b -n -c -pa -s -t -zld -ii -io $@ $(TOBJS) - -$(LNKFILE): Makefile.w32 - @echo * Creating linker file: $@ - @%create $@ - @%append $@ SYSTEM nt_dll INITINSTANCE TERMINSTANCE - @%append $@ NAME $(DLLFILE) - @for %i in ($(OBJS)) do @%append $@ FILE %i - @for %i in ($(LIBS)) do @%append $@ LIB %i - @%append $@ OPTION RESOURCE=$(RCOBJS) - @%append $@ EXPORT=src/dynapi/SDL2.exports - @%append $@ OPTION QUIET - @%append $@ OPTION IMPF=$(EXPFILE) - @%append $@ OPTION MAP=$(LIBHOME)/$^&.map - @%append $@ OPTION ELIMINATE - @%append $@ OPTION SHOWDEAD - -clean: .SYMBOLIC - @echo * Clean: $(LIBNAME) - @if exist *.obj rm *.obj - @if exist *.res rm *.res - @if exist *.err rm *.err - @if exist $(LNKFILE) rm $(LNKFILE) - @if exist $(LIBM) rm $(LIBM) - -distclean: .SYMBOLIC clean - @if exist $(LIBHOME)/*.exp rm $(LIBHOME)/*.exp - @if exist $(LIBHOME)/*.map rm $(LIBHOME)/*.map - @if exist $(LIBFILE) rm $(LIBFILE) - @if exist $(DLLFILE) rm $(DLLFILE) - @if exist $(TLIB) rm $(TLIB) diff --git a/README.md b/README.md index fa7f7ba0b5..fac8663cb5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Simple DirectMedia Layer (SDL) Version 2.0 +# Simple DirectMedia Layer (SDL) Version 3.0 https://www.libsdl.org/ diff --git a/SDL2Config.cmake.in b/SDL2Config.cmake.in deleted file mode 100644 index 8c18aa5d44..0000000000 --- a/SDL2Config.cmake.in +++ /dev/null @@ -1,65 +0,0 @@ -# sdl2 cmake project-config input for CMakeLists.txt script - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -@PACKAGE_INIT@ - -set(SDL2_FOUND TRUE) - -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") - set(SDL2_SDL2_FOUND TRUE) -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") - if(ANDROID) - enable_language(CXX) - endif() - include("${CMAKE_CURRENT_LIST_DIR}/SDL2staticTargets.cmake") - set(SDL2_SDL2-static_FOUND TRUE) -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2mainTargets.cmake") - set(SDL2_SDL2main_FOUND TRUE) -endif() -if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/SDL2testTargets.cmake") - set(SDL2_SDL2test_FOUND TRUE) -endif() - -check_required_components(SDL2) - -# Create SDL2::SDL2 alias for static-only builds -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - if(CMAKE_VERSION VERSION_LESS "3.18") - # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static") - else() - add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) - endif() -endif() - -# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables. - -set(SDL2_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") -set(SDL2_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") -set(SDL2_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") -set(SDL2_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL2") -set(SDL2_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@") -set(SDL2_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@") -set(SDL2_LIBRARIES SDL2::SDL2) -set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) -set(SDL2_STATIC_PRIVATE_LIBS) - -set(SDL2MAIN_LIBRARY) -if(TARGET SDL2::SDL2main) - set(SDL2MAIN_LIBRARY SDL2::SDL2main) - list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) - list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) -endif() - -set(SDL2TEST_LIBRARY SDL2::SDL2test) \ No newline at end of file diff --git a/SDL2.spec.in b/SDL3.spec.in similarity index 97% rename from SDL2.spec.in rename to SDL3.spec.in index 812d2d861a..533af702cb 100644 --- a/SDL2.spec.in +++ b/SDL3.spec.in @@ -1,5 +1,5 @@ Summary: Simple DirectMedia Layer -Name: SDL2 +Name: SDL3 Version: @SDL_VERSION@ Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz @@ -9,7 +9,7 @@ Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot Prefix: %{_prefix} %ifos linux -Provides: libSDL2-2.0.so.0 +Provides: libSDL3-3.0.so.0 %endif %define __defattr %defattr(-,root,root) @@ -75,7 +75,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/lib*.%{__soext} %{_includedir}/*/*.h %{_libdir}/cmake/* -%{_libdir}/pkgconfig/SDL2/* +%{_libdir}/pkgconfig/SDL3/* %{_datadir}/aclocal/* %changelog diff --git a/SDL3Config.cmake.in b/SDL3Config.cmake.in new file mode 100644 index 0000000000..52dcfb1982 --- /dev/null +++ b/SDL3Config.cmake.in @@ -0,0 +1,65 @@ +# SDL cmake project-config input for CMakeLists.txt script + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +@PACKAGE_INIT@ + +set(SDL3_FOUND TRUE) + +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL3Targets.cmake") + set(SDL3_SDL3_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake") + if(ANDROID) + enable_language(CXX) + endif() + include("${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake") + set(SDL3_SDL3-static_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3mainTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL3mainTargets.cmake") + set(SDL3_SDL3main_FOUND TRUE) +endif() +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake") + set(SDL3_SDL3test_FOUND TRUE) +endif() + +check_required_components(SDL3) + +# Create SDL3::SDL3 alias for static-only builds +if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3) + if(CMAKE_VERSION VERSION_LESS "3.18") + # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. + add_library(SDL3::SDL3 INTERFACE IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL3::SDL3-static") + else() + add_library(SDL3::SDL3 ALIAS SDL3::SDL3-static) + endif() +endif() + +# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables. + +set(SDL3_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") +set(SDL3_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@") +set(SDL3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL3") +set(SDL3_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL3") +set(SDL3_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@") +set(SDL3_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@") +set(SDL3_LIBRARIES SDL3::SDL3) +set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static) +set(SDL3_STATIC_PRIVATE_LIBS) + +set(SDL3MAIN_LIBRARY) +if(TARGET SDL3::SDL3main) + set(SDL3MAIN_LIBRARY SDL3::SDL3main) + list(INSERT SDL3_LIBRARIES 0 SDL3::SDL3main) + list(INSERT SDL3_STATIC_LIBRARIES 0 SDL3::SDL3main) +endif() + +set(SDL3TEST_LIBRARY SDL3::SDL3test) diff --git a/VisualC-GDK/SDL.sln b/VisualC-GDK/SDL.sln index 2584219500..827c9ff4bd 100644 --- a/VisualC-GDK/SDL.sln +++ b/VisualC-GDK/SDL.sln @@ -4,13 +4,13 @@ VisualStudioVersion = 17.1.32414.318 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D69D5741-611F-4E14-8541-1FEE94F50B5A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}" EndProject diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index e3966e693d..14b2d37c19 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -27,7 +27,7 @@ - SDL2 + SDL3 {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} SDL 10.0 @@ -378,7 +378,6 @@ - @@ -534,7 +533,6 @@ - @@ -600,6 +598,7 @@ + diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index 0c02e07965..aee609a4cb 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -76,9 +76,6 @@ {4c8ad943-c2fb-4014-9ca3-041e0ad08426} - - {e90fa293-2828-4927-8113-35bf561024a9} - {3d68ae70-a9ff-46cf-be69-069f0b02aca0} @@ -534,9 +531,6 @@ audio\dummy - - audio\winmm - audio\wasapi @@ -1027,9 +1021,6 @@ audio\dummy - - audio\winmm - audio\wasapi @@ -1078,6 +1069,9 @@ joystick\hidapi + + joystick\hidapi + joystick\hidapi diff --git a/VisualC-GDK/SDLmain/SDLmain.vcxproj b/VisualC-GDK/SDLmain/SDLmain.vcxproj index a2c05b1c39..df88a77417 100644 --- a/VisualC-GDK/SDLmain/SDLmain.vcxproj +++ b/VisualC-GDK/SDLmain/SDLmain.vcxproj @@ -30,7 +30,7 @@ - SDL2main + SDL3main {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} SDLmain 10.0 @@ -208,4 +208,4 @@ - \ No newline at end of file + diff --git a/VisualC-GDK/SDLtest/SDLtest.vcxproj b/VisualC-GDK/SDLtest/SDLtest.vcxproj index c2e9348c3e..9ed131a382 100644 --- a/VisualC-GDK/SDLtest/SDLtest.vcxproj +++ b/VisualC-GDK/SDLtest/SDLtest.vcxproj @@ -27,7 +27,7 @@ - SDL2test + SDL3test {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} SDLtest 10.0 @@ -223,4 +223,4 @@ - \ No newline at end of file + diff --git a/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config b/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config index 6a9ea2bf82..eb4ec4e171 100644 --- a/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config +++ b/VisualC-GDK/tests/testgamecontroller/wingdk/MicrosoftGame.config @@ -2,9 +2,9 @@ - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - - - - - - - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF - + Publisher="CN=Publisher"/> - 7325F784 - 0000000000000000 + PleaseChangeMe + FFFFFFFF + + Debug + ARM64 + Debug ARM @@ -17,6 +21,10 @@ Release ARM + + Release + ARM64 + Release Win32 @@ -190,38 +198,18 @@ - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true @@ -236,12 +224,7 @@ - true - true - true - true - true - true + true @@ -264,23 +247,13 @@ - true - true - true - true - true - true + true - true - true - true - true - true - true + true @@ -348,76 +321,36 @@ - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true - true - true - true - true - true - true + true {89e9b32e-a86a-47c3-a948-d2b1622925ce} DynamicLibrary - SDL2-UWP - SDL2 + SDL3-UWP + SDL3 en-US 14.0 true @@ -438,6 +371,11 @@ true v142 + + DynamicLibrary + true + v142 + DynamicLibrary true @@ -455,6 +393,12 @@ true v142 + + DynamicLibrary + false + true + v142 + DynamicLibrary false @@ -478,6 +422,12 @@ + + + + + + @@ -489,32 +439,42 @@ false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 + + + false + false + SDL3 + + + false + false + SDL3 false false - SDL2 + SDL3 false false - SDL2 + SDL3 @@ -572,6 +532,34 @@ /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + + NotUsing + false + ..\include;%(AdditionalIncludeDirectories) + DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) + + + + + NotUsing + false + ..\include;%(AdditionalIncludeDirectories) + DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) + + + Console + false + false + /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) + + NotUsing diff --git a/VisualC-WinRT/SDL-UWP.vcxproj.filters b/VisualC-WinRT/SDL-UWP.vcxproj.filters index d788502e14..6599cdabb0 100644 --- a/VisualC-WinRT/SDL-UWP.vcxproj.filters +++ b/VisualC-WinRT/SDL-UWP.vcxproj.filters @@ -842,5 +842,8 @@ Source Files + + Source Files + - + \ No newline at end of file diff --git a/VisualC/SDL.sln b/VisualC/SDL.sln index 87b2cf5207..ebb836d473 100644 --- a/VisualC/SDL.sln +++ b/VisualC/SDL.sln @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D69D5741-611F-4E14-8541-1FEE94F50B5A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3", "SDL\SDL.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3main", "SDLmain\SDLmain.vcxproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "checkkeys", "tests\checkkeys\checkkeys.vcxproj", "{26828762-C95D-4637-9CB1-7F0979523813}" EndProject @@ -40,7 +40,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testshape", "tests\testshap EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsprite2", "tests\testsprite2\testsprite2.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C96635682}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL2test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3test", "SDLtest\SDLtest.vcxproj", "{DA956FD3-E143-46F2-9FE5-C77BEBC56B1A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testgamecontroller", "tests\testgamecontroller\testgamecontroller.vcxproj", "{55812185-D13C-4022-9C81-32E0F4A08305}" EndProject diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index e3b66d1cb1..40eed8f142 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -19,7 +19,7 @@ - SDL2 + SDL3 {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} SDL 10.0 @@ -302,7 +302,6 @@ - @@ -452,7 +451,6 @@ - @@ -491,6 +489,7 @@ + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index 7ab2f05ab4..b87cc866bf 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -76,9 +76,6 @@ {4c8ad943-c2fb-4014-9ca3-041e0ad08426} - - {e90fa293-2828-4927-8113-35bf561024a9} - {3d68ae70-a9ff-46cf-be69-069f0b02aca0} @@ -495,9 +492,6 @@ haptic - - hidapi - joystick @@ -537,9 +531,6 @@ audio\dummy - - audio\winmm - audio\wasapi @@ -832,6 +823,7 @@ render\direct3d12 + @@ -1020,9 +1012,6 @@ audio\dummy - - audio\winmm - audio\wasapi @@ -1071,6 +1060,9 @@ joystick\hidapi + + joystick\hidapi + joystick\hidapi @@ -1354,6 +1346,7 @@ render\direct3d12 + diff --git a/VisualC/SDLmain/SDLmain.vcxproj b/VisualC/SDLmain/SDLmain.vcxproj index ad63dc6c61..6da048b699 100644 --- a/VisualC/SDLmain/SDLmain.vcxproj +++ b/VisualC/SDLmain/SDLmain.vcxproj @@ -19,7 +19,7 @@ - SDL2main + SDL3main {DA956FD3-E142-46F2-9DD5-C78BEBB56B7A} SDLmain 10.0 diff --git a/VisualC/SDLtest/SDLtest.vcxproj b/VisualC/SDLtest/SDLtest.vcxproj index 042baf1314..3faca9916e 100644 --- a/VisualC/SDLtest/SDLtest.vcxproj +++ b/VisualC/SDLtest/SDLtest.vcxproj @@ -19,7 +19,7 @@ - SDL2test + SDL3test {DA956FD3-E143-46F2-9FE5-C77BEBC56B1A} SDLtest 10.0 diff --git a/VisualC/pkg-support/cmake/sdl2-config.cmake b/VisualC/pkg-support/cmake/sdl2-config.cmake deleted file mode 100644 index 1a25259c0e..0000000000 --- a/VisualC/pkg-support/cmake/sdl2-config.cmake +++ /dev/null @@ -1,111 +0,0 @@ -# SDL2 CMake configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC - -cmake_minimum_required(VERSION 3.0) - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -# Copied from `configure_package_config_file` -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -set(SDL2_FOUND TRUE) - -if(CMAKE_SIZEOF_VOID_P STREQUAL "4") - set(_sdl_arch_subdir "x86") -elseif(CMAKE_SIZEOF_VOID_P STREQUAL "8") - set(_sdl_arch_subdir "x64") -else() - set(SDL2_FOUND FALSE) - return() -endif() - -# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables. - -set_and_check(SDL2_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") -set_and_check(SDL2_EXEC_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") -set_and_check(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include") -set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}") -set_and_check(SDL2_BINDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}") -set_and_check(SDL2_LIBDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}") - -set(SDL2_LIBRARIES SDL2::SDL2main SDL2::SDL2) -set(SDL2MAIN_LIBRARY SDL2::SDL2main) -set(SDL2TEST_LIBRARY SDL2::SDL2test) - - -# All targets are created, even when some might not be requested though COMPONENTS. -# This is done for compatibility with CMake generated SDL2-target.cmake files. - -set(_sdl2_library "${SDL2_LIBDIR}/SDL2.lib") -set(_sdl2_dll_library "${SDL2_BINDIR}/SDL2.dll") -if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_IMPLIB "${_sdl2_library}" - IMPORTED_LOCATION "${_sdl2_dll_library}" - COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" - INTERFACE_SDL2_SHARED "ON" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) -else() - set(SDL2_SDL2_FOUND FALSE) -endif() -unset(_sdl2_library) -unset(_sdl2_dll_library) - -set(_sdl2main_library "${SDL2_LIBDIR}/SDL2main.lib") -if(EXISTS "${_sdl2main_library}") - if(NOT TARGET SDL2::SDL2main) - add_library(SDL2::SDL2main STATIC IMPORTED) - set_target_properties(SDL2::SDL2main - PROPERTIES - IMPORTED_LOCATION "${_sdl2main_library}" - ) - endif() - set(SDL2_SDL2main_FOUND TRUE) -else() - set(SDL2_SDL2_FOUND FALSE) -endif() -unset(_sdl2main_library) - -set(_sdl2test_library "${SDL2_LIBDIR}/SDL2test.lib") -if(EXISTS "${_sdl2test_library}") - if(NOT TARGET SDL2::SDL2test) - add_library(SDL2::SDL2test STATIC IMPORTED) - set_target_properties(SDL2::SDL2test - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" - IMPORTED_LOCATION "${_sdl2test_library}" - ) - endif() - set(SDL2_SDL2test_FOUND TRUE) -else() - set(SDL2_SDL2_FOUND FALSE) -endif() -unset(_sdl2test_library) - -check_required_components(SDL2) diff --git a/VisualC/pkg-support/cmake/sdl2-config-version.cmake b/VisualC/pkg-support/cmake/sdl3-config-version.cmake similarity index 92% rename from VisualC/pkg-support/cmake/sdl2-config-version.cmake rename to VisualC/pkg-support/cmake/sdl3-config-version.cmake index 42bb6e7431..500e88fdbf 100644 --- a/VisualC/pkg-support/cmake/sdl2-config-version.cmake +++ b/VisualC/pkg-support/cmake/sdl3-config-version.cmake @@ -1,10 +1,10 @@ # based on the files generated by CMake's write_basic_package_version_file -# SDL2 CMake version configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC +# SDL CMake version configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h") - message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the root of SDL2-devel-2.x.y-VC") + message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the root of SDL3-devel-3.x.y-VC") return() endif() diff --git a/VisualC/pkg-support/cmake/sdl3-config.cmake b/VisualC/pkg-support/cmake/sdl3-config.cmake new file mode 100644 index 0000000000..c35d6b873d --- /dev/null +++ b/VisualC/pkg-support/cmake/sdl3-config.cmake @@ -0,0 +1,111 @@ +# SDL CMake configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC + +cmake_minimum_required(VERSION 3.0) + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +set(SDL3_FOUND TRUE) + +if(CMAKE_SIZEOF_VOID_P STREQUAL "4") + set(_sdl_arch_subdir "x86") +elseif(CMAKE_SIZEOF_VOID_P STREQUAL "8") + set(_sdl_arch_subdir "x64") +else() + set(SDL3_FOUND FALSE) + return() +endif() + +# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables. + +set_and_check(SDL3_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") +set_and_check(SDL3_EXEC_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..") +set_and_check(SDL3_INCLUDE_DIR "${SDL3_PREFIX}/include") +set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR}") +set_and_check(SDL3_BINDIR "${SDL3_PREFIX}/lib/${_sdl_arch_subdir}") +set_and_check(SDL3_LIBDIR "${SDL3_PREFIX}/lib/${_sdl_arch_subdir}") + +set(SDL3_LIBRARIES SDL3::SDL3main SDL3::SDL3) +set(SDL3MAIN_LIBRARY SDL3::SDL3main) +set(SDL3TEST_LIBRARY SDL3::SDL3test) + + +# All targets are created, even when some might not be requested though COMPONENTS. +# This is done for compatibility with CMake generated SDL3-target.cmake files. + +set(_sdl3_library "${SDL3_LIBDIR}/SDL3.lib") +set(_sdl3_dll_library "${SDL3_BINDIR}/SDL3.dll") +if(EXISTS "${_sdl3_library}" AND EXISTS "${_sdl3_dll_library}") + if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 SHARED IMPORTED) + set_target_properties(SDL3::SDL3 + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}" + IMPORTED_IMPLIB "${_sdl3_library}" + IMPORTED_LOCATION "${_sdl3_dll_library}" + COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" + INTERFACE_SDL3_SHARED "ON" + ) + endif() + set(SDL3_SDL3_FOUND TRUE) +else() + set(SDL3_SDL3_FOUND FALSE) +endif() +unset(_sdl3_library) +unset(_sdl3_dll_library) + +set(_sdl3main_library "${SDL3_LIBDIR}/SDL3main.lib") +if(EXISTS "${_sdl3main_library}") + if(NOT TARGET SDL3::SDL3main) + add_library(SDL3::SDL3main STATIC IMPORTED) + set_target_properties(SDL3::SDL3main + PROPERTIES + IMPORTED_LOCATION "${_sdl3main_library}" + ) + endif() + set(SDL3_SDL3main_FOUND TRUE) +else() + set(SDL3_SDL3_FOUND FALSE) +endif() +unset(_sdl3main_library) + +set(_sdl3test_library "${SDL3_LIBDIR}/SDL3test.lib") +if(EXISTS "${_sdl3test_library}") + if(NOT TARGET SDL3::SDL3test) + add_library(SDL3::SDL3test STATIC IMPORTED) + set_target_properties(SDL3::SDL3test + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}" + IMPORTED_LOCATION "${_sdl3test_library}" + ) + endif() + set(SDL3_SDL3test_FOUND TRUE) +else() + set(SDL3_SDL3_FOUND FALSE) +endif() +unset(_sdl3test_library) + +check_required_components(SDL3) diff --git a/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj b/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj deleted file mode 100644 index 37fa03927c..0000000000 --- a/VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj +++ /dev/null @@ -1,217 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - testquit - testquit - {1D12C737-7C71-45CE-AE2C-AAB47B690BC8} - 10.0 - - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - MultiByte - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - false - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - true - true - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - OnlyExplicitInline - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - - - OnlyExplicitInline - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - EditAndContinue - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - false - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - false - - - - - - - - {da956fd3-e142-46f2-9dd5-c78bebb56b7a} - - - {da956fd3-e143-46f2-9fe5-c77bebc56b1a} - - - {81ce8daf-ebb2-4761-8e45-b71abcca8c68} - - - - - - \ No newline at end of file diff --git a/VisualC/visualtest/visualtest_VS2012.vcxproj b/VisualC/visualtest/visualtest_VS2012.vcxproj deleted file mode 100644 index 6ad5b619d1..0000000000 --- a/VisualC/visualtest/visualtest_VS2012.vcxproj +++ /dev/null @@ -1,308 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - visualtest - visualtest - {13DDF23A-4A8F-4AF9-9734-CC09D9157924} - 10.0 - - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - MultiByte - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - Application - false - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - false - false - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(SolutionDir)\$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - true - true - - - testharness - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - OnlyExplicitInline - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - - - OnlyExplicitInline - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - - - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - Windows - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - - - Disabled - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - EditAndContinue - Default - false - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - - - Disabled - ..\..\include;..\..\visualtest\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - true - true - Windows - false - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;shlwapi.lib;%(AdditionalDependencies) - - - copy "$(SolutionDir)..\test\icon.bmp" "$(ProjectDir)icon.bmp" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testsprite2.exe" "$(ProjectDir)" -copy "$(SolutionDir)\$(Platform)\$(Configuration)\testquit.exe" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\*.actions" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.config" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.parameters" "$(ProjectDir)" -copy /y "$(SolutionDir)..\visualtest\unittest\*.actions" "$(ProjectDir)" - - - Copy data files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {da956fd3-e142-46f2-9dd5-c78bebb56b7a} - - - {da956fd3-e143-46f2-9fe5-c77bebc56b1a} - - - {81ce8daf-ebb2-4761-8e45-b71abcca8c68} - - - - - - \ No newline at end of file diff --git a/WhatsNew.txt b/WhatsNew.txt index 0318b90de0..1f95f05925 100644 --- a/WhatsNew.txt +++ b/WhatsNew.txt @@ -6,9 +6,40 @@ This is a list of major changes in SDL's version history. --------------------------------------------------------------------------- General: +* Updated OpenGL headers to the latest API from The Khronos Group Inc. +* Added SDL_GetWindowSizeInPixels() to get the window size in pixels, which may differ from the window coordinate size for windows with high-DPI support +* Added simulated vsync synchronization for the software renderer +* Added the mouse position to SDL_MouseWheelEvent +* Added SDL_ResetHints() to reset all hints to their default values * Added SDL_GetJoystickGUIDInfo() to get device information encoded in a joystick GUID -* Added support for Nintendo Wii controllers to the HIDAPI driver, and a hint SDL_HINT_JOYSTICK_HIDAPI_WII to control whether this is used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360 to control whether the HIDAPI driver for XBox 360 controllers should be used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED to control whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS to control whether the HIDAPI driver for XBox 360 wireless controllers should be used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE to control whether the HIDAPI driver for XBox One controllers should be used +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED to control the brightness of the XBox One guide button LED +* Added support for PS3 controllers to the HIDAPI driver, enabled by default on macOS, controlled by the SDL_HINT_JOYSTICK_HIDAPI_PS3 hint +* Added support for Nintendo Wii controllers to the HIDAPI driver, not enabled by default, controlled by the SDL_HINT_JOYSTICK_HIDAPI_WII hint * Added the hint SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED to control whether the player LED should be lit on the Nintendo Wii controllers +* Added the hint SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS to control whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver +* Added access to the individual left and right gyro sensors of the combined Joy-Cons controller +* Added a microsecond timestamp to SDL_SensorEvent and SDL_ControllerSensorEvent, when the hardware provides that information +* Added SDL_SensorGetDataWithTimestamp() and SDL_GameControllerGetSensorDataWithTimestamp() to retrieve the last sensor data with the associated microsecond timestamp +* Added the hint SDL_HINT_HIDAPI_IGNORE_DEVICES to have the SDL HID API ignore specific devices +* SDL_GetRevision() now includes more information about the SDL build, including the git commit hash if available + +Windows: +* Added the hint SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE to control whether the system mouse acceleration curve is used for relative mouse motion + +macOS: +* Implemented vsync synchronization on macOS 12 + +Linux: +* Added SDL_SetPrimarySelectionText(), SDL_GetPrimarySelectionText(), and SDL_HasPrimarySelectionText() to interact with the X11 primary selection clipboard +* Added the hint SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP to control whether mouse pointer warp emulation is enabled under Wayland + +Android: +* Enabled IME soft keyboard input +* Added version checking to make sure the SDL Java and C code are compatible --------------------------------------------------------------------------- diff --git a/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj b/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj index 8fc664b8ca..0104d6e0b4 100644 --- a/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj +++ b/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj @@ -7,14 +7,14 @@ objects = { /* Begin PBXBuildFile section */ - F3A497102555EE4800E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A4972F2555EE8A00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A497422555EEBE00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A497442555EECD00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A497462555EEDF00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A4959B2555ED0500E92A8B /* libSDL2.a */; }; - F3A497492555EF0B00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A4974B2555EF1B00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; - F3A4974E2555EF9F00E92A8B /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL2.a */; }; + F3A497102555EE4800E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A4972F2555EE8A00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A497422555EEBE00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A497442555EECD00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A497462555EEDF00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A4959B2555ED0500E92A8B /* libSDL3.a */; }; + F3A497492555EF0B00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A4974B2555EF1B00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; + F3A4974E2555EF9F00E92A8B /* libSDL3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3A495992555ED0500E92A8B /* libSDL3.a */; }; FA30DEB01BBF5A8F009C397F /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0060E26BC0500F39101 /* common.c */; }; FA30DEB11BBF5A93009C397F /* happy.c in Sources */ = {isa = PBXBuildFile; fileRef = FD77A0080E26BC0500F39101 /* happy.c */; }; FA30DEB31BBF5AD7009C397F /* icon.bmp in Resources */ = {isa = PBXBuildFile; fileRef = FDB651CC0E43D19800F688B5 /* icon.bmp */; }; @@ -188,7 +188,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497102555EE4800E92A8B /* libSDL2.a in Frameworks */, + F3A497102555EE4800E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -196,7 +196,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497462555EEDF00E92A8B /* libSDL2.a in Frameworks */, + F3A497462555EEDF00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -204,7 +204,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497442555EECD00E92A8B /* libSDL2.a in Frameworks */, + F3A497442555EECD00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -212,7 +212,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A4972F2555EE8A00E92A8B /* libSDL2.a in Frameworks */, + F3A4972F2555EE8A00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -220,7 +220,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497492555EF0B00E92A8B /* libSDL2.a in Frameworks */, + F3A497492555EF0B00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -228,7 +228,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A4974E2555EF9F00E92A8B /* libSDL2.a in Frameworks */, + F3A4974E2555EF9F00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -236,7 +236,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A497422555EEBE00E92A8B /* libSDL2.a in Frameworks */, + F3A497422555EEBE00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -244,7 +244,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F3A4974B2555EF1B00E92A8B /* libSDL2.a in Frameworks */, + F3A4974B2555EF1B00E92A8B /* libSDL3.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -292,17 +292,17 @@ F3A495812555ED0400E92A8B /* Products */ = { isa = PBXGroup; children = ( - F3A495912555ED0500E92A8B /* SDL2.framework */, - F3A495932555ED0500E92A8B /* SDL2.framework */, - F3A495952555ED0500E92A8B /* SDL2.framework */, - F3C17D9228E4355900E1A26D /* SDL2.framework */, - F3A495972555ED0500E92A8B /* libSDL2.a */, - F3A495992555ED0500E92A8B /* libSDL2.a */, - F3A4959B2555ED0500E92A8B /* libSDL2.a */, - F3A4959D2555ED0500E92A8B /* libSDL2.dylib */, - F3A4959F2555ED0500E92A8B /* libSDL2.dylib */, - F3A495A12555ED0500E92A8B /* libSDL2.dylib */, - F3A495A32555ED0500E92A8B /* SDL2 */, + F3A495912555ED0500E92A8B /* SDL3.framework */, + F3A495932555ED0500E92A8B /* SDL3.framework */, + F3A495952555ED0500E92A8B /* SDL3.framework */, + F3C17D9228E4355900E1A26D /* SDL3.framework */, + F3A495972555ED0500E92A8B /* libSDL3.a */, + F3A495992555ED0500E92A8B /* libSDL3.a */, + F3A4959B2555ED0500E92A8B /* libSDL3.a */, + F3A4959D2555ED0500E92A8B /* libSDL3.dylib */, + F3A4959F2555ED0500E92A8B /* libSDL3.dylib */, + F3A495A12555ED0500E92A8B /* libSDL3.dylib */, + F3A495A32555ED0500E92A8B /* SDL3 */, ); name = Products; sourceTree = ""; @@ -565,80 +565,80 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - F3A495912555ED0500E92A8B /* SDL2.framework */ = { + F3A495912555ED0500E92A8B /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3A495902555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495932555ED0500E92A8B /* SDL2.framework */ = { + F3A495932555ED0500E92A8B /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3A495922555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495952555ED0500E92A8B /* SDL2.framework */ = { + F3A495952555ED0500E92A8B /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3A495942555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495972555ED0500E92A8B /* libSDL2.a */ = { + F3A495972555ED0500E92A8B /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3A495962555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495992555ED0500E92A8B /* libSDL2.a */ = { + F3A495992555ED0500E92A8B /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3A495982555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A4959B2555ED0500E92A8B /* libSDL2.a */ = { + F3A4959B2555ED0500E92A8B /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3A4959A2555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A4959D2555ED0500E92A8B /* libSDL2.dylib */ = { + F3A4959D2555ED0500E92A8B /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3A4959C2555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A4959F2555ED0500E92A8B /* libSDL2.dylib */ = { + F3A4959F2555ED0500E92A8B /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3A4959E2555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495A12555ED0500E92A8B /* libSDL2.dylib */ = { + F3A495A12555ED0500E92A8B /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3A495A02555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3A495A32555ED0500E92A8B /* SDL2 */ = { + F3A495A32555ED0500E92A8B /* SDL3 */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.executable"; - path = SDL2; + path = SDL3; remoteRef = F3A495A22555ED0500E92A8B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17D9228E4355900E1A26D /* SDL2.framework */ = { + F3C17D9228E4355900E1A26D /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3C17D9128E4355900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; diff --git a/Xcode-iOS/Demos/README b/Xcode-iOS/Demos/README index da6fb74908..d0f4ea179a 100644 --- a/Xcode-iOS/Demos/README +++ b/Xcode-iOS/Demos/README @@ -2,7 +2,7 @@ About the iPhone OS Demo Applications ============================================================================== -Demos.xcodeproj contains several targets for iPhone oriented SDL demos. These demos are written strictly using SDL 2.0 calls. All the demos except for Fireworks (which requires OpenGL ES) should work on platforms other than iPhone OS, though you'll need to write your own compile script. +Demos.xcodeproj contains several targets for iPhone oriented SDL demos. These demos are written strictly using SDL 3.0 calls. All the demos except for Fireworks (which requires OpenGL ES) should work on platforms other than iPhone OS, though you'll need to write your own compile script. Common files: diff --git a/Xcode-iOS/Demos/config.xcconfig b/Xcode-iOS/Demos/config.xcconfig index a73eec4d7e..5b7da52714 100644 --- a/Xcode-iOS/Demos/config.xcconfig +++ b/Xcode-iOS/Demos/config.xcconfig @@ -9,6 +9,6 @@ // Include any optional config for this build #include? "build.xcconfig" -CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL2 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal -CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit -CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit +CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL3 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal +CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit +CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit diff --git a/Xcode-iOS/Demos/src/accelerometer.c b/Xcode-iOS/Demos/src/accelerometer.c index 925aee4e3b..0af153676b 100644 --- a/Xcode-iOS/Demos/src/accelerometer.c +++ b/Xcode-iOS/Demos/src/accelerometer.c @@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer) /* create ship texture from surface */ ship = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (ship == 0) { + if (!ship) { fatalError("could not create ship texture"); } SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND); @@ -145,7 +145,7 @@ initializeTextures(SDL_Renderer *renderer) } /* create space texture from surface */ space = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (space == 0) { + if (!space) { fatalError("could not create space texture"); } SDL_FreeSurface(bmp_surface); diff --git a/Xcode-iOS/Demos/src/happy.c b/Xcode-iOS/Demos/src/happy.c index 658a65f01b..73d4d4feb3 100644 --- a/Xcode-iOS/Demos/src/happy.c +++ b/Xcode-iOS/Demos/src/happy.c @@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer) /* convert RGBA surface to texture */ texture = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (texture == 0) { + if (!texture) { fatalError("could not create texture"); } SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); diff --git a/Xcode-iOS/Demos/src/keyboard.c b/Xcode-iOS/Demos/src/keyboard.c index cfbe4e66b4..4d630bae5f 100644 --- a/Xcode-iOS/Demos/src/keyboard.c +++ b/Xcode-iOS/Demos/src/keyboard.c @@ -183,7 +183,7 @@ loadFont(void) SDL_BlitSurface(surface, NULL, converted, NULL); /* create our texture */ texture = SDL_CreateTextureFromSurface(renderer, converted); - if (texture == 0) { + if (!texture) { printf("texture creation failed: %s\n", SDL_GetError()); } else { /* set blend mode for our texture */ diff --git a/Xcode-iOS/Demos/src/rectangles.c b/Xcode-iOS/Demos/src/rectangles.c index 10f9f851b3..a08f997906 100644 --- a/Xcode-iOS/Demos/src/rectangles.c +++ b/Xcode-iOS/Demos/src/rectangles.c @@ -58,7 +58,7 @@ main(int argc, char *argv[]) /* create window and renderer */ window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI); - if (window == 0) { + if (!window) { fatalError("Could not initialize Window"); } renderer = SDL_CreateRenderer(window, -1, 0); diff --git a/Xcode-iOS/Demos/src/touch.c b/Xcode-iOS/Demos/src/touch.c index 918240b820..6c184630da 100644 --- a/Xcode-iOS/Demos/src/touch.c +++ b/Xcode-iOS/Demos/src/touch.c @@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer) brush = SDL_CreateTextureFromSurface(renderer, bmp_surface); SDL_FreeSurface(bmp_surface); - if (brush == 0) { + if (!brush) { fatalError("could not create brush texture"); } /* additive blending -- laying strokes on top of eachother makes them brighter */ diff --git a/Xcode/SDL/Info-Framework.plist b/Xcode/SDL/Info-Framework.plist index ada597b7dd..65acdef217 100644 --- a/Xcode/SDL/Info-Framework.plist +++ b/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.25.0 + 3.0.0 CFBundleSignature SDLX CFBundleVersion - 2.25.0 + 3.0.0 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 9c086f1ff2..40b04d63f1 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3393,6 +3393,9 @@ F323060528939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; }; F323060628939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; }; F323060728939F6400E66D30 /* SDL_hidapi_combined.c in Sources */ = {isa = PBXBuildFile; fileRef = F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */; }; + F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; + F34B9896291DEFF700AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; + F34B9897291DEFFA00AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; F3631C6424884ACF004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3631C652488534E004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F376F6192559B29300CFC0BC /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6182559B29300CFC0BC /* OpenGLES.framework */; platformFilter = ios; }; @@ -3701,8 +3704,8 @@ A1BB8B6227F6CF330057CFA8 /* SDL_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_list.h; sourceTree = ""; }; A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; - A75FCEB323E25AB700529352 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - A75FD06C23E25AC700529352 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + A75FCEB323E25AB700529352 /* libSDL3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL3.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + A75FD06C23E25AC700529352 /* libSDL3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL3.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; A75FDAA523E2792500529352 /* hid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = hid.m; sourceTree = ""; }; A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steam.c; sourceTree = ""; }; A75FDAB923E28A7A00529352 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; @@ -3720,11 +3723,11 @@ A75FDBA723E4CB6F00529352 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = ""; }; A75FDBC323EA380300529352 /* SDL_hidapi_rumble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_rumble.h; sourceTree = ""; }; A75FDBC423EA380300529352 /* SDL_hidapi_rumble.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_rumble.c; sourceTree = ""; }; - A769B23D23E259AE00872273 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; + A769B23D23E259AE00872273 /* libSDL3.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL3.a; sourceTree = BUILT_PRODUCTS_DIR; }; A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; - A7D88B5423E2437C00DCD162 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A7D88D1523E24BED00DCD162 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A7D88E5423E24D3B00DCD162 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; + A7D88B5423E2437C00DCD162 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A7D88D1523E24BED00DCD162 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A7D88E5423E24D3B00DCD162 /* libSDL3.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL3.a; sourceTree = BUILT_PRODUCTS_DIR; }; A7D8A57023E2513D00DCD162 /* SDL_dataqueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dataqueue.h; sourceTree = ""; }; A7D8A57123E2513D00DCD162 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL.c; sourceTree = ""; }; A7D8A57323E2513D00DCD162 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = ""; }; @@ -4095,11 +4098,11 @@ AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_khrplatform.h; sourceTree = ""; }; AADA5B8616CCAB3000107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = ""; }; BECDF66B0761BA81005FE872 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = ""; }; - BECDF66C0761BA81005FE872 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6B30761BA81005FE872 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6BE0761BA81005FE872 /* SDL2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDL2; sourceTree = BUILT_PRODUCTS_DIR; }; - DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - E2D187CF28A5673500D2B4F1 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BECDF66C0761BA81005FE872 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BECDF6B30761BA81005FE872 /* libSDL3.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL3.a; sourceTree = BUILT_PRODUCTS_DIR; }; + BECDF6BE0761BA81005FE872 /* SDL3 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDL3; sourceTree = BUILT_PRODUCTS_DIR; }; + DB31407717554B71006C0E22 /* libSDL3.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL3.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + E2D187CF28A5673500D2B4F1 /* SDL3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL3.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E2D187D228A5673500D2B4F1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; F31A92C628D4CB39003BFD6A /* SDL_offscreenopengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_offscreenopengles.h; sourceTree = ""; }; F31A92C728D4CB39003BFD6A /* SDL_offscreenopengles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_offscreenopengles.c; sourceTree = ""; }; @@ -4383,17 +4386,17 @@ 034768DDFF38A45A11DB9C8B /* Products */ = { isa = PBXGroup; children = ( - BECDF66C0761BA81005FE872 /* SDL2.framework */, - BECDF6B30761BA81005FE872 /* libSDL2.a */, - BECDF6BE0761BA81005FE872 /* SDL2 */, - DB31407717554B71006C0E22 /* libSDL2.dylib */, - A7D88B5423E2437C00DCD162 /* SDL2.framework */, - A7D88D1523E24BED00DCD162 /* SDL2.framework */, - A7D88E5423E24D3B00DCD162 /* libSDL2.a */, - A769B23D23E259AE00872273 /* libSDL2.a */, - A75FCEB323E25AB700529352 /* libSDL2.dylib */, - A75FD06C23E25AC700529352 /* libSDL2.dylib */, - E2D187CF28A5673500D2B4F1 /* SDL2.framework */, + BECDF66C0761BA81005FE872 /* SDL3.framework */, + BECDF6B30761BA81005FE872 /* libSDL3.a */, + BECDF6BE0761BA81005FE872 /* SDL3 */, + DB31407717554B71006C0E22 /* libSDL3.dylib */, + A7D88B5423E2437C00DCD162 /* SDL3.framework */, + A7D88D1523E24BED00DCD162 /* SDL3.framework */, + A7D88E5423E24D3B00DCD162 /* libSDL3.a */, + A769B23D23E259AE00872273 /* libSDL3.a */, + A75FCEB323E25AB700529352 /* libSDL3.dylib */, + A75FD06C23E25AC700529352 /* libSDL3.dylib */, + E2D187CF28A5673500D2B4F1 /* SDL3.framework */, ); name = Products; sourceTree = ""; @@ -4405,7 +4408,7 @@ F59C70FC00D5CB5801000001 /* pkg-support */, 0153844A006D81B07F000001 /* Public Headers */, 08FB77ACFE841707C02AAC07 /* Library Source */, - E2D187D028A5673500D2B4F1 /* SDL2 */, + E2D187D028A5673500D2B4F1 /* SDL3 */, 034768DDFF38A45A11DB9C8B /* Products */, BECDF66B0761BA81005FE872 /* Info-Framework.plist */, 564624341FF821B70074AC87 /* Frameworks */, @@ -5341,12 +5344,12 @@ path = events; sourceTree = ""; }; - E2D187D028A5673500D2B4F1 /* SDL2 */ = { + E2D187D028A5673500D2B4F1 /* SDL3 */ = { isa = PBXGroup; children = ( E2D187D228A5673500D2B4F1 /* Info.plist */, ); - path = SDL2; + path = SDL3; sourceTree = ""; }; F3ADAB8C2576F08500A6B1D9 /* ios */ = { @@ -7296,13 +7299,13 @@ ); buildRules = ( ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; + comments = "This produces libSDL3.dylib, which is the shared build of SDL."; dependencies = ( ); name = "Shared Library-iOS"; productInstallPath = /usr/local/lib; productName = "Shared Library"; - productReference = A75FCEB323E25AB700529352 /* libSDL2.dylib */; + productReference = A75FCEB323E25AB700529352 /* libSDL3.dylib */; productType = "com.apple.product-type.library.dynamic"; }; A75FCEB423E25AC700529352 /* Shared Library-tvOS */ = { @@ -7316,13 +7319,13 @@ ); buildRules = ( ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; + comments = "This produces libSDL3.dylib, which is the shared build of SDL."; dependencies = ( ); name = "Shared Library-tvOS"; productInstallPath = /usr/local/lib; productName = "Shared Library"; - productReference = A75FD06C23E25AC700529352 /* libSDL2.dylib */; + productReference = A75FD06C23E25AC700529352 /* libSDL3.dylib */; productType = "com.apple.product-type.library.dynamic"; }; A769B08223E259AE00872273 /* Static Library-tvOS */ = { @@ -7342,7 +7345,7 @@ name = "Static Library-tvOS"; productInstallPath = /usr/local/lib; productName = "Static Library"; - productReference = A769B23D23E259AE00872273 /* libSDL2.a */; + productReference = A769B23D23E259AE00872273 /* libSDL3.a */; productType = "com.apple.product-type.library.static"; }; A7D88A1423E2437C00DCD162 /* Framework-iOS */ = { @@ -7364,7 +7367,7 @@ name = "Framework-iOS"; productInstallPath = "@executable_path/../Frameworks"; productName = SDL; - productReference = A7D88B5423E2437C00DCD162 /* SDL2.framework */; + productReference = A7D88B5423E2437C00DCD162 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; A7D88BC923E24BED00DCD162 /* Framework-tvOS */ = { @@ -7386,7 +7389,7 @@ name = "Framework-tvOS"; productInstallPath = "@executable_path/../Frameworks"; productName = SDL; - productReference = A7D88D1523E24BED00DCD162 /* SDL2.framework */; + productReference = A7D88D1523E24BED00DCD162 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; A7D88D1723E24D3B00DCD162 /* Static Library-iOS */ = { @@ -7406,7 +7409,7 @@ name = "Static Library-iOS"; productInstallPath = /usr/local/lib; productName = "Static Library"; - productReference = A7D88E5423E24D3B00DCD162 /* libSDL2.a */; + productReference = A7D88E5423E24D3B00DCD162 /* libSDL3.a */; productType = "com.apple.product-type.library.static"; }; BECDF5FE0761BA81005FE872 /* Framework */ = { @@ -7428,7 +7431,7 @@ name = Framework; productInstallPath = "@executable_path/../Frameworks"; productName = SDL; - productReference = BECDF66C0761BA81005FE872 /* SDL2.framework */; + productReference = BECDF66C0761BA81005FE872 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; BECDF66D0761BA81005FE872 /* Static Library */ = { @@ -7448,7 +7451,7 @@ name = "Static Library"; productInstallPath = /usr/local/lib; productName = "Static Library"; - productReference = BECDF6B30761BA81005FE872 /* libSDL2.a */; + productReference = BECDF6B30761BA81005FE872 /* libSDL3.a */; productType = "com.apple.product-type.library.static"; }; BECDF6BB0761BA81005FE872 /* Standard DMG */ = { @@ -7465,7 +7468,7 @@ name = "Standard DMG"; productInstallPath = /usr/local/bin; productName = "Standard Package"; - productReference = BECDF6BE0761BA81005FE872 /* SDL2 */; + productReference = BECDF6BE0761BA81005FE872 /* SDL3 */; productType = "com.apple.product-type.tool"; }; DB313F7217554B71006C0E22 /* Shared Library */ = { @@ -7479,13 +7482,13 @@ ); buildRules = ( ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; + comments = "This produces libSDL3.dylib, which is the shared build of SDL."; dependencies = ( ); name = "Shared Library"; productInstallPath = /usr/local/lib; productName = "Shared Library"; - productReference = DB31407717554B71006C0E22 /* libSDL2.dylib */; + productReference = DB31407717554B71006C0E22 /* libSDL3.dylib */; productType = "com.apple.product-type.library.dynamic"; }; E2D187CE28A5673500D2B4F1 /* xcFramework-iOS */ = { @@ -7503,8 +7506,8 @@ dependencies = ( ); name = "xcFramework-iOS"; - productName = SDL2; - productReference = E2D187CF28A5673500D2B4F1 /* SDL2.framework */; + productName = SDL3; + productReference = E2D187CF28A5673500D2B4F1 /* SDL3.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -7642,7 +7645,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; + shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL3.framework/Versions/A || exit $?\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\ncp -a $TARGET_BUILD_DIR/SDL3.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n"; }; E2D187E728A5685000D2B4F1 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -7659,7 +7662,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Build an xcframework with both device and simulator files for all platforms.\n# Adapted from an answer in\n# https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022\n\nif [ \"$XCODE_VERSION_ACTUAL\" -lt 1100 ]\nthen\n\techo \"error: Building an xcframework requires Xcode 11 minimum.\"\n\texit 1\nfi\n\nSCHEME_NAME=\"Framework-iOS\"\nFRAMEWORK_NAME=\"SDL2\"\nPROJECT_NAME=\"SDL\"\n\nSIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive\"\nDEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive\"\n\nOUTPUT_DIR=\"./Products/\"\n\n# Simulator xcarchive (arm64, i386, x86_64)\nxcodebuild archive \\\n\tONLY_ACTIVE_ARCH=NO \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${SIMULATOR_ARCHIVE_PATH} \\\n\t-sdk iphonesimulator \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Device xcarchive (arm64, armv7)\nxcodebuild archive \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${DEVICE_ARCHIVE_PATH} \\\n\t-sdk iphoneos \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf \"${OUTPUT_DIR}${FRAMEWORK_NAME}.xcframework\"\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n\t-framework \"${DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-framework \"${SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-output ${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework\n\n# Ensure git doesn't pick up on our Products folder. \nrm -rf ${OUTPUT_DIR}/.gitignore\necho \"*\" >> ${OUTPUT_DIR}/.gitignore\n"; + shellScript = "# Build an xcframework with both device and simulator files for all platforms.\n# Adapted from an answer in\n# https://developer.apple.com/forums/thread/666335?answerId=685927022#685927022\n\nif [ \"$XCODE_VERSION_ACTUAL\" -lt 1100 ]\nthen\n\techo \"error: Building an xcframework requires Xcode 11 minimum.\"\n\texit 1\nfi\n\nSCHEME_NAME=\"Framework-iOS\"\nFRAMEWORK_NAME=\"SDL3\"\nPROJECT_NAME=\"SDL\"\n\nSIMULATOR_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphonesimulator.xcarchive\"\nDEVICE_ARCHIVE_PATH=\"${BUILD_DIR}/${CONFIGURATION}/${FRAMEWORK_NAME}-iphoneos.xcarchive\"\n\nOUTPUT_DIR=\"./Products/\"\n\n# Simulator xcarchive (arm64, i386, x86_64)\nxcodebuild archive \\\n\tONLY_ACTIVE_ARCH=NO \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${SIMULATOR_ARCHIVE_PATH} \\\n\t-sdk iphonesimulator \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Device xcarchive (arm64, armv7)\nxcodebuild archive \\\n\t-scheme ${SCHEME_NAME} \\\n\t-project \"${PROJECT_NAME}.xcodeproj\" \\\n\t-archivePath ${DEVICE_ARCHIVE_PATH} \\\n\t-sdk iphoneos \\\n\tBUILD_LIBRARY_FOR_DISTRIBUTION=YES \\\n\tSKIP_INSTALL=NO\n\n# Clean-up any existing instance of this xcframework from the Products directory\nrm -rf \"${OUTPUT_DIR}${FRAMEWORK_NAME}.xcframework\"\n\n# Create final xcframework\nxcodebuild -create-xcframework \\\n\t-framework \"${DEVICE_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-framework \"${SIMULATOR_ARCHIVE_PATH}\"/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework \\\n\t-output ${OUTPUT_DIR}/${FRAMEWORK_NAME}.xcframework\n\n# Ensure git doesn't pick up on our Products folder. \nrm -rf ${OUTPUT_DIR}/.gitignore\necho \"*\" >> ${OUTPUT_DIR}/.gitignore\n"; }; F3ED8106281DB8A500C33C5B /* Convert SDL includes to SDL Framework includes */ = { isa = PBXShellScriptBuildPhase; @@ -7677,7 +7680,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; }; F3ED8107281DB8E600C33C5B /* Convert SDL includes to SDL Framework includes */ = { isa = PBXShellScriptBuildPhase; @@ -7695,7 +7698,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; }; F3ED8108281DB8F200C33C5B /* Convert SDL includes to SDL Framework includes */ = { isa = PBXShellScriptBuildPhase; @@ -7713,7 +7716,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; + shellScript = "cd \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"\nsed -i '' -e 's,#include \"\\(.*\\)\",#include ,' *.h\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -8909,6 +8912,7 @@ A7D8BBD923E2574800DCD162 /* SDL_uikitmessagebox.m in Sources */, A7D8AD2923E2514100DCD162 /* SDL_vulkan_utils.c in Sources */, A7D8A95123E2514000DCD162 /* SDL_spinlock.c in Sources */, + F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */, A7D8BAAF23E2514400DCD162 /* s_atan.c in Sources */, A7D8B75223E2514300DCD162 /* SDL_sysloadso.c in Sources */, A7D8BBE123E2574800DCD162 /* SDL_uikitopenglview.m in Sources */, @@ -9103,6 +9107,7 @@ A7D8B41F23E2514300DCD162 /* SDL_systls.c in Sources */, A7D8AD2C23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */, A7D8A95423E2514000DCD162 /* SDL_spinlock.c in Sources */, + F34B9896291DEFF700AAC96E /* SDL_hidapi_steam.c in Sources */, A7D8BAB223E2514400DCD162 /* s_atan.c in Sources */, F3A490A12554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */, A7D8B75523E2514300DCD162 /* SDL_sysloadso.c in Sources */, @@ -9297,6 +9302,7 @@ A7D8AD2E23E2514100DCD162 /* SDL_vulkan_utils.c in Sources */, A7D8A95623E2514000DCD162 /* SDL_spinlock.c in Sources */, A7D8BAB423E2514400DCD162 /* s_atan.c in Sources */, + F34B9897291DEFFA00AAC96E /* SDL_hidapi_steam.c in Sources */, A7D8B75723E2514300DCD162 /* SDL_sysloadso.c in Sources */, F3A490A42554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */, A7D8B98B23E2514400DCD162 /* SDL_render_metal.m in Sources */, @@ -9522,8 +9528,8 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9553,8 +9559,8 @@ "@loader_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; + PRODUCT_NAME = SDL3; STRIP_STYLE = "non-global"; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -9564,7 +9570,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.0.17; + MARKETING_VERSION = 3.0.0; OTHER_LDFLAGS = "-liconv"; }; name = Release; @@ -9607,8 +9613,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9639,8 +9645,8 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = NO; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; + PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3; + PRODUCT_NAME = SDL3; STRIP_INSTALLED_PRODUCT = NO; TVOS_DEPLOYMENT_TARGET = 9.0; }; @@ -9650,7 +9656,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.0.17; + MARKETING_VERSION = 3.0.0; OTHER_LDFLAGS = "-liconv"; }; name = Debug; @@ -9856,8 +9862,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -9867,7 +9873,7 @@ ); GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = SDL2/Info.plist; + INFOPLIST_FILE = SDL3/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.1; LD_RUNPATH_SEARCH_PATHS = ( @@ -9879,7 +9885,7 @@ MTL_FAST_MATH = YES; OTHER_LDFLAGS = "-liconv"; PRODUCT_BUNDLE_IDENTIFIER = ""; - PRODUCT_NAME = SDL2; + PRODUCT_NAME = SDL3; SDKROOT = iphoneos; SKIP_INSTALL = NO; SUPPORTS_MACCATALYST = NO; @@ -9908,14 +9914,14 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2501.0.0; - DYLIB_CURRENT_VERSION = 2501.0.0; + DYLIB_COMPATIBILITY_VERSION = 1.0.0; + DYLIB_CURRENT_VERSION = 1.0.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - INFOPLIST_FILE = SDL2/Info.plist; + INFOPLIST_FILE = SDL3/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.1; LD_RUNPATH_SEARCH_PATHS = ( @@ -9927,7 +9933,7 @@ MTL_FAST_MATH = YES; OTHER_LDFLAGS = "-liconv"; PRODUCT_BUNDLE_IDENTIFIER = ""; - PRODUCT_NAME = SDL2; + PRODUCT_NAME = SDL3; SDKROOT = iphoneos; SKIP_INSTALL = NO; SUPPORTS_MACCATALYST = NO; diff --git a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme index b797feacb8..9c01052f2a 100644 --- a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme +++ b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/Framework-iOS.xcscheme @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ diff --git a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme index 82b4643736..36ddd8e2ae 100644 --- a/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme +++ b/Xcode/SDL/SDL.xcodeproj/xcshareddata/xcschemes/xcFramework-iOS.xcscheme @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ diff --git a/Xcode/SDL/SDL2/Info.plist b/Xcode/SDL/SDL3/Info.plist similarity index 100% rename from Xcode/SDL/SDL2/Info.plist rename to Xcode/SDL/SDL3/Info.plist diff --git a/Xcode/SDL/pkg-support/SDL.info b/Xcode/SDL/pkg-support/SDL.info index f08facd234..c60abf3a3a 100644 --- a/Xcode/SDL/pkg-support/SDL.info +++ b/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 2.0.0 +Title SDL 3.0.0 Version 1 Description SDL Library for Mac OS X (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake deleted file mode 100644 index ca6bb3e923..0000000000 --- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config.cmake +++ /dev/null @@ -1,67 +0,0 @@ -# SDL2 CMake configuration file: -# This file is meant to be placed in Resources/CMake of a SDL2 framework - -# INTERFACE_LINK_OPTIONS needs CMake 3.12 -cmake_minimum_required(VERSION 3.12) - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -# Copied from `configure_package_config_file` -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -set(SDL2_FOUND TRUE) - -string(REGEX REPLACE "SDL2\\.framework.*" "SDL2.framework" SDL2_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}") -string(REGEX REPLACE "SDL2\\.framework.*" "" SDL2_FRAMEWORK_PARENT_PATH "${CMAKE_CURRENT_LIST_DIR}") - -# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables. - -set_and_check(SDL2_PREFIX "${SDL2_FRAMEWORK_PATH}") -set_and_check(SDL2_EXEC_PREFIX "${SDL2_FRAMEWORK_PATH}") -set_and_check(SDL2_INCLUDE_DIR "${SDL2_FRAMEWORK_PATH}/Headers") -set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}") -set_and_check(SDL2_BINDIR "${SDL2_FRAMEWORK_PATH}") -set_and_check(SDL2_LIBDIR "${SDL2_FRAMEWORK_PATH}") - -set(SDL2_LIBRARIES "SDL2::SDL2") - -# All targets are created, even when some might not be requested though COMPONENTS. -# This is done for compatibility with CMake generated SDL2-target.cmake files. - -if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 - PROPERTIES - INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\"" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL2_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL2" - COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED" - INTERFACE_SDL2_SHARED "ON" - ) - set(SDL2_SDL2_FOUND TRUE) -endif() - -add_library(SDL2::SDL2main INTERFACE IMPORTED) -set(SDL2_SDL2main_FOUND TRUE) - -check_required_components(SDL2) diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config-version.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config-version.cmake similarity index 94% rename from Xcode/SDL/pkg-support/resources/CMake/sdl2-config-version.cmake rename to Xcode/SDL/pkg-support/resources/CMake/sdl3-config-version.cmake index feea76e5f7..6dbcf12988 100644 --- a/Xcode/SDL/pkg-support/resources/CMake/sdl2-config-version.cmake +++ b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config-version.cmake @@ -1,10 +1,10 @@ # based on the files generated by CMake's write_basic_package_version_file -# SDL2 CMake version configuration file: -# This file is meant to be placed in Resources/CMake of a SDL2 framework +# SDL CMake version configuration file: +# This file is meant to be placed in Resources/CMake of a SDL3 framework if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h") - message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework") + message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL3.framework") return() endif() diff --git a/Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake new file mode 100644 index 0000000000..c62043a2e2 --- /dev/null +++ b/Xcode/SDL/pkg-support/resources/CMake/sdl3-config.cmake @@ -0,0 +1,69 @@ +# SDL CMake configuration file: +# This file is meant to be placed in Resources/CMake of a SDL3 framework + +# INTERFACE_LINK_OPTIONS needs CMake 3.12 +cmake_minimum_required(VERSION 3.12) + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +set(SDL3_FOUND TRUE) + +string(REGEX REPLACE "SDL3\\.framework.*" "SDL3.framework" SDL3_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}") +string(REGEX REPLACE "SDL3\\.framework.*" "" SDL3_FRAMEWORK_PARENT_PATH "${CMAKE_CURRENT_LIST_DIR}") + +# For compatibility with autotools sdl3-config.cmake, provide SDL3_* variables. + +set_and_check(SDL3_PREFIX "${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_EXEC_PREFIX "${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_INCLUDE_DIR "${SDL3_FRAMEWORK_PATH}/Headers") +set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR};${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_BINDIR "${SDL3_FRAMEWORK_PATH}") +set_and_check(SDL3_LIBDIR "${SDL3_FRAMEWORK_PATH}") + +set(SDL3_LIBRARIES "SDL3::SDL3") + +# All targets are created, even when some might not be requested though COMPONENTS. +# This is done for compatibility with CMake generated SDL3-target.cmake files. + +if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 INTERFACE IMPORTED) + set_target_properties(SDL3::SDL3 + PROPERTIES + INTERFACE_COMPILE_OPTIONS "SHELL:-F \"${SDL3_FRAMEWORK_PARENT_PATH}\"" + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIRS}" + INTERFACE_LINK_OPTIONS "SHELL:-F \"${SDL3_FRAMEWORK_PARENT_PATH}\";SHELL:-framework SDL3" + COMPATIBLE_INTERFACE_BOOL "SDL3_SHARED" + INTERFACE_SDL3_SHARED "ON" + ) +endif() +set(SDL3_SDL3_FOUND TRUE) + +if(NOT TARGET SDL3::SDL3main) + add_library(SDL3::SDL3main INTERFACE IMPORTED) +endif() +set(SDL3_SDL3main_FOUND TRUE) + +check_required_components(SDL3) diff --git a/Xcode/SDL/pkg-support/resources/ReadMe.txt b/Xcode/SDL/pkg-support/resources/ReadMe.txt index 9f495913c6..9e2976c601 100644 --- a/Xcode/SDL/pkg-support/resources/ReadMe.txt +++ b/Xcode/SDL/pkg-support/resources/ReadMe.txt @@ -15,20 +15,20 @@ contains both the SDL runtime component and development header files. To Install: -Copy the SDL2.framework to /Library/Frameworks +Copy the SDL3.framework to /Library/Frameworks You may alternatively install it in /Library/Frameworks if your access privileges are not high enough. Use in CMake projects: -SDL2.framework can be used in CMake projects using the following pattern: +SDL3.framework can be used in CMake projects using the following pattern: ``` -find_package(SDL2 REQUIRED COMPONENTS SDL2) +find_package(SDL3 REQUIRED COMPONENTS SDL3) add_executable(my_game ${MY_SOURCES}) -target_link_libraries(my_game PRIVATE SDL2::SDL2) +target_link_libraries(my_game PRIVATE SDL3::SDL3) ``` -If SDL2.framework is installed in a non-standard location, +If SDL3.framework is installed in a non-standard location, please refer to the following link for ways to configure CMake: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure diff --git a/Xcode/SDL/pkg-support/resources/SDL_DS_Store b/Xcode/SDL/pkg-support/resources/SDL_DS_Store index 5658d15e4f..99e0b237ae 100644 Binary files a/Xcode/SDL/pkg-support/resources/SDL_DS_Store and b/Xcode/SDL/pkg-support/resources/SDL_DS_Store differ diff --git a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index 1d5183a7da..051c920068 100644 --- a/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -1222,17 +1222,17 @@ 003FA63B093FFD41000C53B3 /* Products */ = { isa = PBXGroup; children = ( - 003FA643093FFD41000C53B3 /* SDL2.framework */, - F3C17C5D28E3FB2900E1A26D /* SDL2.framework */, - F3C17C5F28E3FB2900E1A26D /* SDL2.framework */, - F3C17C6128E3FB2900E1A26D /* SDL2.framework */, - 003FA645093FFD41000C53B3 /* libSDL2.a */, - F3C17C6328E3FB2900E1A26D /* libSDL2.a */, - F3C17C6528E3FB2900E1A26D /* libSDL2.a */, - DB1D40D717B3F30D00D74CFC /* libSDL2.dylib */, - F3C17C6728E3FB2900E1A26D /* libSDL2.dylib */, - F3C17C6928E3FB2900E1A26D /* libSDL2.dylib */, - 003FA649093FFD41000C53B3 /* SDL2 */, + 003FA643093FFD41000C53B3 /* SDL3.framework */, + F3C17C5D28E3FB2900E1A26D /* SDL3.framework */, + F3C17C5F28E3FB2900E1A26D /* SDL3.framework */, + F3C17C6128E3FB2900E1A26D /* SDL3.framework */, + 003FA645093FFD41000C53B3 /* libSDL3.a */, + F3C17C6328E3FB2900E1A26D /* libSDL3.a */, + F3C17C6528E3FB2900E1A26D /* libSDL3.a */, + DB1D40D717B3F30D00D74CFC /* libSDL3.dylib */, + F3C17C6728E3FB2900E1A26D /* libSDL3.dylib */, + F3C17C6928E3FB2900E1A26D /* libSDL3.dylib */, + 003FA649093FFD41000C53B3 /* SDL3 */, ); name = Products; sourceTree = ""; @@ -2298,80 +2298,80 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 003FA643093FFD41000C53B3 /* SDL2.framework */ = { + 003FA643093FFD41000C53B3 /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = 003FA642093FFD41000C53B3 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 003FA645093FFD41000C53B3 /* libSDL2.a */ = { + 003FA645093FFD41000C53B3 /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = 003FA644093FFD41000C53B3 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 003FA649093FFD41000C53B3 /* SDL2 */ = { + 003FA649093FFD41000C53B3 /* SDL3 */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.executable"; - path = SDL2; + path = SDL3; remoteRef = 003FA648093FFD41000C53B3 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - DB1D40D717B3F30D00D74CFC /* libSDL2.dylib */ = { + DB1D40D717B3F30D00D74CFC /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = DB1D40D617B3F30D00D74CFC /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17C5D28E3FB2900E1A26D /* SDL2.framework */ = { + F3C17C5D28E3FB2900E1A26D /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3C17C5C28E3FB2900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17C5F28E3FB2900E1A26D /* SDL2.framework */ = { + F3C17C5F28E3FB2900E1A26D /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3C17C5E28E3FB2900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17C6128E3FB2900E1A26D /* SDL2.framework */ = { + F3C17C6128E3FB2900E1A26D /* SDL3.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; - path = SDL2.framework; + path = SDL3.framework; remoteRef = F3C17C6028E3FB2900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17C6328E3FB2900E1A26D /* libSDL2.a */ = { + F3C17C6328E3FB2900E1A26D /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3C17C6228E3FB2900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17C6528E3FB2900E1A26D /* libSDL2.a */ = { + F3C17C6528E3FB2900E1A26D /* libSDL3.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; - path = libSDL2.a; + path = libSDL3.a; remoteRef = F3C17C6428E3FB2900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17C6728E3FB2900E1A26D /* libSDL2.dylib */ = { + F3C17C6728E3FB2900E1A26D /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3C17C6628E3FB2900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - F3C17C6928E3FB2900E1A26D /* libSDL2.dylib */ = { + F3C17C6928E3FB2900E1A26D /* libSDL3.dylib */ = { isa = PBXReferenceProxy; fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; + path = libSDL3.dylib; remoteRef = F3C17C6828E3FB2900E1A26D /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; diff --git a/Xcode/SDLTest/config.xcconfig b/Xcode/SDLTest/config.xcconfig index a73eec4d7e..1e6a3ff4b7 100644 --- a/Xcode/SDLTest/config.xcconfig +++ b/Xcode/SDLTest/config.xcconfig @@ -9,6 +9,6 @@ // Include any optional config for this build #include? "build.xcconfig" -CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL2 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal -CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit -CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework SDL2 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit +CONFIG_FRAMEWORK_LDFLAGS[sdk=macos*] = $(inherited) -framework SDL3 -framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio -framework CoreHaptics -framework CoreVideo -framework ForceFeedback -framework GameController -framework IOKit -framework Metal +CONFIG_FRAMEWORK_LDFLAGS[sdk=iphone*] = $(inherited) -framework SDL3 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework CoreMotion -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit +CONFIG_FRAMEWORK_LDFLAGS[sdk=appletv*] = $(inherited) -framework SDL3 -framework AVFoundation -framework AudioToolbox -framework CoreGraphics -framework CoreHaptics -framework Foundation -framework GameController -framework Metal -framework OpenGLES -framework QuartzCore -framework UIKit diff --git a/acinclude/esd.m4 b/acinclude/esd.m4 deleted file mode 100644 index bd4b84849d..0000000000 --- a/acinclude/esd.m4 +++ /dev/null @@ -1,173 +0,0 @@ -# Configure paths for ESD -# Manish Singh 98-9-30 -# stolen back from Frank Belew -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS -dnl -AC_DEFUN([AM_PATH_ESD], -[dnl -dnl Get the cflags and libraries from the esd-config script -dnl -AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], - esd_prefix="$withval", esd_prefix="") -AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], - esd_exec_prefix="$withval", esd_exec_prefix="") -AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], - , enable_esdtest=yes) - - if test x$esd_exec_prefix != x ; then - esd_args="$esd_args --exec-prefix=$esd_exec_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_exec_prefix/bin/esd-config - fi - fi - if test x$esd_prefix != x ; then - esd_args="$esd_args --prefix=$esd_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_prefix/bin/esd-config - fi - fi - - AC_PATH_PROG(ESD_CONFIG, esd-config, no) - min_esd_version=ifelse([$1], ,0.2.7,$1) - AC_MSG_CHECKING(for ESD - version >= $min_esd_version) - no_esd="" - if test "$ESD_CONFIG" = "no" ; then - no_esd=yes - else - ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` - ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` - - esd_major_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - esd_minor_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_esdtest" = "xyes" ; then - AC_LANG_PUSH([C]) - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" -dnl -dnl Now check if the installed ESD is sufficiently new. (Also sanity -dnl checks the results of esd-config to some extent -dnl - rm -f conf.esdtest - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include - -int main (void) -{ - int major, minor, micro; - FILE *fp = fopen("conf.esdtest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_esd_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_esd_version"); - exit(1); - } - - if (($esd_major_version > major) || - (($esd_major_version == major) && ($esd_minor_version > minor)) || - (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); - printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); - printf("*** to point to the correct copy of esd-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} -]])], [], [no_esd=yes], [echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - AC_LANG_POP([C]) - fi - fi - if test "x$no_esd" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$ESD_CONFIG" = "no" ; then -dnl echo "*** The esd-config script installed by ESD could not be found" -dnl echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" -dnl echo "*** your path, or set the ESD_CONFIG environment variable to the" -dnl echo "*** full path to esd-config." - : - else - if test -f conf.esdtest ; then - : - else - echo "*** Could not run ESD test program, checking why..." - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" - AC_LANG_PUSH([C]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -]], [[ return 0; ]])], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding ESD or finding the wrong" - echo "*** version of ESD. If it is not finding ESD, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means ESD was incorrectly installed" - echo "*** or that you have moved ESD since it was installed. In the latter case, you" - echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - AC_LANG_POP([C]) - fi - fi - ESD_CFLAGS="" - ESD_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(ESD_CFLAGS) - AC_SUBST(ESD_LIBS) - rm -f conf.esdtest -]) - -dnl AM_ESD_SUPPORTS_MULTIPLE_RECORD([ACTION-IF-SUPPORTS [, ACTION-IF-NOT-SUPPORTS]]) -dnl Test, whether esd supports multiple recording clients (version >=0.2.21) -dnl -AC_DEFUN([AM_ESD_SUPPORTS_MULTIPLE_RECORD], -[dnl - AC_MSG_NOTICE([whether installed esd version supports multiple recording clients]) - ac_save_ESD_CFLAGS="$ESD_CFLAGS" - ac_save_ESD_LIBS="$ESD_LIBS" - AM_PATH_ESD(0.2.21, - ifelse([$1], , [ - AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, true) - AC_DEFINE(ESD_SUPPORTS_MULTIPLE_RECORD, 1, - [Define if you have esound with support of multiple recording clients.])], - [$1]), - ifelse([$2], , [AM_CONDITIONAL(ESD_SUPPORTS_MULTIPLE_RECORD, false)], [$2]) - if test "x$ac_save_ESD_CFLAGS" != x ; then - ESD_CFLAGS="$ac_save_ESD_CFLAGS" - fi - if test "x$ac_save_ESD_LIBS" != x ; then - ESD_LIBS="$ac_save_ESD_LIBS" - fi - ) -]) diff --git a/android-project-ant/jni/src/Android.mk b/android-project-ant/jni/src/Android.mk index 1adcb6e9aa..7ed3d6de25 100644 --- a/android-project-ant/jni/src/Android.mk +++ b/android-project-ant/jni/src/Android.mk @@ -11,7 +11,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include # Add your application source files here... LOCAL_SRC_FILES := YourSourceHere.c -LOCAL_SHARED_LIBRARIES := SDL2 +LOCAL_SHARED_LIBRARIES := SDL3 LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog diff --git a/android-project-ant/jni/src/Android_static.mk b/android-project-ant/jni/src/Android_static.mk index faed669c0e..e49ca4d319 100644 --- a/android-project-ant/jni/src/Android_static.mk +++ b/android-project-ant/jni/src/Android_static.mk @@ -6,7 +6,7 @@ LOCAL_MODULE := main LOCAL_SRC_FILES := YourSourceHere.c -LOCAL_STATIC_LIBRARIES := SDL2_static +LOCAL_STATIC_LIBRARIES := SDL3_static include $(BUILD_SHARED_LIBRARY) $(call import-module,SDL)LOCAL_PATH := $(call my-dir) diff --git a/android-project/app/jni/src/Android.mk b/android-project/app/jni/src/Android.mk index 04e006ae9d..982f661703 100644 --- a/android-project/app/jni/src/Android.mk +++ b/android-project/app/jni/src/Android.mk @@ -11,7 +11,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(SDL_PATH)/include # Add your application source files here... LOCAL_SRC_FILES := YourSourceHere.c -LOCAL_SHARED_LIBRARIES := SDL2 +LOCAL_SHARED_LIBRARIES := SDL3 LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid diff --git a/android-project/app/jni/src/CMakeLists.txt b/android-project/app/jni/src/CMakeLists.txt index fb021f9f8f..aaac0c80d6 100644 --- a/android-project/app/jni/src/CMakeLists.txt +++ b/android-project/app/jni/src/CMakeLists.txt @@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 3.6) project(MY_APP) -find_library(SDL2 SDL2) +find_library(SDL3 SDL3) add_library(main SHARED) target_sources(main PRIVATE YourSourceHere.c) -target_link_libraries(main SDL2) +target_link_libraries(main SDL3) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index 8d4039c1ba..0472e18507 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -44,6 +44,7 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.widget.Button; +import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -58,6 +59,9 @@ import java.util.Locale; */ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; + private static final int SDL_MAJOR_VERSION = 3; + private static final int SDL_MINOR_VERSION = 0; + private static final int SDL_MICRO_VERSION = 0; /* // Display InputType.SOURCE/CLASS of events and devices // @@ -206,7 +210,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh // Main components protected static SDLActivity mSingleton; protected static SDLSurface mSurface; - protected static View mTextEdit; + protected static DummyEdit mTextEdit; protected static boolean mScreenKeyboardShown; protected static ViewGroup mLayout; protected static SDLClipboardHandler mClipboardHandler; @@ -259,17 +263,17 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh * This method is called by SDL before loading the native shared libraries. * It can be overridden to provide names of shared libraries to be loaded. * The default implementation returns the defaults. It never returns null. - * An array returned by a new implementation must at least contain "SDL2". + * An array returned by a new implementation must at least contain "SDL3". * Also keep in mind that the order the libraries are loaded may matter. - * @return names of shared libraries to be loaded (e.g. "SDL2", "main"). + * @return names of shared libraries to be loaded (e.g. "SDL3", "main"). */ protected String[] getLibraries() { return new String[] { - "SDL2", - // "SDL2_image", - // "SDL2_mixer", - // "SDL2_net", - // "SDL2_ttf", + "SDL3", + // "SDL3_image", + // "SDL3_mixer", + // "SDL3_net", + // "SDL3_ttf", "main" }; } @@ -341,8 +345,18 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh errorMsgBrokenLib = e.getMessage(); } - if (mBrokenLibraries) - { + if (!mBrokenLibraries) { + String expected_version = String.valueOf(SDL_MAJOR_VERSION) + "." + + String.valueOf(SDL_MINOR_VERSION) + "." + + String.valueOf(SDL_MICRO_VERSION); + String version = nativeGetVersion(); + if (!version.equals(expected_version)) { + mBrokenLibraries = true; + errorMsgBrokenLib = "SDL C/Java version mismatch (expected " + expected_version + ", got " + version + ")"; + } + } + + if (mBrokenLibraries) { mSingleton = this; AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); dlgAlert.setMessage("An error occurred while trying to start the application. Please try again and/or reinstall." @@ -883,6 +897,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } // C functions we call + public static native String nativeGetVersion(); public static native int nativeSetupJNI(); public static native int nativeRunMain(String library, String function, Object arguments); public static native void nativeLowMemory(); @@ -1217,8 +1232,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } // This method is called by SDLControllerManager's API 26 Generic Motion Handler. - public static View getContentView() - { + public static View getContentView() { return mLayout; } @@ -1289,6 +1303,77 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE; } + public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputConnection ic) { + int deviceId = event.getDeviceId(); + int source = event.getSource(); + + if (source == InputDevice.SOURCE_UNKNOWN) { + InputDevice device = InputDevice.getDevice(deviceId); + if (device != null) { + source = device.getSources(); + } + } + +// if (event.getAction() == KeyEvent.ACTION_DOWN) { +// Log.v("SDL", "key down: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); +// } else if (event.getAction() == KeyEvent.ACTION_UP) { +// Log.v("SDL", "key up: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); +// } + + // Dispatch the different events depending on where they come from + // Some SOURCE_JOYSTICK, SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD + // So, we try to process them as JOYSTICK/DPAD/GAMEPAD events first, if that fails we try them as KEYBOARD + // + // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and + // SOURCE_JOYSTICK, while its key events arrive from the keyboard source + // So, retrieve the device itself and check all of its sources + if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) { + // Note that we process events with specific key codes here + if (event.getAction() == KeyEvent.ACTION_DOWN) { + if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) { + return true; + } + } else if (event.getAction() == KeyEvent.ACTION_UP) { + if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) { + return true; + } + } + } + + if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { + if (event.getAction() == KeyEvent.ACTION_DOWN) { + if (isTextInputEvent(event)) { + if (ic != null) { + ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1); + } else { + SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); + } + } + onNativeKeyDown(keyCode); + return true; + } else if (event.getAction() == KeyEvent.ACTION_UP) { + onNativeKeyUp(keyCode); + return true; + } + } + + if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { + // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses + // they are ignored here because sending them as mouse input to SDL is messy + if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { + switch (event.getAction()) { + case KeyEvent.ACTION_DOWN: + case KeyEvent.ACTION_UP: + // mark the event as handled or it will be handled by system + // handling KEYCODE_BACK by system will call onBackPressed() + return true; + } + } + } + + return false; + } + /** * This method is called by SDL using JNI. */ @@ -1826,21 +1911,7 @@ class DummyEdit extends View implements View.OnKeyListener { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { - /* - * This handles the hardware keyboard input - */ - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLActivity.isTextInputEvent(event)) { - ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1); - return true; - } - SDLActivity.onNativeKeyDown(keyCode); - return true; - } else if (event.getAction() == KeyEvent.ACTION_UP) { - SDLActivity.onNativeKeyUp(keyCode); - return true; - } - return false; + return SDLActivity.handleKeyEvent(v, keyCode, event, ic); } // @@ -1864,9 +1935,10 @@ class DummyEdit extends View implements View.OnKeyListener { public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new SDLInputConnection(this, true); - outAttrs.inputType = InputType.TYPE_CLASS_TEXT; - outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI - | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; + outAttrs.inputType = InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_FLAG_MULTI_LINE; + outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | + EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; return ic; } @@ -1874,9 +1946,17 @@ class DummyEdit extends View implements View.OnKeyListener { class SDLInputConnection extends BaseInputConnection { + protected EditText mEditText; + protected String mCommittedText = ""; + public SDLInputConnection(View targetView, boolean fullEditor) { super(targetView, fullEditor); + mEditText = new EditText(SDL.getContext()); + } + @Override + public Editable getEditable() { + return mEditText.getEditableText(); } @Override @@ -1899,79 +1979,84 @@ class SDLInputConnection extends BaseInputConnection { } } - return super.sendKeyEvent(event); } @Override public boolean commitText(CharSequence text, int newCursorPosition) { - - /* Generate backspaces for the text we're going to replace */ - final Editable content = getEditable(); - if (content != null) { - int a = getComposingSpanStart(content); - int b = getComposingSpanEnd(content); - if (a == -1 || b == -1) { - a = Selection.getSelectionStart(content); - b = Selection.getSelectionEnd(content); - } - if (a < 0) a = 0; - if (b < 0) b = 0; - if (b < a) { - int tmp = a; - a = b; - b = tmp; - } - int backspaces = (b - a); - - for (int i = 0; i < backspaces; i++) { - nativeGenerateScancodeForUnichar('\b'); - } + if (!super.commitText(text, newCursorPosition)) { + return false; } - - for (int i = 0; i < text.length(); i++) { - char c = text.charAt(i); - if (c == '\n') { - if (SDLActivity.onNativeSoftReturnKey()) { - return true; - } - } - nativeGenerateScancodeForUnichar(c); - } - - SDLInputConnection.nativeCommitText(text.toString(), newCursorPosition); - - return super.commitText(text, newCursorPosition); + updateText(); + return true; } @Override public boolean setComposingText(CharSequence text, int newCursorPosition) { + if (!super.setComposingText(text, newCursorPosition)) { + return false; + } + updateText(); + return true; + } - nativeSetComposingText(text.toString(), newCursorPosition); + @Override + public boolean deleteSurroundingText(int beforeLength, int afterLength) { + if (!super.deleteSurroundingText(beforeLength, afterLength)) { + return false; + } + updateText(); + return true; + } - return super.setComposingText(text, newCursorPosition); + protected void updateText() { + final Editable content = getEditable(); + if (content == null) { + return; + } + + String text = content.toString(); + int compareLength = Math.min(text.length(), mCommittedText.length()); + int matchLength, offset; + + /* Backspace over characters that are no longer in the string */ + for (matchLength = 0; matchLength < compareLength; ) { + int codePoint = mCommittedText.codePointAt(matchLength); + if (codePoint != text.codePointAt(matchLength)) { + break; + } + matchLength += Character.charCount(codePoint); + } + /* FIXME: This doesn't handle graphemes, like '🌬ï¸' */ + for (offset = matchLength; offset < mCommittedText.length(); ) { + int codePoint = mCommittedText.codePointAt(offset); + nativeGenerateScancodeForUnichar('\b'); + offset += Character.charCount(codePoint); + } + + if (matchLength < text.length()) { + String pendingText = text.subSequence(matchLength, text.length()).toString(); + for (offset = 0; offset < pendingText.length(); ) { + int codePoint = pendingText.codePointAt(offset); + if (codePoint == '\n') { + if (SDLActivity.onNativeSoftReturnKey()) { + return; + } + } + /* Higher code points don't generate simulated scancodes */ + if (codePoint < 128) { + nativeGenerateScancodeForUnichar((char)codePoint); + } + offset += Character.charCount(codePoint); + } + SDLInputConnection.nativeCommitText(pendingText, 0); + } + mCommittedText = text; } public static native void nativeCommitText(String text, int newCursorPosition); - public native void nativeGenerateScancodeForUnichar(char c); - - public native void nativeSetComposingText(String text, int newCursorPosition); - - @Override - public boolean deleteSurroundingText(int beforeLength, int afterLength) { - // 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; - } - - return super.deleteSurroundingText(beforeLength, afterLength); - } + public static native void nativeGenerateScancodeForUnichar(char c); } class SDLClipboardHandler implements diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java index 77cf1768b0..dcd26d495c 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java @@ -189,72 +189,8 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, // Key events @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - - int deviceId = event.getDeviceId(); - int source = event.getSource(); - - if (source == InputDevice.SOURCE_UNKNOWN) { - InputDevice device = InputDevice.getDevice(deviceId); - if (device != null) { - source = device.getSources(); - } - } - -// if (event.getAction() == KeyEvent.ACTION_DOWN) { -// Log.v("SDL", "key down: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); -// } else if (event.getAction() == KeyEvent.ACTION_UP) { -// Log.v("SDL", "key up: " + keyCode + ", deviceId = " + deviceId + ", source = " + source); -// } - - // Dispatch the different events depending on where they come from - // Some SOURCE_JOYSTICK, SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD - // So, we try to process them as JOYSTICK/DPAD/GAMEPAD events first, if that fails we try them as KEYBOARD - // - // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and - // SOURCE_JOYSTICK, while its key events arrive from the keyboard source - // So, retrieve the device itself and check all of its sources - if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) { - // Note that we process events with specific key codes here - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) { - return true; - } - } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) { - return true; - } - } - } - - if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLActivity.isTextInputEvent(event)) { - SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1); - } - SDLActivity.onNativeKeyDown(keyCode); - return true; - } else if (event.getAction() == KeyEvent.ACTION_UP) { - SDLActivity.onNativeKeyUp(keyCode); - return true; - } - } - - if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { - // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses - // they are ignored here because sending them as mouse input to SDL is messy - if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) { - switch (event.getAction()) { - case KeyEvent.ACTION_DOWN: - case KeyEvent.ACTION_UP: - // mark the event as handled or it will be handled by system - // handling KEYCODE_BACK by system will call onBackPressed() - return true; - } - } - } - - return false; + public boolean onKey(View v, int keyCode, KeyEvent event) { + return SDLActivity.handleKeyEvent(v, keyCode, event, null); } // Touch events @@ -466,4 +402,4 @@ public class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, return false; } -} \ No newline at end of file +} diff --git a/build-scripts/android-prefab.sh b/build-scripts/android-prefab.sh new file mode 100755 index 0000000000..25201c9099 --- /dev/null +++ b/build-scripts/android-prefab.sh @@ -0,0 +1,351 @@ +#!/bin/bash + +set -e + +if ! [ "x$ANDROID_NDK_HOME" != "x" -a -d "$ANDROID_NDK_HOME" ]; then + echo "ANDROID_NDK_HOME environment variable is not set" + exit 1 +fi + +if ! [ "x$ANDROID_HOME" != "x" -a -d "$ANDROID_HOME" ]; then + echo "ANDROID_HOME environment variable is not set" + exit 1 +fi + +if [ "x$ANDROID_API" = "x" ]; then + ANDROID_API="$(ls "$ANDROID_HOME/platforms" | grep -E "^android-[0-9]+$" | sed 's/android-//' | sort -n -r | head -1)" + if [ "x$ANDROID_API" = "x" ]; then + echo "No Android platform found in $ANDROID_HOME/platforms" + exit 1 + fi +else + if ! [ -d "$ANDROID_HOME/platforms/android-$ANDROID_API" ]; then + echo "Android api version $ANDROID_API is not available ($ANDROID_HOME/platforms/android-$ANDROID_API does not exist)" >2 + exit 1 + fi +fi + +android_platformdir="$ANDROID_HOME/platforms/android-$ANDROID_API" + +echo "Building for android api version $ANDROID_API" +echo "android_platformdir=$android_platformdir" + +scriptdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") +sdl_root=$(cd -P -- "$(dirname -- "$0")/.." && printf '%s\n' "$(pwd -P)") + +build_root="${sdl_root}/build-android-prefab" + +android_abis="armeabi-v7a arm64-v8a x86 x86_64" +android_api=19 +android_ndk=21 +android_stl="c++_shared" + +sdl_major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' "${sdl_root}/include/SDL_version.h") +sdl_minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' "${sdl_root}/include/SDL_version.h") +sdl_patch=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' "${sdl_root}/include/SDL_version.h") +sdl_version="${sdl_major}.${sdl_minor}.${sdl_patch}" +echo "Building Android prefab package for SDL version $sdl_version" + +prefabhome="${build_root}/prefab-${sdl_version}" +rm -rf "$prefabhome" +mkdir -p "${prefabhome}" + +build_cmake_projects() { + for android_abi in $android_abis; do + echo "Configuring CMake project for $android_abi" + cmake -S "$sdl_root" -B "${build_root}/build_${android_abi}" \ + -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \ + -DANDROID_PLATFORM=${android_platform} \ + -DANDROID_ABI=${android_abi} \ + -DSDL_SHARED=ON \ + -DSDL_STATIC=ON \ + -DSDL_STATIC_PIC=ON \ + -DSDL_TEST=ON \ + -DSDL3_DISABLE_SDL3MAIN=OFF \ + -DSDL3_DISABLE_INSTALL=OFF \ + -DCMAKE_INSTALL_PREFIX="${build_root}/build_${android_abi}/prefix" \ + -DCMAKE_INSTALL_INCLUDEDIR=include \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_BUILD_TYPE=Release \ + -GNinja + + rm -rf "${build_root}/build_${android_abi}/prefix" + + echo "Building CMake project for $android_abi" + cmake --build "${build_root}/build_${android_abi}" + + echo "Installing CMake project for $android_abi" + cmake --install "${build_root}/build_${android_abi}" + done +} + +classes_sources_jar_path="${prefabhome}/classes-sources.jar" +classes_jar_path="${prefabhome}/classes.jar" +compile_java() { + classes_sources_root="${prefabhome}/classes-sources" + + rm -rf "${classes_sources_root}" + mkdir -p "${classes_sources_root}/META-INF" + + echo "Copying LICENSE.txt to java build folder" + cp "$sdl_root/LICENSE.txt" "${classes_sources_root}/META-INF" + + echo "Copy JAVA sources to java build folder" + cp -r "$sdl_root/android-project/app/src/main/java/org" "${classes_sources_root}" + + java_sourceslist_path="${prefabhome}/java_sources.txt" + pushd "${classes_sources_root}" + echo "Collecting sources for classes-sources.jar" + find "." -name "*.java" >"${java_sourceslist_path}" + find "META-INF" -name "*" >>"${java_sourceslist_path}" + + echo "Creating classes-sources.jar" + jar -cf "${classes_sources_jar_path}" "@${java_sourceslist_path}" + popd + + classes_root="${prefabhome}/classes" + mkdir -p "${classes_root}/META-INF" + cp "$sdl_root/LICENSE.txt" "${classes_root}/META-INF" + java_sourceslist_path="${prefabhome}/java_sources.txt" + + echo "Collecting sources for classes.jar" + find "$sdl_root/android-project/app/src/main/java" -name "*.java" >"${java_sourceslist_path}" + + echo "Compiling classes" + javac -encoding utf-8 -classpath "$android_platformdir/android.jar" -d "${classes_root}" "@${java_sourceslist_path}" + + java_classeslist_path="${prefabhome}/java_classes.txt" + pushd "${classes_root}" + find "." -name "*.class" >"${java_classeslist_path}" + find "META-INF" -name "*" >>"${java_classeslist_path}" + echo "Creating classes.jar" + jar -cf "${classes_jar_path}" "@${java_classeslist_path}" + popd +} + +pom_filename="SDL${sdl_major}-${sdl_version}.pom" +pom_filepath="${prefabhome}/${pom_filename}" +create_pom_xml() { + echo "Creating ${pom_filename}" + cat >"${pom_filepath}" < + 4.0.0 + org.libsdl.android + SDL${sdl_major} + ${sdl_version} + aar + SDL${sdl_major} + The AAR for SDL${sdl_major} + https://libsdl.org/ + + + zlib License + https://github.com/libsdl-org/SDL/blob/main/LICENSE.txt + repo + + + + scm:git:https://github.com/libsdl-org/SDL + https://github.com/libsdl-org/SDL + + +EOF +} + +create_aar_androidmanifest() { + echo "Creating AndroidManifest.xml" + cat >"${aar_root}/AndroidManifest.xml" < + + +EOF +} + +echo "Creating AAR root directory" +aar_root="${prefabhome}/SDL${sdl_major}-${sdl_version}" +mkdir -p "${aar_root}" + +aar_metainfdir_path=${aar_root}/META-INF +mkdir -p "${aar_metainfdir_path}" +cp "${sdl_root}/LICENSE.txt" "${aar_metainfdir_path}" + +prefabworkdir="${aar_root}/prefab" +mkdir -p "${prefabworkdir}" + +cat >"${prefabworkdir}/prefab.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" <"${sdl_moduleworkdir}/module.json" <"${abi_sdllibdir}/abi.json" </dev/null ; + mv "${aar_filename}" "${prefabhome}" +popd + +maven_filename="SDL${sdl_major}-${sdl_version}.zip" + +pushd "${prefabhome}" + zip_filename="SDL${sdl_major}-${sdl_version}.zip" + zip "${maven_filename}" "${aar_filename}" "${pom_filename}" 2>/dev/null; + zip -Tv "${zip_filename}" 2>/dev/null; +popd + +echo "Prefab zip is ready at ${prefabhome}/${aar_filename}" +echo "Maven archive is ready at ${prefabhome}/${zip_filename}" diff --git a/build-scripts/androidbuildlibs.sh b/build-scripts/androidbuildlibs.sh index dc72172936..39df9e551b 100755 --- a/build-scripts/androidbuildlibs.sh +++ b/build-scripts/androidbuildlibs.sh @@ -69,5 +69,5 @@ ndk-build \ APP_BUILD_SCRIPT=Android.mk \ APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ APP_PLATFORM=android-16 \ - APP_MODULES="SDL2 SDL2_main" \ + APP_MODULES="SDL3 SDL3_main" \ $ndk_args diff --git a/build-scripts/emscripten-buildbot.sh b/build-scripts/emscripten-buildbot.sh index 8538c45aec..c8b201755d 100755 --- a/build-scripts/emscripten-buildbot.sh +++ b/build-scripts/emscripten-buildbot.sh @@ -55,7 +55,7 @@ mkdir buildbot pushd buildbot echo "Configuring..." -emconfigure ../configure --host=wasm32-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-s USE_SDL=0 -O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? +emconfigure ../configure --host=wasm32-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-s USE_SDL=0 -O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl3-installed" || exit $? echo "Building..." emmake $MAKE || exit $? @@ -64,9 +64,9 @@ echo "Moving things around..." emmake $MAKE install || exit $? # Fix up a few things to a real install path -perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config +perl -w -pi -e "s#$PWD/emscripten-sdl3-installed#/usr/local#g;" ./emscripten-sdl3-installed/lib/libSDL3.la ./emscripten-sdl3-installed/lib/pkgconfig/sdl3.pc ./emscripten-sdl3-installed/bin/sdl3-config mkdir -p ./usr -mv ./emscripten-sdl2-installed ./usr/local +mv ./emscripten-sdl3-installed ./usr/local tar -cJvvf $TARBALL usr popd diff --git a/build-scripts/fnsince.pl b/build-scripts/fnsince.pl index fde65c8622..53a30888e0 100755 --- a/build-scripts/fnsince.pl +++ b/build-scripts/fnsince.pl @@ -19,7 +19,15 @@ open(PIPEFH, '-|', 'git tag -l') or die "Failed to read git release tags: $!\n"; while () { chomp; if (/\Arelease\-(.*?)\Z/) { - push @unsorted_releases, $1; + # Ignore anything that isn't a x.y.0 release. + # Make sure new APIs are assigned to the next minor version and ignore the patch versions. + my $ver = $1; + my @versplit = split /\./, $ver; + next if (scalar(@versplit) < 1) || ($versplit[0] != 3); # Ignore anything that isn't an SDL3 release. + next if (scalar(@versplit) < 3) || ($versplit[2] != 0); + + # Consider this release version. + push @unsorted_releases, $ver; } } @@ -44,13 +52,12 @@ my @releases = sort { return 0; # still here? They matched completely?! } @unsorted_releases; -# this happens to work for how SDL versions things at the moment. -my $current_release = $releases[-1]; -my $next_release; +my $current_release = 'in-development'; +my $next_release = '3.0.0'; # valid until we actually ship something. :) +if (scalar(@releases) > 0) { + # this happens to work for how SDL versions things at the moment. + $current_release = $releases[-1]; -if ($current_release eq '2.0.22') { # Hack for our jump from 2.0.22 to 2.24.0... - $next_release = '2.24.0'; -} else { my @current_release_segments = split /\./, $current_release; @current_release_segments[1] = '' . ($current_release_segments[1] + 2); $next_release = join('.', @current_release_segments); @@ -68,8 +75,6 @@ push @releases, 'HEAD'; my %funcs = (); foreach my $release (@releases) { #print("Checking $release...\n"); - next if ($release eq '2.0.0') || ($release eq '2.0.1'); # no dynapi before 2.0.2 - my $assigned_release = ($release eq '2.0.2') ? '2.0.0' : $release; # assume everything in 2.0.2--first with dynapi--was there since 2.0.0. We'll fix it up later. my $tag = ($release eq 'HEAD') ? $release : "release-$release"; my $blobname = "$tag:src/dynapi/SDL_dynapi_overrides.h"; open(PIPEFH, '-|', "git show '$blobname'") or die "Failed to read git blob '$blobname': $!\n"; @@ -77,40 +82,12 @@ foreach my $release (@releases) { chomp; if (/\A\#define\s+(SDL_.*?)\s+SDL_.*?_REAL\Z/) { my $fn = $1; - $funcs{$fn} = $assigned_release if not defined $funcs{$fn}; + $funcs{$fn} = $release if not defined $funcs{$fn}; } } close(PIPEFH); } -# Fixup the handful of functions that were added in 2.0.1 and 2.0.2 that we -# didn't have dynapi revision data about... -$funcs{'SDL_GetSystemRAM'} = '2.0.1'; -$funcs{'SDL_GetBasePath'} = '2.0.1'; -$funcs{'SDL_GetPrefPath'} = '2.0.1'; -$funcs{'SDL_UpdateYUVTexture'} = '2.0.1'; -$funcs{'SDL_GL_GetDrawableSize'} = '2.0.1'; -$funcs{'SDL_Direct3D9GetAdapterIndex'} = '2.0.1'; -$funcs{'SDL_RenderGetD3D9Device'} = '2.0.1'; - -$funcs{'SDL_RegisterApp'} = '2.0.2'; -$funcs{'SDL_UnregisterApp'} = '2.0.2'; -$funcs{'SDL_GetAssertionHandler'} = '2.0.2'; -$funcs{'SDL_GetDefaultAssertionHandler'} = '2.0.2'; -$funcs{'SDL_AtomicAdd'} = '2.0.2'; -$funcs{'SDL_AtomicGet'} = '2.0.2'; -$funcs{'SDL_AtomicGetPtr'} = '2.0.2'; -$funcs{'SDL_AtomicSet'} = '2.0.2'; -$funcs{'SDL_AtomicSetPtr'} = '2.0.2'; -$funcs{'SDL_HasAVX'} = '2.0.2'; -$funcs{'SDL_GameControllerAddMappingsFromRW'} = '2.0.2'; -$funcs{'SDL_acos'} = '2.0.2'; -$funcs{'SDL_asin'} = '2.0.2'; -$funcs{'SDL_vsscanf'} = '2.0.2'; -$funcs{'SDL_DetachThread'} = '2.0.2'; -$funcs{'SDL_GL_ResetAttributes'} = '2.0.2'; -$funcs{'SDL_DXGIGetOutputInfo'} = '2.0.2'; - # these are incorrect in the dynapi header, because we forgot to add them # until a later release, but are available in the older release. $funcs{'SDL_WinRTGetFSPathUNICODE'} = '2.0.3'; diff --git a/build-scripts/nacl-buildbot.sh b/build-scripts/nacl-buildbot.sh deleted file mode 100755 index 73aae9eaf4..0000000000 --- a/build-scripts/nacl-buildbot.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from -# amd64 Linux to NaCl. - -# PLEASE NOTE that we have reports that SDL built with pepper_49 (current -# stable release as of November 10th, 2016) is broken. Please retest -# when something newer becomes stable and then decide if this was SDL's -# bug or NaCl's bug. --ryan. -export NACL_SDK_ROOT="/nacl_sdk/pepper_47" - -TARBALL="$1" -if [ -z $1 ]; then - TARBALL=sdl-nacl.tar.xz -fi - -OSTYPE=`uname -s` -if [ "$OSTYPE" != "Linux" ]; then - # !!! FIXME - echo "This only works on x86 or x64-64 Linux at the moment." 1>&2 - exit 1 -fi - -if [ "x$MAKE" == "x" ]; then - NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l` - let NCPU=$NCPU+1 - MAKE="make -j$NCPU" -fi - -BUILDBOTDIR="nacl-buildbot" -PARENTDIR="$PWD" - -set -e -set -x -rm -f $TARBALL -rm -rf $BUILDBOTDIR -mkdir -p $BUILDBOTDIR -pushd $BUILDBOTDIR - -# !!! FIXME: ccache? -export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang" -export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl" -export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar" -export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar" -export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib" - -../configure --host=pnacl --prefix=$PWD/nacl-sdl2-installed -$MAKE -$MAKE install -# Fix up a few things to a real install path -perl -w -pi -e "s#$PWD/nacl-sdl2-installed#/usr/local#g;" ./nacl-sdl2-installed/lib/libSDL2.la ./nacl-sdl2-installed/lib/pkgconfig/sdl2.pc ./nacl-sdl2-installed/bin/sdl2-config -mkdir -p ./usr -mv ./nacl-sdl2-installed ./usr/local - -popd -tar -cJvvf $TARBALL -C $BUILDBOTDIR usr -rm -rf $BUILDBOTDIR - -set +x -echo "All done. Final installable is in $TARBALL ..."; - diff --git a/build-scripts/naclbuild.sh b/build-scripts/naclbuild.sh deleted file mode 100755 index db745f9e31..0000000000 --- a/build-scripts/naclbuild.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -if [ -z "$1" ] && [ -z "$NACL_SDK_ROOT" ]; then - echo "Usage: ./naclbuild ~/nacl/pepper_35" - echo "This will build SDL for Native Client, and testgles2.c as a demo" - echo "You can set env vars CC, AR, LD and RANLIB to override the default PNaCl toolchain used" - echo "You can set env var SOURCES to select a different source file than testgles2.c" - exit 1 -fi - -if [ -n "$1" ]; then - NACL_SDK_ROOT="$1" -fi - -CC="" - -if [ -n "$2" ]; then - CC="$2" -fi - -echo "Using SDK at $NACL_SDK_ROOT" - -export NACL_SDK_ROOT="$NACL_SDK_ROOT" -export CFLAGS="$CFLAGS -I$NACL_SDK_ROOT/include -I$NACL_SDK_ROOT/include/pnacl" - -NCPUS="1" -case "$OSTYPE" in - darwin*) - NCPU=`sysctl -n hw.ncpu` - ;; - linux*) - if [ -n `which nproc` ]; then - NCPUS=`nproc` - fi - ;; - *);; -esac - -CURDIR=`pwd -P` -SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )" -BUILDPATH="$SDLPATH/build/nacl" -TESTBUILDPATH="$BUILDPATH/test" -SDL2_STATIC="$BUILDPATH/build/.libs/libSDL2.a" -mkdir -p $BUILDPATH -mkdir -p $TESTBUILDPATH - -if [ -z "$CC" ]; then - export CC="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-clang" -fi -if [ -z "$AR" ]; then - export AR="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar" -fi -if [ -z "$LD" ]; then - export LD="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ar" -fi -if [ -z "$RANLIB" ]; then - export RANLIB="$NACL_SDK_ROOT/toolchain/linux_pnacl/bin/pnacl-ranlib" -fi - -if [ -z "$SOURCES" ]; then - export SOURCES="$SDLPATH/test/testgles2.c" -fi - -if [ ! -f "$CC" ]; then - echo "Could not find compiler at $CC" - exit 1 -fi - - - - -cd $BUILDPATH -$SDLPATH/configure --host=pnacl --prefix $TESTBUILDPATH -make -j$NCPUS CFLAGS="$CFLAGS -I./include" -make install - -if [ ! -f "$SDL2_STATIC" ]; then - echo "Build failed! $SDL2_STATIC" - exit 1 -fi - -echo "Building test" -cp -f $SDLPATH/test/nacl/* $TESTBUILDPATH -# Some tests need these resource files -cp -f $SDLPATH/test/*.bmp $TESTBUILDPATH -cp -f $SDLPATH/test/*.wav $TESTBUILDPATH -cp -f $SDL2_STATIC $TESTBUILDPATH - -# Copy user sources -_SOURCES=($SOURCES) -for src in "${_SOURCES[@]}" -do - cp $src $TESTBUILDPATH -done -export SOURCES="$SOURCES" - -cd $TESTBUILDPATH -make -j$NCPUS CONFIG="Release" CFLAGS="$CFLAGS -I$TESTBUILDPATH/include/SDL2 -I$SDLPATH/include" -make -j$NCPUS CONFIG="Debug" CFLAGS="$CFLAGS -I$TESTBUILDPATH/include/SDL2 -I$SDLPATH/include" - -echo -echo "Run the test with: " -echo "cd $TESTBUILDPATH;python -m SimpleHTTPServer" -echo "Then visit http://localhost:8000 with Chrome" - -cd $CURDIR diff --git a/build-scripts/raspberrypi-buildbot.sh b/build-scripts/raspberrypi-buildbot.sh index 9486198926..677c0cdc01 100755 --- a/build-scripts/raspberrypi-buildbot.sh +++ b/build-scripts/raspberrypi-buildbot.sh @@ -1,13 +1,13 @@ #!/bin/bash -# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from +# This is the script buildbot.libsdl.org uses to cross-compile SDL3 from # x86 Linux to Raspberry Pi. # The final tarball can be unpacked in the root directory of a RPi, -# so the SDL2 install lands in /usr/local. Run ldconfig, and then -# you should be able to build and run SDL2-based software on your +# so the SDL3 install lands in /usr/local. Run ldconfig, and then +# you should be able to build and run SDL3-based software on your # Pi. Standard configure scripts should be able to find SDL and -# build against it, and sdl2-config should work correctly on the +# build against it, and sdl3-config should work correctly on the # actual device. TARBALL="$1" @@ -42,13 +42,13 @@ SYSROOT="/opt/rpi-sysroot" export CC="ccache /opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux -L$SYSROOT/opt/vc/lib" # -L$SYSROOT/usr/lib/arm-linux-gnueabihf" # !!! FIXME: shouldn't have to --disable-* things here. -../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd --disable-video-wayland +../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl3-installed --disable-pulseaudio --disable-esd --disable-video-wayland $MAKE $MAKE install # Fix up a few things to a real install path on a real Raspberry Pi... -perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config +perl -w -pi -e "s#$PWD/rpi-sdl3-installed#/usr/local#g;" ./rpi-sdl3-installed/lib/libSDL3.la ./rpi-sdl3-installed/lib/pkgconfig/sdl3.pc ./rpi-sdl3-installed/bin/sdl3-config mkdir -p ./usr -mv ./rpi-sdl2-installed ./usr/local +mv ./rpi-sdl3-installed ./usr/local tar -cJvvf $TARBALL usr popd diff --git a/build-scripts/showrev.sh b/build-scripts/showrev.sh index 71be3fea92..a061df4235 100755 --- a/build-scripts/showrev.sh +++ b/build-scripts/showrev.sh @@ -5,10 +5,31 @@ SDL_ROOT=$(dirname $0)/.. cd $SDL_ROOT +if [ -e ./VERSION.txt ]; then + cat ./VERSION.txt + exit 0 +fi + +major=$(sed -ne 's/^#define SDL_MAJOR_VERSION *//p' include/SDL_version.h) +minor=$(sed -ne 's/^#define SDL_MINOR_VERSION *//p' include/SDL_version.h) +micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h) +version="${major}.${minor}.${micro}" + if [ -x "$(command -v git)" ]; then - rev=$(echo "$(git remote get-url origin 2>/dev/null)@$(git rev-list HEAD~.. 2>/dev/null)") - if [ "$rev" != "@" ]; then - echo $rev + rev="$(git describe --tags --long 2>/dev/null)" + if [ -n "$rev" ]; then + # e.g. release-2.24.0-542-g96361fc47 + # or release-2.24.1-5-g36b987dab + # or prerelease-2.23.2-0-gcb46e1b3f + echo "$rev" + exit 0 + fi + + rev="$(git describe --always --tags --long 2>/dev/null)" + if [ -n "$rev" ]; then + # Just a truncated sha1, e.g. 96361fc47. + # Turn it into e.g. 2.25.0-g96361fc47 + echo "${version}-g${rev}" exit 0 fi fi @@ -16,10 +37,12 @@ fi if [ -x "$(command -v p4)" ]; then rev="$(p4 changes -m1 ./...\#have 2>/dev/null| awk '{print $2}')" if [ $? = 0 ]; then - echo $rev + # e.g. 2.25.0-p7511446 + echo "${version}-p${rev}" exit 0 fi fi -echo "" -exit 1 +# best we can do +echo "${version}-no-vcs" +exit 0 diff --git a/build-scripts/test-versioning.sh b/build-scripts/test-versioning.sh index c1b6c3084b..ab972ffdf5 100755 --- a/build-scripts/test-versioning.sh +++ b/build-scripts/test-versioning.sh @@ -4,6 +4,8 @@ set -eu +cd `dirname $0`/.. + 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_micro=$(sed -ne 's/^#define SDL_PATCHLEVEL *//p' include/SDL_version.h) @@ -56,26 +58,15 @@ else not_ok "CMakeLists.txt $version disagrees with SDL_version.h $ref_version" fi -major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.os2) -minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.os2) -micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.os2) +major=$(sed -ne 's/.*SDL_MAJOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java) +minor=$(sed -ne 's/.*SDL_MINOR_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java) +micro=$(sed -ne 's/.*SDL_MICRO_VERSION = \([0-9]*\);/\1/p' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java) version="${major}.${minor}.${micro}" if [ "$ref_version" = "$version" ]; then - ok "Makefile.os2 $version" + ok "SDLActivity.java $version" else - not_ok "Makefile.os2 $version disagrees with SDL_version.h $ref_version" -fi - -major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.w32) -minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.w32) -micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.w32) -version="${major}.${minor}.${micro}" - -if [ "$ref_version" = "$version" ]; then - ok "Makefile.w32 $version" -else - not_ok "Makefile.w32 $version disagrees with SDL_version.h $ref_version" + not_ok "android-project/app/src/main/java/org/libsdl/app/SDLActivity.java $version disagrees with SDL_version.h $ref_version" fi tuple=$(sed -ne 's/^ *FILEVERSION *//p' src/main/windows/version.rc | tr -d '\r') @@ -128,6 +119,25 @@ else not_ok "Info-Framework.plist CFBundleVersion $version disagrees with SDL_version.h $ref_version" 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. dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL/SDL.xcodeproj/project.pbxproj) diff --git a/build-scripts/update-version.sh b/build-scripts/update-version.sh index fc247fd9d3..524f815775 100755 --- a/build-scripts/update-version.sh +++ b/build-scripts/update-version.sh @@ -30,6 +30,10 @@ 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. perl -w -pi -e 's/(\)\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` perl -w -pi -e 's/(DYLIB_CURRENT_VERSION\s*=\s*)\d+\.\d+\.\d+/${1}'$DYVER'.0.0/;' Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -58,13 +62,9 @@ perl -w -pi -e 's/\A(set\(SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' CMakeLists.tx perl -w -pi -e 's/\A(set\(SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' CMakeLists.txt perl -w -pi -e 's/\A(set\(SDL_MICRO_VERSION\s+)\d+/${1}'$PATCH'/;' CMakeLists.txt -perl -w -pi -e 's/\A(MAJOR_VERSION\s*=\s*)\d+/${1}'$MAJOR'/;' Makefile.os2 -perl -w -pi -e 's/\A(MINOR_VERSION\s*=\s*)\d+/${1}'$MINOR'/;' Makefile.os2 -perl -w -pi -e 's/\A(MICRO_VERSION\s*=\s*)\d+/${1}'$PATCH'/;' Makefile.os2 - -perl -w -pi -e 's/\A(MAJOR_VERSION\s*=\s*)\d+/${1}'$MAJOR'/;' Makefile.w32 -perl -w -pi -e 's/\A(MINOR_VERSION\s*=\s*)\d+/${1}'$MINOR'/;' Makefile.w32 -perl -w -pi -e 's/\A(MICRO_VERSION\s*=\s*)\d+/${1}'$PATCH'/;' Makefile.w32 +perl -w -pi -e 's/\A(.* SDL_MAJOR_VERSION = )\d+/${1}'$MAJOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +perl -w -pi -e 's/\A(.* SDL_MINOR_VERSION = )\d+/${1}'$MINOR'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +perl -w -pi -e 's/\A(.* SDL_MICRO_VERSION = )\d+/${1}'$PATCH'/;' android-project/app/src/main/java/org/libsdl/app/SDLActivity.java perl -w -pi -e 's/(\#define SDL_MAJOR_VERSION\s+)\d+/${1}'$MAJOR'/;' include/SDL_version.h perl -w -pi -e 's/(\#define SDL_MINOR_VERSION\s+)\d+/${1}'$MINOR'/;' include/SDL_version.h diff --git a/build-scripts/updaterev.sh b/build-scripts/updaterev.sh index eb20e8069a..cc8638210a 100755 --- a/build-scripts/updaterev.sh +++ b/build-scripts/updaterev.sh @@ -6,10 +6,40 @@ outdir=`pwd` cd `dirname $0` srcdir=.. header=$outdir/include/SDL_revision.h +dist= +vendor= + +while [ "$#" -gt 0 ]; do + case "$1" in + (--dist) + dist=yes + shift + ;; + (--vendor) + vendor="$2" + shift 2 + ;; + (*) + echo "$0: Unknown option: $1" >&2 + exit 2 + ;; + esac +done rev=`sh showrev.sh 2>/dev/null` if [ "$rev" != "" ]; then - echo "#define SDL_REVISION \"$rev\"" >"$header.new" + if [ -n "$dist" ]; then + echo "$rev" > "$outdir/VERSION.txt" + fi + echo "/* Generated by updaterev.sh, do not edit */" >"$header.new" + if [ -n "$vendor" ]; then + echo "#define SDL_VENDOR_INFO \"$vendor\"" >>"$header.new" + fi + echo "#ifdef SDL_VENDOR_INFO" >>"$header.new" + echo "#define SDL_REVISION \"SDL-$rev (\" SDL_VENDOR_INFO \")\"" >>"$header.new" + echo "#else" >>"$header.new" + echo "#define SDL_REVISION \"SDL-$rev\"" >>"$header.new" + echo "#endif" >>"$header.new" echo "#define SDL_REVISION_NUMBER 0" >>"$header.new" if diff $header $header.new >/dev/null 2>&1; then rm "$header.new" diff --git a/build-scripts/windows-buildbot-zipper.bat b/build-scripts/windows-buildbot-zipper.bat index 5bbc4658b4..c1242680d6 100644 --- a/build-scripts/windows-buildbot-zipper.bat +++ b/build-scripts/windows-buildbot-zipper.bat @@ -16,9 +16,9 @@ mkdir zipper\SDL mkdir zipper\SDL\include mkdir zipper\SDL\lib copy include\*.h include\ -copy %2\%1\Release\SDL2.dll zipper\SDL\lib\ -copy %2\%1\Release\SDL2.lib zipper\SDL\lib\ -copy %2\%1\Release\SDL2main.lib zipper\SDL\lib\ +copy %2\%1\Release\SDL3.dll zipper\SDL\lib\ +copy %2\%1\Release\SDL3.lib zipper\SDL\lib\ +copy %2\%1\Release\SDL3main.lib zipper\SDL\lib\ cd zipper zip -9r ..\%3 SDL cd .. diff --git a/cmake/CheckCPUArchitecture.cmake b/cmake/CheckCPUArchitecture.cmake new file mode 100644 index 0000000000..79639f1c2b --- /dev/null +++ b/cmake/CheckCPUArchitecture.cmake @@ -0,0 +1,40 @@ +include(CheckCSourceCompiles) +include(CMakePushCheckState) + +function(_internal_check_cpu_architecture macro_check NAME VARIABLE) + cmake_push_check_state(RESET) + string(TOUPPER "${NAME}" UPPER_NAME) + set(CACHE_VARIABLE "CHECK_CPU_ARCHITECTURE_${UPPER_NAME}") + set(test_src " +int main(int argc, char *argv[]) { +#if ${macro_check} + return 0; +#else + choke +#endif +} +") + check_c_source_compiles("${test_src}" "${CACHE_VARIABLE}") + cmake_pop_check_state() + if(${CACHE_VARIABLE}) + set(${VARIABLE} "TRUE" PARENT_SCOPE) + else() + set(${VARIABLE} "FALSE" PARENT_SCOPE) + endif() +endfunction() + +function(check_cpu_architecture ARCH VARIABLE) + if(ARCH STREQUAL "x86") + _internal_check_cpu_architecture("defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" x86 ${VARIABLE}) + elseif(ARCH STREQUAL "x64") + _internal_check_cpu_architecture("defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" x64 ${VARIABLE}) + elseif(ARCH STREQUAL "arm32") + _internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE}) + elseif(ARCH STREQUAL "arm64") + _internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE}) + else() + message(WARNING "Unknown CPU architectures (${ARCH}).") + set(${VARIABLE} FALSE) + endif() + set("${VARIABLE}" "${${VARIABLE}}" PARENT_SCOPE) +endfunction() diff --git a/cmake/macros.cmake b/cmake/macros.cmake index 267a8afb12..c703abf6b3 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -92,7 +92,11 @@ macro(LISTTOSTRREV _LIST _OUTPUT) endforeach() endmacro() -if(${CMAKE_VERSION} VERSION_LESS "3.16.0") +if(CMAKE_VERSION VERSION_LESS 3.16.0 OR SDL3_SUBPROJECT) + # - CMake versions <3.16 do not support the OBJC language + # - When SDL is built as a subproject and when the main project does not enable OBJC, + # CMake fails due to missing internal CMake variables (CMAKE_OBJC_COMPILE_OBJECT) + # (reproduced with CMake 3.24.2) macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR) set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}") set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}") @@ -106,6 +110,13 @@ else() endif() endif() +if(APPLE) + check_language(OBJC) + if(NOT CMAKE_OBJC_COMPILER) + message(WARNING "Cannot find working OBJC compiler.") + endif() +endif() + if(CMAKE_VERSION VERSION_LESS 3.13.0) macro(target_link_directories _TARGET _SCOPE) link_directories(${ARGN}) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 040029db72..01fbbc396c 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -1,8 +1,11 @@ +include(CMakeParseArguments) macro(FindLibraryAndSONAME _LIB) + cmake_parse_arguments(FLAS "" "" "LIBDIRS" ${ARGN}) + string(TOUPPER ${_LIB} _UPPERLNAME) string(REGEX REPLACE "\\-" "_" _LNAME "${_UPPERLNAME}") - find_library(${_LNAME}_LIB ${_LIB}) + find_library(${_LNAME}_LIB ${_LIB} PATHS ${FLAS_LIBDIRS}) if(${_LNAME}_LIB) # reduce the library name for shared linking @@ -59,21 +62,13 @@ macro(CheckOSS) check_c_source_compiles(" #include int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SYS_SOUNDCARD_H) - if(NOT HAVE_OSS_SYS_SOUNDCARD_H) - check_c_source_compiles(" - #include - int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SOUNDCARD_H) - endif() - if(HAVE_OSS_SYS_SOUNDCARD_H OR HAVE_OSS_SOUNDCARD_H) + if(HAVE_OSS_SYS_SOUNDCARD_H) set(HAVE_OSS TRUE) - file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c) - if(HAVE_OSS_SOUNDCARD_H) - set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1) - endif() + file(GLOB OSS_SOURCES ${SDL3_SOURCE_DIR}/src/audio/dsp/*.c) set(SDL_AUDIO_DRIVER_OSS 1) list(APPEND SOURCE_FILES ${OSS_SOURCES}) - if(NETBSD OR OPENBSD) + if(NETBSD) list(APPEND EXTRA_LIBS ossaudio) endif() set(HAVE_SDL_AUDIO TRUE) @@ -94,7 +89,7 @@ macro(CheckALSA) endif() if(HAVE_LIBASOUND) set(HAVE_ALSA TRUE) - file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c) + file(GLOB ALSA_SOURCES ${SDL3_SOURCE_DIR}/src/audio/alsa/*.c) list(APPEND SOURCE_FILES ${ALSA_SOURCES}) set(SDL_AUDIO_DRIVER_ALSA 1) if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO) @@ -122,14 +117,14 @@ macro(CheckPipewire) pkg_check_modules(PKG_PIPEWIRE libpipewire-0.3>=0.3.20) if(PKG_PIPEWIRE_FOUND) set(HAVE_PIPEWIRE TRUE) - file(GLOB PIPEWIRE_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pipewire/*.c) + file(GLOB PIPEWIRE_SOURCES ${SDL3_SOURCE_DIR}/src/audio/pipewire/*.c) list(APPEND SOURCE_FILES ${PIPEWIRE_SOURCES}) set(SDL_AUDIO_DRIVER_PIPEWIRE 1) list(APPEND EXTRA_CFLAGS ${PKG_PIPEWIRE_CFLAGS}) if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading") endif() - FindLibraryAndSONAME("pipewire-0.3") + FindLibraryAndSONAME("pipewire-0.3" LIBDIRS ${PKG_PIPEWIRE_LIBRARY_DIRS}) if(SDL_PIPEWIRE_SHARED AND PIPEWIRE_0.3_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"") set(HAVE_PIPEWIRE_SHARED TRUE) @@ -151,14 +146,14 @@ macro(CheckPulseAudio) pkg_check_modules(PKG_PULSEAUDIO libpulse-simple) if(PKG_PULSEAUDIO_FOUND) set(HAVE_PULSEAUDIO TRUE) - file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c) + file(GLOB PULSEAUDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/pulseaudio/*.c) list(APPEND SOURCE_FILES ${PULSEAUDIO_SOURCES}) set(SDL_AUDIO_DRIVER_PULSEAUDIO 1) list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS}) if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading") endif() - FindLibraryAndSONAME("pulse-simple") + FindLibraryAndSONAME("pulse-simple" LIBDIRS ${PKG_PULSEAUDIO_LIBRARY_DIRS}) if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"") set(HAVE_PULSEAUDIO_SHARED TRUE) @@ -170,6 +165,35 @@ macro(CheckPulseAudio) endif() endmacro() +# Requires: +# - PkgCheckModules +# Optional: +# - SDL_SNDIO_SHARED opt +# - HAVE_SDL_LOADSO opt +macro(CheckSNDIO) + if(SDL_SNDIO) + pkg_check_modules(PKG_SNDIO sndio) + if(PKG_SNDIO_FOUND) + set(HAVE_SNDIO TRUE) + file(GLOB SNDIO_SOURCES ${SDL3_SOURCE_DIR}/src/audio/sndio/*.c) + list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) + set(SDL_AUDIO_DRIVER_SNDIO 1) + list(APPEND EXTRA_CFLAGS ${PKG_SNDIO_CFLAGS}) + if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) + message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") + endif() + FindLibraryAndSONAME("sndio" LIBDIRS ${PKG_SNDIO_LIBRARY_DIRS}) + if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO) + set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") + set(HAVE_SNDIO_SHARED TRUE) + else() + list(APPEND EXTRA_LIBS ${PKG_SNDIO_LDFLAGS}) + endif() + set(HAVE_SDL_AUDIO TRUE) + endif() + endif() +endmacro() + # Requires: # - PkgCheckModules # Optional: @@ -180,14 +204,14 @@ macro(CheckJACK) pkg_check_modules(PKG_JACK jack) if(PKG_JACK_FOUND) set(HAVE_JACK TRUE) - file(GLOB JACK_SOURCES ${SDL2_SOURCE_DIR}/src/audio/jack/*.c) + file(GLOB JACK_SOURCES ${SDL3_SOURCE_DIR}/src/audio/jack/*.c) list(APPEND SOURCE_FILES ${JACK_SOURCES}) set(SDL_AUDIO_DRIVER_JACK 1) list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") endif() - FindLibraryAndSONAME("jack") + FindLibraryAndSONAME("jack" LIBDIRS ${PKG_JACK_LIBRARY_DIRS}) if(SDL_JACK_SHARED AND JACK_LIB AND HAVE_SDL_LOADSO) set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") set(HAVE_JACK_SHARED TRUE) @@ -199,158 +223,6 @@ macro(CheckJACK) endif() endmacro() -# Requires: -# - PkgCheckModules -# Optional: -# - SDL_ESD_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckESD) - if(SDL_ESD) - pkg_check_modules(PKG_ESD esound) - if(PKG_ESD_FOUND) - set(HAVE_ESD TRUE) - file(GLOB ESD_SOURCES ${SDL2_SOURCE_DIR}/src/audio/esd/*.c) - list(APPEND SOURCE_FILES ${ESD_SOURCES}) - set(SDL_AUDIO_DRIVER_ESD 1) - list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS}) - if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic ESD loading") - endif() - FindLibraryAndSONAME(esd) - if(SDL_ESD_SHARED AND ESD_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"") - set(HAVE_ESD_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${PKG_ESD_LDFLAGS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - n/a -# Optional: -# - SDL_ARTS_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckARTS) - if(SDL_ARTS) - find_program(ARTS_CONFIG arts-config) - if(ARTS_CONFIG) - execute_process(CMD_ARTSCFLAGS ${ARTS_CONFIG} --cflags - OUTPUT_VARIABLE ARTS_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) - list(APPEND EXTRA_CFLAGS ${ARTS_CFLAGS}) - execute_process(CMD_ARTSLIBS ${ARTS_CONFIG} --libs - OUTPUT_VARIABLE ARTS_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE) - file(GLOB ARTS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/arts/*.c) - list(APPEND SOURCE_FILES ${ARTS_SOURCES}) - set(SDL_AUDIO_DRIVER_ARTS 1) - set(HAVE_ARTS TRUE) - if(SDL_ARTS_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading") - endif() - FindLibraryAndSONAME(artsc) - if(SDL_ARTS_SHARED AND ARTSC_LIB AND HAVE_SDL_LOADSO) - # TODO - set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"") - set(HAVE_ARTS_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${ARTS_LIBS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - n/a -# Optional: -# - SDL_NAS_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckNAS) - if(SDL_NAS) - # TODO: set include paths properly, so the NAS headers are found - check_include_file(audio/audiolib.h HAVE_NAS_H) - find_library(D_NAS_LIB audio) - if(HAVE_NAS_H AND D_NAS_LIB) - set(HAVE_NAS TRUE) - file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c) - list(APPEND SOURCE_FILES ${NAS_SOURCES}) - set(SDL_AUDIO_DRIVER_NAS 1) - if(SDL_NAS_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic NAS loading") - endif() - FindLibraryAndSONAME("audio") - if(SDL_NAS_SHARED AND AUDIO_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"") - set(HAVE_NAS_SHARED TRUE) - else() - list(APPEND EXTRA_LIBS ${D_NAS_LIB}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - n/a -# Optional: -# - SDL_SNDIO_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckSNDIO) - if(SDL_SNDIO) - # TODO: set include paths properly, so the sndio headers are found - check_include_file(sndio.h HAVE_SNDIO_H) - find_library(D_SNDIO_LIB sndio) - if(HAVE_SNDIO_H AND D_SNDIO_LIB) - set(HAVE_SNDIO TRUE) - file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) - list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) - set(SDL_AUDIO_DRIVER_SNDIO 1) - if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") - endif() - FindLibraryAndSONAME("sndio") - if(SDL_SNDIO_SHARED AND SNDIO_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") - set(HAVE_SNDIO_SHARED TRUE) - else() - list(APPEND EXTRA_LIBS ${D_SNDIO_LIB}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - -# Requires: -# - PkgCheckModules -# Optional: -# - FUSIONSOUND_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckFusionSound) - if(FUSIONSOUND) - pkg_check_modules(PKG_FUSIONSOUND fusionsound>=1.0.0) - if(PKG_FUSIONSOUND_FOUND) - set(HAVE_FUSIONSOUND TRUE) - file(GLOB FUSIONSOUND_SOURCES ${SDL2_SOURCE_DIR}/src/audio/fusionsound/*.c) - list(APPEND SOURCE_FILES ${FUSIONSOUND_SOURCES}) - set(SDL_AUDIO_DRIVER_FUSIONSOUND 1) - list(APPEND EXTRA_CFLAGS ${PKG_FUSIONSOUND_CFLAGS}) - if(FUSIONSOUND_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic FusionSound loading") - endif() - FindLibraryAndSONAME("fusionsound") - if(FUSIONSOUND_SHARED AND FUSIONSOUND_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"") - set(HAVE_FUSIONSOUND_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${PKG_FUSIONSOUND_LDFLAGS}) - endif() - set(HAVE_SDL_AUDIO TRUE) - endif() - endif() -endmacro() - # Requires: # - SDL_LIBSAMPLERATE # Optional: @@ -370,7 +242,7 @@ macro(CheckLibSampleRate) get_property(_samplerate_type TARGET SampleRate::samplerate PROPERTY TYPE) if(_samplerate_type STREQUAL "SHARED_LIBRARY") set(HAVE_LIBSAMPLERATE_SHARED TRUE) - if(WIN32 OR OS2) + if(WIN32) set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") else() set(SDL_LIBSAMPLERATE_DYNAMIC "\"$\"") @@ -448,7 +320,7 @@ macro(CheckX11) set(HAVE_X11 TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB X11_SOURCES ${SDL2_SOURCE_DIR}/src/video/x11/*.c) + file(GLOB X11_SOURCES ${SDL3_SOURCE_DIR}/src/video/x11/*.c) list(APPEND SOURCE_FILES ${X11_SOURCES}) set(SDL_VIDEO_DRIVER_X11 1) @@ -635,9 +507,11 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckWayland) if(SDL_WAYLAND) - pkg_check_modules(WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") + set(WAYLAND_FOUND FALSE) + pkg_check_modules(PKG_WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") - if(WAYLAND_FOUND) + if(PKG_WAYLAND_FOUND) + set(WAYLAND_FOUND TRUE) find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED) execute_process( COMMAND ${WAYLAND_SCANNER} --version @@ -660,23 +534,23 @@ macro(CheckWayland) endif() if(WAYLAND_FOUND) - target_link_directories(sdl-build-options INTERFACE "${WAYLAND_LIBRARY_DIRS}") - target_include_directories(sdl-build-options INTERFACE "${WAYLAND_INCLUDE_DIRS}") + target_link_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_LIBRARY_DIRS}") + target_include_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_INCLUDE_DIRS}") set(HAVE_WAYLAND TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) + file(GLOB WAYLAND_SOURCES ${SDL3_SOURCE_DIR}/src/video/wayland/*.c) list(APPEND SOURCE_FILES ${WAYLAND_SOURCES}) # We have to generate some protocol interface code for some unstable Wayland features. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") target_include_directories(sdl-build-options INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") - file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL2_SOURCE_DIR}/wayland-protocols/" "${SDL2_SOURCE_DIR}/wayland-protocols/*.xml") + file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL3_SOURCE_DIR}/wayland-protocols/" "${SDL3_SOURCE_DIR}/wayland-protocols/*.xml") foreach(_XML ${WAYLAND_PROTOCOLS_XML}) string(REGEX REPLACE "\\.xml$" "" _PROTL "${_XML}") - WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL2_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}") + WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL3_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}") endforeach() if(SDL_WAYLAND_QT_TOUCH) @@ -687,10 +561,10 @@ macro(CheckWayland) if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading") endif() - FindLibraryAndSONAME(wayland-client) - FindLibraryAndSONAME(wayland-egl) - FindLibraryAndSONAME(wayland-cursor) - FindLibraryAndSONAME(xkbcommon) + FindLibraryAndSONAME(wayland-client LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) + FindLibraryAndSONAME(wayland-egl LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) + FindLibraryAndSONAME(wayland-cursor LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) + FindLibraryAndSONAME(xkbcommon LIBDIRS ${PKG_WAYLAND_LIBRARY_DIRS}) if(SDL_WAYLAND_SHARED AND WAYLAND_CLIENT_LIB AND WAYLAND_EGL_LIB AND WAYLAND_CURSOR_LIB AND XKBCOMMON_LIB AND HAVE_SDL_LOADSO) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"") @@ -698,25 +572,25 @@ macro(CheckWayland) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"") set(HAVE_WAYLAND_SHARED TRUE) else() - list(APPEND EXTRA_LIBS ${WAYLAND_LIBRARIES}) + list(APPEND EXTRA_LIBS ${PKG_WAYLAND_LIBRARIES}) endif() if(SDL_WAYLAND_LIBDECOR) - pkg_check_modules(LIBDECOR libdecor-0) - if(LIBDECOR_FOUND) + pkg_check_modules(PKG_LIBDECOR libdecor-0) + if(PKG_LIBDECOR_FOUND) set(HAVE_WAYLAND_LIBDECOR TRUE) set(HAVE_LIBDECOR_H 1) - target_link_directories(sdl-build-options INTERFACE "${LIBDECOR_LIBRARY_DIRS}") - target_include_directories(sdl-build-options INTERFACE "${LIBDECOR_INCLUDE_DIRS}") + target_link_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_LIBRARY_DIRS}") + target_include_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}") if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading") endif() - FindLibraryAndSONAME(decor-0) + FindLibraryAndSONAME(decor-0 LIBDIRS ${PKG_LIBDECOR_LIBRARY_DIRS}) if(SDL_WAYLAND_LIBDECOR_SHARED AND DECOR_0_LIB AND HAVE_SDL_LOADSO) - set(HAVE_LIBDECOR_SHARED TRUE) + set(HAVE_WAYLAND_LIBDECOR_SHARED TRUE) set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"") else() - list(APPEND EXTRA_LIBS ${LIBDECOR_LIBRARIES}) + list(APPEND EXTRA_LIBS ${PKG_LIBDECOR_LIBRARIES}) endif() endif() endif() @@ -735,7 +609,7 @@ macro(CheckCOCOA) set(HAVE_COCOA TRUE) endif() if(HAVE_COCOA) - file(GLOB COCOA_SOURCES ${SDL2_SOURCE_DIR}/src/video/cocoa/*.m) + file(GLOB COCOA_SOURCES ${SDL3_SOURCE_DIR}/src/video/cocoa/*.m) list(APPEND SOURCE_FILES ${COCOA_SOURCES}) set(SDL_VIDEO_DRIVER_COCOA 1) set(HAVE_SDL_VIDEO TRUE) @@ -743,37 +617,6 @@ macro(CheckCOCOA) endif() endmacro() -# Requires: -# - PkgCheckModules -# Optional: -# - DIRECTFB_SHARED opt -# - HAVE_SDL_LOADSO opt -macro(CheckDirectFB) - if(SDL_DIRECTFB) - pkg_check_modules(PKG_DIRECTFB directfb>=1.0.0) - if(PKG_DIRECTFB_FOUND) - set(HAVE_DIRECTFB TRUE) - file(GLOB DIRECTFB_SOURCES ${SDL2_SOURCE_DIR}/src/video/directfb/*.c) - list(APPEND SOURCE_FILES ${DIRECTFB_SOURCES}) - set(SDL_VIDEO_DRIVER_DIRECTFB 1) - set(SDL_VIDEO_RENDER_DIRECTFB 1) - list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS}) - list(APPEND SDL_CFLAGS ${PKG_DIRECTFB_CFLAGS}) - if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO) - message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading") - endif() - FindLibraryAndSONAME("directfb") - if(SDL_DIRECTFB_SHARED AND DIRECTFB_LIB AND HAVE_SDL_LOADSO) - set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"") - set(HAVE_DIRECTFB_SHARED TRUE) - else() - list(APPEND EXTRA_LDFLAGS ${PKG_DIRECTFB_LDFLAGS}) - endif() - set(HAVE_SDL_VIDEO TRUE) - endif() - endif() -endmacro() - # Requires: # - n/a macro(CheckVivante) @@ -790,7 +633,7 @@ macro(CheckVivante) set(HAVE_VIVANTE TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB VIVANTE_SOURCES ${SDL2_SOURCE_DIR}/src/video/vivante/*.c) + file(GLOB VIVANTE_SOURCES ${SDL3_SOURCE_DIR}/src/video/vivante/*.c) list(APPEND SOURCE_FILES ${VIVANTE_SOURCES}) set(SDL_VIDEO_DRIVER_VIVANTE 1) if(HAVE_VIVANTE_VDK) @@ -909,7 +752,7 @@ macro(CheckPTHREAD) set(PTHREAD_LDFLAGS "-lpthread") elseif(OPENBSD) set(PTHREAD_CFLAGS "-D_REENTRANT") - set(PTHREAD_LDFLAGS "-pthread") + set(PTHREAD_LDFLAGS "-lpthread") elseif(SOLARIS) set(PTHREAD_CFLAGS "-D_REENTRANT") set(PTHREAD_LDFLAGS "-pthread -lposix4") @@ -1004,17 +847,17 @@ macro(CheckPTHREAD) endif() set(SOURCE_FILES ${SOURCE_FILES} - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_sysmutex.c # Can be faked, if necessary - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_syscond.c # Can be faked, if necessary - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systls.c + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_sysmutex.c # Can be faked, if necessary + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_syscond.c # Can be faked, if necessary + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_systls.c ) if(HAVE_PTHREADS_SEM) set(SOURCE_FILES ${SOURCE_FILES} - ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_syssem.c) + ${SDL3_SOURCE_DIR}/src/thread/pthread/SDL_syssem.c) else() set(SOURCE_FILES ${SOURCE_FILES} - ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syssem.c) + ${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syssem.c) endif() set(HAVE_SDL_THREADS TRUE) endif() @@ -1151,7 +994,7 @@ macro(CheckUSBHID) set(SDL_HAVE_MACHINE_JOYSTICK_H 1) endif() set(SDL_JOYSTICK_USBHID 1) - file(GLOB BSD_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/bsd/*.c) + file(GLOB BSD_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/bsd/*.c) list(APPEND SOURCE_FILES ${BSD_JOYSTICK_SOURCES}) list(APPEND EXTRA_CFLAGS ${USB_CFLAGS}) list(APPEND EXTRA_LIBS ${USB_LIBS}) @@ -1168,19 +1011,17 @@ macro(CheckHIDAPI) if(SDL_HIDAPI) if(SDL_HIDAPI_LIBUSB) set(HAVE_LIBUSB FALSE) - pkg_check_modules(LIBUSB libusb-1.0) - if(LIBUSB_FOUND) - check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS}) + pkg_check_modules(PKG_LIBUSB libusb-1.0) + if(PKG_LIBUSB_FOUND) + check_include_file(libusb.h HAVE_LIBUSB_H ${PKG_LIBUSB_CFLAGS}) if(HAVE_LIBUSB_H) set(HAVE_LIBUSB TRUE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PKG_LIBUSB_CFLAGS}") if(HIDAPI_ONLY_LIBUSB) - list(APPEND EXTRA_LIBS ${LIBUSB_LIBRARIES}) - elseif(OS2) - set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"") + list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES}) else() # libusb is loaded dynamically, so don't add it to EXTRA_LIBS - FindLibraryAndSONAME("usb-1.0") + FindLibraryAndSONAME("usb-1.0" LIBDIRS ${PKG_LIBUSB_LIBRARY_DIRS}) if(USB_1.0_LIB) set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"") endif() @@ -1195,10 +1036,10 @@ macro(CheckHIDAPI) if(HAVE_HIDAPI) if(ANDROID) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/hidapi/android/hid.cpp) endif() if(IOS OR TVOS) - list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/ios/hid.m) + list(APPEND SOURCE_FILES ${SDL3_SOURCE_DIR}/src/hidapi/ios/hid.m) set(SDL_FRAMEWORK_COREBLUETOOTH 1) endif() set(HAVE_SDL_HIDAPI TRUE) @@ -1207,7 +1048,7 @@ macro(CheckHIDAPI) set(SDL_JOYSTICK_HIDAPI 1) set(HAVE_SDL_JOYSTICK TRUE) set(HAVE_HIDAPI_JOYSTICK TRUE) - file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c) + file(GLOB HIDAPI_JOYSTICK_SOURCES ${SDL3_SOURCE_DIR}/src/joystick/hidapi/*.c) list(APPEND SOURCE_FILES ${HIDAPI_JOYSTICK_SOURCES}) endif() else() @@ -1248,7 +1089,7 @@ macro(CheckRPI) if(SDL_VIDEO AND HAVE_RPI) set(HAVE_SDL_VIDEO TRUE) set(SDL_VIDEO_DRIVER_RPI 1) - file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) + file(GLOB VIDEO_RPI_SOURCES ${SDL3_SOURCE_DIR}/src/video/raspberry/*.c) list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES}) list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) # !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right? @@ -1266,19 +1107,17 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckKMSDRM) if(SDL_KMSDRM) - pkg_check_modules(KMSDRM libdrm gbm egl) - if(KMSDRM_FOUND AND HAVE_OPENGL_EGL) - link_directories( - ${KMSDRM_LIBRARY_DIRS} - ) - target_include_directories(sdl-build-options INTERFACE "${KMSDRM_INCLUDE_DIRS}") + pkg_check_modules(PKG_KMSDRM libdrm gbm egl) + if(PKG_KMSDRM_FOUND AND HAVE_OPENGL_EGL) + target_link_directories(sdl-build-options INTERFACE ${PKG_KMSDRM_LIBRARY_DIRS}) + target_include_directories(sdl-build-options INTERFACE "${PKG_KMSDRM_INCLUDE_DIRS}") set(HAVE_KMSDRM TRUE) set(HAVE_SDL_VIDEO TRUE) - file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) + file(GLOB KMSDRM_SOURCES ${SDL3_SOURCE_DIR}/src/video/kmsdrm/*.c) list(APPEND SOURCE_FILES ${KMSDRM_SOURCES}) - list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS}) + list(APPEND EXTRA_CFLAGS ${PKG_KMSDRM_CFLAGS}) set(SDL_VIDEO_DRIVER_KMSDRM 1) @@ -1286,13 +1125,13 @@ macro(CheckKMSDRM) message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading") endif() if(SDL_KMSDRM_SHARED AND HAVE_SDL_LOADSO) - FindLibraryAndSONAME(drm) - FindLibraryAndSONAME(gbm) + FindLibraryAndSONAME(drm LIBDIRS ${PKG_KMSDRM_LIBRARY_DIRS}) + FindLibraryAndSONAME(gbm LIBDIRS ${PKG_KMSDRM_LIBRARY_DIRS}) set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") set(HAVE_KMSDRM_SHARED TRUE) else() - list(APPEND EXTRA_LIBS ${KMSDRM_LIBRARIES}) + list(APPEND EXTRA_LIBS ${PKG_KMSDRM_LIBRARIES}) endif() endif() endif() diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 0695e9dfbb..d4e488c542 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -16,109 +16,109 @@ endif() cmake_policy(SET CMP0074 NEW) -# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL2 outside of sysroot +# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL3 outside of sysroot set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) include(FeatureSummary) -option(TEST_SHARED "Test linking to shared SDL2 library" ON) +option(TEST_SHARED "Test linking to shared SDL3 library" ON) add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library") -option(TEST_STATIC "Test linking to static SDL2 libary" ON) +option(TEST_STATIC "Test linking to static SDL3 library" ON) add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library") if(TEST_SHARED) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3) if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE)) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3main) endif() add_executable(gui-shared WIN32 main_gui.c) - if(TARGET SDL2::SDL2main) - target_link_libraries(gui-shared PRIVATE SDL2::SDL2main) + if(TARGET SDL3::SDL3main) + target_link_libraries(gui-shared PRIVATE SDL3::SDL3main) endif() - target_link_libraries(gui-shared PRIVATE SDL2::SDL2) + target_link_libraries(gui-shared PRIVATE SDL3::SDL3) if(WIN32) add_custom_command(TARGET gui-shared POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) endif() add_library(sharedlib-shared SHARED main_lib.c) - target_link_libraries(sharedlib-shared PRIVATE SDL2::SDL2) + target_link_libraries(sharedlib-shared PRIVATE SDL3::SDL3) generate_export_header(sharedlib-shared EXPORT_MACRO_NAME MYLIBRARY_EXPORT) target_compile_definitions(sharedlib-shared PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-shared_export.h\"") set_target_properties(sharedlib-shared PROPERTIES C_VISIBILITY_PRESET "hidden") add_executable(gui-shared-vars WIN32 main_gui.c) - target_link_libraries(gui-shared-vars PRIVATE ${SDL2_LIBRARIES}) - target_include_directories(gui-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(gui-shared-vars PRIVATE ${SDL3_LIBRARIES}) + target_include_directories(gui-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS}) add_executable(cli-shared main_cli.c) - target_link_libraries(cli-shared PRIVATE SDL2::SDL2) + target_link_libraries(cli-shared PRIVATE SDL3::SDL3) if(WIN32) add_custom_command(TARGET cli-shared POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" ) endif() - # SDL2_LIBRARIES does not support creating a cli SDL2 application - # (it is possible that SDL2main is a stub, but we don't know for sure) - if(NOT TARGET SDL2::SDL2main) + # SDL3_LIBRARIES does not support creating a cli SDL3 application + # (it is possible that SDL3main is a stub, but we don't know for sure) + if(NOT TARGET SDL3::SDL3main) add_executable(cli-shared-vars main_cli.c) - target_link_libraries(cli-shared-vars PRIVATE ${SDL2_LIBRARIES}) - target_include_directories(cli-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(cli-shared-vars PRIVATE ${SDL3_LIBRARIES}) + target_include_directories(cli-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS}) endif() add_library(sharedlib-shared-vars SHARED main_lib.c) - target_link_libraries(sharedlib-shared-vars PRIVATE ${SDL2_LIBRARIES}) - target_include_directories(sharedlib-shared-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(sharedlib-shared-vars PRIVATE ${SDL3_LIBRARIES}) + target_include_directories(sharedlib-shared-vars PRIVATE ${SDL3_INCLUDE_DIRS}) generate_export_header(sharedlib-shared-vars EXPORT_MACRO_NAME MYLIBRARY_EXPORT) target_compile_definitions(sharedlib-shared-vars PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-shared-vars_export.h\"") set_target_properties(sharedlib-shared-vars PROPERTIES C_VISIBILITY_PRESET "hidden") endif() if(TEST_STATIC) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2-static) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3-static) if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE)) - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3main) endif() add_executable(gui-static WIN32 main_gui.c) - if(TARGET SDL2::SDL2main) - target_link_libraries(gui-static PRIVATE SDL2::SDL2main) + if(TARGET SDL3::SDL3main) + target_link_libraries(gui-static PRIVATE SDL3::SDL3main) endif() - target_link_libraries(gui-static PRIVATE SDL2::SDL2-static) + target_link_libraries(gui-static PRIVATE SDL3::SDL3-static) option(SDL_STATIC_PIC "SDL static library has been built with PIC") if(SDL_STATIC_PIC OR WIN32) add_library(sharedlib-static SHARED main_lib.c) - target_link_libraries(sharedlib-static PRIVATE SDL2::SDL2-static) + target_link_libraries(sharedlib-static PRIVATE SDL3::SDL3-static) generate_export_header(sharedlib-static EXPORT_MACRO_NAME MYLIBRARY_EXPORT) target_compile_definitions(sharedlib-static PRIVATE "EXPORT_HEADER=\"${CMAKE_CURRENT_BINARY_DIR}/sharedlib-static_export.h\"") set_target_properties(sharedlib-static PROPERTIES C_VISIBILITY_PRESET "hidden") endif() add_executable(gui-static-vars WIN32 main_gui.c) - target_link_libraries(gui-static-vars PRIVATE ${SDL2MAIN_LIBRARY} ${SDL2_STATIC_LIBRARIES}) - target_include_directories(gui-static-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(gui-static-vars PRIVATE ${SDL3MAIN_LIBRARY} ${SDL3_STATIC_LIBRARIES}) + target_include_directories(gui-static-vars PRIVATE ${SDL3_INCLUDE_DIRS}) add_executable(cli-static main_cli.c) - target_link_libraries(cli-static PRIVATE SDL2::SDL2-static) + target_link_libraries(cli-static PRIVATE SDL3::SDL3-static) - # SDL2_LIBRARIES does not support creating a cli SDL2 application (when SDL2::SDL2main is available) - # (it is possible that SDL2main is a stub, but we don't know for sure) - if(NOT TARGET SDL2::SDL2main) + # SDL3_LIBRARIES does not support creating a cli SDL3 application (when SDL3::SDL3main is available) + # (it is possible that SDL3main is a stub, but we don't know for sure) + if(NOT TARGET SDL3::SDL3main) add_executable(cli-static-vars main_cli.c) - target_link_libraries(cli-static-vars PRIVATE ${SDL2_STATIC_LIBRARIES}) - target_include_directories(cli-static-vars PRIVATE ${SDL2_INCLUDE_DIRS}) + target_link_libraries(cli-static-vars PRIVATE ${SDL3_STATIC_LIBRARIES}) + target_include_directories(cli-static-vars PRIVATE ${SDL3_INCLUDE_DIRS}) endif() endif() -message(STATUS "SDL2_PREFIX: ${SDL2_PREFIX}") -message(STATUS "SDL2_INCLUDE_DIR: ${SDL2_INCLUDE_DIR}") -message(STATUS "SDL2_INCLUDE_DIRS: ${SDL2_INCLUDE_DIRS}") -message(STATUS "SDL2_LIBRARIES: ${SDL2_LIBRARIES}") -message(STATUS "SDL2_STATIC_LIBRARIES: ${SDL2_STATIC_LIBRARIES}") -message(STATUS "SDL2MAIN_LIBRARY: ${SDL2MAIN_LIBRARY}") -message(STATUS "SDL2TEST_LIBRARY: ${SDL2TEST_LIBRARY}") +message(STATUS "SDL3_PREFIX: ${SDL3_PREFIX}") +message(STATUS "SDL3_INCLUDE_DIR: ${SDL3_INCLUDE_DIR}") +message(STATUS "SDL3_INCLUDE_DIRS: ${SDL3_INCLUDE_DIRS}") +message(STATUS "SDL3_LIBRARIES: ${SDL3_LIBRARIES}") +message(STATUS "SDL3_STATIC_LIBRARIES: ${SDL3_STATIC_LIBRARIES}") +message(STATUS "SDL3MAIN_LIBRARY: ${SDL3MAIN_LIBRARY}") +message(STATUS "SDL3TEST_LIBRARY: ${SDL3TEST_LIBRARY}") feature_summary(WHAT ALL) diff --git a/cmake/test/jni/Android.mk b/cmake/test/jni/Android.mk index c4956d6859..3934988571 100644 --- a/cmake/test/jni/Android.mk +++ b/cmake/test/jni/Android.mk @@ -4,8 +4,8 @@ include $(CLEAR_VARS) LOCAL_MODULE := main_gui_androidmk LOCAL_SRC_FILES := ../main_gui.c -LOCAL_SHARED_LIBRARIES += SDL2 +LOCAL_SHARED_LIBRARIES += SDL3 include $(BUILD_SHARED_LIBRARY) -$(call import-module,SDL2main) -$(call import-module,SDL2) +$(call import-module,SDL3main) +$(call import-module,SDL3) diff --git a/cmake/test/main_cli.c b/cmake/test/main_cli.c index f6b0836061..2bbedde88e 100644 --- a/cmake/test/main_cli.c +++ b/cmake/test/main_cli.c @@ -5,7 +5,7 @@ int main(int argc, char *argv[]) { SDL_SetMainReady(); if (SDL_Init(0) < 0) { - fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); return 1; } SDL_Delay(100); diff --git a/cmake/test/main_gui.c b/cmake/test/main_gui.c index 4ffe9be1c4..3ba0adbeef 100644 --- a/cmake/test/main_gui.c +++ b/cmake/test/main_gui.c @@ -5,11 +5,11 @@ int main(int argc, char *argv[]) { SDL_Window *window = NULL; SDL_Surface *screenSurface = NULL; if (SDL_Init(SDL_INIT_VIDEO) < 0) { - fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); return 1; } window = SDL_CreateWindow( - "hello_sdl2", + "Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN diff --git a/cmake/test/main_lib.c b/cmake/test/main_lib.c index 9801ed56c5..0f8928b8d9 100644 --- a/cmake/test/main_lib.c +++ b/cmake/test/main_lib.c @@ -17,7 +17,7 @@ int MYLIBRARY_EXPORT mylibrary_work(void); int mylibrary_init(void) { SDL_SetMainReady(); if (SDL_Init(0) < 0) { - fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError()); return 1; } return 0; diff --git a/cmake/test/test_pkgconfig.sh b/cmake/test/test_pkgconfig.sh index 7afc00b096..c2aa3408cf 100755 --- a/cmake/test/test_pkgconfig.sh +++ b/cmake/test/test_pkgconfig.sh @@ -25,9 +25,9 @@ set -e # Get the canonical path of the folder containing this script testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") -CFLAGS="$( pkg-config sdl2 --cflags )" -LDFLAGS="$( pkg-config sdl2 --libs )" -STATIC_LDFLAGS="$( pkg-config sdl2 --libs --static )" +CFLAGS="$( pkg-config sdl3 --cflags )" +LDFLAGS="$( pkg-config sdl3 --libs )" +STATIC_LDFLAGS="$( pkg-config sdl3 --libs --static )" 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} $LDFLAGS $EXTRA_LDFLAGS" diff --git a/cmake/test/test_sdlconfig.sh b/cmake/test/test_sdlconfig.sh index 8de5421dc9..67b62f5c2e 100755 --- a/cmake/test/test_sdlconfig.sh +++ b/cmake/test/test_sdlconfig.sh @@ -25,9 +25,9 @@ set -e # Get the canonical path of the folder containing this script testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") -CFLAGS="$( sdl2-config --cflags )" -LDFLAGS="$( sdl2-config --libs )" -STATIC_LDFLAGS="$( sdl2-config --static-libs )" +CFLAGS="$( sdl3-config --cflags )" +LDFLAGS="$( sdl3-config --libs )" +STATIC_LDFLAGS="$( sdl3-config --static-libs )" 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} $LDFLAGS $EXTRA_LDFLAGS" diff --git a/configure b/configure index f626d12e4c..1e59e861ea 100755 --- a/configure +++ b/configure @@ -683,7 +683,8 @@ SDL_LIBS SDL_CFLAGS bin_prefix_relpath cmake_prefix_relpath -INSTALL_SDL2_CONFIG +SDL_VENDOR_INFO +INSTALL_SDL3_CONFIG LIBUSB_LIBS LIBUSB_CFLAGS IBUS_LIBS @@ -694,8 +695,6 @@ LIBGBM_LIBS LIBGBM_CFLAGS LIBDRM_LIBS LIBDRM_CFLAGS -DIRECTFB_LIBS -DIRECTFB_CFLAGS X_EXTRA_LIBS X_LIBS X_PRE_LIBS @@ -705,16 +704,12 @@ RPI_LIBS RPI_CFLAGS DECOR_LIBS DECOR_CFLAGS -FUSIONSOUND_LIBS -FUSIONSOUND_CFLAGS -ARTSCONFIG +SNDIO_LIBS +SNDIO_CFLAGS PULSEAUDIO_LIBS PULSEAUDIO_CFLAGS PIPEWIRE_LIBS PIPEWIRE_CFLAGS -ESD_CONFIG -ESD_LIBS -ESD_CFLAGS JACK_LIBS JACK_CFLAGS ALSA_LIBS @@ -840,6 +835,7 @@ enable_largefile enable_assertions enable_dependency_tracking enable_libc +enable_system_iconv enable_gcc_atomics enable_atomic enable_audio @@ -876,29 +872,19 @@ enable_alsatest enable_alsa_shared enable_jack enable_jack_shared -enable_esd -with_esd_prefix -with_esd_exec_prefix -enable_esdtest -enable_esd_shared enable_pipewire enable_pipewire_shared enable_pulseaudio enable_pulseaudio_shared -enable_arts -enable_arts_shared -enable_nas -enable_nas_shared enable_sndio enable_sndio_shared -enable_fusionsound -enable_fusionsound_shared enable_diskaudio enable_dummyaudio enable_libsamplerate enable_libsamplerate_shared enable_arm_simd enable_arm_neon +enable_werror enable_video_wayland enable_video_wayland_qt_touch enable_wayland_shared @@ -919,8 +905,6 @@ enable_video_vivante enable_video_cocoa enable_video_metal enable_render_metal -enable_video_directfb -enable_directfb_shared enable_video_kmsdrm enable_kmsdrm_shared enable_video_dummy @@ -949,7 +933,8 @@ enable_backgrounding_signal enable_foregrounding_signal enable_joystick_virtual enable_render_d3d -enable_sdl2_config +enable_sdl3_config +enable_vendor_info ' ac_precious_vars='build_alias host_alias @@ -970,21 +955,17 @@ PKG_CONFIG_LIBDIR CPP JACK_CFLAGS JACK_LIBS -ESD_CFLAGS -ESD_LIBS PIPEWIRE_CFLAGS PIPEWIRE_LIBS PULSEAUDIO_CFLAGS PULSEAUDIO_LIBS -FUSIONSOUND_CFLAGS -FUSIONSOUND_LIBS +SNDIO_CFLAGS +SNDIO_LIBS DECOR_CFLAGS DECOR_LIBS RPI_CFLAGS RPI_LIBS XMKMF -DIRECTFB_CFLAGS -DIRECTFB_LIBS LIBDRM_CFLAGS LIBDRM_LIBS LIBGBM_CFLAGS @@ -1631,6 +1612,8 @@ Optional Features: --enable-dependency-tracking Use gcc -MMD -MT dependency tracking [default=yes] --enable-libc Use the system C library [default=yes] + --enable-system-iconv Use iconv() from system-installed libraries + [default=yes] --enable-gcc-atomics Use gcc builtin atomics [default=yes] --enable-atomic Enable the atomic operations subsystem [default=yes] --enable-audio Enable the audio subsystem [default=yes] @@ -1668,26 +1651,14 @@ Optional Features: --enable-alsa-shared dynamically load ALSA audio support [default=yes] --enable-jack use JACK audio [default=yes] --enable-jack-shared dynamically load JACK audio support [default=yes] - --enable-esd support the Enlightened Sound Daemon [default=yes] - --disable-esdtest Do not try to compile and run a test ESD program - --enable-esd-shared dynamically load ESD audio support [default=yes] --enable-pipewire use Pipewire audio [default=yes] --enable-pipewire-shared dynamically load Pipewire support [default=yes] --enable-pulseaudio use PulseAudio [default=yes] --enable-pulseaudio-shared dynamically load PulseAudio support [default=yes] - --enable-arts support the Analog Real Time Synthesizer - [default=yes] - --enable-arts-shared dynamically load aRts audio support [default=yes] - --enable-nas support the NAS audio API [default=yes] - --enable-nas-shared dynamically load NAS audio support [default=yes] --enable-sndio support the sndio audio API [default=yes] --enable-sndio-shared dynamically load sndio audio support [default=yes] - --enable-fusionsound use FusionSound audio driver [default=no] - --enable-fusionsound-shared - dynamically load fusionsound audio support - [default=yes] --enable-diskaudio support the disk writer audio driver [default=yes] --enable-dummyaudio support the dummy audio driver [default=yes] --enable-libsamplerate use libsamplerate for audio rate conversion @@ -1696,6 +1667,7 @@ Optional Features: dynamically load libsamplerate [default=yes] --enable-arm-simd use SIMD assembly blitters on ARM [default=no] --enable-arm-neon use NEON assembly blitters on ARM [default=no] + --enable-werror treat warnings as errors [default=no] --enable-video-wayland use Wayland video driver [default=yes] --enable-video-wayland-qt-touch QtWayland server support for Wayland video driver @@ -1706,7 +1678,7 @@ Optional Features: --enable-libdecor-shared dynamically load libdecor [default=yes] --enable-video-rpi use Raspberry Pi 2/3 video driver [default=yes] - --enable-video-x11 use X11 video driver [default=yes] + --enable-video-x11 use X11 video driver [default=maybe] --enable-x11-shared dynamically load X11 support [default=maybe] --enable-video-x11-xcursor enable X11 Xcursor support [default=yes] @@ -1727,9 +1699,6 @@ Optional Features: --enable-video-cocoa use Cocoa video driver [default=yes] --enable-video-metal include Metal support [default=yes] --enable-render-metal enable the Metal render driver [default=yes] - --enable-video-directfb use DirectFB video driver [default=no] - --enable-directfb-shared - dynamically load directfb support [default=yes] --enable-video-kmsdrm use KMSDRM video driver [default=yes] --enable-kmsdrm-shared dynamically load kmsdrm support [default=yes] --enable-video-dummy use dummy video driver [default=yes] @@ -1771,7 +1740,9 @@ Optional Features: --enable-joystick-virtual enable virtual joystick APIs [default=yes] --enable-render-d3d enable the Direct3D render driver [default=yes] - --enable-sdl2-config Install sdl2-config [default=yes] + --enable-sdl3-config Install sdl3-config [default=yes] + --enable-vendor-info=STRING + Add vendor info to SDL_REVISION Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1786,8 +1757,6 @@ Optional Packages: compiler's sysroot if not specified). --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional) --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional) - --with-esd-prefix=PFX Prefix where ESD is installed (optional) - --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional) --with-x use the X Window System Some influential environment variables: @@ -1811,8 +1780,6 @@ Some influential environment variables: CPP C preprocessor JACK_CFLAGS C compiler flags for JACK, overriding pkg-config JACK_LIBS linker flags for JACK, overriding pkg-config - ESD_CFLAGS C compiler flags for ESD, overriding pkg-config - ESD_LIBS linker flags for ESD, overriding pkg-config PIPEWIRE_CFLAGS C compiler flags for PIPEWIRE, overriding pkg-config PIPEWIRE_LIBS @@ -1821,20 +1788,15 @@ Some influential environment variables: C compiler flags for PULSEAUDIO, overriding pkg-config PULSEAUDIO_LIBS linker flags for PULSEAUDIO, overriding pkg-config - FUSIONSOUND_CFLAGS - C compiler flags for FUSIONSOUND, overriding pkg-config - FUSIONSOUND_LIBS - linker flags for FUSIONSOUND, overriding pkg-config + SNDIO_CFLAGS + C compiler flags for SNDIO, overriding pkg-config + SNDIO_LIBS linker flags for SNDIO, overriding pkg-config DECOR_CFLAGS C compiler flags for DECOR, overriding pkg-config DECOR_LIBS linker flags for DECOR, overriding pkg-config RPI_CFLAGS C compiler flags for RPI, overriding pkg-config RPI_LIBS linker flags for RPI, overriding pkg-config XMKMF Path to xmkmf, Makefile generator for X Window System - DIRECTFB_CFLAGS - C compiler flags for DIRECTFB, overriding pkg-config - DIRECTFB_LIBS - linker flags for DIRECTFB, overriding pkg-config LIBDRM_CFLAGS C compiler flags for LIBDRM, overriding pkg-config LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config @@ -3436,8 +3398,8 @@ ac_config_headers="$ac_config_headers include/SDL_config.h" orig_CFLAGS="$CFLAGS" # See docs/release_checklist.md -SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=25 +SDL_MAJOR_VERSION=3 +SDL_MINOR_VERSION=0 SDL_MICRO_VERSION=0 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -13057,9 +13019,9 @@ CFLAGS=$lt_save_CFLAGS # For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. +# version twice: libSDL3-3.0.so.0. # TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 -LT_RELEASE=2.0 +LT_RELEASE=3.0 # Increment this if there is an incompatible change - but if that happens, # we should rename the library from SDL2 to SDL3, at which point this would # reset to 0 anyway. @@ -17952,7 +17914,8 @@ test -n "$SORT" || SORT="false" if ! "$SORT" -V /dev/null then : - as_fn_error $? "GNU sort(1) is required" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: sort(1) that supports the -V option is required to find dynamic libraries" >&5 +printf "%s\n" "$as_me: WARNING: sort(1) that supports the -V option is required to find dynamic libraries" >&2;} fi # Check whether --enable-largefile was given. @@ -18170,14 +18133,7 @@ case "$host" in esac INCLUDE="-I$srcdir/include" - -case "$host" in - *-*-nto-qnx*) - ;; - *) - INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos" - ;; -esac +INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos" case "$host" in *-*-haiku*) @@ -18259,7 +18215,7 @@ EXTRA_LDFLAGS="$BASE_LDFLAGS" # fi #done SDL_CFLAGS="$BASE_CFLAGS" -SDL_LIBS="-lSDL2" +SDL_LIBS="-lSDL3" if test "x$BASE_LDFLAGS" != x; then SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS" fi @@ -18676,6 +18632,16 @@ else $as_nop enable_libc=yes fi + +# Check whether --enable-system-iconv was given. +if test ${enable_system_iconv+y} +then : + enableval=$enable_system_iconv; +else $as_nop + enable_system_iconv=yes +fi + + if test x$enable_libc = xyes; then printf "%s\n" "#define HAVE_LIBC 1" >>confdefs.h @@ -18789,6 +18755,12 @@ if test "x$ac_cv_header_signal_h" = xyes then : printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h +fi +ac_fn_c_check_header_compile "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_input_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_INPUT_H 1" >>confdefs.h + fi @@ -19502,6 +19474,12 @@ if test "x$ac_cv_func_strncasecmp" = xyes then : printf "%s\n" "#define HAVE_STRNCASECMP 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr" +if test "x$ac_cv_func_strcasestr" = xyes +then : + printf "%s\n" "#define HAVE_STRCASESTR 1" >>confdefs.h + fi ac_fn_c_check_func "$LINENO" "vsscanf" "ac_cv_func_vsscanf" if test "x$ac_cv_func_vsscanf" = xyes @@ -19883,7 +19861,8 @@ then : fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 + if test x$enable_system_iconv = xyes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 printf %s "checking for iconv_open in -liconv... " >&6; } if test ${ac_cv_lib_iconv_iconv_open+y} then : @@ -19923,13 +19902,14 @@ then : LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" fi - ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" + ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" if test "x$ac_cv_func_iconv" = xyes then : printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi + fi ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include " @@ -20976,16 +20956,8 @@ else $as_nop enable_oss=maybe fi - - # OpenBSD "has" OSS, but it's not really for app use. They want you to - # use sndio instead. So on there, we default to disabled. You can force - # it on if you really want, though. if test x$enable_oss = xmaybe; then enable_oss=yes - case "$host" in - *-*-openbsd*) - enable_oss=no;; - esac fi if test x$enable_audio = xyes -a x$enable_oss = xyes; then @@ -21011,33 +20983,6 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : have_oss=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - fi - if test x$have_oss != xyes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int -main (void) -{ - - int arg = SNDCTL_DSP_SETFRAGMENT; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - - have_oss=yes - -printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1" >>confdefs.h - - fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi @@ -21053,7 +20998,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_OSS 1" >>confdefs.h # We may need to link with ossaudio emulation library case "$host" in - *-*-openbsd*|*-*-netbsd*) + *-*-netbsd*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";; esac fi @@ -21448,376 +21393,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_JACK_DYNAMIC \"$jack_lib\"" >>confdefs.h fi } -CheckESD() -{ - # Check whether --enable-esd was given. -if test ${enable_esd+y} -then : - enableval=$enable_esd; -else $as_nop - enable_esd=yes -fi - - if test x$enable_audio = xyes -a x$enable_esd = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for esound >= 0.2.8" >&5 -printf %s "checking for esound >= 0.2.8... " >&6; } - -if test -n "$ESD_CFLAGS"; then - pkg_cv_ESD_CFLAGS="$ESD_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"esound >= 0.2.8\""; } >&5 - ($PKG_CONFIG --exists --print-errors "esound >= 0.2.8") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_ESD_CFLAGS=`$PKG_CONFIG --cflags "esound >= 0.2.8" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$ESD_LIBS"; then - pkg_cv_ESD_LIBS="$ESD_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"esound >= 0.2.8\""; } >&5 - ($PKG_CONFIG --exists --print-errors "esound >= 0.2.8") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_ESD_LIBS=`$PKG_CONFIG --libs "esound >= 0.2.8" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - ESD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "esound >= 0.2.8" 2>&1` - else - ESD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "esound >= 0.2.8" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$ESD_PKG_ERRORS" >&5 - - have_esd=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - have_esd=no -else - ESD_CFLAGS=$pkg_cv_ESD_CFLAGS - ESD_LIBS=$pkg_cv_ESD_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - have_esd=yes -fi - if test x$have_esd = xno; then - -# Check whether --with-esd-prefix was given. -if test ${with_esd_prefix+y} -then : - withval=$with_esd_prefix; esd_prefix="$withval" -else $as_nop - esd_prefix="" -fi - - -# Check whether --with-esd-exec-prefix was given. -if test ${with_esd_exec_prefix+y} -then : - withval=$with_esd_exec_prefix; esd_exec_prefix="$withval" -else $as_nop - esd_exec_prefix="" -fi - -# Check whether --enable-esdtest was given. -if test ${enable_esdtest+y} -then : - enableval=$enable_esdtest; -else $as_nop - enable_esdtest=yes -fi - - - if test x$esd_exec_prefix != x ; then - esd_args="$esd_args --exec-prefix=$esd_exec_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_exec_prefix/bin/esd-config - fi - fi - if test x$esd_prefix != x ; then - esd_args="$esd_args --prefix=$esd_prefix" - if test x${ESD_CONFIG+set} != xset ; then - ESD_CONFIG=$esd_prefix/bin/esd-config - fi - fi - - # Extract the first word of "esd-config", so it can be a program name with args. -set dummy esd-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ESD_CONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $ESD_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ESD_CONFIG="$ESD_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ESD_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_ESD_CONFIG" && ac_cv_path_ESD_CONFIG="no" - ;; -esac -fi -ESD_CONFIG=$ac_cv_path_ESD_CONFIG -if test -n "$ESD_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ESD_CONFIG" >&5 -printf "%s\n" "$ESD_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - min_esd_version=0.2.8 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ESD - version >= $min_esd_version" >&5 -printf %s "checking for ESD - version >= $min_esd_version... " >&6; } - no_esd="" - if test "$ESD_CONFIG" = "no" ; then - no_esd=yes - else - ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` - ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` - - esd_major_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - esd_minor_version=`$ESD_CONFIG $esd_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_esdtest" = "xyes" ; then - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" - rm -f conf.esdtest - if test "$cross_compiling" = yes -then : - echo $ac_n "cross compiling; assumed OK... $ac_c" -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include - -int main (void) -{ - int major, minor, micro; - FILE *fp = fopen("conf.esdtest", "w"); - - if (fp) fclose(fp); - - if (sscanf("$min_esd_version", "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_esd_version"); - exit(1); - } - - if (($esd_major_version > major) || - (($esd_major_version == major) && ($esd_minor_version > minor)) || - (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); - printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); - printf("*** to point to the correct copy of esd-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - -else $as_nop - no_esd=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - fi - fi - if test "x$no_esd" = x ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - have_esd=yes - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - if test "$ESD_CONFIG" = "no" ; then - : - else - if test -f conf.esdtest ; then - : - else - echo "*** Could not run ESD test program, checking why..." - CFLAGS="$CFLAGS $ESD_CFLAGS" - LIBS="$LIBS $ESD_LIBS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main (void) -{ - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding ESD or finding the wrong" - echo "*** version of ESD. If it is not finding ESD, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else $as_nop - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means ESD was incorrectly installed" - echo "*** or that you have moved ESD since it was installed. In the latter case, you" - echo "*** may want to edit the esd-config script: $ESD_CONFIG" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - fi - fi - ESD_CFLAGS="" - ESD_LIBS="" - have_esd=no - fi - - - rm -f conf.esdtest - - fi - if test x$have_esd = xyes; then - # Check whether --enable-esd-shared was given. -if test ${enable_esd_shared+y} -then : - enableval=$enable_esd_shared; -else $as_nop - enable_esd_shared=yes -fi - - esd_lib=`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_esd_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ESD loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_esd_shared = xyes && test x$esd_lib != x; then - echo "-- dynamic libesd -> $esd_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ESD_DYNAMIC \"$esd_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} esd(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS" - SUMMARY_audio="${SUMMARY_audio} esd" - fi - have_audio=yes - fi - fi -} - CheckPipewire() { # Check whether --enable-pipewire was given. @@ -22066,247 +21641,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC \"$pulseaudio_lib\"" fi } -CheckARTSC() -{ - # Check whether --enable-arts was given. -if test ${enable_arts+y} -then : - enableval=$enable_arts; -else $as_nop - enable_arts=yes -fi - - if test x$enable_audio = xyes -a x$enable_arts = xyes; then - # Extract the first word of "artsc-config", so it can be a program name with args. -set dummy artsc-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ARTSCONFIG+y} -then : - printf %s "(cached) " >&6 -else $as_nop - case $ARTSCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ARTSCONFIG="$ARTSCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ARTSCONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ARTSCONFIG=$ac_cv_path_ARTSCONFIG -if test -n "$ARTSCONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ARTSCONFIG" >&5 -printf "%s\n" "$ARTSCONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then - : # arts isn't installed - else - ARTS_CFLAGS=`$ARTSCONFIG --cflags` - ARTS_LIBS=`$ARTSCONFIG --libs` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for aRts development environment" >&5 -printf %s "checking for aRts development environment... " >&6; } - audio_arts=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ARTS_CFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int -main (void) -{ - - arts_stream_t stream; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - audio_arts=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS="$save_CFLAGS" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $audio_arts" >&5 -printf "%s\n" "$audio_arts" >&6; } - if test x$audio_arts = xyes; then - # Check whether --enable-arts-shared was given. -if test ${enable_arts_shared+y} -then : - enableval=$enable_arts_shared; -else $as_nop - enable_arts_shared=yes -fi - - arts_lib=`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_arts_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic ARTS loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_arts_shared = xyes && test x$arts_lib != x; then - echo "-- dynamic libartsc -> $arts_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_ARTS_DYNAMIC \"$arts_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} arts(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS" - SUMMARY_audio="${SUMMARY_audio} arts" - fi - have_audio=yes - fi - fi - fi -} - -CheckNAS() -{ - # Check whether --enable-nas was given. -if test ${enable_nas+y} -then : - enableval=$enable_nas; -else $as_nop - enable_nas=yes -fi - - if test x$enable_audio = xyes -a x$enable_nas = xyes; then - ac_fn_c_check_header_compile "$LINENO" "audio/audiolib.h" "ac_cv_header_audio_audiolib_h" "$ac_includes_default" -if test "x$ac_cv_header_audio_audiolib_h" = xyes -then : - have_nas_hdr=yes -fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for AuOpenServer in -laudio" >&5 -printf %s "checking for AuOpenServer in -laudio... " >&6; } -if test ${ac_cv_lib_audio_AuOpenServer+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-laudio $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 AuOpenServer (); -int -main (void) -{ -return AuOpenServer (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_audio_AuOpenServer=yes -else $as_nop - ac_cv_lib_audio_AuOpenServer=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_audio_AuOpenServer" >&5 -printf "%s\n" "$ac_cv_lib_audio_AuOpenServer" >&6; } -if test "x$ac_cv_lib_audio_AuOpenServer" = xyes -then : - have_nas_lib=yes -fi - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NAS audio support" >&5 -printf %s "checking for NAS audio support... " >&6; } - have_nas=no - - if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then - have_nas=yes - NAS_LIBS="-laudio" - - elif test -r /usr/X11R6/include/audio/audiolib.h; then - have_nas=yes - NAS_CFLAGS="-I/usr/X11R6/include/" - NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" - - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5 -printf "%s\n" "$have_nas" >&6; } - - if test x$have_nas = xyes; then - # Check whether --enable-nas-shared was given. -if test ${enable_nas_shared+y} -then : - enableval=$enable_nas_shared; -else $as_nop - enable_nas_shared=yes -fi - - nas_lib=`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - - if test x$have_loadso != xyes && \ - test x$enable_nas_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic NAS loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_nas_shared = xyes && test x$nas_lib != x; then - echo "-- dynamic libaudio -> $nas_lib" - -printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS_DYNAMIC \"$nas_lib\"" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} nas(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS" - SUMMARY_audio="${SUMMARY_audio} nas" - fi - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_NAS 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" - have_audio=yes - fi - fi -} - CheckSNDIO() { # Check whether --enable-sndio was given. @@ -22318,66 +21652,79 @@ else $as_nop fi if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - ac_fn_c_check_header_compile "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default" -if test "x$ac_cv_header_sndio_h" = xyes -then : - have_sndio_hdr=yes -fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5 -printf %s "checking for sio_open in -lsndio... " >&6; } -if test ${ac_cv_lib_sndio_sio_open+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsndio $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sndio" >&5 +printf %s "checking for sndio... " >&6; } -/* 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 sio_open (); -int -main (void) -{ -return sio_open (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_lib_sndio_sio_open=yes -else $as_nop - ac_cv_lib_sndio_sio_open=no +if test -n "$SNDIO_CFLAGS"; then + pkg_cv_SNDIO_CFLAGS="$SNDIO_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sndio") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SNDIO_CFLAGS=`$PKG_CONFIG --cflags "sndio" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + else + pkg_failed=untried fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5 -printf "%s\n" "$ac_cv_lib_sndio_sio_open" >&6; } -if test "x$ac_cv_lib_sndio_sio_open" = xyes -then : - have_sndio_lib=yes +if test -n "$SNDIO_LIBS"; then + pkg_cv_SNDIO_LIBS="$SNDIO_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5 + ($PKG_CONFIG --exists --print-errors "sndio") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SNDIO_LIBS=`$PKG_CONFIG --libs "sndio" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sndio audio support" >&5 -printf %s "checking for sndio audio support... " >&6; } - have_sndio=no - if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then - have_sndio=yes - SNDIO_LIBS="-lsndio" +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SNDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sndio" 2>&1` + else + SNDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sndio" 2>&1` fi + # Put the nasty error message in config.log where it belongs + echo "$SNDIO_PKG_ERRORS" >&5 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_sndio" >&5 -printf "%s\n" "$have_sndio" >&6; } + audio_sndio=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + audio_sndio=no +else + SNDIO_CFLAGS=$pkg_cv_SNDIO_CFLAGS + SNDIO_LIBS=$pkg_cv_SNDIO_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + audio_sndio=yes +fi - if test x$have_sndio = xyes; then + if test x$audio_sndio = xyes; then # Check whether --enable-sndio-shared was given. if test ${enable_sndio_shared+y} then : @@ -22415,131 +21762,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h fi } -CheckFusionSound() -{ - # Check whether --enable-fusionsound was given. -if test ${enable_fusionsound+y} -then : - enableval=$enable_fusionsound; -else $as_nop - enable_fusionsound=no -fi - - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fusionsound >= 1.1.1" >&5 -printf %s "checking for fusionsound >= 1.1.1... " >&6; } - -if test -n "$FUSIONSOUND_CFLAGS"; then - pkg_cv_FUSIONSOUND_CFLAGS="$FUSIONSOUND_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags "fusionsound >= 1.1.1" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$FUSIONSOUND_LIBS"; then - pkg_cv_FUSIONSOUND_LIBS="$FUSIONSOUND_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fusionsound >= 1.1.1\""; } >&5 - ($PKG_CONFIG --exists --print-errors "fusionsound >= 1.1.1") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_FUSIONSOUND_LIBS=`$PKG_CONFIG --libs "fusionsound >= 1.1.1" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - FUSIONSOUND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fusionsound >= 1.1.1" 2>&1` - else - FUSIONSOUND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fusionsound >= 1.1.1" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$FUSIONSOUND_PKG_ERRORS" >&5 - - fusionsound=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fusionsound=no -else - FUSIONSOUND_CFLAGS=$pkg_cv_FUSIONSOUND_CFLAGS - FUSIONSOUND_LIBS=$pkg_cv_FUSIONSOUND_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - fusionsound=yes -fi - - if test x$fusionsound = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - # Check whether --enable-fusionsound-shared was given. -if test ${enable_fusionsound_shared+y} -then : - enableval=$enable_fusionsound_shared; -else $as_nop - enable_fusionsound_shared=yes -fi - - fusionsound_shared=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 -printf %s "checking for FusionSound dynamic loading support... " >&6; } - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC \"libfusionsound.so\"" >>confdefs.h - - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 -printf "%s\n" "$fusionsound_shared" >&6; } - - have_audio=yes - fi - fi -} - CheckDiskAudio() { # Check whether --enable-diskaudio was given. @@ -22773,6 +21995,41 @@ printf "%s\n" "$have_clang_objc_arc" >&6; } fi } +CheckGDwarf4() +{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -gdwarf-4 option" >&5 +printf %s "checking for GCC -gdwarf-4 option... " >&6; } + have_gcc_gdwarf4=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -gdwarf-4" + 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_gdwarf4=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_gdwarf4" >&5 +printf "%s\n" "$have_gcc_gdwarf4" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_gdwarf4 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4" + fi +} + CheckVisibilityHidden() { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 @@ -22881,6 +22138,86 @@ printf "%s\n" "$have_gcc_preferred_stack_boundary" >&6; } fi } +CheckWerror() +{ + # Check whether --enable-werror was given. +if test ${enable_werror+y} +then : + enableval=$enable_werror; enable_werror=$enableval +else $as_nop + enable_werror=no +fi + + if test x$enable_werror = xyes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 +printf %s "checking for GCC -Werror option... " >&6; } + have_gcc_werror=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Werror" + 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_werror=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_werror" >&5 +printf "%s\n" "$have_gcc_werror" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_werror = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Werror" + fi + fi +} + +CheckNoErrorDeprecatedDeclarationsWerror() +{ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wno-error=deprecated-declarations option" >&5 +printf %s "checking for GCC -Wno-error=deprecated-declarations option... " >&6; } + have_gcc_no_werror_deprecated_declarations=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations" + 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_no_werror_deprecated_declarations=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_werror" >&5 +printf "%s\n" "$have_gcc_werror" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_no_werror_deprecated_declarations = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations" + fi +} + CheckDeclarationAfterStatement() { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wdeclaration-after-statement option" >&5 @@ -23201,59 +22538,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR \"$decor_lib\"" fi } -CheckNativeClient() -{ - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #if !defined(__native_client__) - #error "NO NACL" - #endif - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - - -printf "%s\n" "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h - - -printf "%s\n" "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h - - -printf "%s\n" "#define HAVE_POW 1" >>confdefs.h - - -printf "%s\n" "#define HAVE_OPENGLES2 1" >>confdefs.h - - -printf "%s\n" "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h - - -printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h - - - SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS" - - SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" - SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" - SUMMARY_audio="${SUMMARY_audio} nacl" - have_audio=yes - SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" - SUMMARY_video="${SUMMARY_video} nacl opengles2" - have_video=yes - -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -} - CheckRPI() { # Check whether --enable-video-rpi was given. @@ -23407,9 +22691,16 @@ if test ${enable_video_x11+y} then : enableval=$enable_video_x11; else $as_nop - enable_video_x11=yes + + enable_video_x11=yes + case "$host" in + *-*-darwin*|*-ios-*) + enable_video_x11=no + ;; + esac fi + if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then case "$host" in *-*-darwin*) @@ -25065,149 +24356,6 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h fi } -CheckDirectFB() -{ - # Check whether --enable-video-directfb was given. -if test ${enable_video_directfb+y} -then : - enableval=$enable_video_directfb; -else $as_nop - enable_video_directfb=no -fi - - if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for directfb >= 1.0.0" >&5 -printf %s "checking for directfb >= 1.0.0... " >&6; } - -if test -n "$DIRECTFB_CFLAGS"; then - pkg_cv_DIRECTFB_CFLAGS="$DIRECTFB_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags "directfb >= 1.0.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$DIRECTFB_LIBS"; then - pkg_cv_DIRECTFB_LIBS="$DIRECTFB_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"directfb >= 1.0.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "directfb >= 1.0.0") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_DIRECTFB_LIBS=`$PKG_CONFIG --libs "directfb >= 1.0.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - DIRECTFB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "directfb >= 1.0.0" 2>&1` - else - DIRECTFB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "directfb >= 1.0.0" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$DIRECTFB_PKG_ERRORS" >&5 - - video_directfb=no -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - video_directfb=no -else - DIRECTFB_CFLAGS=$pkg_cv_DIRECTFB_CFLAGS - DIRECTFB_LIBS=$pkg_cv_DIRECTFB_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - video_directfb=yes -fi - - if test x$video_directfb = xyes; then - # SuSE 11.1 installs directfb-config without directfb-devel - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS" - ac_fn_c_check_header_compile "$LINENO" "directfb.h" "ac_cv_header_directfb_h" "$ac_includes_default" -if test "x$ac_cv_header_directfb_h" = xyes -then : - have_directfb_hdr=yes -else $as_nop - have_directfb_hdr=no -fi - - CPPFLAGS="$save_CPPFLAGS" - video_directfb=$have_directfb_hdr - fi - - if test x$video_directfb = xyes; then - # Check whether --enable-directfb-shared was given. -if test ${enable_directfb_shared+y} -then : - enableval=$enable_directfb_shared; -else $as_nop - enable_directfb_shared=yes -fi - - - -printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h - - -printf "%s\n" "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" - - directfb_shared=no - directfb_lib=`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` - if test x$have_loadso != xyes && \ - test x$enable_directfb_shared = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&5 -printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic directfb loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then - directfb_shared=yes - echo "-- dynamic libdirectfb -> $directfb_lib" - -printf "%s\n" "#define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC \"$directfb_lib\"" >>confdefs.h - - SUMMARY_video="${SUMMARY_video} directfb(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS" - SUMMARY_video="${SUMMARY_video} directfb" - fi - SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS" - have_video=yes - fi - fi -} - CheckKMSDRM() { # Check whether --enable-video-kmsdrm was given. @@ -25466,32 +24614,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_OFFSCREEN 1" >>confdefs.h fi } -CheckQNXVideo() -{ - if test x$enable_video = xyes; then - -printf "%s\n" "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" - have_video=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" - SUMMARY_video="${SUMMARY_video} qnx" - fi -} - -CheckQNXAudio() -{ - if test x$enable_audio = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" - have_audio=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" - SUMMARY_audio="${SUMMARY_audio} qsa" - fi -} - # Check whether --enable-video-opengl was given. if test ${enable_video_opengl+y} then : @@ -26653,7 +25775,7 @@ fi ;; *-*-openbsd*) pthread_cflags="-D_REENTRANT" - pthread_lib="-pthread" + pthread_lib="-lpthread" ;; *-*-solaris2.9) # From Solaris 9+, posix4's preferred name is rt. @@ -26686,10 +25808,6 @@ fi pthread_cflags="-D_REENTRANT" pthread_lib="" ;; - *-*-nto*) - pthread_cflags="-D_REENTRANT" - pthread_lib="" - ;; *-*-emscripten*) pthread_cflags="-D_REENTRANT -pthread" pthread_lib="-pthread" @@ -27095,36 +26213,6 @@ printf "%s\n" "#define HAVE_SHELLSCALINGAPI_H 1" >>confdefs.h fi } -CheckOS2() -{ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OS/2 compiler" >&5 -printf %s "checking OS/2 compiler... " >&6; } - have_os2_gcc=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_os2_gcc=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_os2_gcc" >&5 -printf "%s\n" "$have_os2_gcc" >&6; } - if test x$have_os2_gcc != xyes; then - as_fn_error $? " -*** Your compiler ($CC) does not produce OS/2 executables! - " "$LINENO" 5 - fi -} - CheckDIRECTX() { # Check whether --enable-directx was given. @@ -27867,9 +26955,6 @@ fi enable_hidapi_libusb=yes require_hidapi_libusb=yes ;; - *-*-os2* ) - enable_hidapi_libusb=yes - ;; esac hidapi_support=yes @@ -27982,9 +27067,6 @@ printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynam *-*-cygwin* | *-*-mingw* ) libusb_lib="libusb-1.0.dll" ;; - *-*-os2* ) - libusb_lib="usb100.dll" - ;; esac if test x$libusb_lib = x; then libusb_lib=`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` @@ -28196,7 +27278,7 @@ CheckEventSignals have_locale=no case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) case "$host" in *-*-android*) # Android @@ -28232,11 +27314,9 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; - *-*-nto*) ARCH=nto - CheckQNXVideo - ;; esac CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -28251,16 +27331,11 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h CheckPipewire CheckPulseAudio CheckJACK - CheckARTSC - CheckESD - CheckNAS CheckSNDIO - CheckFusionSound CheckLibSampleRate # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! CheckRPI CheckX11 - CheckDirectFB # Need to check for EGL first because KMSDRM and Wayland depends on it. CheckEGL CheckKMSDRM @@ -28308,14 +27383,6 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in - sysv5|solaris|hpux) - -printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" - SUMMARY_audio="${SUMMARY_audio} sun" - have_audio=yes - ;; netbsd) # Don't use this on OpenBSD, it's busted. printf "%s\n" "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h @@ -28324,14 +27391,6 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; - aix) - -printf "%s\n" "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" - SUMMARY_audio="${SUMMARY_audio} paudio" - have_audio=yes - ;; android) printf "%s\n" "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h @@ -28353,24 +27412,23 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_AAUDIO 1" >>confdefs.h have_audio=yes ;; - nto) - CheckQNXAudio - ;; esac fi # Set up files for the joystick library if test x$enable_joystick = xyes; then case $ARCH in linux) + if test "x$ac_cv_header_linux_input_h" = xyes; then printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" - have_joystick=yes + SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" + have_joystick=yes + fi ;; freebsd) - if test x$use_input_events = xyes; then + if test x$use_input_events = xyes -a x$ac_cv_header_linux_input_h = xyes; then printf "%s\n" "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h @@ -28503,6 +27561,8 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h if test x$enable_loadso = xyes; then have_loadso=yes fi + CheckGDwarf4 + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -28563,11 +27623,6 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_D3D12 1" >>confdefs.h fi # Set up files for the audio library if test x$enable_audio = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_WINMM 1" >>confdefs.h - - SUMMARY_audio="${SUMMARY_audio} winmm" - SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then printf "%s\n" "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h @@ -28702,7 +27757,7 @@ printf "%s\n" "#define SDL_LOADSO_WINDOWS 1" >>confdefs.h VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" - SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows" + SDL_LIBS="-lSDL3main $SDL_LIBS -mwindows" # Check to see if this is a mingw or cygwin build have_mingw32= @@ -28826,6 +27881,8 @@ printf "%s\n" "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h ARCH=ios CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -28931,7 +27988,11 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" SUMMARY_video="${SUMMARY_video} uikit" have_video=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" + if test x$enable_system_iconv = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" + fi + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" @@ -28959,6 +28020,8 @@ printf "%s\n" "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h CheckObjectiveCARC CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -29057,33 +28120,6 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" fi ;; - *-nacl|*-pnacl) - ARCH=nacl - CheckNativeClient - CheckDummyAudio - CheckDummyVideo - CheckOffscreenVideo - CheckInputEvents - CheckPTHREAD - CheckO_CLOEXEC - - # Set up files for the timer library - if test x$enable_timers = xyes; then - -printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" - have_timers=yes - fi - - if test x$enable_filesystem = xyes; then - -printf "%s\n" "#define SDL_FILESYSTEM_NACL 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c" - have_filesystem=yes - fi - ;; *-*-emscripten* ) if test x$enable_video = xyes; then @@ -29104,6 +28140,7 @@ printf "%s\n" "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h fi CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -29163,6 +28200,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h *-*-riscos*) ARCH=riscos CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -29205,97 +28243,6 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h have_timers=yes fi ;; - *-*-os2*) - ARCH=os2 - if test "$build" != "$host"; then # cross-compiling - # Default cross-compile location - ac_default_prefix=/@unixroot/usr/local/cross-tools/$host - else - # Look for the location of the tools and install there - if test "$BUILD_PREFIX" != ""; then - ac_default_prefix=$BUILD_PREFIX - fi - fi - enable_static=no # disable static builds - EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" - CheckOS2 - CheckDeclarationAfterStatement - CheckDummyVideo - CheckDiskAudio - CheckDummyAudio - CheckHIDAPI - - # Set up the core platform files - SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" - fi - # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi - # Set up files for the video library - if test x$enable_video = xyes; then - -printf "%s\n" "#define SDL_VIDEO_DRIVER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/video/os2/*.c" - have_video=yes - SUMMARY_video="${SUMMARY_video} os/2" - fi - # Set up files for the audio library - if test x$enable_audio = xyes; then - -printf "%s\n" "#define SDL_AUDIO_DRIVER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" - have_audio=yes - SUMMARY_audio="${SUMMARY_audio} os/2" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" - fi - # Set up files for the thread library - if test x$enable_threads = xyes; then - -printf "%s\n" "#define SDL_THREAD_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" - SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" - have_threads=yes - fi - # Set up files for the timer library - if test x$enable_timers = xyes; then - -printf "%s\n" "#define SDL_TIMER_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" - have_timers=yes - fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - -printf "%s\n" "#define SDL_LOADSO_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" - have_loadso=yes - fi - # Set up files for the filesystem library - if test x$enable_filesystem = xyes; then - -printf "%s\n" "#define SDL_FILESYSTEM_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" - have_filesystem=yes - fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - -printf "%s\n" "#define SDL_JOYSTICK_OS2 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" - have_joystick=yes - fi - ;; *) as_fn_error $? " *** Unsupported host: Please add to configure.ac @@ -29305,29 +28252,44 @@ esac CheckVirtualJoystick -# Check whether to install sdl2-config -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to install sdl2-config" >&5 -printf %s "checking whether to install sdl2-config... " >&6; } -# Check whether --enable-sdl2-config was given. -if test ${enable_sdl2_config+y} +# Check whether to install sdl3-config +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to install sdl3-config" >&5 +printf %s "checking whether to install sdl3-config... " >&6; } +# Check whether --enable-sdl3-config was given. +if test ${enable_sdl3_config+y} then : - enableval=$enable_sdl2_config; case "${enableval}" in - yes) enable_sdl2_config="TRUE" ;; - no) enable_sdl2_config="FALSE" ;; - *) as_fn_error $? "bad value '${enableval}' for --enable-sdl2-config" "$LINENO" 5 ;; + enableval=$enable_sdl3_config; case "${enableval}" in + yes) enable_sdl3_config="TRUE" ;; + no) enable_sdl3_config="FALSE" ;; + *) as_fn_error $? "bad value '${enableval}' for --enable-sdl3-config" "$LINENO" 5 ;; esac else $as_nop - enable_sdl2_config="TRUE" + enable_sdl3_config="TRUE" fi -if test "$enable_sdl2_config" = "TRUE"; then +if test "$enable_sdl3_config" = "TRUE"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi -INSTALL_SDL2_CONFIG=$enable_sdl2_config +INSTALL_SDL3_CONFIG=$enable_sdl3_config + + +# Check whether --enable-vendor-info was given. +if test ${enable_vendor_info+y} +then : + enableval=$enable_vendor_info; enable_vendor_info="$enableval" +else $as_nop + enable_vendor_info= +fi + +if test "$enable_vendor_info" = no +then : + enable_vendor_info= +fi +SDL_VENDOR_INFO=$enable_vendor_info # Verify that we have all the platform specific files we need @@ -29526,7 +28488,7 @@ fi SDL_STATIC_LIBS="$EXTRA_LDFLAGS" -pkg_cmakedir='$libdir/cmake/SDL2' +pkg_cmakedir='$libdir/cmake/SDL3' for _lcl_i in pkg_cmakedir:prefix:cmake_prefix_relpath bindir:prefix:bin_prefix_relpath; do _lcl_from=\$`echo "$_lcl_i" | sed 's,:.*$,,'` _lcl_to=\$`echo "$_lcl_i" | sed 's,^[^:]*:,,' | sed 's,:[^:]*$,,'` @@ -29678,12 +28640,12 @@ $SDLTEST_DEPENDS $WAYLAND_PROTOCOLS_DEPENDS __EOF__ -ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc" +ac_config_files="$ac_config_files Makefile:Makefile.in:Makefile.rules sdl3-config sdl3-config.cmake sdl3-config-version.cmake SDL3.spec sdl3.pc" -ac_config_commands="$ac_config_commands sdl2_config" +ac_config_commands="$ac_config_commands sdl3_config" -SUMMARY="SDL2 Configure Summary:\n" +SUMMARY="SDL3 Configure Summary:\n" if test x$enable_shared = xyes; then SUMMARY="${SUMMARY}Building Shared Libraries\n" fi @@ -30919,12 +29881,12 @@ do "include/SDL_config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/SDL_config.h" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.in:Makefile.rules" ;; - "sdl2-config") CONFIG_FILES="$CONFIG_FILES sdl2-config" ;; - "sdl2-config.cmake") CONFIG_FILES="$CONFIG_FILES sdl2-config.cmake" ;; - "sdl2-config-version.cmake") CONFIG_FILES="$CONFIG_FILES sdl2-config-version.cmake" ;; - "SDL2.spec") CONFIG_FILES="$CONFIG_FILES SDL2.spec" ;; - "sdl2.pc") CONFIG_FILES="$CONFIG_FILES sdl2.pc" ;; - "sdl2_config") CONFIG_COMMANDS="$CONFIG_COMMANDS sdl2_config" ;; + "sdl3-config") CONFIG_FILES="$CONFIG_FILES sdl3-config" ;; + "sdl3-config.cmake") CONFIG_FILES="$CONFIG_FILES sdl3-config.cmake" ;; + "sdl3-config-version.cmake") CONFIG_FILES="$CONFIG_FILES sdl3-config-version.cmake" ;; + "SDL3.spec") CONFIG_FILES="$CONFIG_FILES SDL3.spec" ;; + "sdl3.pc") CONFIG_FILES="$CONFIG_FILES sdl3.pc" ;; + "sdl3_config") CONFIG_COMMANDS="$CONFIG_COMMANDS sdl3_config" ;; "summary") CONFIG_COMMANDS="$CONFIG_COMMANDS summary" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -32348,7 +31310,7 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX _LT_EOF ;; - "sdl2_config":C) chmod a+x sdl2-config ;; + "sdl3_config":C) chmod a+x sdl3-config ;; "summary":C) printf "$SUMMARY" ;; esac diff --git a/configure.ac b/configure.ac index 4a4023e194..f8e71411dd 100644 --- a/configure.ac +++ b/configure.ac @@ -11,18 +11,18 @@ orig_CFLAGS="$CFLAGS" dnl Set various version strings - taken gratefully from the GTk sources # See docs/release_checklist.md -SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=25 +SDL_MAJOR_VERSION=3 +SDL_MINOR_VERSION=0 SDL_MICRO_VERSION=0 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` AS_CASE(["$SDL_MINOR_VERSION"], [*@<:@02468@:>@], - dnl Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1 + dnl Stable branch, 3.24.1 -> libSDL3-3.0.so.0.2400.1 [SDL_INTERFACE_AGE="$SDL_MICRO_VERSION"], [*], - dnl Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0 + dnl Development branch, 3.23.1 -> libSDL3-3.0.so.0.2301.0 [SDL_INTERFACE_AGE=0]) AC_SUBST(SDL_MAJOR_VERSION) @@ -37,9 +37,9 @@ LT_INIT([win32-dll]) LT_LANG([Windows Resource]) # For historical reasons, the library name redundantly includes the major -# version twice: libSDL2-2.0.so.0. +# version twice: libSDL3-3.0.so.0. # TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0 -LT_RELEASE=2.0 +LT_RELEASE=3.0 # Increment this if there is an incompatible change - but if that happens, # we should rename the library from SDL2 to SDL3, at which point this would # reset to 0 anyway. @@ -71,7 +71,7 @@ if [ test -z "$AWK" ]; then fi AC_CHECK_PROGS([SORT], [gsort sort], [false]) -AS_IF([! "$SORT" -V /dev/null], [AC_MSG_ERROR([GNU sort(1) is required])]) +AS_IF([! "$SORT" -V /dev/null], [AC_MSG_WARN([sort(1) that supports the -V option is required to find dynamic libraries])]) dnl 64-bit file offsets if possible unless --disable-largefile is specified AC_SYS_LARGEFILE @@ -88,15 +88,7 @@ esac dnl Set up the compiler and linker flags INCLUDE="-I$srcdir/include" - -dnl Don't use our khronos headers on QNX. -case "$host" in - *-*-nto-qnx*) - ;; - *) - INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos" - ;; -esac +INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos" dnl use CXX for linker on Haiku case "$host" in @@ -162,7 +154,7 @@ EXTRA_LDFLAGS="$BASE_LDFLAGS" # fi #done SDL_CFLAGS="$BASE_CFLAGS" -SDL_LIBS="-lSDL2" +SDL_LIBS="-lSDL3" if test "x$BASE_LDFLAGS" != x; then SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS" fi @@ -317,13 +309,19 @@ dnl See whether we are allowed to use the system C library AC_ARG_ENABLE(libc, [AS_HELP_STRING([--enable-libc], [Use the system C library [default=yes]])], , enable_libc=yes) + +dnl See whether we are allowed to use libiconv +AC_ARG_ENABLE(system-iconv, +[AS_HELP_STRING([--enable-system-iconv], [Use iconv() from system-installed libraries [default=yes]])], + , enable_system_iconv=yes) + if test x$enable_libc = xyes; then AC_DEFINE(HAVE_LIBC, 1, [ ]) dnl Check for C library headers dnl AC_CHECK_INCLUDES_DEFAULT is an autoconf-2.7x thing where AC_HEADER_STDC is deprecated. m4_ifdef([AC_CHECK_INCLUDES_DEFAULT], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC]) - AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h linux/input.h) dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T @@ -342,13 +340,15 @@ dnl Checks for library functions. AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ],[]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) - AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) - AC_CHECK_FUNCS(iconv) + if test x$enable_system_iconv = xyes; then + AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) + AC_CHECK_FUNCS(iconv) + fi AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) @@ -919,16 +919,8 @@ CheckOSS() AC_ARG_ENABLE(oss, [AS_HELP_STRING([--enable-oss], [support the OSS audio API [default=maybe]])], , enable_oss=maybe) - - # OpenBSD "has" OSS, but it's not really for app use. They want you to - # use sndio instead. So on there, we default to disabled. You can force - # it on if you really want, though. if test x$enable_oss = xmaybe; then enable_oss=yes - case "$host" in - *-*-openbsd*) - enable_oss=no;; - esac fi if test x$enable_audio = xyes -a x$enable_oss = xyes; then @@ -941,16 +933,6 @@ CheckOSS() int arg = SNDCTL_DSP_SETFRAGMENT; ]])], [have_oss=yes],[]) fi - if test x$have_oss != xyes; then - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ - int arg = SNDCTL_DSP_SETFRAGMENT; - ]])], [ - have_oss=yes - AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ]) - ],[]) - fi AC_MSG_RESULT($have_oss) if test x$have_oss = xyes; then SUMMARY_audio="${SUMMARY_audio} oss" @@ -960,7 +942,7 @@ CheckOSS() # We may need to link with ossaudio emulation library case "$host" in - *-*-openbsd*|*-*-netbsd*) + *-*-netbsd*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";; esac fi @@ -1050,44 +1032,6 @@ CheckJACK() fi } -dnl Find the ESD includes and libraries -CheckESD() -{ - AC_ARG_ENABLE(esd, -[AS_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [default=yes]])], - , enable_esd=yes) - if test x$enable_audio = xyes -a x$enable_esd = xyes; then - PKG_CHECK_MODULES([ESD], [esound >= 0.2.8], have_esd=yes, have_esd=no) - if test x$have_esd = xno; then - AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no) - fi - if test x$have_esd = xyes; then - AC_ARG_ENABLE(esd-shared, -[AS_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [default=yes]])], - , enable_esd_shared=yes) - esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/esd/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_esd_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_esd_shared = xyes && test x$esd_lib != x; then - echo "-- dynamic libesd -> $esd_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} esd(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS" - SUMMARY_audio="${SUMMARY_audio} esd" - fi - have_audio=yes - fi - fi -} - dnl Find Pipewire CheckPipewire() { @@ -1168,111 +1112,6 @@ CheckPulseAudio() fi } -CheckARTSC() -{ - AC_ARG_ENABLE(arts, -[AS_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [default=yes]])], - , enable_arts=yes) - if test x$enable_audio = xyes -a x$enable_arts = xyes; then - AC_PATH_PROG(ARTSCONFIG, artsc-config) - if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then - : # arts isn't installed - else - ARTS_CFLAGS=`$ARTSCONFIG --cflags` - ARTS_LIBS=`$ARTSCONFIG --libs` - AC_MSG_CHECKING(for aRts development environment) - audio_arts=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ARTS_CFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ - arts_stream_t stream; - ]])], [audio_arts=yes],[]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT($audio_arts) - if test x$audio_arts = xyes; then - AC_ARG_ENABLE(arts-shared, -[AS_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [default=yes]])], - , enable_arts_shared=yes) - arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/arts/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS" - if test x$have_loadso != xyes && \ - test x$enable_arts_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_arts_shared = xyes && test x$arts_lib != x; then - echo "-- dynamic libartsc -> $arts_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} arts(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS" - SUMMARY_audio="${SUMMARY_audio} arts" - fi - have_audio=yes - fi - fi - fi -} - -dnl See if the NAS audio interface is supported -CheckNAS() -{ - AC_ARG_ENABLE(nas, -[AS_HELP_STRING([--enable-nas], [support the NAS audio API [default=yes]])], - , enable_nas=yes) - if test x$enable_audio = xyes -a x$enable_nas = xyes; then - AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes) - AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes) - - AC_MSG_CHECKING(for NAS audio support) - have_nas=no - - if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then - have_nas=yes - NAS_LIBS="-laudio" - - elif test -r /usr/X11R6/include/audio/audiolib.h; then - have_nas=yes - NAS_CFLAGS="-I/usr/X11R6/include/" - NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" - - fi - - AC_MSG_RESULT($have_nas) - - if test x$have_nas = xyes; then - AC_ARG_ENABLE(nas-shared, -[AS_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [default=yes]])], - , enable_nas_shared=yes) - nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - - if test x$have_loadso != xyes && \ - test x$enable_nas_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_nas_shared = xyes && test x$nas_lib != x; then - echo "-- dynamic libaudio -> $nas_lib" - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ]) - SUMMARY_audio="${SUMMARY_audio} nas(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS" - SUMMARY_audio="${SUMMARY_audio} nas" - fi - - AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/nas/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS" - have_audio=yes - fi - fi -} - dnl See if the sndio audio interface is supported CheckSNDIO() { @@ -1280,20 +1119,9 @@ CheckSNDIO() [AS_HELP_STRING([--enable-sndio], [support the sndio audio API [default=yes]])], , enable_sndio=yes) if test x$enable_audio = xyes -a x$enable_sndio = xyes; then - AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes) - AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes) + PKG_CHECK_MODULES([SNDIO], [sndio], audio_sndio=yes, audio_sndio=no) - AC_MSG_CHECKING(for sndio audio support) - have_sndio=no - - if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then - have_sndio=yes - SNDIO_LIBS="-lsndio" - fi - - AC_MSG_RESULT($have_sndio) - - if test x$have_sndio = xyes; then + if test x$audio_sndio = xyes; then AC_ARG_ENABLE(sndio-shared, [AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [default=yes]])], , enable_sndio_shared=yes) @@ -1321,45 +1149,6 @@ CheckSNDIO() fi } -dnl Find FusionSound -CheckFusionSound() -{ - AC_ARG_ENABLE(fusionsound, -[AS_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [default=no]])], - , enable_fusionsound=no) - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 1.1.1], fusionsound=yes, fusionsound=no) - - if test x$fusionsound = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - AC_ARG_ENABLE(fusionsound-shared, -[AS_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [default=yes]])], - , enable_fusionsound_shared=yes) - fusionsound_shared=no - AC_MSG_CHECKING(for FusionSound dynamic loading support) - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - AC_MSG_RESULT($fusionsound_shared) - - have_audio=yes - fi - fi -} - dnl rcg07142001 See if the user wants the disk writer audio driver... CheckDiskAudio() { @@ -1515,6 +1304,26 @@ CheckObjectiveCARC() fi } +dnl See if GCC's -gdwarf-4 is supported +dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows +CheckGDwarf4() +{ + AC_MSG_CHECKING(for GCC -gdwarf-4 option) + have_gcc_gdwarf4=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -gdwarf-4" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_gcc_gdwarf4=yes],[]) + AC_MSG_RESULT($have_gcc_gdwarf4) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_gdwarf4 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4" + fi +} + dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility CheckVisibilityHidden() @@ -1578,6 +1387,49 @@ CheckStackBoundary() fi } +dnl See if GCC's -Werror is supported. +CheckWerror() +{ + AC_ARG_ENABLE(werror, +[AS_HELP_STRING([--enable-werror], [treat warnings as errors [default=no]])], + enable_werror=$enableval, enable_werror=no) + if test x$enable_werror = xyes; then + AC_MSG_CHECKING(for GCC -Werror option) + have_gcc_werror=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_gcc_werror=yes],[]) + AC_MSG_RESULT($have_gcc_werror) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_werror = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Werror" + fi + fi +} + +dnl See if GCC's -Wno-error=deprecated-declarations is supported. +CheckNoErrorDeprecatedDeclarationsWerror() +{ + AC_MSG_CHECKING(for GCC -Wno-error=deprecated-declarations option) + have_gcc_no_werror_deprecated_declarations=no + + save_CFLAGS="$CFLAGS" + CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + int x = 0; + ]],[])], [have_gcc_no_werror_deprecated_declarations=yes],[]) + AC_MSG_RESULT($have_gcc_werror) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_no_werror_deprecated_declarations = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations" + fi +} + dnl See if GCC's -Wdeclaration-after-statement is supported. dnl This lets us catch things that would fail on a C89 compiler when using dnl a modern GCC. @@ -1750,33 +1602,6 @@ dnl See if libdecor is available fi } -dnl Check for Native Client stuff -CheckNativeClient() -{ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #if !defined(__native_client__) - #error "NO NACL" - #endif - ]],[])], [ - AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ]) - AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ]) - AC_DEFINE(HAVE_POW, 1, [ ]) - AC_DEFINE(HAVE_OPENGLES2, 1, [ ]) - AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) - AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) - - SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS" - - SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c" - SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c" - SUMMARY_audio="${SUMMARY_audio} nacl" - have_audio=yes - SOURCES="$SOURCES $srcdir/src/video/nacl/*.c" - SUMMARY_video="${SUMMARY_video} nacl opengles2" - have_video=yes - ],[]) -} - CheckRPI() { AC_ARG_ENABLE(video-rpi, @@ -1832,8 +1657,15 @@ dnl Find the X11 include and library directories CheckX11() { AC_ARG_ENABLE(video-x11, -[AS_HELP_STRING([--enable-video-x11], [use X11 video driver [default=yes]])], - , enable_video_x11=yes) +[AS_HELP_STRING([--enable-video-x11], [use X11 video driver [default=maybe]])], + ,[ + enable_video_x11=yes + case "$host" in + *-*-darwin*|*-ios-*) + enable_video_x11=no + ;; + esac]) + if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then case "$host" in *-*-darwin*) @@ -2268,56 +2100,6 @@ dnl Work around that we don't have Objective-C support in autoconf fi } -dnl Find DirectFB -CheckDirectFB() -{ - AC_ARG_ENABLE(video-directfb, -[AS_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]])], - , enable_video_directfb=no) - if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then - PKG_CHECK_MODULES([DIRECTFB], [directfb >= 1.0.0], video_directfb=yes, video_directfb=no) - - if test x$video_directfb = xyes; then - # SuSE 11.1 installs directfb-config without directfb-devel - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS" - AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no) - CPPFLAGS="$save_CPPFLAGS" - video_directfb=$have_directfb_hdr - fi - - if test x$video_directfb = xyes; then - AC_ARG_ENABLE(directfb-shared, -[AS_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [default=yes]])], - , enable_directfb_shared=yes) - - AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ]) - AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" - - directfb_shared=no - directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] - if test x$have_loadso != xyes && \ - test x$enable_directfb_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading]) - fi - if test x$have_loadso = xyes && \ - test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then - directfb_shared=yes - echo "-- dynamic libdirectfb -> $directfb_lib" - AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ]) - SUMMARY_video="${SUMMARY_video} directfb(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS" - SUMMARY_video="${SUMMARY_video} directfb" - fi - SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS" - have_video=yes - fi - fi -} - dnl Find KMSDRM CheckKMSDRM() { @@ -2403,30 +2185,6 @@ CheckOffscreenVideo() fi } -dnl Set up the QNX video driver if enabled -CheckQNXVideo() -{ - if test x$enable_video = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" - have_video=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" - SUMMARY_video="${SUMMARY_video} qnx" - fi -} - -dnl Set up the QNX audio driver if enabled -CheckQNXAudio() -{ - if test x$enable_audio = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" - have_audio=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" - SUMMARY_audio="${SUMMARY_audio} qsa" - fi -} - dnl Check to see if OpenGL support is desired AC_ARG_ENABLE(video-opengl, [AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [default=yes]])], @@ -3014,7 +2772,7 @@ dnl This is used on Linux for glibc binary compatibility (Doh!) ;; *-*-openbsd*) pthread_cflags="-D_REENTRANT" - pthread_lib="-pthread" + pthread_lib="-lpthread" ;; *-*-solaris2.9) # From Solaris 9+, posix4's preferred name is rt. @@ -3047,10 +2805,6 @@ dnl This is used on Linux for glibc binary compatibility (Doh!) pthread_cflags="-D_REENTRANT" pthread_lib="" ;; - *-*-nto*) - pthread_cflags="-D_REENTRANT" - pthread_lib="" - ;; *-*-emscripten*) pthread_cflags="-D_REENTRANT -pthread" pthread_lib="-pthread" @@ -3245,21 +2999,6 @@ CheckWINDOWS() fi } -dnl Determine whether the compiler can produce OS/2 executables -CheckOS2() -{ - AC_MSG_CHECKING(OS/2 compiler) - have_os2_gcc=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [])],[have_os2_gcc=yes],[]) - AC_MSG_RESULT($have_os2_gcc) - if test x$have_os2_gcc != xyes; then - AC_MSG_ERROR([ -*** Your compiler ($CC) does not produce OS/2 executables! - ]) - fi -} - dnl Find the DirectX includes and libraries CheckDIRECTX() { @@ -3558,9 +3297,6 @@ CheckHIDAPI() enable_hidapi_libusb=yes require_hidapi_libusb=yes ;; - *-*-os2* ) - enable_hidapi_libusb=yes - ;; esac hidapi_support=yes @@ -3594,9 +3330,6 @@ CheckHIDAPI() *-*-cygwin* | *-*-mingw* ) libusb_lib="libusb-1.0.dll" ;; - *-*-os2* ) - libusb_lib="usb100.dll" - ;; esac if test x$libusb_lib = x; then libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] @@ -3698,7 +3431,7 @@ have_locale=no dnl Set up the configuration based on the host platform! case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) case "$host" in *-*-android*) # Android @@ -3732,11 +3465,9 @@ case "$host" in *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; - *-*-nto*) ARCH=nto - CheckQNXVideo - ;; esac CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -3751,16 +3482,11 @@ case "$host" in CheckPipewire CheckPulseAudio CheckJACK - CheckARTSC - CheckESD - CheckNAS CheckSNDIO - CheckFusionSound CheckLibSampleRate # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! CheckRPI CheckX11 - CheckDirectFB # Need to check for EGL first because KMSDRM and Wayland depends on it. CheckEGL CheckKMSDRM @@ -3808,24 +3534,12 @@ case "$host" in # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in - sysv5|solaris|hpux) - AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" - SUMMARY_audio="${SUMMARY_audio} sun" - have_audio=yes - ;; netbsd) # Don't use this on OpenBSD, it's busted. AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; - aix) - AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" - SUMMARY_audio="${SUMMARY_audio} paudio" - have_audio=yes - ;; android) AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/android/*.c" @@ -3841,22 +3555,21 @@ case "$host" in have_audio=yes ;; - nto) - CheckQNXAudio - ;; esac fi # Set up files for the joystick library if test x$enable_joystick = xyes; then case $ARCH in linux) - AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" - SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" - have_joystick=yes + if test "x$ac_cv_header_linux_input_h" = xyes; then + AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" + have_joystick=yes + fi ;; freebsd) - if test x$use_input_events = xyes; then + if test x$use_input_events = xyes -a x$ac_cv_header_linux_input_h = xyes; then AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" @@ -3969,6 +3682,8 @@ case "$host" in if test x$enable_loadso = xyes; then have_loadso=yes fi + CheckGDwarf4 + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4016,9 +3731,6 @@ case "$host" in fi # Set up files for the audio library if test x$enable_audio = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ]) - SUMMARY_audio="${SUMMARY_audio} winmm" - SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c" if test x$have_dsound = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) SUMMARY_audio="${SUMMARY_audio} directsound" @@ -4114,7 +3826,7 @@ case "$host" in VERSION_SOURCES="$srcdir/src/main/windows/*.rc" SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c" SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" - SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows" + SDL_LIBS="-lSDL3main $SDL_LIBS -mwindows" # Check to see if this is a mingw or cygwin build have_mingw32= @@ -4193,6 +3905,8 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. ARCH=ios CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4276,7 +3990,11 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" SUMMARY_video="${SUMMARY_video} uikit" have_video=yes - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" + if test x$enable_system_iconv = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" + fi + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" @@ -4304,6 +4022,8 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. CheckObjectiveCARC CheckVisibilityHidden + CheckWerror + CheckNoErrorDeprecatedDeclarationsWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4390,29 +4110,6 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" fi ;; - *-nacl|*-pnacl) - ARCH=nacl - CheckNativeClient - CheckDummyAudio - CheckDummyVideo - CheckOffscreenVideo - CheckInputEvents - CheckPTHREAD - CheckO_CLOEXEC - - # Set up files for the timer library - if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" - have_timers=yes - fi - - if test x$enable_filesystem = xyes; then - AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c" - have_filesystem=yes - fi - ;; *-*-emscripten* ) if test x$enable_video = xyes; then AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ]) @@ -4429,6 +4126,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. fi CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4480,6 +4178,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. *-*-riscos*) ARCH=riscos CheckVisibilityHidden + CheckWerror CheckDeclarationAfterStatement CheckDummyVideo CheckOffscreenVideo @@ -4516,83 +4215,6 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan. have_timers=yes fi ;; - *-*-os2*) - ARCH=os2 - if test "$build" != "$host"; then # cross-compiling - # Default cross-compile location - ac_default_prefix=/@unixroot/usr/local/cross-tools/$host - else - # Look for the location of the tools and install there - if test "$BUILD_PREFIX" != ""; then - ac_default_prefix=$BUILD_PREFIX - fi - fi - enable_static=no # disable static builds - EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR" - CheckOS2 - CheckDeclarationAfterStatement - CheckDummyVideo - CheckDiskAudio - CheckDummyAudio - CheckHIDAPI - - # Set up the core platform files - SOURCES="$SOURCES $srcdir/src/core/os2/*.c" - if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then - SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c" - fi - # Use the Unix locale APIs. - if test x$enable_locale = xyes; then - SOURCES="$SOURCES $srcdir/src/locale/unix/*.c" - have_locale=yes - fi - # Set up files for the video library - if test x$enable_video = xyes; then - AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/video/os2/*.c" - have_video=yes - SUMMARY_video="${SUMMARY_video} os/2" - fi - # Set up files for the audio library - if test x$enable_audio = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/os2/*.c" - have_audio=yes - SUMMARY_audio="${SUMMARY_audio} os/2" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2" - fi - # Set up files for the thread library - if test x$enable_threads = xyes; then - AC_DEFINE(SDL_THREAD_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/thread/os2/*.c" - SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c" - have_threads=yes - fi - # Set up files for the timer library - if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/timer/os2/*.c" - have_timers=yes - fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c" - have_loadso=yes - fi - # Set up files for the filesystem library - if test x$enable_filesystem = xyes; then - AC_DEFINE(SDL_FILESYSTEM_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c" - have_filesystem=yes - fi - # Set up files for the joystick library - if test x$enable_joystick = xyes; then - AC_DEFINE(SDL_JOYSTICK_OS2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c" - have_joystick=yes - fi - ;; *) AC_MSG_ERROR([ *** Unsupported host: Please add to configure.ac @@ -4603,21 +4225,27 @@ esac dnl Permit use of virtual joystick APIs on any platform (subject to configure options) CheckVirtualJoystick -# Check whether to install sdl2-config -AC_MSG_CHECKING(whether to install sdl2-config) -AC_ARG_ENABLE([sdl2-config], - [AS_HELP_STRING([--enable-sdl2-config],[Install sdl2-config [default=yes]])], +# Check whether to install sdl3-config +AC_MSG_CHECKING(whether to install sdl3-config) +AC_ARG_ENABLE([sdl3-config], + [AS_HELP_STRING([--enable-sdl3-config],[Install sdl3-config [default=yes]])], [case "${enableval}" in - yes) enable_sdl2_config="TRUE" ;; - no) enable_sdl2_config="FALSE" ;; - *) AC_MSG_ERROR([bad value '${enableval}' for --enable-sdl2-config]) ;; - esac], [enable_sdl2_config="TRUE"]) -if test "$enable_sdl2_config" = "TRUE"; then + yes) enable_sdl3_config="TRUE" ;; + no) enable_sdl3_config="FALSE" ;; + *) AC_MSG_ERROR([bad value '${enableval}' for --enable-sdl3-config]) ;; + esac], [enable_sdl3_config="TRUE"]) +if test "$enable_sdl3_config" = "TRUE"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi -AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config]) +AC_SUBST([INSTALL_SDL3_CONFIG], [$enable_sdl3_config]) + +AC_ARG_ENABLE([vendor-info], + [AS_HELP_STRING([--enable-vendor-info=STRING], [Add vendor info to SDL_REVISION])], + [enable_vendor_info="$enableval"], [enable_vendor_info=]) +AS_IF([test "$enable_vendor_info" = no], [enable_vendor_info=]) +AC_SUBST([SDL_VENDOR_INFO], [$enable_vendor_info]) # Verify that we have all the platform specific files we need @@ -4777,7 +4405,7 @@ SDL_STATIC_LIBS="$EXTRA_LDFLAGS" dnl Calculate the location of the prefix, relative to the cmake folder dnl Calculate the location of the prefix, relative to bindir -pkg_cmakedir='$libdir/cmake/SDL2' +pkg_cmakedir='$libdir/cmake/SDL3' AX_COMPUTE_RELATIVE_PATHS([pkg_cmakedir:prefix:cmake_prefix_relpath bindir:prefix:bin_prefix_relpath]) AC_SUBST([cmake_prefix_relpath]) AC_SUBST([bin_prefix_relpath]) @@ -4841,11 +4469,11 @@ $WAYLAND_PROTOCOLS_DEPENDS __EOF__ AC_CONFIG_FILES([ - Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc + Makefile:Makefile.in:Makefile.rules sdl3-config sdl3-config.cmake sdl3-config-version.cmake SDL3.spec sdl3.pc ]) -AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config]) +AC_CONFIG_COMMANDS([sdl3_config],[chmod a+x sdl3-config]) -SUMMARY="SDL2 Configure Summary:\n" +SUMMARY="SDL3 Configure Summary:\n" if test x$enable_shared = xyes; then SUMMARY="${SUMMARY}Building Shared Libraries\n" fi diff --git a/docs/README-android.md b/docs/README-android.md index a247e57210..03d2d87780 100644 --- a/docs/README-android.md +++ b/docs/README-android.md @@ -86,8 +86,8 @@ If you already have a project that uses CMake, the instructions change somewhat: 2. Edit "/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. 3. Edit "/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 - as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)" + adding the "src" subdirectory). Note that you'll have SDL3, SDL3main and SDL3-static + as targets in your project, so you should have "target_link_libraries(yourgame SDL3 SDL3main)" in your CMakeLists.txt file. Also be aware that you should use add_library() instead of add_executable() for the target containing your "main" function. @@ -414,10 +414,10 @@ Graphics debugging ================================================================================ If you are developing on a compatible Tegra-based tablet, NVidia provides -Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL +Tegra Graphics Debugger at their website. Because SDL3 dynamically loads EGL and GLES libraries, you must follow their instructions for installing the interposer library on a rooted device. The non-rooted instructions are not -compatible with applications that use SDL2 for video. +compatible with applications that use SDL3 for video. The Tegra Graphics Debugger is available from NVidia here: https://developer.nvidia.com/tegra-graphics-debugger diff --git a/docs/README-cmake.md b/docs/README-cmake.md index b10751c1a3..10e60b3651 100644 --- a/docs/README-cmake.md +++ b/docs/README-cmake.md @@ -57,24 +57,24 @@ option(MYGAME_VENDORED "Use vendored libraries" OFF) if(MYGAME_VENDORED) add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL) else() - # 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found - find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2) + # 1. Look for a SDL3 package, 2. look for the SDL3 component and 3. fail if none can be found + find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3) - # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available - find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) + # 1. Look for a SDL3 package, 2. Look for the SDL3maincomponent and 3. DO NOT fail when SDL3main is not available + find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3main) endif() # Create your game executable target as usual add_executable(mygame WIN32 mygame.c) -# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications -if(TARGET SDL2::SDL2main) - # It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static) - target_link_libraries(mygame PRIVATE SDL2::SDL2main) +# SDL3::SDL3main may or may not be available. It is e.g. required by Windows GUI applications +if(TARGET SDL3::SDL3main) + # It has an implicit dependency on SDL3 functions, so it MUST be added before SDL3::SDL3 (or SDL3::SDL3-static) + target_link_libraries(mygame PRIVATE SDL3::SDL3main) endif() -# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary. -target_link_libraries(mygame PRIVATE SDL2::SDL2) +# Link to the actual SDL3 library. SDL3::SDL3 is the shared SDL library, SDL3::SDL3-static is the static SDL libarary. +target_link_libraries(mygame PRIVATE SDL3::SDL3) ``` ### A system SDL library @@ -85,10 +85,10 @@ The following components are available, to be used as an argument of `find_packa | Component name | Description | |----------------|--------------------------------------------------------------------------------------------| -| SDL2 | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] | -| SDL2-static | The SDL2 static library, available through the `SDL2::SDL2-static` target | -| SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target | -| SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target | +| SDL3 | The SDL3 shared library, available through the `SDL3::SDL3` target [^SDL_TARGET_EXCEPTION] | +| SDL3-static | The SDL3 static library, available through the `SDL3::SDL3-static` target | +| SDL3main | The SDL3main static library, available through the `SDL3::SDL3main` target | +| SDL3test | The SDL3test static library, available through the `SDL3::SDL3test` target | ### Using a vendored SDL @@ -160,4 +160,4 @@ To use, set the following CMake variables when running CMake's configuration sta ``` -[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons. +[^SDL_TARGET_EXCEPTION]: `SDL3::SDL3` can be an ALIAS to a static `SDL3::SDL3-static` target for multiple reasons. diff --git a/docs/README-directfb.md b/docs/README-directfb.md deleted file mode 100644 index 3b28eef344..0000000000 --- a/docs/README-directfb.md +++ /dev/null @@ -1,123 +0,0 @@ -DirectFB -======== - -Supports: - -- Hardware YUV overlays -- OpenGL - software only -- 2D/3D accelerations (depends on directfb driver) -- multiple displays -- windows - -What you need: - -* DirectFB 1.0.1, 1.2.x, 1.3.0 -* Kernel-Framebuffer support: required: vesafb, radeonfb .... -* Mesa 7.0.x - optional for OpenGL - -The `/etc/directfbrc` file should contain the following lines to make -your joystick work and avoid crashes: - -``` -disable-module=joystick -disable-module=cle266 -disable-module=cyber5k -no-linux-input-grab -``` - -To disable to use x11 backend when DISPLAY variable is found use - -``` -export SDL_DIRECTFB_X11_CHECK=0 -``` - -To disable the use of linux input devices, i.e. multimice/multikeyboard support, -use - -``` -export SDL_DIRECTFB_LINUX_INPUT=0 -``` - -To use hardware accelerated YUV-overlays for YUV-textures, use: - -``` -export SDL_DIRECTFB_YUV_DIRECT=1 -``` - -This is disabled by default. It will only support one -YUV texture, namely the first. Every other YUV texture will be -rendered in software. - -In addition, you may use (directfb-1.2.x) - -``` -export SDL_DIRECTFB_YUV_UNDERLAY=1 -``` - -to make the YUV texture an underlay. This will make the cursor to -be shown. - -Simple Window Manager -===================== - -The driver has support for a very, very basic window manager you may -want to use when running with `wm=default`. Use - -``` -export SDL_DIRECTFB_WM=1 -``` - -to enable basic window borders. In order to have the window title rendered, -you need to have the following font installed: - -``` -/usr/share/fonts/truetype/freefont/FreeSans.ttf -``` - -OpenGL Support -============== - -The following instructions will give you *software* OpenGL. However this -works at least on all directfb supported platforms. - -As of this writing 20100802 you need to pull Mesa from git and do the following: - -``` -git clone git://anongit.freedesktop.org/git/mesa/mesa -cd mesa -git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a -``` - -Edit `configs/linux-directfb` so that the Directories-section looks like this: - -``` -# Directories -SRC_DIRS = mesa glu -GLU_DIRS = sgi -DRIVER_DIRS = directfb -PROGRAM_DIRS = -``` - -Then do the following: - -``` -make linux-directfb -make - -echo Installing - please enter sudo pw. - -sudo make install INSTALL_DIR=/usr/local/dfb_GL -cd src/mesa/drivers/directfb -make -sudo make install INSTALL_DIR=/usr/local/dfb_GL -``` - -To run the SDL - testprograms: - -``` -export SDL_VIDEODRIVER=directfb -export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib -export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 - -./testgl -``` diff --git a/docs/README-dynapi.md b/docs/README-dynapi.md index 47b726b1df..99f5074ee8 100644 --- a/docs/README-dynapi.md +++ b/docs/README-dynapi.md @@ -4,22 +4,22 @@ Originally posted on Ryan's Google+ account. Background: -- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, - but developers are shipping their own SDL2 with individual Steam games. - These games might stop getting updates, but a newer SDL2 might be needed later. +- The Steam Runtime has (at least in theory) a really kick-ass build of SDL, + but developers are shipping their own SDL with individual Steam games. + These games might stop getting updates, but a newer SDL might be needed later. Certainly we'll always be fixing bugs in SDL, even if a new video target isn't ever needed, and these fixes won't make it to a game shipping its own SDL. -- Even if we replace the SDL2 in those games with a compatible one, that is to +- Even if we replace the SDL in those games with a compatible one, that is to say, edit a developer's Steam depot (yuck!), there are developers that are - statically linking SDL2 that we can't do this for. We can't even force the - dynamic loader to ignore their SDL2 in this case, of course. -- If you don't ship an SDL2 with the game in some form, people that disabled the + statically linking SDL that we can't do this for. We can't even force the + dynamic loader to ignore their SDL in this case, of course. +- If you don't ship an SDL with the game in some form, people that disabled the Steam Runtime, or just tried to run the game from the command line instead of Steam might find themselves unable to run the game, due to a missing dependency. - If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target - generic Linux boxes that may or may not have SDL2 installed, you have to ship + generic Linux boxes that may or may not have SDL installed, you have to ship the library or risk a total failure to launch. So now, you might have to have - a non-Steam build plus a Steam build (that is, one with and one without SDL2 + a non-Steam build plus a Steam build (that is, one with and one without SDL included), which is inconvenient if you could have had one universal build that works everywhere. - We like the zlib license, but the biggest complaint from the open source @@ -65,8 +65,8 @@ system's dynamic loader was supposed to do for us? Yes, but now we've got this level of indirection, we can do things like this: ```bash -export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 -./MyGameThatIsStaticallyLinkedToSDL2 +export SDL_DYNAMIC_API=/my/actual/libSDL3.so.0 +./MyGameThatIsStaticallyLinkedToSDL ``` And now, this game that is statically linked to SDL, can still be overridden @@ -108,7 +108,7 @@ the jump table, and the size, in bytes, of the table. Now, we've got policy here: this table's layout never changes; new stuff gets added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all the needed functions if tablesize <= sizeof its own jump table. If tablesize is -bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but +bigger (say, SDL 3.0.4 is trying to load SDL 3.0.3), then we know to abort, but if it's smaller, we know we can provide the entire API that the caller needs. The version variable is a failsafe switch. diff --git a/docs/README-emscripten.md b/docs/README-emscripten.md index b535cc60a1..f73c6090eb 100644 --- a/docs/README-emscripten.md +++ b/docs/README-emscripten.md @@ -1,5 +1,46 @@ -Emscripten -================================================================================ +# Emscripten + +(This documentation is not very robust; we will update and expand this later.) + +## A quick note about audio + +Modern web browsers will not permit web pages to produce sound before the +user has interacted with them; this is for several reasons, not the least +of which being that no one likes when a random browser tab suddenly starts +making noise and the user has to scramble to figure out which and silence +it. + +To solve this, most browsers will refuse to let a web app use the audio +subsystem at all before the user has interacted with (clicked on) the page +in a meaningful way. SDL-based apps also have to deal with this problem; if +the user hasn't interacted with the page, SDL_OpenAudioDevice will fail. + +There are two reasonable ways to deal with this: if you are writing some +sort of media player thing, where the user expects there to be a volume +control when you mouseover the canvas, just default that control to a muted +state; if the user clicks on the control to unmute it, on this first click, +open the audio device. This allows the media to play at start, the user can +reasonably opt-in to listening, and you never get access denied to the audio +device. + +Many games do not have this sort of UI, and are more rigid about starting +audio along with everything else at the start of the process. For these, your +best bet is to write a little Javascript that puts up a "Click here to play!" +UI, and upon the user clicking, remove that UI and then call the Emscripten +app's main() function. As far as the application knows, the audio device was +available to be opened as soon as the program started, and since this magic +happens in a little Javascript, you don't have to change your C/C++ code at +all to make it happen. + +Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385 +for some Javascript code to steal for this approach. + + +## Building SDL/emscripten + +SDL currently requires at least Emscripten 2.0.32 to build. Newer versions +are likely to work, as well. + Build: @@ -18,11 +59,11 @@ Or with cmake: To build one of the tests: $ cd test/ - $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html + $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL3.a ../build/libSDL3_test.a -o a.html Uses GLES2 renderer or software -Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): +Some other SDL3 libraries can be easily built (assuming SDL3 is installed somewhere): SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): diff --git a/docs/README-gdk.md b/docs/README-gdk.md index 5f6b18be3f..e172adf07b 100644 --- a/docs/README-gdk.md +++ b/docs/README-gdk.md @@ -25,7 +25,7 @@ The Windows GDK port supports the full set of Win32 APIs, renderers, controllers * Initializing/uninitializing the game runtime, and initializing Xbox Live services * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue. - * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. + * An implementation on `WinMain` that performs the above GDK setup (you should link against SDL3main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`). * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak). @@ -36,8 +36,8 @@ The Windows GDK port supports the full set of Win32 APIs, renderers, controllers The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration: -* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64. -* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs. +* SDL3 (DLL) - This is the typical SDL3.dll, but for Gaming.Desktop.x64. +* SDL3main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs. * tests/testgamecontroller - Standard SDL test program demonstrating controller functionality. * tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live. *NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this. @@ -54,21 +54,21 @@ These steps assume you already have a game using SDL that runs on Windows x64 al In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration. -### 2. Build SDL2 and SDL2main for GDK ### +### 2. Build SDL3 and SDL3main for GDK ### -Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project. +Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL3 and SDL3main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL3.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL3.lib`, and `SDL3main.lib` output files for your game project. -*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built. +*Alternatively*, you could setup your solution file to instead reference the SDL3/SDL3main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL3 and SDL3main would both be built when your game is built. ### 3. Configuring Project Settings ### While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration: * Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced -* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are +* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL3.lib and SDL3main.lib are * Under Linker > Input > Additional Dependencies, you need the following: - * `SDL2.lib` - * `SDL2main.lib` (unless not using) + * `SDL3.lib` + * `SDL3main.lib` (unless not using) * `xgameruntime.lib` * `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib` * Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK. @@ -81,7 +81,7 @@ Rather than using your own implementation of `WinMain`, it's recommended that yo The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory: -* Your SDL2.dll +* Your SDL3.dll * "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll" * XCurl.dll diff --git a/docs/README-ios.md b/docs/README-ios.md index cae5f9cc8a..d06e3b518e 100644 --- a/docs/README-ios.md +++ b/docs/README-ios.md @@ -20,7 +20,7 @@ Using the Simple DirectMedia Layer for iOS 3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj 4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name" 5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left -6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS" +6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL3.framework from "Framework-iOS" 7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library. 8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files 9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function. @@ -194,15 +194,15 @@ http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOS Notes -- xcFramework ============================================================================== -The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform. +The SDL.xcodeproj file now includes a target to build SDL3.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform. In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package. -The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac. +The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL3.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac. This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes. -In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this: +In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL3.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this: #ifndef SDL_MAIN_HANDLED #ifdef main @@ -293,7 +293,7 @@ e.g. Deploying to older versions of iOS ============================================================================== -SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 6.1 +SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0 In order to do that you need to download an older version of Xcode: https://developer.apple.com/download/more/?name=Xcode diff --git a/docs/README-kmsbsd.md b/docs/README-kmsbsd.md index 01db5e8aaf..7604817071 100644 --- a/docs/README-kmsbsd.md +++ b/docs/README-kmsbsd.md @@ -8,7 +8,7 @@ WSCONS support has been brought back, but only as an input backend. It will not OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices. -SDL2 WSCONS input backend features +SDL WSCONS input backend features =================================================== 1. It is keymap-aware; it will work properly with different keymaps. 2. It has mouse support. diff --git a/docs/README-linux.md b/docs/README-linux.md index 4634ecd884..345e0acbc3 100644 --- a/docs/README-linux.md +++ b/docs/README-linux.md @@ -42,9 +42,6 @@ NOTES: for higher-quality audio resampling. SDL will work without it if the library is missing, so it's safe to build in support even if the end user doesn't have this library installed. -- DirectFB isn't included because the configure script (currently) fails to find - it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the - configure script to include DirectFB support. Send patches. :) Joystick does not work diff --git a/docs/README-n3ds.md b/docs/README-n3ds.md new file mode 100644 index 0000000000..1fa8e15a6e --- /dev/null +++ b/docs/README-n3ds.md @@ -0,0 +1,27 @@ +# Nintendo 3DS + +SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by: + +- [Pierre Wendling](https://github.com/FtZPetruska) + +Credits to: + +- The awesome people who ported SDL to other homebrew platforms. +- The Devkitpro team for making all the tools necessary to achieve this. + +## Building + +To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run: + +```bash +cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release +cmake --build build +cmake --install build +``` + +## Notes + +- Currently only software rendering is supported. +- SDL3main 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. +- `SDL_GetBasePath` returns the romfs root instead of the executable's directory. diff --git a/docs/README-nacl.md b/docs/README-nacl.md deleted file mode 100644 index 53ada33c31..0000000000 --- a/docs/README-nacl.md +++ /dev/null @@ -1,103 +0,0 @@ -Native Client -================================================================================ - -Requirements: - -* Native Client SDK (https://developer.chrome.com/native-client), - (tested with Pepper version 33 or higher). - -The SDL backend for Chrome's Native Client has been tested only with the PNaCl -toolchain, which generates binaries designed to run on ARM and x86_32/64 -platforms. This does not mean it won't work with the other toolchains! - -================================================================================ -Building SDL for NaCl -================================================================================ - -Set up the right environment variables (see naclbuild.sh), then configure SDL with: - - configure --host=pnacl --prefix some/install/destination - -Then "make". - -As an example of how to create a deployable app a Makefile project is provided -in test/nacl/Makefile, which includes some monkey patching of the common.mk file -provided by NaCl, without which linking properly to SDL won't work (the search -path can't be modified externally, so the linker won't find SDL's binaries unless -you dump them into the SDK path, which is inconvenient). -Also provided in test/nacl is the required support file, such as index.html, -manifest.json, etc. -SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure. -This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem), -hiding the asynchronous nature of the browser behind the scenes...which is not the -same as making it disappear! - - -================================================================================ -Running tests -================================================================================ - -Due to the nature of NaCl programs, building and running SDL tests is not as -straightforward as one would hope. The script naclbuild.sh in build-scripts -automates the process and should serve as a guide for users of SDL trying to build -their own applications. - -Basic usage: - - ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35) - -This will build testgles2.c by default. - -If you want to build a different test, for example testrendercopyex.c: - - SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35 - -Once the build finishes, you have to serve the contents with a web server (the -script will give you instructions on how to do that with Python). - -================================================================================ -RWops and nacl_io -================================================================================ - -SDL_RWops work transparently with nacl_io. Two functions control the mount points: - - int mount(const char* source, const char* target, - const char* filesystemtype, - unsigned long mountflags, const void *data); - int umount(const char *target); - - For convenience, SDL will by default mount an httpfs tree at / before calling -the app's main function. Such setting can be overridden by calling: - - umount("/"); - -And then mounting a different filesystem at / - -It's important to consider that the asynchronous nature of file operations on a -browser is hidden from the application, effectively providing the developer with -a set of blocking file operations just like you get in a regular desktop -environment, which eases the job of porting to Native Client, but also introduces -a set of challenges of its own, in particular when big file sizes and slow -connections are involved. - -For more information on how nacl_io and mount points work, see: - - https://developer.chrome.com/native-client/devguide/coding/nacl_io - https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h - -To be able to save into the directory "/save/" (like backup of game) : - - mount("", "/save", "html5fs", 0, "type=PERSISTENT"); - -And add to manifest.json : - - "permissions": [ - "unlimitedStorage" - ] - -================================================================================ -TODO - Known Issues -================================================================================ -* Testing of all systems with a real application (something other than SDL's tests) -* Key events don't seem to work properly - diff --git a/docs/README-ngage.md b/docs/README-ngage.md index 83c2e3384c..363760b992 100644 --- a/docs/README-ngage.md +++ b/docs/README-ngage.md @@ -1,7 +1,7 @@ Nokia N-Gage ============ -SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage +SDL port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage (Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev). Compiling @@ -12,7 +12,7 @@ The library is included in the [toolchain](https://github.com/ngagesdk/ngage-toolchain) as a sub-module. -A complete example project based on SDL2 can be found in the GitHub +A complete example project based on SDL can be found in the GitHub account of the SDK: [Wordle](https://github.com/ngagesdk/wordle). Current level of implementation diff --git a/docs/README-os2.md b/docs/README-os2.md deleted file mode 100644 index 1815b944d0..0000000000 --- a/docs/README-os2.md +++ /dev/null @@ -1,92 +0,0 @@ -Simple DirectMedia Layer 2 for OS/2 & eComStation -================================================================================ -SDL port for OS/2, authored by Andrey Vasilkin , 2016 - - -OpenGL and audio capture not supported by this port. - -Additional optional environment variables: - -SDL_AUDIO_SHARE - Values: 0 or 1, default is 0 - Initializes the device as shareable or exclusively acquired. - -SDL_VIDEODRIVER - Values: DIVE or VMAN, default is DIVE - Use video subsystem: Direct interface video extensions (DIVE) or - Video Manager (VMAN). - -You may significantly increase video output speed with OS4 kernel and patched -files vman.dll and dive.dll or with latest versions of ACPI support and video -driver Panorama. - -Latest versions of OS/4 kernel: - http://gus.biysk.ru/os4/ - (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4) - -Patched files vman.dll and dive.dll: - http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR - - -Compiling: ----------- - -Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see: -https://github.com/open-watcom/ and https://open-watcom.github.io -WATCOM environment variable must to be set to the Open Watcom install -directory. To compile, run: wmake -f Makefile.os2 - - -Installing: ------------ - -- eComStation: - - If you have previously installed SDL2, make a Backup copy of SDL2.dll - located in D:\ecs\dll (where D: is disk on which installed eComStation). - Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll - -- OS/2: - - Copy SDL2.dll to any directory on your LIBPATH. If you have a previous - version installed, close all SDL2 applications before replacing the old - copy. Also make sure that any other older versions of DLLs are removed - from your system. - - -Joysticks in SDL2: ------------------- - -The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version. -Here is the original documentation from SDL-1.2: - -The Joystick detection only works for standard joysticks (2 buttons, 2 axes -and the like). Therefore, if you use a non-standard joystick, you should -specify its features in the SDL_OS2_JOYSTICK environment variable in a batch -file or CONFIG.SYS, so SDL applications can provide full capability to your -device. The syntax is: - -SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS] - -So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls, -the line should be: - -SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0 - -If you want to add spaces in your joystick name, just surround it with -quotes or double-quotes: - -SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0 - -or - -SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0 - - Note however that Balls and Hats are not supported under OS/2, and the -value will be ignored... but it is wise to define these correctly because -in the future those can be supported. - - Also the number of buttons is limited to 2 when using two joysticks, -4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes -and 8 when using a joystick with 2 axes. Notice however these are limitations -of the Joystick Port hardware, not OS/2. diff --git a/docs/README-pandora.md b/docs/README-pandora.md deleted file mode 100644 index a0277634b5..0000000000 --- a/docs/README-pandora.md +++ /dev/null @@ -1,17 +0,0 @@ -Pandora -===================================================================== - -( http://openpandora.org/ ) -- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES -support to work on the pandora under the framebuffer. This driver do not have -input support for now, so if you use it you will have to add your own control code. -The video driver name is "pandora" so if you have problem running it from -the framebuffer, try to set the following variable before starting your application : -"export SDL_VIDEODRIVER=pandora" - -- OpenGL ES support was added to the x11 driver, so it's working like the normal -x11 driver one with OpenGLX support, with SDL input event's etc.. - - -David Carré (Cpasjuste) -cpasjuste@gmail.com diff --git a/docs/README-ps2.md b/docs/README-ps2.md index b27b57d1a1..095e5685bf 100644 --- a/docs/README-ps2.md +++ b/docs/README-ps2.md @@ -1,6 +1,6 @@ PS2 ====== -SDL2 port for the Sony Playstation 2 contributed by: +SDL port for the Sony Playstation 2 contributed by: - Francisco Javier Trujillo Mata @@ -9,7 +9,7 @@ Credit to - David G. F. for helping me with several issues and tests. ## Building -To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run: +To build SDL library for the PS2, make sure you have the latest PS2Dev status and run: ```bash cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake cmake --build build @@ -48,4 +48,4 @@ Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_ ## To Do - PS2 Screen Keyboard - Dialogs -- Others \ No newline at end of file +- Others diff --git a/docs/README-psp.md b/docs/README-psp.md index 0c84f866bb..5d9b34f8d7 100644 --- a/docs/README-psp.md +++ b/docs/README-psp.md @@ -1,6 +1,6 @@ PSP ====== -SDL2 port for the Sony PSP contributed by: +SDL port for the Sony PSP contributed by: - Captian Lex - Francisco Javier Trujillo Mata - Wouter Wijsman @@ -11,7 +11,7 @@ Credit to Geecko for his PSP GU lib "Glib2d" ## Building -To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run: +To build SDL library for the PSP, make sure you have the latest PSPDev status and run: ```bash cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake cmake --build build @@ -33,4 +33,4 @@ cmake --install build ## To Do - PSP Screen Keyboard -- Dialogs \ No newline at end of file +- Dialogs diff --git a/docs/README-raspberrypi.md b/docs/README-raspberrypi.md index d2eddb862a..fe13a1be67 100644 --- a/docs/README-raspberrypi.md +++ b/docs/README-raspberrypi.md @@ -81,13 +81,13 @@ The final step is compiling SDL itself. export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux" cd mkdir -p build;cd build - LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd + LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl3-installed --disable-pulseaudio --disable-esd make make install To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths: - perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config + perl -w -pi -e "s#$PWD/rpi-sdl3-installed#/usr/local#g;" ./rpi-sdl3-installed/lib/libSDL3.la ./rpi-sdl3-installed/lib/pkgconfig/sdl3.pc ./rpi-sdl3-installed/bin/sdl3-config Apps don't work or poor video/audio performance ----------------------------------------------- diff --git a/docs/README-riscos.md b/docs/README-riscos.md index 76b27e0aa3..4c31b5cf7c 100644 --- a/docs/README-riscos.md +++ b/docs/README-riscos.md @@ -12,20 +12,22 @@ Requirements: Compiling: ---------- -Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported. +Currently, SDL for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported. -The following commands can be used to build SDL2 for RISC OS using autoconf: +The following commands can be used to build SDL for RISC OS using autoconf: - ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics + ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV make make install -The following commands can be used to build SDL2 for RISC OS using CMake: +The following commands can be used to build SDL for RISC OS using CMake: - cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF + cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release cmake --build build-riscos cmake --build build-riscos --target install +When using GCCSDK 4.7.4 release 6 or earlier versions, the builtin atomic functions are broken, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake. Newer versions of GCCSDK don't have this problem. + Current level of implementation ------------------------------- @@ -36,6 +38,4 @@ The filesystem APIs return either Unix-style paths or RISC OS-style paths based The audio, loadso, thread and timer APIs are currently provided by UnixLib. -GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake. - The joystick, locale and power APIs are not yet implemented. diff --git a/docs/README-visualc.md b/docs/README-visualc.md index 759752a561..04ab63ff89 100644 --- a/docs/README-visualc.md +++ b/docs/README-visualc.md @@ -27,9 +27,9 @@ You may get a few warnings, but you should not get any errors. Later, we will refer to the following `.lib` and `.dll` files that have just been generated: -- `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll` -- `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib` -- `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib` +- `./VisualC/Win32/Debug/SDL3.dll` or `./VisualC/Win32/Release/SDL3.dll` +- `./VisualC/Win32/Debug/SDL3.lib` or `./VisualC/Win32/Release/SDL3.lib` +- `./VisualC/Win32/Debug/SDL3main.lib` or `./VisualC/Win32/Release/SDL3main.lib` _Note for the `x64` versions, just replace `Win32` in the path with `x64`_ @@ -59,12 +59,12 @@ Now we're going to use the files that we had created earlier in the *Build SDL* Copy the following file into your Project directory: -- `SDL2.dll` +- `SDL3.dll` Add the following files to your project (It is not necessary to copy them to your project directory): -- `SDL2.lib` -- `SDL2main.lib` +- `SDL3.lib` +- `SDL3main.lib` To add them to your project, right click on your project, and select `Add files to project`. @@ -73,7 +73,7 @@ To add them to your project, right click on your project, and select and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration (e.g. Release,Debug).** -### Hello SDL2 +### Hello SDL Here's a sample SDL snippet to verify everything is setup in your IDE: @@ -88,7 +88,7 @@ Here's a sample SDL snippet to verify everything is setup in your IDE: SDL_Renderer* renderer = NULL; SDL_Init(SDL_INIT_VIDEO); - window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); + window = SDL_CreateWindow("Hello SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); SDL_DestroyRenderer(renderer); diff --git a/docs/README-wince.md b/docs/README-wince.md deleted file mode 100644 index d5fb64fcb3..0000000000 --- a/docs/README-wince.md +++ /dev/null @@ -1,10 +0,0 @@ -WinCE -===== - -Windows CE is no longer supported by SDL. - -We have left the CE support in SDL 1.2 for those that must have it, and we -have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3. - ---ryan. - diff --git a/docs/README-winrt.md b/docs/README-winrt.md index c05c77e02d..68271cc655 100644 --- a/docs/README-winrt.md +++ b/docs/README-winrt.md @@ -272,8 +272,8 @@ To include these files for C/C++ projects: 2. navigate to the directory containing SDL's source code, then into its subdirectory, 'src/main/winrt/'. Select, then add, the following files: - `SDL_winrt_main_NonXAML.cpp` - - `SDL2-WinRTResources.rc` - - `SDL2-WinRTResource_BlankCursor.cur` + - `SDL3-WinRTResources.rc` + - `SDL3-WinRTResource_BlankCursor.cur` 3. right-click on the file `SDL_winrt_main_NonXAML.cpp` (as listed in your project), then click on "Properties...". 4. in the drop-down box next to "Configuration", choose, "All Configurations" @@ -287,7 +287,7 @@ app's project. This is to make sure that Visual C++'s linker builds a 'Windows Metadata' file (.winmd) for your app. Not doing so can lead to build errors.** For non-C++ projects, you will need to call SDL_WinRTRunApp from your language's -main function, and generate SDL2-WinRTResources.res manually by using `rc` via +main function, and generate SDL3-WinRTResources.res manually by using `rc` via the Developer Command Prompt and including it as a within the first block in your Visual Studio project file. diff --git a/docs/README.md b/docs/README.md index 6813f75fb3..5844223654 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,7 +25,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [Android](README-android.md) - [CMake](README-cmake.md) -- [DirectFB](README-directfb.md) - [DynAPI](README-dynapi.md) - [Emscripten](README-emscripten.md) - [GDK](README-gdk.md) @@ -34,9 +33,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [iOS](README-ios.md) - [Linux](README-linux.md) - [macOS](README-macos.md) -- [OS/2](README-os2.md) -- [Native Client](README-nacl.md) -- [Pandora](README-pandora.md) - [Supported Platforms](README-platforms.md) - [Porting information](README-porting.md) - [PSP](README-psp.md) @@ -44,7 +40,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [Raspberry Pi](README-raspberrypi.md) - [Touch](README-touch.md) - [Versions](README-versions.md) -- [WinCE](README-wince.md) - [Windows](README-windows.md) - [WinRT](README-winrt.md) - [PSVita](README-vita.md) diff --git a/docs/doxyfile b/docs/doxyfile index 7b80a3a8da..a9d837c320 100644 --- a/docs/doxyfile +++ b/docs/doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = SDL # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 2.0 +PROJECT_NUMBER = 3.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -868,14 +868,14 @@ GENERATE_DOCSET = NO # documentation sets from a single provider (such as a company or product suite) # can be grouped. -DOCSET_FEEDNAME = "SDL 2.0 Doxygen" +DOCSET_FEEDNAME = "SDL 3.0 Doxygen" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. -DOCSET_BUNDLE_ID = org.libsdl.sdl20 +DOCSET_BUNDLE_ID = org.libsdl.sdl30 # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the @@ -889,7 +889,7 @@ GENERATE_HTMLHELP = NO # can add a path in front of the file if the result should not be # written to the html output directory. -CHM_FILE = ./sdl20.chm +CHM_FILE = ./sdl30.chm # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of diff --git a/docs/release_checklist.md b/docs/release_checklist.md index a5c1d17808..37d8b6d947 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -16,6 +16,8 @@ mechanical work. * Do the release +* Update the website file include/header.inc.php to reflect the new version + ## New bugfix release * Check that no new API/ABI was added @@ -28,6 +30,8 @@ mechanical work. * Do the release +* Update the website file include/header.inc.php to reflect the new version + ## After a feature release * Create a branch like `release-2.24.x` diff --git a/include/SDL.h b/include/SDL.h index 12e7f31a28..946ff158f9 100644 --- a/include/SDL.h +++ b/include/SDL.h @@ -134,7 +134,7 @@ extern "C" { * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_InitSubSystem * \sa SDL_Quit @@ -146,13 +146,13 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); /** * Compatibility function to initialize the SDL library. * - * In SDL2, this function and SDL_Init() are interchangeable. + * This function and SDL_Init() are interchangeable. * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Init * \sa SDL_Quit @@ -175,7 +175,7 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_InitSubSystem * \sa SDL_Quit @@ -191,7 +191,7 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); * * The return value does not include SDL_INIT_NOPARACHUTE. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Init * \sa SDL_InitSubSystem @@ -215,7 +215,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); * application is shutdown, but it is not wise to do this from a library or * other dynamically loaded code. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Init * \sa SDL_QuitSubSystem diff --git a/include/SDL_assert.h b/include/SDL_assert.h index e71cf9792d..15709e6921 100644 --- a/include/SDL_assert.h +++ b/include/SDL_assert.h @@ -53,7 +53,7 @@ assert can have unique static variables associated with it. #define SDL_TriggerBreakpoint() __debugbreak() #elif _SDL_HAS_BUILTIN(__builtin_debugtrap) #define SDL_TriggerBreakpoint() __builtin_debugtrap() -#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" ) @@ -219,7 +219,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( * fails or NULL for the default handler * \param userdata a pointer that is passed to `handler` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAssertionHandler */ @@ -238,7 +238,7 @@ extern DECLSPEC void SDLCALL SDL_SetAssertionHandler( * \returns the default SDL_AssertionHandler that is called when an assert * triggers. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAssertionHandler */ @@ -261,7 +261,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void * was passed to SDL_SetAssertionHandler() * \returns the SDL_AssertionHandler that is called when an assert triggers. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetAssertionHandler */ @@ -289,7 +289,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse * \returns a list of all failed assertions or NULL if the list is empty. This * memory should not be modified or freed by the application. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ResetAssertionReport */ @@ -303,7 +303,7 @@ extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); * no items. In addition, any previously-triggered assertions will be reset to * a trigger_count of zero, and their always_ignore state will be false. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAssertionReport */ diff --git a/include/SDL_atomic.h b/include/SDL_atomic.h index f0c05f4bb8..09c8a7c67c 100644 --- a/include/SDL_atomic.h +++ b/include/SDL_atomic.h @@ -98,7 +98,7 @@ typedef int SDL_SpinLock; * \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already * held. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicLock * \sa SDL_AtomicUnlock @@ -113,7 +113,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); * * \param lock a pointer to a lock variable * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicTryLock * \sa SDL_AtomicUnlock @@ -130,7 +130,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock); * * \param lock a pointer to a lock variable * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicLock * \sa SDL_AtomicTryLock @@ -178,7 +178,7 @@ extern __inline void SDL_CompilerBarrier(void); * For more information on these semantics, take a look at the blog post: * http://preshing.com/20120913/acquire-and-release-semantics * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); @@ -200,11 +200,6 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); typedef void (*SDL_KernelMemoryBarrierFunc)(); #define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() #define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() -#elif 0 /* defined(__QNXNTO__) */ -#include - -#define SDL_MemoryBarrierRelease() __cpu_membarrier() -#define SDL_MemoryBarrierAcquire() __cpu_membarrier() #else #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") @@ -274,7 +269,7 @@ typedef struct { int value; } SDL_atomic_t; * \param newval the new value * \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicCASPtr * \sa SDL_AtomicGet @@ -294,7 +289,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int * \param v the desired value * \returns the previous value of the atomic variable. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicGet */ @@ -309,7 +304,7 @@ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v); * \param a a pointer to an SDL_atomic_t variable * \returns the current value of an atomic variable. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicSet */ @@ -327,7 +322,7 @@ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a); * \param v the desired value to add * \returns the previous value of the atomic variable. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicDecRef * \sa SDL_AtomicIncRef @@ -362,7 +357,7 @@ extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v); * \param newval the new pointer value * \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicCAS * \sa SDL_AtomicGetPtr @@ -380,7 +375,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void * * \param v the desired pointer value * \returns the previous value of the pointer. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicCASPtr * \sa SDL_AtomicGetPtr @@ -396,7 +391,7 @@ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v); * \param a a pointer to a pointer * \returns the current value of a pointer. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AtomicCASPtr * \sa SDL_AtomicSetPtr diff --git a/include/SDL_audio.h b/include/SDL_audio.h index c42de3ed97..a5d4ef8bf7 100644 --- a/include/SDL_audio.h +++ b/include/SDL_audio.h @@ -269,7 +269,7 @@ typedef struct SDL_AudioCVT * * \returns the number of built-in audio drivers. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAudioDriver */ @@ -291,7 +291,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); * \returns the name of the audio driver at the requested index, or NULL if an * invalid index was specified. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumAudioDrivers */ @@ -318,7 +318,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AudioQuit */ @@ -332,7 +332,7 @@ extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); * specific need to specify the audio driver you want to use. You should * normally use SDL_Quit() or SDL_QuitSubSystem(). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AudioInit */ @@ -351,7 +351,7 @@ extern DECLSPEC void SDLCALL SDL_AudioQuit(void); * \returns the name of the current audio driver or NULL if no driver has been * initialized. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AudioInit */ @@ -397,7 +397,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); * audio device or failure to set up the audio thread; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CloseAudio * \sa SDL_LockAudio @@ -457,7 +457,7 @@ typedef Uint32 SDL_AudioDeviceID; * -1 if an explicit list of devices can't be determined. A return * value of -1 does not necessarily mean an error condition. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAudioDeviceName * \sa SDL_OpenAudioDevice @@ -484,7 +484,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); * \returns the name of the audio device at the requested index, or NULL on * error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumAudioDevices * \sa SDL_GetDefaultAudioInfo @@ -510,7 +510,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, * \param spec The SDL_AudioSpec to be initialized by this function. * \returns 0 on success, nonzero on error * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumAudioDevices * \sa SDL_GetDefaultAudioInfo @@ -544,7 +544,7 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index, * query the default output device. * \returns 0 on success, nonzero on error * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAudioDeviceName * \sa SDL_GetAudioDeviceSpec @@ -657,7 +657,7 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name, * For compatibility with SDL 1.2, this will never return 1, since * SDL reserves that ID for the legacy SDL_OpenAudio() function. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CloseAudioDevice * \sa SDL_GetAudioDeviceName @@ -702,7 +702,7 @@ typedef enum * * \returns the SDL_AudioStatus of the audio device opened by SDL_OpenAudio(). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAudioDeviceStatus */ @@ -715,7 +715,7 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void); * SDL_OpenAudioDevice() * \returns the SDL_AudioStatus of the specified audio device. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PauseAudioDevice */ @@ -747,7 +747,7 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDevice * * \param pause_on non-zero to pause, 0 to unpause * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetAudioStatus * \sa SDL_PauseAudioDevice @@ -778,7 +778,7 @@ extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); * \param dev a device opened by SDL_OpenAudioDevice() * \param pause_on non-zero to pause, 0 to unpause * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LockAudioDevice */ @@ -862,7 +862,7 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, * When the application is done with the data returned in * `audio_buf`, it should call SDL_FreeWAV() to dispose of it. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FreeWAV * \sa SDL_LoadWAV @@ -890,7 +890,7 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or * SDL_LoadWAV_RW() * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadWAV * \sa SDL_LoadWAV_RW @@ -925,7 +925,7 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); * or a negative error code on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ConvertAudio */ @@ -971,7 +971,7 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, * \returns 0 if the conversion was completed successfully or a negative error * code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BuildAudioCVT */ @@ -999,7 +999,7 @@ typedef struct _SDL_AudioStream SDL_AudioStream; * \param dst_rate The sampling rate of the desired audio output * \returns 0 on success, or -1 on error. * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AudioStreamPut * \sa SDL_AudioStreamGet @@ -1023,7 +1023,7 @@ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioForm * \param len The number of bytes to write to the stream * \returns 0 on success, or -1 on error. * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamGet @@ -1042,7 +1042,7 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const vo * \param len The maximum number of bytes to fill * \returns the number of bytes read from the stream, or -1 on error * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut @@ -1060,7 +1060,7 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *bu * resample correctly, so this number might be lower than what you expect, or * even be zero. Add more data or flush the stream if you need the data now. * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut @@ -1079,7 +1079,7 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); * audio gaps in the output. Generally this is intended to signal the end of * input, so the complete output becomes available. * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut @@ -1093,7 +1093,7 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); /** * Clear any pending data in the stream without converting it * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut @@ -1107,7 +1107,7 @@ extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); /** * Free an audio stream * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut @@ -1138,7 +1138,7 @@ extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME * for full audio volume * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_MixAudioFormat */ @@ -1173,7 +1173,7 @@ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME * for full audio volume * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, @@ -1211,9 +1211,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * You should not call SDL_LockAudio() on the device before queueing; SDL * handles locking internally for this function. * - * Note that SDL2 does not support planar audio. You will need to resample - * from planar audio formats into a non-planar one (see SDL_AudioFormat) - * before queuing audio. + * Note that SDL does not support planar audio. You will need to resample from + * planar audio formats into a non-planar one (see SDL_AudioFormat) before + * queuing audio. * * \param dev the device ID to which we will queue audio * \param data the data to queue to the device for later playback @@ -1221,7 +1221,7 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ClearQueuedAudio * \sa SDL_GetQueuedAudioSize @@ -1269,7 +1269,7 @@ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *da * \returns the number of bytes dequeued, which could be less than requested; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ClearQueuedAudio * \sa SDL_GetQueuedAudioSize @@ -1302,7 +1302,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *dat * \param dev the device ID of which we will query queued audio size * \returns the number of bytes (not samples!) of queued audio. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ClearQueuedAudio * \sa SDL_QueueAudio @@ -1336,7 +1336,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); * * \param dev the device ID of which to clear the audio queue * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetQueuedAudioSize * \sa SDL_QueueAudio @@ -1367,7 +1367,7 @@ extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev); * * ...and is only useful if you used the legacy SDL_OpenAudio() function. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LockAudioDevice * \sa SDL_UnlockAudio @@ -1408,7 +1408,7 @@ extern DECLSPEC void SDLCALL SDL_LockAudio(void); * * \param dev the ID of the device to be locked * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_UnlockAudioDevice */ @@ -1426,7 +1426,7 @@ extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); * * ...and is only useful if you used the legacy SDL_OpenAudio() function. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LockAudio * \sa SDL_UnlockAudioDevice @@ -1441,7 +1441,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); * * \param dev the ID of the device to be unlocked * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LockAudioDevice */ @@ -1459,7 +1459,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); * * ...and is only useful if you used the legacy SDL_OpenAudio() function. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_OpenAudio */ @@ -1483,7 +1483,7 @@ extern DECLSPEC void SDLCALL SDL_CloseAudio(void); * * \param dev an audio device previously opened with SDL_OpenAudioDevice() * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_OpenAudioDevice */ diff --git a/include/SDL_blendmode.h b/include/SDL_blendmode.h index 08c9f9dd65..0df3d14567 100644 --- a/include/SDL_blendmode.h +++ b/include/SDL_blendmode.h @@ -173,7 +173,7 @@ typedef enum * \returns an SDL_BlendMode that represents the chosen factors and * operations. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderDrawBlendMode * \sa SDL_GetRenderDrawBlendMode diff --git a/include/SDL_clipboard.h b/include/SDL_clipboard.h index 783c7c251a..29be3b8911 100644 --- a/include/SDL_clipboard.h +++ b/include/SDL_clipboard.h @@ -45,7 +45,7 @@ extern "C" { * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetClipboardText * \sa SDL_HasClipboardText @@ -63,7 +63,7 @@ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); * on the returned pointer when done with it (even if there was an * error). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasClipboardText * \sa SDL_SetClipboardText @@ -75,7 +75,7 @@ extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); * * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetClipboardText * \sa SDL_SetClipboardText @@ -89,7 +89,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_HasPrimarySelectionText @@ -108,7 +108,7 @@ extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text); * call SDL_free() on the returned pointer when done with it (even if * there was an error). * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasPrimarySelectionText * \sa SDL_SetPrimarySelectionText @@ -122,7 +122,7 @@ extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it * does not. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_SetPrimarySelectionText diff --git a/include/SDL_config.h b/include/SDL_config.h index f91cb47ec7..f59b6bbffd 100644 --- a/include/SDL_config.h +++ b/include/SDL_config.h @@ -43,8 +43,6 @@ #include "SDL_config_iphoneos.h" #elif defined(__ANDROID__) #include "SDL_config_android.h" -#elif defined(__OS2__) -#include "SDL_config_os2.h" #elif defined(__EMSCRIPTEN__) #include "SDL_config_emscripten.h" #elif defined(__NGAGE__) diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index 15c5c9e1d9..cebc9007b8 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -72,6 +72,7 @@ #cmakedefine HAVE_STRING_H 1 #cmakedefine HAVE_SYS_TYPES_H 1 #cmakedefine HAVE_WCHAR_H 1 +#cmakedefine HAVE_LINUX_INPUT_H 1 #cmakedefine HAVE_PTHREAD_NP_H 1 #cmakedefine HAVE_LIBUNWIND_H 1 @@ -139,6 +140,7 @@ #cmakedefine HAVE_STRCASECMP 1 #cmakedefine HAVE__STRNICMP 1 #cmakedefine HAVE_STRNCASECMP 1 +#cmakedefine HAVE_STRCASESTR 1 #cmakedefine HAVE_SSCANF 1 #cmakedefine HAVE_VSSCANF 1 #cmakedefine HAVE_VSNPRINTF 1 @@ -291,40 +293,27 @@ #cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_OPENSLES @SDL_AUDIO_DRIVER_OPENSLES@ #cmakedefine SDL_AUDIO_DRIVER_AAUDIO @SDL_AUDIO_DRIVER_AAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ -#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ #cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ #cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ -#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ -#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ #cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ #cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ -#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ -#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ -#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE @SDL_AUDIO_DRIVER_PIPEWIRE@ #cmakedefine SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC @SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ #cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ #cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ -#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ -#cmakedefine SDL_AUDIO_DRIVER_OS2 @SDL_AUDIO_DRIVER_OS2@ #cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@ #cmakedefine SDL_AUDIO_DRIVER_PSP @SDL_AUDIO_DRIVER_PSP@ #cmakedefine SDL_AUDIO_DRIVER_PS2 @SDL_AUDIO_DRIVER_PS2@ +#cmakedefine SDL_AUDIO_DRIVER_N3DS @SDL_AUDIO_DRIVER_N3DS@ /* Enable various input drivers */ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ @@ -339,7 +328,6 @@ #cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ #cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ #cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ -#cmakedefine SDL_JOYSTICK_OS2 @SDL_JOYSTICK_OS2@ #cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ #cmakedefine SDL_HAVE_MACHINE_JOYSTICK_H @SDL_HAVE_MACHINE_JOYSTICK_H@ #cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@ @@ -349,6 +337,7 @@ #cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@ #cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@ #cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@ +#cmakedefine SDL_JOYSTICK_N3DS @SDL_JOYSTICK_N3DS@ #cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ #cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ @@ -363,13 +352,13 @@ #cmakedefine SDL_SENSOR_WINDOWS @SDL_SENSOR_WINDOWS@ #cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@ #cmakedefine SDL_SENSOR_VITA @SDL_SENSOR_VITA@ +#cmakedefine SDL_SENSOR_N3DS @SDL_SENSOR_N3DS@ /* Enable various shared object loading systems */ #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ #cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ #cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@ -#cmakedefine SDL_LOADSO_OS2 @SDL_LOADSO_OS2@ /* Enable various threading systems */ #cmakedefine SDL_THREAD_GENERIC_COND_SUFFIX @SDL_THREAD_GENERIC_COND_SUFFIX@ @@ -377,20 +366,20 @@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@ #cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@ #cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@ -#cmakedefine SDL_THREAD_OS2 @SDL_THREAD_OS2@ #cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@ #cmakedefine SDL_THREAD_PSP @SDL_THREAD_PSP@ #cmakedefine SDL_THREAD_PS2 @SDL_THREAD_PS2@ +#cmakedefine SDL_THREAD_N3DS @SDL_THREAD_N3DS@ /* Enable various timer systems */ #cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@ #cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@ #cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@ #cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@ -#cmakedefine SDL_TIMER_OS2 @SDL_TIMER_OS2@ #cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@ #cmakedefine SDL_TIMER_PSP @SDL_TIMER_PSP@ #cmakedefine SDL_TIMER_PS2 @SDL_TIMER_PS2@ +#cmakedefine SDL_TIMER_N3DS @SDL_TIMER_N3DS@ /* Enable various video drivers */ #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ @@ -398,8 +387,6 @@ #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@ #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@ #cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@ -#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@ -#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@ #cmakedefine SDL_VIDEO_DRIVER_OFFSCREEN @SDL_VIDEO_DRIVER_OFFSCREEN@ #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ @@ -408,8 +395,6 @@ #cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ -#cmakedefine SDL_VIDEO_DRIVER_OS2 @SDL_VIDEO_DRIVER_OS2@ -#cmakedefine SDL_VIDEO_DRIVER_QNX @SDL_VIDEO_DRIVER_QNX@ #cmakedefine SDL_VIDEO_DRIVER_RISCOS @SDL_VIDEO_DRIVER_RISCOS@ #cmakedefine SDL_VIDEO_DRIVER_PSP @SDL_VIDEO_DRIVER_PSP@ #cmakedefine SDL_VIDEO_DRIVER_PS2 @SDL_VIDEO_DRIVER_PS2@ @@ -444,6 +429,7 @@ #cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ #cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ #cmakedefine SDL_VIDEO_DRIVER_VITA @SDL_VIDEO_DRIVER_VITA@ +#cmakedefine SDL_VIDEO_DRIVER_N3DS @SDL_VIDEO_DRIVER_N3DS@ #cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ #cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ @@ -451,7 +437,6 @@ #cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ -#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ #cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@ #cmakedefine SDL_VIDEO_RENDER_VITA_GXM @SDL_VIDEO_RENDER_VITA_GXM@ #cmakedefine SDL_VIDEO_RENDER_PS2 @SDL_VIDEO_RENDER_PS2@ @@ -487,6 +472,7 @@ #cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@ #cmakedefine SDL_POWER_VITA @SDL_POWER_VITA@ #cmakedefine SDL_POWER_PSP @SDL_POWER_PSP@ +#cmakedefine SDL_POWER_N3DS @SDL_POWER_N3DS@ /* Enable system filesystem support */ #cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@ @@ -497,10 +483,10 @@ #cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@ #cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@ #cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@ -#cmakedefine SDL_FILESYSTEM_OS2 @SDL_FILESYSTEM_OS2@ #cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@ #cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@ #cmakedefine SDL_FILESYSTEM_PS2 @SDL_FILESYSTEM_PS2@ +#cmakedefine SDL_FILESYSTEM_N3DS @SDL_FILESYSTEM_N3DS@ /* Enable misc subsystem */ #cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@ diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 56b53029a7..fe2a255940 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -75,6 +75,7 @@ #undef HAVE_STRING_H #undef HAVE_SYS_TYPES_H #undef HAVE_WCHAR_H +#undef HAVE_LINUX_INPUT_H #undef HAVE_PTHREAD_NP_H #undef HAVE_LIBUNWIND_H @@ -142,6 +143,7 @@ #undef HAVE_STRCASECMP #undef HAVE__STRNICMP #undef HAVE_STRNCASECMP +#undef HAVE_STRCASESTR #undef HAVE_SSCANF #undef HAVE_VSSCANF #undef HAVE_SNPRINTF @@ -277,39 +279,24 @@ #undef SDL_AUDIO_DRIVER_ALSA #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC #undef SDL_AUDIO_DRIVER_ANDROID -#undef SDL_AUDIO_DRIVER_ARTS -#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC #undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_DISK #undef SDL_AUDIO_DRIVER_DSOUND #undef SDL_AUDIO_DRIVER_DUMMY #undef SDL_AUDIO_DRIVER_EMSCRIPTEN -#undef SDL_AUDIO_DRIVER_ESD -#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC -#undef SDL_AUDIO_DRIVER_FUSIONSOUND -#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC #undef SDL_AUDIO_DRIVER_HAIKU #undef SDL_AUDIO_DRIVER_JACK #undef SDL_AUDIO_DRIVER_JACK_DYNAMIC -#undef SDL_AUDIO_DRIVER_NACL -#undef SDL_AUDIO_DRIVER_NAS -#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC #undef SDL_AUDIO_DRIVER_NETBSD #undef SDL_AUDIO_DRIVER_OPENSLES #undef SDL_AUDIO_DRIVER_OSS -#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H -#undef SDL_AUDIO_DRIVER_PAUDIO #undef SDL_AUDIO_DRIVER_PIPEWIRE #undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC #undef SDL_AUDIO_DRIVER_PULSEAUDIO #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_QSA #undef SDL_AUDIO_DRIVER_SNDIO #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_SUNAUDIO #undef SDL_AUDIO_DRIVER_WASAPI -#undef SDL_AUDIO_DRIVER_WINMM -#undef SDL_AUDIO_DRIVER_OS2 /* Enable various input drivers */ #undef SDL_INPUT_LINUXEV @@ -325,7 +312,6 @@ #undef SDL_JOYSTICK_MFI #undef SDL_JOYSTICK_LINUX #undef SDL_JOYSTICK_ANDROID -#undef SDL_JOYSTICK_OS2 #undef SDL_JOYSTICK_USBHID #undef SDL_HAVE_MACHINE_JOYSTICK_H #undef SDL_JOYSTICK_HIDAPI @@ -350,7 +336,6 @@ #undef SDL_LOADSO_DUMMY #undef SDL_LOADSO_LDG #undef SDL_LOADSO_WINDOWS -#undef SDL_LOADSO_OS2 /* Enable various threading systems */ #undef SDL_THREAD_GENERIC_COND_SUFFIX @@ -358,20 +343,16 @@ #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP #undef SDL_THREAD_WINDOWS -#undef SDL_THREAD_OS2 /* Enable various timer systems */ #undef SDL_TIMER_HAIKU #undef SDL_TIMER_DUMMY #undef SDL_TIMER_UNIX #undef SDL_TIMER_WINDOWS -#undef SDL_TIMER_OS2 /* Enable various video drivers */ #undef SDL_VIDEO_DRIVER_HAIKU #undef SDL_VIDEO_DRIVER_COCOA -#undef SDL_VIDEO_DRIVER_DIRECTFB -#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC #undef SDL_VIDEO_DRIVER_DUMMY #undef SDL_VIDEO_DRIVER_WINDOWS #undef SDL_VIDEO_DRIVER_WAYLAND @@ -406,11 +387,8 @@ #undef SDL_VIDEO_DRIVER_X11_XSHAPE #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM -#undef SDL_VIDEO_DRIVER_NACL #undef SDL_VIDEO_DRIVER_VIVANTE #undef SDL_VIDEO_DRIVER_VIVANTE_VDK -#undef SDL_VIDEO_DRIVER_OS2 -#undef SDL_VIDEO_DRIVER_QNX #undef SDL_VIDEO_DRIVER_RISCOS #undef SDL_VIDEO_RENDER_D3D @@ -419,7 +397,6 @@ #undef SDL_VIDEO_RENDER_OGL #undef SDL_VIDEO_RENDER_OGL_ES #undef SDL_VIDEO_RENDER_OGL_ES2 -#undef SDL_VIDEO_RENDER_DIRECTFB #undef SDL_VIDEO_RENDER_METAL /* Enable OpenGL support */ @@ -457,9 +434,7 @@ #undef SDL_FILESYSTEM_RISCOS #undef SDL_FILESYSTEM_UNIX #undef SDL_FILESYSTEM_WINDOWS -#undef SDL_FILESYSTEM_NACL #undef SDL_FILESYSTEM_EMSCRIPTEN -#undef SDL_FILESYSTEM_OS2 #undef SDL_FILESYSTEM_VITA #undef SDL_FILESYSTEM_PSP #undef SDL_FILESYSTEM_PS2 diff --git a/include/SDL_config_android.h b/include/SDL_config_android.h index 5a9cfc0459..64918ae0b8 100644 --- a/include/SDL_config_android.h +++ b/include/SDL_config_android.h @@ -85,6 +85,7 @@ #define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 +#define HAVE_STRCASESTR 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_ACOS 1 diff --git a/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h index 48f9f9f9be..6db16eb4cc 100644 --- a/include/SDL_config_iphoneos.h +++ b/include/SDL_config_iphoneos.h @@ -85,6 +85,7 @@ #define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 +#define HAVE_STRCASESTR 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h index 023ecaae32..e7189f3a14 100644 --- a/include/SDL_config_macosx.h +++ b/include/SDL_config_macosx.h @@ -88,6 +88,7 @@ #define HAVE_STRNCMP 1 #define HAVE_STRCASECMP 1 #define HAVE_STRNCASECMP 1 +#define HAVE_STRCASESTR 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 diff --git a/include/SDL_config_os2.h b/include/SDL_config_os2.h deleted file mode 100644 index c86769db4e..0000000000 --- a/include/SDL_config_os2.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_os2_h_ -#define SDL_config_os2_h_ -#define SDL_config_h_ - -#include "SDL_platform.h" - -#define SIZEOF_VOIDP 4 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_OS2 1 - -#define SDL_POWER_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 - -#define SDL_SENSOR_DUMMY 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_OS2 1 -#define SDL_JOYSTICK_OS2 1 -#ifndef HAVE_LIBUSB_H /* see Makefile */ -#define SDL_HIDAPI_DISABLED 1 -/*#undef SDL_JOYSTICK_HIDAPI */ -#else -#define SDL_JOYSTICK_HIDAPI 1 -#define HAVE_LIBUSB 1 -/* dynamically loaded libusb-1.0 dll: */ -#define SDL_LIBUSB_DYNAMIC "usb100.dll" -#endif -/*#undef SDL_JOYSTICK_VIRTUAL */ - -/* Enable OpenGL support */ -/* #undef SDL_VIDEO_OPENGL */ - -#define SDL_THREAD_OS2 1 -#define SDL_LOADSO_OS2 1 -#define SDL_TIMER_OS2 1 -#define SDL_FILESYSTEM_OS2 1 - -/* use libsamplerate for audio rate conversion. */ -/*#define HAVE_LIBSAMPLERATE_H 1 */ - -/* Enable dynamic libsamplerate support */ -#define SDL_LIBSAMPLERATE_DYNAMIC "SAMPRATE.DLL" - -#define HAVE_LIBC 1 - -#define HAVE_STDARG_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_STDINT_H 1 - -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 -#define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_WCHAR_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 -#define HAVE_FLOAT_H 1 -#define HAVE_SIGNAL_H 1 - -#if 0 /* see Makefile */ -#define HAVE_ICONV 1 -#define HAVE_ICONV_H 1 -#endif - -/* #undef HAVE_DLOPEN */ -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#if defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE__FTELLI64 1 -#endif -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#endif -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -#define HAVE_WCSCMP 1 -#define HAVE__WCSICMP 1 -#define HAVE__WCSNICMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 -/* #undef HAVE_WCSDUP */ -#define HAVE__WCSDUP 1 -#define HAVE_WCSSTR 1 -#define HAVE_WCSCMP 1 -#define HAVE_WCSNCMP 1 -#define HAVE_STRLEN 1 -#define HAVE_STRLCPY 1 -#define HAVE_STRLCAT 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 -/* #undef HAVE_INDEX */ -/* #undef HAVE_RINDEX */ -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -/* #undef HAVE_STRTOK_R */ -#define HAVE_ITOA 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE__I64TOA 1 -#define HAVE__UI64TOA 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRICMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_SSCANF 1 -#define HAVE_VSSCANF 1 -#define HAVE_SNPRINTF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_SETJMP 1 -#define HAVE_ACOS 1 -/* #undef HAVE_ACOSF */ -#define HAVE_ASIN 1 -/* #undef HAVE_ASINF */ -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -/* #undef HAVE_ATAN2F */ -#define HAVE_CEIL 1 -/* #undef HAVE_CEILF */ -/* #undef HAVE_COPYSIGN */ -/* #undef HAVE_COPYSIGNF */ -#define HAVE_COS 1 -/* #undef HAVE_COSF */ -#define HAVE_EXP 1 -/* #undef HAVE_EXPF */ -#define HAVE_FABS 1 -/* #undef HAVE_FABSF */ -#define HAVE_FLOOR 1 -/* #undef HAVE_FLOORF */ -#define HAVE_FMOD 1 -/* #undef HAVE_FMODF */ -#define HAVE_LOG 1 -/* #undef HAVE_LOGF */ -#define HAVE_LOG10 1 -/* #undef HAVE_LOG10F */ -#define HAVE_POW 1 -/* #undef HAVE_POWF */ -#define HAVE_SIN 1 -/* #undef HAVE_SINF */ -/* #undef HAVE_SCALBN */ -/* #undef HAVE_SCALBNF */ -#define HAVE_SQRT 1 -/* #undef HAVE_SQRTF */ -#define HAVE_TAN 1 -/* #undef HAVE_TANF */ -/* #undef HAVE_TRUNC */ -/* #undef HAVE_TRUNCF */ -/* #undef HAVE_LROUND */ -/* #undef HAVE_LROUNDF */ -/* #undef HAVE_ROUND */ -/* #undef HAVE_ROUNDF */ - -#endif /* SDL_config_os2_h_ */ diff --git a/include/SDL_config_pandora.h b/include/SDL_config_pandora.h deleted file mode 100644 index 01bbf49b06..0000000000 --- a/include/SDL_config_pandora.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SDL_config_pandora_h_ -#define SDL_config_pandora_h_ -#define SDL_config_h_ - -/* This is a set of defines to configure the SDL features */ - -/* General platform specific identifiers */ -#include "SDL_platform.h" - -#ifdef __LP64__ -#define SIZEOF_VOIDP 8 -#else -#define SIZEOF_VOIDP 4 -#endif - -#define SDL_BYTEORDER 1234 - -#define STDC_HEADERS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_CTYPE_H 1 -#define HAVE_ICONV_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MATH_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_TYPES_H 1 - -#define HAVE_DLOPEN 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ALLOCA 1 -#define HAVE_GETENV 1 -#define HAVE_SETENV 1 -#define HAVE_PUTENV 1 -#define HAVE_UNSETENV 1 -#define HAVE_QSORT 1 -#define HAVE_BSEARCH 1 -#define HAVE_ABS 1 -#define HAVE_BCOPY 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_STRLEN 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_STRCASECMP 1 -#define HAVE_STRNCASECMP 1 -#define HAVE_VSSCANF 1 -#define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_LOG10 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_SIGACTION 1 -#define HAVE_SETJMP 1 -#define HAVE_NANOSLEEP 1 - -#define SDL_AUDIO_DRIVER_DUMMY 1 -#define SDL_AUDIO_DRIVER_OSS 1 - -#define SDL_INPUT_LINUXEV 1 -#define SDL_JOYSTICK_LINUX 1 -#define SDL_JOYSTICK_VIRTUAL 1 -#define SDL_HAPTIC_LINUX 1 - -#define SDL_SENSOR_DUMMY 1 - -#define SDL_LOADSO_DLOPEN 1 - -#define SDL_THREAD_PTHREAD 1 -#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 - -#define SDL_TIMER_UNIX 1 -#define SDL_FILESYSTEM_UNIX 1 - -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_X11 1 -#define SDL_VIDEO_DRIVER_PANDORA 1 -#define SDL_VIDEO_RENDER_OGL_ES 1 -#define SDL_VIDEO_OPENGL_ES 1 - -#endif /* SDL_config_pandora_h_ */ diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h index 58e0b7ecbf..2ea2f9d256 100644 --- a/include/SDL_config_windows.h +++ b/include/SDL_config_windows.h @@ -89,7 +89,6 @@ typedef unsigned int uintptr_t; #define HAVE_DDRAW_H 1 #define HAVE_DINPUT_H 1 #define HAVE_DSOUND_H 1 -#ifndef __WATCOMC__ #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */ @@ -109,7 +108,6 @@ typedef unsigned int uintptr_t; #define HAVE_AUDIOCLIENT_H 1 #define HAVE_TPCSHRD_H 1 #define HAVE_SENSORSAPI_H 1 -#endif #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600) #define HAVE_IMMINTRIN_H 1 #elif defined(__has_include) && (defined(__i386__) || defined(__x86_64)) @@ -136,11 +134,8 @@ typedef unsigned int uintptr_t; #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 -/* OpenWatcom requires specific calling conventions for qsort and bsearch */ -#ifndef __WATCOMC__ #define HAVE_QSORT 1 #define HAVE_BSEARCH 1 -#endif #define HAVE_ABS 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 @@ -186,7 +181,6 @@ typedef unsigned int uintptr_t; #define HAVE_SIN 1 #define HAVE_SQRT 1 #define HAVE_TAN 1 -#ifndef __WATCOMC__ #define HAVE_ACOSF 1 #define HAVE_ASINF 1 #define HAVE_ATANF 1 @@ -204,7 +198,6 @@ typedef unsigned int uintptr_t; #define HAVE_SINF 1 #define HAVE_SQRTF 1 #define HAVE_TANF 1 -#endif #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 @@ -227,14 +220,6 @@ typedef unsigned int uintptr_t; #ifdef _USE_MATH_DEFINES #define HAVE_M_PI 1 #endif -#elif defined(__WATCOMC__) -#define HAVE__FSEEKI64 1 -#define HAVE_STRTOLL 1 -#define HAVE_STRTOULL 1 -#define HAVE_VSSCANF 1 -#define HAVE_ROUND 1 -#define HAVE_SCALBN 1 -#define HAVE_TRUNC 1 #else #define HAVE_M_PI 1 #endif diff --git a/include/SDL_cpuinfo.h b/include/SDL_cpuinfo.h index 43a8ac5017..44cbebb233 100644 --- a/include/SDL_cpuinfo.h +++ b/include/SDL_cpuinfo.h @@ -90,6 +90,7 @@ _m_prefetch(void *__P) # include # include # define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ +# define __ARM_ARCH 8 # endif # endif #endif @@ -143,7 +144,7 @@ extern "C" { * technologies such as hyperthreading, the number of logical cores * may be more than the number of physical cores. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); @@ -155,7 +156,7 @@ extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); * * \returns the L1 cache line size of the CPU, in bytes. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); @@ -166,7 +167,7 @@ extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); * * \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -189,7 +190,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); * * \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAVX @@ -211,7 +212,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); * * \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -233,7 +234,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); * * \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasAltiVec * \sa SDL_HasAVX @@ -255,7 +256,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); * * \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -277,7 +278,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); * * \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -299,7 +300,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); * * \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -321,7 +322,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); * * \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -343,7 +344,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); * * \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -365,7 +366,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); * * \returns SDL_TRUE if the CPU has AVX features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -387,7 +388,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); * * \returns SDL_TRUE if the CPU has AVX2 features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Has3DNow * \sa SDL_HasAltiVec @@ -409,7 +410,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); * * \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasAVX */ @@ -424,7 +425,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); * * \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasNEON */ @@ -437,7 +438,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void); * * \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); @@ -450,7 +451,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); * \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if * not. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void); @@ -463,7 +464,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void); * \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if * not. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void); @@ -472,7 +473,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void); * * \returns the amount of RAM configured in the system in MiB. * - * \since This function is available since SDL 2.0.1. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); @@ -491,7 +492,7 @@ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); * \returns the alignment in bytes needed for available, known SIMD * instructions. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); @@ -526,7 +527,7 @@ extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); * allocated block might be larger due to padding, etc. * \returns a pointer to the newly-allocated block, NULL if out of memory. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SIMDGetAlignment * \sa SDL_SIMDRealloc @@ -550,7 +551,7 @@ extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len); * memory. * \returns a pointer to the newly-reallocated block, NULL if out of memory. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SIMDGetAlignment * \sa SDL_SIMDAlloc @@ -575,7 +576,7 @@ extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len); * \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to * deallocate. NULL is a legal no-op. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SIMDAlloc * \sa SDL_SIMDRealloc diff --git a/include/SDL_error.h b/include/SDL_error.h index 5c961e4284..e4fda71d69 100644 --- a/include/SDL_error.h +++ b/include/SDL_error.h @@ -58,7 +58,7 @@ extern "C" { * any * \returns always -1. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ClearError * \sa SDL_GetError @@ -95,7 +95,7 @@ extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fm * return values of SDL function calls to determine when to * appropriately call SDL_GetError(). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ClearError * \sa SDL_SetError @@ -113,7 +113,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetError(void); * \param maxlen The size of the buffer pointed to by the errstr parameter * \returns the pointer passed in as the `errstr` parameter. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetError */ @@ -122,7 +122,7 @@ extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen); /** * Clear any previous error message for this thread. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetError * \sa SDL_SetError diff --git a/include/SDL_events.h b/include/SDL_events.h index 240a8a8bad..599ec90697 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -295,7 +295,7 @@ typedef struct SDL_MouseButtonEvent Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ - Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ @@ -312,12 +312,14 @@ typedef struct SDL_MouseWheelEvent Uint32 type; /**< ::SDL_MOUSEWHEEL */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ - Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */ Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ float preciseX; /**< The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18) */ float preciseY; /**< The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18) */ + Sint32 mouseX; /**< X coordinate, relative to window (added in 2.26.0) */ + Sint32 mouseY; /**< Y coordinate, relative to window (added in 2.26.0) */ } SDL_MouseWheelEvent; /** @@ -393,7 +395,7 @@ typedef struct SDL_JoyDeviceEvent { Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ - Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ + SDL_JoystickID which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; /** @@ -446,7 +448,7 @@ typedef struct SDL_ControllerDeviceEvent { Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ - Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ + SDL_JoystickID which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; /** @@ -564,7 +566,7 @@ typedef struct SDL_SensorEvent { Uint32 type; /**< ::SDL_SENSORUPDATE */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ - Sint32 which; /**< The instance ID of the sensor */ + SDL_SensorID which; /**< The instance ID of the sensor */ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */ } SDL_SensorEvent; @@ -693,7 +695,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NUL * polling or waiting for events (e.g. you are filtering them), then you must * call SDL_PumpEvents() to force an event queue update. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PollEvent * \sa SDL_WaitEvent @@ -740,7 +742,7 @@ typedef enum * \returns the number of events actually stored or a negative error code on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PollEvent * \sa SDL_PumpEvents @@ -761,7 +763,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, * \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if * events matching `type` are not present. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasEvents */ @@ -780,7 +782,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); * \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are * present, or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasEvents */ @@ -802,7 +804,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); * * \param type the type of event to be cleared; see SDL_EventType for details * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FlushEvents */ @@ -827,7 +829,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); * \param maxType the high end of event type to be cleared, inclusive; see * SDL_EventType for details * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FlushEvent */ @@ -869,7 +871,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); * the queue, or NULL * \returns 1 if there is a pending event or 0 if there are none available. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetEventFilter * \sa SDL_PeepEvents @@ -894,7 +896,7 @@ extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event); * \returns 1 on success or 0 if there was an error while waiting for events; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PollEvent * \sa SDL_PumpEvents @@ -920,7 +922,7 @@ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event); * call SDL_GetError() for more information. This also returns 0 if * the timeout elapsed without an event arriving. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PollEvent * \sa SDL_PumpEvents @@ -955,7 +957,7 @@ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event, * code on failure; call SDL_GetError() for more information. A * common reason for error is the event queue being full. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PeepEvents * \sa SDL_PollEvent @@ -1011,7 +1013,7 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event); * \param filter An SDL_EventFilter function to call when an event happens * \param userdata a pointer that is passed to `filter` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AddEventWatch * \sa SDL_EventState @@ -1033,7 +1035,7 @@ extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, * be stored here * \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetEventFilter */ @@ -1061,7 +1063,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter, * \param filter an SDL_EventFilter function to call when an event happens. * \param userdata a pointer that is passed to `filter` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_DelEventWatch * \sa SDL_SetEventFilter @@ -1078,7 +1080,7 @@ extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, * \param filter the function originally passed to SDL_AddEventWatch() * \param userdata the pointer originally passed to SDL_AddEventWatch() * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AddEventWatch */ @@ -1096,7 +1098,7 @@ extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, * \param filter the SDL_EventFilter function to call when an event happens * \param userdata a pointer that is passed to `filter` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetEventFilter * \sa SDL_SetEventFilter @@ -1125,7 +1127,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, * \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state * of the event before this function makes any changes to it. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetEventState */ @@ -1147,7 +1149,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); * \returns the beginning event number, or (Uint32)-1 if there are not enough * user-defined events left. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PushEvent */ diff --git a/include/SDL_filesystem.h b/include/SDL_filesystem.h index a7606bde2a..7baa343b44 100644 --- a/include/SDL_filesystem.h +++ b/include/SDL_filesystem.h @@ -60,6 +60,10 @@ extern "C" { * - `parent`: the containing directory of the bundle. For example: * `/Applications/SDLApp/` * + * **Nintendo 3DS Specific Functionality**: This function returns "romfs" + * directory of the application as it is uncommon to store resources outside + * the executable. As such it is not a writable directory. + * * The returned path is guaranteed to end with a path separator ('\' on * Windows, '/' on most other platforms). * @@ -71,7 +75,7 @@ extern "C" { * doesn't implement this functionality, call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.1. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetPrefPath */ @@ -128,7 +132,7 @@ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); * notation. NULL if there's a problem (creating directory failed, * etc.). * - * \since This function is available since SDL 2.0.1. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetBasePath */ diff --git a/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h index 05eeec0cef..66373a8026 100644 --- a/include/SDL_gamecontroller.h +++ b/include/SDL_gamecontroller.h @@ -156,7 +156,7 @@ typedef struct SDL_GameControllerButtonBind * \returns the number of mappings added or -1 on error; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerAddMapping * \sa SDL_GameControllerAddMappingsFromFile @@ -193,7 +193,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, * \returns 1 if a new mapping is added, 0 if an existing mapping is updated, * -1 on error; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerMapping * \sa SDL_GameControllerMappingForGUID @@ -205,7 +205,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingStri * * \returns the number of mappings. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); @@ -215,7 +215,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if * the index is out of range. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); @@ -228,7 +228,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_ind * \returns a mapping string or NULL on error; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetDeviceGUID * \sa SDL_JoystickGetGUID @@ -247,7 +247,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID * \returns a string that has the controller's mapping or NULL if no mapping * is available; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerAddMapping * \sa SDL_GameControllerMappingForGUID @@ -265,7 +265,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gam * \returns SDL_TRUE if the given joystick is supported by the game controller * interface, SDL_FALSE if it isn't or it's an invalid index. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerNameForIndex * \sa SDL_GameControllerOpen @@ -285,7 +285,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); * \returns the implementation-dependent name for the game controller, or NULL * if there is no name or the index is invalid. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerName * \sa SDL_GameControllerOpen @@ -306,7 +306,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_ * \returns the implementation-dependent path for the game controller, or NULL * if there is no path or the index is invalid. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerPath */ @@ -321,7 +321,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_ * SDL_NumJoysticks()-1 * \returns the controller type. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index); @@ -335,7 +335,7 @@ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(in * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if * no mapping is available. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); @@ -355,7 +355,7 @@ extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joysti * \returns a gamecontroller identifier or NULL if an error occurred; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerClose * \sa SDL_GameControllerNameForIndex @@ -370,7 +370,7 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_ * \returns an SDL_GameController on success or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); @@ -384,7 +384,7 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL * instance id! * \returns the SDL_GameController associated with a player index. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetPlayerIndex * \sa SDL_GameControllerSetPlayerIndex @@ -402,7 +402,7 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(in * \returns the implementation dependent name for the game controller, or NULL * if there is no name or the identifier passed is invalid. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerNameForIndex * \sa SDL_GameControllerOpen @@ -420,7 +420,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g * \returns the implementation dependent path for the game controller, or NULL * if there is no path or the identifier passed is invalid. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerPathForIndex */ @@ -435,7 +435,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerPath(SDL_GameController *g * \param gamecontroller the game controller object to query. * \returns the controller type. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller); @@ -447,7 +447,7 @@ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_Gam * \param gamecontroller the game controller object to query. * \returns the player index for controller, or -1 if it's not available. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); @@ -458,7 +458,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController * \param player_index Player index to assign to this controller, or -1 to * clear the player index and turn off player LEDs. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); @@ -470,7 +470,7 @@ extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController * \param gamecontroller the game controller object to query. * \return the USB vendor ID, or zero if unavailable. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller); @@ -482,7 +482,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *g * \param gamecontroller the game controller object to query. * \return the USB product ID, or zero if unavailable. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller); @@ -494,7 +494,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * * \param gamecontroller the game controller object to query. * \return the USB product version, or zero if unavailable. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller); @@ -506,7 +506,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameContr * \param gamecontroller the game controller object to query. * \return the controller firmware version, or zero if unavailable. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller); @@ -519,7 +519,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameCont * \param gamecontroller the game controller object to query. * \return the serial number, or NULL if unavailable. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); @@ -531,7 +531,7 @@ extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameControl * \returns SDL_TRUE if the controller has been opened and is currently * connected, or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerClose * \sa SDL_GameControllerOpen @@ -555,7 +555,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameControlle * joystick from * \returns a SDL_Joystick object; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); @@ -573,7 +573,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameCont * \returns the same value passed to the function, with exception to -1 * (SDL_QUERY), which will return the current state. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickEventState */ @@ -586,7 +586,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); * enabled. Under such circumstances, it will not be necessary to call this * function. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); @@ -628,7 +628,7 @@ typedef enum * \returns the SDL_GameControllerAxis enum corresponding to the input string, * or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetStringForAxis */ @@ -644,7 +644,7 @@ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromStri * specified. The string returned is of the format used by * SDL_GameController mapping strings. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetAxisFromString */ @@ -659,7 +659,7 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameC * (like the given Controller axis doesn't exist on the device), its * `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetBindForButton */ @@ -677,7 +677,7 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, * \param axis an axis enum value (an SDL_GameControllerAxis value) * \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); @@ -695,7 +695,7 @@ SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameController * \returns axis state (including 0) on success or 0 (also) on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetButton */ @@ -744,7 +744,7 @@ typedef enum * \returns the SDL_GameControllerButton enum corresponding to the input * string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *str); @@ -754,11 +754,11 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom * The caller should not SDL_free() the returned string. * * \param button an enum value for a given SDL_GameControllerButton - * \returns a string for the given button, or NULL if an invalid axis is + * \returns a string for the given button, or NULL if an invalid button is * specified. The string returned is of the format used by * SDL_GameController mapping strings. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetButtonFromString */ @@ -773,7 +773,7 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_Gam * (like the given Controller button doesn't exist on the device), * its `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetBindForAxis */ @@ -791,7 +791,7 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, * \param button a button enum value (an SDL_GameControllerButton value) * \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); @@ -804,7 +804,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController * \returns 1 for pressed state or 0 for not pressed state or error; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetAxis */ @@ -814,7 +814,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *ga /** * Get the number of touchpads on a game controller. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller); @@ -822,14 +822,14 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController * Get the number of supported simultaneous fingers on a touchpad on a game * controller. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad); /** * Get the current state of a finger on a touchpad on a game controller. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure); @@ -840,7 +840,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameControll * \param type The type of sensor to query * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type); @@ -852,7 +852,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController * \param enabled Whether data reporting should be enabled * \returns 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled); @@ -863,7 +863,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameControlle * \param type The type of sensor to query * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type); @@ -875,7 +875,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameContr * \param type The type of sensor to query * \return the data rate, or 0.0f if the data rate is not available. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameController *gamecontroller, SDL_SensorType type); @@ -891,7 +891,7 @@ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameContro * \param num_values The number of values to write to data * \return 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values); @@ -910,7 +910,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController * * \param num_values The number of values to write to data * \return 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values); @@ -928,7 +928,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_Gam * \param duration_ms The duration of the rumble effect, in milliseconds * \returns 0, or -1 if rumble isn't supported on this controller * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerHasRumble */ @@ -953,7 +953,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon * \param duration_ms The duration of the rumble effect, in milliseconds * \returns 0, or -1 if trigger rumble isn't supported on this controller * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerHasRumbleTriggers */ @@ -966,7 +966,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController * \returns SDL_TRUE, or SDL_FALSE if this controller does not have a * modifiable LED * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *gamecontroller); @@ -977,7 +977,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *ga * \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble * support * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerRumble */ @@ -990,7 +990,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumble(SDL_GameController * \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger * rumble support * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerRumbleTriggers */ @@ -1005,7 +1005,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumbleTriggers(SDL_GameCon * \param blue The intensity of the blue LED * \returns 0, or -1 if this controller does not have a modifiable LED * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue); @@ -1018,7 +1018,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecon * \returns 0, or -1 if this controller or driver doesn't support effect * packets * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void *data, int size); @@ -1028,7 +1028,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gam * \param gamecontroller a game controller identifier previously returned by * SDL_GameControllerOpen() * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerOpen */ @@ -1042,7 +1042,7 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon * \param button a button on the game controller * \returns the sfSymbolsName or NULL if the name can't be found * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetAppleSFSymbolsNameForAxis */ @@ -1056,7 +1056,7 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForBu * \param axis an axis on the game controller * \returns the sfSymbolsName or NULL if the name can't be found * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerGetAppleSFSymbolsNameForButton */ diff --git a/include/SDL_gesture.h b/include/SDL_gesture.h index e2caea2a92..7ba2dcba63 100644 --- a/include/SDL_gesture.h +++ b/include/SDL_gesture.h @@ -54,7 +54,7 @@ typedef Sint64 SDL_GestureID; * \param touchId the touch device id, or -1 for all touch devices * \returns 1 on success or 0 if the specified device could not be found. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTouchDevice */ @@ -68,7 +68,7 @@ extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); * \returns the number of saved templates on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadDollarTemplates * \sa SDL_SaveDollarTemplate @@ -83,7 +83,7 @@ extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); * \returns 1 on success or 0 on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadDollarTemplates * \sa SDL_SaveAllDollarTemplates @@ -99,7 +99,7 @@ extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_R * \returns the number of loaded templates on success or a negative error code * (or 0) on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SaveAllDollarTemplates * \sa SDL_SaveDollarTemplate diff --git a/include/SDL_guid.h b/include/SDL_guid.h index b971636a06..3b4d372a45 100644 --- a/include/SDL_guid.h +++ b/include/SDL_guid.h @@ -67,7 +67,7 @@ typedef struct { * \param pszGUID buffer in which to write the ASCII string * \param cbGUID the size of pszGUID * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GUIDFromString */ @@ -83,7 +83,7 @@ extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int * \param pchGUID string containing an ASCII representation of a GUID * \returns a ::SDL_GUID structure. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GUIDToString */ diff --git a/include/SDL_haptic.h b/include/SDL_haptic.h index f240ae9272..9161152dae 100644 --- a/include/SDL_haptic.h +++ b/include/SDL_haptic.h @@ -827,7 +827,7 @@ typedef union SDL_HapticEffect * \returns the number of haptic devices detected on the system or a negative * error code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticName */ @@ -843,7 +843,7 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void); * \returns the name of the device or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_NumHaptics */ @@ -863,7 +863,7 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); * \returns the device identifier or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticClose * \sa SDL_HapticIndex @@ -883,7 +883,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); * \returns 1 if it has been opened, 0 if it hasn't or on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticIndex * \sa SDL_HapticOpen @@ -897,7 +897,7 @@ extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); * \returns the index of the specified haptic device or a negative error code * on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticOpen * \sa SDL_HapticOpened @@ -909,7 +909,7 @@ extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); * * \returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticOpenFromMouse */ @@ -921,7 +921,7 @@ extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); * \returns the haptic device identifier or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticOpen * \sa SDL_MouseIsHaptic @@ -936,7 +936,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); * negative error code on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticOpenFromJoystick */ @@ -957,7 +957,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); * \returns a valid haptic device identifier on success or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticClose * \sa SDL_HapticOpen @@ -971,7 +971,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * * * \param haptic the SDL_Haptic device to close * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticOpen */ @@ -988,7 +988,7 @@ extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); * \returns the number of effects the haptic device can store or a negative * error code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticNumEffectsPlaying * \sa SDL_HapticQuery @@ -1005,7 +1005,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); * or a negative error code on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticNumEffects * \sa SDL_HapticQuery @@ -1019,7 +1019,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); * \returns a list of supported haptic features in bitwise manner (OR'd), or 0 * on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticEffectSupported * \sa SDL_HapticNumEffects @@ -1037,7 +1037,7 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); * \returns the number of axes on success or a negative error code on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); @@ -1050,7 +1050,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); * negative error code on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticNewEffect * \sa SDL_HapticQuery @@ -1068,7 +1068,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, * \returns the ID of the effect on success or a negative error code on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticDestroyEffect * \sa SDL_HapticRunEffect @@ -1092,7 +1092,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticDestroyEffect * \sa SDL_HapticNewEffect @@ -1118,7 +1118,7 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticDestroyEffect * \sa SDL_HapticGetEffectStatus @@ -1138,7 +1138,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticDestroyEffect * \sa SDL_HapticRunEffect @@ -1155,7 +1155,7 @@ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, * \param haptic the SDL_Haptic device to destroy the effect on * \param effect the ID of the haptic effect to destroy * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticNewEffect */ @@ -1172,7 +1172,7 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, * \returns 0 if it isn't playing, 1 if it is playing, or a negative error * code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticRunEffect * \sa SDL_HapticStopEffect @@ -1195,7 +1195,7 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticQuery */ @@ -1214,7 +1214,7 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticQuery */ @@ -1234,7 +1234,7 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticUnpause */ @@ -1249,7 +1249,7 @@ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticPause */ @@ -1262,7 +1262,7 @@ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); @@ -1274,7 +1274,7 @@ extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); * negative error code on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticRumbleInit * \sa SDL_HapticRumblePlay @@ -1289,7 +1289,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticOpen * \sa SDL_HapticRumblePlay @@ -1307,7 +1307,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticRumbleInit * \sa SDL_HapticRumbleStop @@ -1322,7 +1322,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float stre * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HapticRumbleInit * \sa SDL_HapticRumblePlay diff --git a/include/SDL_hidapi.h b/include/SDL_hidapi.h index 354af5c52d..393053b2d2 100644 --- a/include/SDL_hidapi.h +++ b/include/SDL_hidapi.h @@ -135,7 +135,7 @@ typedef struct SDL_hid_device_info * * \returns 0 on success and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_hid_exit */ @@ -149,7 +149,7 @@ extern DECLSPEC int SDLCALL SDL_hid_init(void); * * \returns 0 on success and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_hid_init */ @@ -170,7 +170,7 @@ extern DECLSPEC int SDLCALL SDL_hid_exit(void); * \returns a change counter that is incremented with each potential device * change, or 0 if device change detection isn't available. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_hid_enumerate */ @@ -192,7 +192,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void); * in the case of failure. Free this linked list by calling * SDL_hid_free_enumeration(). * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_hid_device_change_count */ @@ -206,7 +206,7 @@ extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short v * \param devs Pointer to a list of struct_device returned from * SDL_hid_enumerate(). * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs); @@ -224,7 +224,7 @@ extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs) * \returns a pointer to a SDL_hid_device object on success or NULL on * failure. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number); @@ -238,7 +238,7 @@ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, * \returns a pointer to a SDL_hid_device object on success or NULL on * failure. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */); @@ -264,7 +264,7 @@ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int * \param length The length in bytes of the data to send. * \returns the actual number of bytes written and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length); @@ -285,7 +285,7 @@ extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned ch * available to be read within the timeout period, this function * returns 0. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds); @@ -305,7 +305,7 @@ extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned c * available to be read and the handle is in non-blocking mode, this * function returns 0. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length); @@ -323,7 +323,7 @@ extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *dat * nonblocking - 0 to disable nonblocking. * \returns 0 on success and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock); @@ -347,7 +347,7 @@ extern DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int non * number. * \returns the actual number of bytes written and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length); @@ -369,7 +369,7 @@ extern DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, con * \returns the number of bytes read plus one for the report ID (which is * still in the first byte), or -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length); @@ -378,7 +378,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsi * * \param dev A device handle returned from SDL_hid_open(). * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev); @@ -390,7 +390,7 @@ extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev); * \param maxlen The length of the buffer in multiples of wchar_t. * \returns 0 on success and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); @@ -402,7 +402,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, * \param maxlen The length of the buffer in multiples of wchar_t. * \returns 0 on success and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); @@ -414,7 +414,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wcha * \param maxlen The length of the buffer in multiples of wchar_t. * \returns 0 on success and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen); @@ -427,7 +427,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev * \param maxlen The length of the buffer in multiples of wchar_t. * \returns 0 on success and -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen); @@ -436,7 +436,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int * * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active); diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 10171c445d..43fb5bf36c 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -278,10 +278,7 @@ extern "C" { * If this hint isn't specified to a valid setting, or libsamplerate isn't * available, SDL will use the default, internal resampling algorithm. * - * Note that this is currently only applicable to resampling audio that is - * being written to a device for playback or audio being read from a device - * for capture. SDL_AudioCVT always uses the default resampler (although this - * might change for SDL 2.1). + * As of SDL 2.26, SDL_ConvertAudio() respects this hint when libsamplerate is available. * * This hint is currently only checked at audio subsystem initialization. * @@ -355,7 +352,7 @@ extern "C" { * \brief Disable giving back control to the browser automatically * when running with asyncify * - * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations + * With -s ASYNCIFY, SDL calls emscripten_sleep during operations * such as refreshing the screen or polling events. * * This hint only applies to the emscripten platform @@ -366,6 +363,15 @@ extern "C" { */ #define SDL_HINT_EMSCRIPTEN_ASYNCIFY "SDL_EMSCRIPTEN_ASYNCIFY" +/** + * \brief Specify the CSS selector used for the "default" window/canvas + * + * This hint only applies to the emscripten platform + * + * The default value is "#canvas" + */ +#define SDL_HINT_EMSCRIPTEN_CANVAS_SELECTOR "SDL_EMSCRIPTEN_CANVAS_SELECTOR" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -542,6 +548,14 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable containing a list of devices to ignore in SDL_hid_enumerate() + * + * For example, to ignore the Shanwan DS3 controller and any Valve controller, you might + * have the string "0x2563/0x0523,0x28de/0x0000" + */ +#define SDL_HINT_HIDAPI_IGNORE_DEVICES "SDL_HIDAPI_IGNORE_DEVICES" + /** * \brief A variable controlling whether the idle timer is disabled on iOS. * @@ -672,6 +686,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS" +/** + * \brief A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver + * + * This variable can be set to the following values: + * "0" - Left and right Joy-Con controllers will not be in vertical mode (the default) + * "1" - Left and right Joy-Con controllers will be in vertical mode + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS" + /** * \brief A variable controlling whether the HIDAPI driver for Amazon Luna controllers connected via Bluetooth should be used. * @@ -801,7 +826,7 @@ extern "C" { #define SDL_HINT_JOYSTICK_HIDAPI_STADIA "SDL_JOYSTICK_HIDAPI_STADIA" /** - * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * \brief A variable controlling whether the HIDAPI driver for Bluetooth Steam Controllers should be used. * * This variable can be set to the following values: * "0" - HIDAPI driver is not used @@ -861,7 +886,7 @@ extern "C" { * "0" - HIDAPI driver is not used * "1" - HIDAPI driver is used * - * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE for now. */ #define SDL_HINT_JOYSTICK_HIDAPI_WII "SDL_JOYSTICK_HIDAPI_WII" @@ -917,7 +942,7 @@ extern "C" { #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS" /** - * \brief A variable controlling whether the HIDAPI driver for XBox One should be used. + * \brief A variable controlling whether the HIDAPI driver for XBox One controllers should be used. * * This variable can be set to the following values: * "0" - HIDAPI driver is not used @@ -927,6 +952,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE "SDL_JOYSTICK_HIDAPI_XBOX_ONE" +/** + * \brief A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is turned off + * "1" - home button LED is turned on + * + * By default the Home button LED state is not changed. This hint can also be set to a floating point value between 0.0 and 1.0 which controls the brightness of the Home button LED. The default brightness is 0.4. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED" + /** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * @@ -1249,7 +1285,7 @@ extern "C" { * When polling for events, SDL_PumpEvents is used to gather new events from devices. * If a device keeps producing new events between calls to SDL_PumpEvents, a poll loop will * become stuck until the new events stop. - * This is most noticable when moving a high frequency mouse. + * This is most noticeable when moving a high frequency mouse. * * By default, poll sentinels are enabled. */ @@ -1701,6 +1737,23 @@ extern "C" { */ #define SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION "SDL_VIDEO_WAYLAND_MODE_EMULATION" +/** + * \brief Enable or disable mouse pointer warp emulation, needed by some older games. + * + * When this hint is set, any SDL will emulate mouse warps using relative mouse mode. + * This is required for some older games (such as Source engine games), which warp the + * mouse to the centre of the screen rather than using relative mouse motion. Note that + * relative mouse mode may have different mouse acceleration behaviour than pointer warps. + * + * This variable can be set to the following values: + * "0" - All mouse warps fail, as mouse warping is not available under wayland. + * "1" - Some mouse warps will be emulated by forcing relative mouse mode. + * + * If not set, this is automatically enabled unless an application uses relative mouse + * mode directly. + */ +#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP" + /** * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). * @@ -2367,7 +2420,7 @@ typedef enum * \param priority the SDL_HintPriority level for the hint * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHint * \sa SDL_SetHint @@ -2387,7 +2440,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, * \param value the value of the hint variable * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHint * \sa SDL_SetHintWithPriority @@ -2405,20 +2458,35 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, * \param name the hint to set * \returns SDL_TRUE if the hint was set, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHint * \sa SDL_SetHint */ extern DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); +/** + * Reset all hints to the default values. + * + * This will reset all hints to the value of the associated environment + * variable, or NULL if the environment isn't set. Callbacks will be called + * normally with this change. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetHint + * \sa SDL_SetHint + * \sa SDL_ResetHint + */ +extern DECLSPEC void SDLCALL SDL_ResetHints(void); + /** * Get the value of a hint. * * \param name the hint to query * \returns the string value of a hint or NULL if the hint isn't set. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetHint * \sa SDL_SetHintWithPriority @@ -2433,7 +2501,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); * \returns the boolean value of a hint or the provided default value if the * hint does not exist. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHint * \sa SDL_SetHint @@ -2458,7 +2526,7 @@ typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const * hint value changes * \param userdata a pointer to pass to the callback function * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_DelHintCallback */ @@ -2474,7 +2542,7 @@ extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, * hint value changes * \param userdata a pointer being passed to the callback function * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AddHintCallback */ @@ -2485,9 +2553,16 @@ extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, /** * Clear all hints. * - * This function is automatically called during SDL_Quit(). + * This function is automatically called during SDL_Quit(), and deletes all + * callbacks without calling them and frees all memory associated with hints. + * If you're calling this from application code you probably want to call + * SDL_ResetHints() instead. * - * \since This function is available since SDL 2.0.0. + * This function will be removed from the API the next time we rev the ABI. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_ResetHints */ extern DECLSPEC void SDLCALL SDL_ClearHints(void); diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h index 72c6604df2..63b04ce2c6 100644 --- a/include/SDL_joystick.h +++ b/include/SDL_joystick.h @@ -129,7 +129,7 @@ typedef enum * uninitialized state. However, all open joysticks will be closed and SDL * functions called with them will fail. * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); @@ -144,7 +144,7 @@ extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); * the API functions that take a joystick index will be valid, and joystick * and game controller events will not be delivered. * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); @@ -154,7 +154,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); * \returns the number of attached joysticks on success or a negative error * code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickName * \sa SDL_JoystickPath @@ -172,7 +172,7 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickName * \sa SDL_JoystickOpen @@ -189,7 +189,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickPath * \sa SDL_JoystickOpen @@ -200,7 +200,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickPathForIndex(int device_index); * Get the player index of a joystick, or -1 if it's not available This can be * called before any joysticks are opened. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); @@ -215,7 +215,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); * \returns the GUID of the selected joystick. If called on an invalid index, * this function returns a zero GUID * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetGUID * \sa SDL_JoystickGetGUIDString @@ -233,7 +233,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_in * \returns the USB vendor ID of the selected joystick. If called on an * invalid index, this function returns zero * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); @@ -248,7 +248,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); * \returns the USB product ID of the selected joystick. If called on an * invalid index, this function returns zero * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); @@ -263,7 +263,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); * \returns the product version of the selected joystick. If called on an * invalid index, this function returns zero * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); @@ -277,7 +277,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_in * \returns the SDL_JoystickType of the selected joystick. If called on an * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN` * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index); @@ -292,7 +292,7 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_in * \returns the instance id of the selected joystick. If called on an invalid * index, this function returns zero * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index); @@ -311,7 +311,7 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int devic * \returns a joystick identifier or NULL if an error occurred; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickClose * \sa SDL_JoystickInstanceID @@ -325,7 +325,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id); @@ -336,7 +336,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index); @@ -345,7 +345,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_ind * * \returns the joystick's device index, or -1 if an error occurred. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, @@ -396,7 +396,7 @@ typedef struct SDL_VirtualJoystickDesc * * \returns the joystick's device index, or -1 if an error occurred. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc); @@ -407,7 +407,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystic * SDL_JoystickAttachVirtual() * \returns 0 on success, or -1 if an error occurred. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index); @@ -417,7 +417,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index); * \param device_index a joystick device index. * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index); @@ -439,7 +439,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index); * \param value the new value for the specified axis. * \returns 0 on success, -1 on error. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value); @@ -457,7 +457,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, i * \param value the new value for the specified button. * \returns 0 on success, -1 on error. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value); @@ -475,7 +475,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, * \param value the new value for the specified hat. * \returns 0 on success, -1 on error. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value); @@ -486,7 +486,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, in * \returns the name of the selected joystick. If no name can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickNameForIndex * \sa SDL_JoystickOpen @@ -500,7 +500,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick); * \returns the path of the selected joystick. If no path can be found, this * function returns NULL; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickPathForIndex */ @@ -515,7 +515,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick); * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() * \returns the player index, or -1 if it's not available. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick); @@ -526,7 +526,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick); * \param player_index Player index to assign to this joystick, or -1 to clear * the player index and turn off player LEDs. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index); @@ -540,7 +540,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, * this function returns a zero GUID; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetDeviceGUID * \sa SDL_JoystickGetGUIDString @@ -555,7 +555,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joyst * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() * \returns the USB vendor ID of the selected joystick, or 0 if unavailable. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick); @@ -567,7 +567,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick); * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() * \returns the USB product ID of the selected joystick, or 0 if unavailable. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick); @@ -579,7 +579,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick); * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() * \returns the product version of the selected joystick, or 0 if unavailable. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick); @@ -592,7 +592,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joyst * \returns the firmware version of the selected joystick, or 0 if * unavailable. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick); @@ -605,7 +605,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joys * \returns the serial number of the selected joystick, or NULL if * unavailable. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick); @@ -615,7 +615,7 @@ extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystic * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen() * \returns the SDL_JoystickType of the selected joystick. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick); @@ -628,7 +628,7 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joyst * \param pszGUID buffer in which to write the ASCII string * \param cbGUID the size of pszGUID * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetDeviceGUID * \sa SDL_JoystickGetGUID @@ -646,7 +646,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, ch * \param pchGUID string containing an ASCII representation of a GUID * \returns a SDL_JoystickGUID structure. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetGUIDString */ @@ -665,7 +665,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha * \param crc16 A pointer filled in with a CRC used to distinguish different * products with the same VID/PID, or 0 if not available * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetDeviceGUID */ @@ -678,7 +678,7 @@ extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickClose * \sa SDL_JoystickOpen @@ -692,7 +692,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick) * \returns the instance ID of the specified joystick on success or a negative * error code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickOpen */ @@ -710,7 +710,7 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joys * negative error code on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetAxis * \sa SDL_JoystickOpen @@ -729,7 +729,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); * \returns the number of trackballs on success or a negative error code on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetBall */ @@ -742,7 +742,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); * \returns the number of POV hats on success or a negative error code on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetHat * \sa SDL_JoystickOpen @@ -756,7 +756,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); * \returns the number of buttons on success or a negative error code on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickGetButton * \sa SDL_JoystickOpen @@ -769,7 +769,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); * This is called automatically by the event loop if any joystick events are * enabled. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickEventState */ @@ -794,7 +794,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); * If `state` is `SDL_QUERY` then the current state is returned, * otherwise the new processing state is returned. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GameControllerEventState */ @@ -821,7 +821,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); * \returns a 16-bit signed integer representing the current position of the * axis or 0 on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickNumAxes */ @@ -840,7 +840,7 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, * \param state Upon return, the initial value is supplied here. * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state); @@ -879,7 +879,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *j * \param hat the hat index to get the state from; indices start at index 0 * \returns the current hat position. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickNumHats */ @@ -901,7 +901,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickNumBalls */ @@ -916,7 +916,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, * index 0 * \returns 1 if the specified button is pressed, 0 otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickNumButtons */ @@ -937,7 +937,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, * \param duration_ms The duration of the rumble effect, in milliseconds * \returns 0, or -1 if rumble isn't supported on this joystick * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickHasRumble */ @@ -962,7 +962,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo * \param duration_ms The duration of the rumble effect, in milliseconds * \returns 0, or -1 if trigger rumble isn't supported on this joystick * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickHasRumbleTriggers */ @@ -977,7 +977,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, U * \param joystick The joystick to query * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick); @@ -987,7 +987,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick); * \param joystick The joystick to query * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickRumble */ @@ -999,7 +999,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumble(SDL_Joystick *joystick); * \param joystick The joystick to query * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickRumbleTriggers */ @@ -1017,7 +1017,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumbleTriggers(SDL_Joystick *joy * \param blue The intensity of the blue LED * \returns 0 on success, -1 if this joystick does not have a modifiable LED * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue); @@ -1029,7 +1029,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red * \param size The size of the data to send to the joystick * \returns 0, or -1 if this joystick or driver doesn't support effect packets * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size); @@ -1038,7 +1038,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const * * \param joystick The joystick device to close * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_JoystickOpen */ @@ -1051,7 +1051,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); * \returns the current battery level as SDL_JoystickPowerLevel on success or * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick); diff --git a/include/SDL_keyboard.h b/include/SDL_keyboard.h index e7663fb34c..cf296f2391 100644 --- a/include/SDL_keyboard.h +++ b/include/SDL_keyboard.h @@ -59,7 +59,7 @@ typedef struct SDL_Keysym * * \returns the window with keyboard focus. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); @@ -87,7 +87,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); * \param numkeys if non-NULL, receives the length of the returned array * \returns a pointer to an array of key states. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PumpEvents * \sa SDL_ResetKeyboard @@ -99,7 +99,7 @@ extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); * * This function will generate key up events for all pressed keys. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyboardState */ @@ -111,7 +111,7 @@ extern DECLSPEC void SDLCALL SDL_ResetKeyboard(void); * \returns an OR'd combination of the modifier keys for the keyboard. See * SDL_Keymod for details. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyboardState * \sa SDL_SetModState @@ -131,7 +131,7 @@ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); * * \param modstate the desired SDL_Keymod for the keyboard * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetModState */ @@ -146,7 +146,7 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); * \param scancode the desired SDL_Scancode to query * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromKey @@ -162,7 +162,7 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode * \param key the desired SDL_Keycode to query * \returns the SDL_Scancode that corresponds to the given SDL_Keycode. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_GetScancodeName @@ -187,7 +187,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); * \returns a pointer to the name for the scancode. If the scancode doesn't * have a name this function returns an empty string (""). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetScancodeFromKey * \sa SDL_GetScancodeFromName @@ -201,7 +201,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't * recognized; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyFromName * \sa SDL_GetScancodeFromKey @@ -220,7 +220,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); * must copy it. If the key doesn't have a name, this function * returns an empty string (""). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyFromName * \sa SDL_GetKeyFromScancode @@ -235,7 +235,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyFromScancode * \sa SDL_GetKeyName @@ -253,7 +253,7 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); * * On some platforms using this function activates the screen keyboard. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextInputRect * \sa SDL_StopTextInput @@ -265,7 +265,7 @@ extern DECLSPEC void SDLCALL SDL_StartTextInput(void); * * \returns SDL_TRUE if text input events are enabled else SDL_FALSE. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput */ @@ -274,7 +274,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); /** * Stop receiving any text input events. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput */ @@ -283,7 +283,7 @@ extern DECLSPEC void SDLCALL SDL_StopTextInput(void); /** * Dismiss the composition window/IME without disabling the subsystem. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput * \sa SDL_StopTextInput @@ -293,7 +293,7 @@ extern DECLSPEC void SDLCALL SDL_ClearComposition(void); /** * Returns if an IME Composite or Candidate window is currently shown. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); @@ -311,7 +311,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); * \param rect the SDL_Rect structure representing the rectangle to receive * text (ignored if NULL) * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput */ @@ -323,7 +323,7 @@ extern DECLSPEC void SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect); * \returns SDL_TRUE if the platform has some screen keyboard support or * SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput * \sa SDL_IsScreenKeyboardShown @@ -336,7 +336,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); * \param window the window for which screen keyboard should be queried * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasScreenKeyboardSupport */ diff --git a/include/SDL_loadso.h b/include/SDL_loadso.h index 61857c8137..e8b248501d 100644 --- a/include/SDL_loadso.h +++ b/include/SDL_loadso.h @@ -57,7 +57,7 @@ extern "C" { * \returns an opaque pointer to the object handle or NULL if there was an * error; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadFunction * \sa SDL_UnloadObject @@ -84,7 +84,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); * \returns a pointer to the function or NULL if there was an error; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadObject * \sa SDL_UnloadObject @@ -97,7 +97,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, * * \param handle a valid shared object handle returned by SDL_LoadObject() * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadFunction * \sa SDL_LoadObject diff --git a/include/SDL_locale.h b/include/SDL_locale.h index 7515779947..97ae11d81f 100644 --- a/include/SDL_locale.h +++ b/include/SDL_locale.h @@ -86,7 +86,7 @@ typedef struct SDL_Locale * \return array of locales, terminated with a locale with a NULL language * field. Will return NULL on error. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void); diff --git a/include/SDL_log.h b/include/SDL_log.h index 1d8b20b62c..522a9843df 100644 --- a/include/SDL_log.h +++ b/include/SDL_log.h @@ -116,7 +116,7 @@ typedef enum * * \param priority the SDL_LogPriority to assign * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LogSetPriority */ @@ -128,7 +128,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); * \param category the category to assign a priority to * \param priority the SDL_LogPriority to assign * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LogGetPriority * \sa SDL_LogSetAllPriority @@ -142,7 +142,7 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, * \param category the category to query * \returns the SDL_LogPriority for the requested category * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LogSetPriority */ @@ -153,7 +153,7 @@ extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); * * This is called by SDL_Quit(). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LogSetAllPriority * \sa SDL_LogSetPriority @@ -168,7 +168,7 @@ extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); * \param ... additional parameters matching % tokens in the `fmt` string, if * any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LogCritical * \sa SDL_LogDebug @@ -189,7 +189,7 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, . * \param ... additional parameters matching % tokens in the **fmt** string, * if any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -210,7 +210,7 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI * \param ... additional parameters matching % tokens in the **fmt** string, * if any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -231,7 +231,7 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING * \param ... additional parameters matching % tokens in the **fmt** string, * if any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -252,7 +252,7 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING * \param ... additional parameters matching % tokens in the **fmt** string, * if any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -273,7 +273,7 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING * \param ... additional parameters matching % tokens in the **fmt** string, * if any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -294,7 +294,7 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING * \param ... additional parameters matching % tokens in the **fmt** string, * if any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogDebug @@ -316,7 +316,7 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR * \param ... additional parameters matching % tokens in the **fmt** string, * if any * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -339,7 +339,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, * \param fmt a printf() style message format string * \param ap a variable argument list * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Log * \sa SDL_LogCritical @@ -374,7 +374,7 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_ * \param userdata a pointer filled in with the pointer that is passed to * `callback` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LogSetOutputFunction */ @@ -386,7 +386,7 @@ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *cal * \param callback an SDL_LogOutputFunction to call instead of the default * \param userdata a pointer that is passed to `callback` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LogGetOutputFunction */ diff --git a/include/SDL_main.h b/include/SDL_main.h index 8b267082f2..4553b4f07a 100644 --- a/include/SDL_main.h +++ b/include/SDL_main.h @@ -55,7 +55,7 @@ /* On GDK, SDL provides a main function that initializes the game runtime. Please note that #include'ing SDL_main.h is not enough to get a main() - function working. You must either link against SDL2main or, if not possible, + function working. You must either link against SDL3main or, if not possible, call the SDL_GDKRunApp function from your entry point. */ #define SDL_MAIN_NEEDED @@ -83,15 +83,6 @@ /* We need to export SDL_main so it can be launched from Java */ #define SDLMAIN_DECLSPEC DECLSPEC -#elif defined(__NACL__) -/* On NACL we use ppapi_simple to set up the application helper code, - then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before - starting the user main function. - All user code is run in a separate thread by ppapi_simple, thus - allowing for blocking io to take place via nacl_io -*/ -#define SDL_MAIN_NEEDED - #elif defined(__PSP__) /* On PSP SDL provides a main function that sets the module info, activates the GPU and starts the thread required to be able to exit @@ -108,6 +99,15 @@ void reset_IOP(); \ void reset_IOP() {} +#elif defined(__3DS__) +/* + On N3DS, SDL provides a main function that sets up the screens + and storage. + + If you provide this yourself, you may define SDL_MAIN_HANDLED +*/ +#define SDL_MAIN_AVAILABLE + #endif #endif /* SDL_MAIN_HANDLED */ @@ -155,7 +155,7 @@ extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); * will not be changed it is necessary to define SDL_MAIN_HANDLED before * including SDL.h. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Init */ @@ -184,7 +184,7 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void); * will use `GetModuleHandle(NULL)` instead. * \returns 0 on success, -1 on error. SDL_GetError() may have details. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); @@ -201,7 +201,7 @@ extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void * deregistered when the registration counter in SDL_RegisterApp decrements to * zero through calls to this function. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); @@ -234,7 +234,7 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * r * \param mainFunction The SDL app's C-style main(), an SDL_main_func * \return the return value from mainFunction * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction); @@ -250,7 +250,7 @@ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_fun * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve * more information on the failure. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved); diff --git a/include/SDL_messagebox.h b/include/SDL_messagebox.h index d763534d21..d6c01a5d1d 100644 --- a/include/SDL_messagebox.h +++ b/include/SDL_messagebox.h @@ -133,7 +133,7 @@ typedef struct * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ShowSimpleMessageBox */ @@ -175,7 +175,7 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ShowMessageBox */ diff --git a/include/SDL_metal.h b/include/SDL_metal.h index eb30828792..da6f991910 100644 --- a/include/SDL_metal.h +++ b/include/SDL_metal.h @@ -58,7 +58,7 @@ typedef void *SDL_MetalView; * The returned handle can be casted directly to a NSView or UIView. To access * the backing CAMetalLayer, call SDL_Metal_GetLayer(). * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Metal_DestroyView * \sa SDL_Metal_GetLayer @@ -71,7 +71,7 @@ extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window); * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was * called after SDL_CreateWindow. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Metal_CreateView */ @@ -80,9 +80,9 @@ extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); /** * Get a pointer to the backing CAMetalLayer for the given view. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. * - * \sa SDL_MetalCreateView + * \sa SDL_Metal_CreateView */ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); @@ -94,7 +94,7 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); * \param w Pointer to variable for storing the width in pixels, may be NULL * \param h Pointer to variable for storing the height in pixels, may be NULL * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSize * \sa SDL_CreateWindow diff --git a/include/SDL_misc.h b/include/SDL_misc.h index 261b6b8713..84644ba1f0 100644 --- a/include/SDL_misc.h +++ b/include/SDL_misc.h @@ -64,7 +64,7 @@ extern "C" { * \returns 0 on success, or -1 on error; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url); diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h index b318c70383..c5f9a96138 100644 --- a/include/SDL_mouse.h +++ b/include/SDL_mouse.h @@ -38,6 +38,8 @@ extern "C" { #endif +typedef Uint32 SDL_MouseID; + typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ /** @@ -76,7 +78,7 @@ typedef enum * * \returns the window with mouse focus. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); @@ -95,7 +97,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); * focus window * \returns a 32-bit button bitmask of the current button state. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGlobalMouseState * \sa SDL_GetRelativeMouseState @@ -126,7 +128,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y); * \returns the current button state as a bitmask which can be tested using * the SDL_BUTTON(X) macros. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CaptureMouse */ @@ -145,7 +147,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y); * \param y a pointer filled with the last recorded y coordinate of the mouse * \returns a 32-bit button bitmask of the relative button state. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetMouseState */ @@ -166,7 +168,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); * \param x the x coordinate within the window * \param y the y coordinate within the window * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WarpMouseGlobal */ @@ -189,7 +191,7 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WarpMouseInWindow */ @@ -214,7 +216,7 @@ extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y); * * If relative mode is not supported, this returns -1. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRelativeMouseMode */ @@ -260,7 +262,7 @@ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); * \returns 0 on success or -1 if not supported; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGlobalMouseState */ @@ -271,7 +273,7 @@ extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled); * * \returns SDL_TRUE if relative mode is enabled or SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRelativeMouseMode */ @@ -312,7 +314,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); * \returns a new cursor with the specified parameters on success or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FreeCursor * \sa SDL_SetCursor @@ -332,7 +334,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, * \returns the new cursor on success or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateCursor * \sa SDL_FreeCursor @@ -348,7 +350,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, * \returns a cursor on success or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FreeCursor */ @@ -364,7 +366,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id); * * \param cursor a cursor to make active * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateCursor * \sa SDL_GetCursor @@ -380,7 +382,7 @@ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); * * \returns the active cursor or NULL if there is no mouse. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetCursor */ @@ -391,7 +393,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); * * \returns the default cursor on success or NULL on failure. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSystemCursor */ @@ -405,7 +407,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); * * \param cursor the cursor to free * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateColorCursor * \sa SDL_CreateCursor @@ -428,7 +430,7 @@ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); * cursor is hidden, or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateCursor * \sa SDL_SetCursor diff --git a/include/SDL_mutex.h b/include/SDL_mutex.h index 173468f6ac..a855c97f42 100644 --- a/include/SDL_mutex.h +++ b/include/SDL_mutex.h @@ -71,7 +71,7 @@ typedef struct SDL_mutex SDL_mutex; * \returns the initialized and unlocked mutex or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_DestroyMutex * \sa SDL_LockMutex @@ -94,7 +94,7 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); * \param mutex the mutex to lock * \return 0, or -1 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); #define SDL_mutexP(m) SDL_LockMutex(m) @@ -112,7 +112,7 @@ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); * \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for * more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateMutex * \sa SDL_DestroyMutex @@ -136,7 +136,7 @@ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); * \param mutex the mutex to unlock. * \returns 0, or -1 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); #define SDL_mutexV(m) SDL_UnlockMutex(m) @@ -152,7 +152,7 @@ extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); * * \param mutex the mutex to destroy * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateMutex * \sa SDL_LockMutex @@ -186,7 +186,7 @@ typedef struct SDL_semaphore SDL_sem; * \returns a new semaphore or NULL on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_DestroySemaphore * \sa SDL_SemPost @@ -205,7 +205,7 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); * * \param sem the semaphore to destroy * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSemaphore * \sa SDL_SemPost @@ -231,7 +231,7 @@ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSemaphore * \sa SDL_DestroySemaphore @@ -256,7 +256,7 @@ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); * block, or a negative error code on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSemaphore * \sa SDL_DestroySemaphore @@ -281,7 +281,7 @@ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); * succeed in the allotted time, or a negative error code on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSemaphore * \sa SDL_DestroySemaphore @@ -299,7 +299,7 @@ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSemaphore * \sa SDL_DestroySemaphore @@ -316,7 +316,7 @@ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); * \param sem the semaphore to query * \returns the current value of the semaphore. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSemaphore */ @@ -340,7 +340,7 @@ typedef struct SDL_cond SDL_cond; * \returns a new condition variable or NULL on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CondBroadcast * \sa SDL_CondSignal @@ -355,7 +355,7 @@ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void); * * \param cond the condition variable to destroy * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CondBroadcast * \sa SDL_CondSignal @@ -372,7 +372,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CondBroadcast * \sa SDL_CondWait @@ -389,7 +389,7 @@ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CondSignal * \sa SDL_CondWait @@ -417,7 +417,7 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); * \returns 0 when it is signaled or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CondBroadcast * \sa SDL_CondSignal @@ -446,7 +446,7 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); * the condition is not signaled in the allotted time, or a negative * error code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CondBroadcast * \sa SDL_CondSignal diff --git a/include/SDL_opengl.h b/include/SDL_opengl.h index 0f2b257abb..1816d4eb4b 100644 --- a/include/SDL_opengl.h +++ b/include/SDL_opengl.h @@ -97,13 +97,6 @@ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall -#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ -# define GLAPI extern -# define GLAPIENTRY _System -# define APIENTRY _System -# if defined(__GNUC__) && !defined(_System) -# define _System -# endif #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY diff --git a/include/SDL_pixels.h b/include/SDL_pixels.h index 5d2c0c8982..3766e4328c 100644 --- a/include/SDL_pixels.h +++ b/include/SDL_pixels.h @@ -356,7 +356,7 @@ typedef struct SDL_PixelFormat * \returns the human readable name of the specified pixel format or * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format); @@ -372,7 +372,7 @@ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format); * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't * possible; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_MasksToPixelFormatEnum */ @@ -396,7 +396,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, * \param Amask the alpha mask for the format * \returns one of the SDL_PixelFormatEnum values * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_PixelFormatEnumToMasks */ @@ -417,7 +417,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp, * \returns the new SDL_PixelFormat structure or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FreeFormat */ @@ -428,7 +428,7 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format); * * \param format the SDL_PixelFormat structure to free * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AllocFormat */ @@ -444,7 +444,7 @@ extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format); * there wasn't enough memory); call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FreePalette */ @@ -458,7 +458,7 @@ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AllocPalette * \sa SDL_FreePalette @@ -476,7 +476,7 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format, * \returns 0 on success or a negative error code if not all of the colors * could be set; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AllocPalette * \sa SDL_CreateRGBSurface @@ -490,7 +490,7 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette, * * \param palette the SDL_Palette structure to be freed * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AllocPalette */ @@ -520,7 +520,7 @@ extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette); * \param b the blue component of the pixel in the range 0-255 * \returns a pixel value * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRGB * \sa SDL_GetRGBA @@ -555,7 +555,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format, * \param a the alpha component of the pixel in the range 0-255 * \returns a pixel value * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRGB * \sa SDL_GetRGBA @@ -580,7 +580,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format, * \param g a pointer filled in with the green component * \param b a pointer filled in with the blue component * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRGBA * \sa SDL_MapRGB @@ -609,7 +609,7 @@ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, * \param b a pointer filled in with the blue component * \param a a pointer filled in with the alpha component * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRGB * \sa SDL_MapRGB @@ -626,7 +626,7 @@ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, * \param gamma a gamma value where 0.0 is black and 1.0 is identity * \param ramp an array of 256 values filled in with the gamma ramp * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowGammaRamp */ diff --git a/include/SDL_platform.h b/include/SDL_platform.h index f1f6f8b066..832a48743e 100644 --- a/include/SDL_platform.h +++ b/include/SDL_platform.h @@ -201,26 +201,15 @@ #define __PS2__ 1 #endif -/* The NACL compiler defines __native_client__ and __pnacl__ - * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi - */ -#if defined(__native_client__) -#undef __LINUX__ -#undef __NACL__ -#define __NACL__ 1 -#endif -#if defined(__pnacl__) -#undef __LINUX__ -#undef __PNACL__ -#define __PNACL__ 1 -/* PNACL with newlib supports static linking only */ -#define __SDL_NOGETPROCADDR__ -#endif - #if defined(__vita__) #define __VITA__ 1 #endif +#if defined(__3DS__) +#undef __3DS__ +#define __3DS__ 1 +#endif + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -241,7 +230,7 @@ extern "C" { * \returns the name of the platform. If the correct platform name is not * available, returns a string beginning with the text "Unknown". * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); diff --git a/include/SDL_power.h b/include/SDL_power.h index ecb3f4b023..a1d4efadea 100644 --- a/include/SDL_power.h +++ b/include/SDL_power.h @@ -73,7 +73,7 @@ typedef enum * determine a value, or we're not running on a battery * \returns an SDL_PowerState enum representing the current battery state. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); diff --git a/include/SDL_rect.h b/include/SDL_rect.h index 6c641c581c..5d2965d93e 100644 --- a/include/SDL_rect.h +++ b/include/SDL_rect.h @@ -139,7 +139,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) * \param B an SDL_Rect structure representing the second rectangle * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_IntersectRect */ @@ -157,7 +157,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, * rectangles `A` and `B` * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasIntersection */ @@ -173,7 +173,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, * \param result an SDL_Rect structure filled in with the union of rectangles * `A` and `B` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, @@ -194,7 +194,7 @@ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the * points were outside of the clipping rectangle. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, int count, @@ -217,7 +217,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, * \param Y2 a pointer to the ending Y-coordinate of the line * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, @@ -278,7 +278,7 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b * \param B an SDL_FRect structure representing the second rectangle * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. * * \sa SDL_IntersectRect */ @@ -296,7 +296,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A, * rectangles `A` and `B` * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HasIntersectionF */ @@ -312,7 +312,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A, * \param result an SDL_FRect structure filled in with the union of rectangles * `A` and `B` * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A, const SDL_FRect * B, @@ -334,7 +334,7 @@ extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A, * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the * points were outside of the clipping rectangle. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points, int count, @@ -358,7 +358,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points, * \param Y2 a pointer to the ending Y-coordinate of the line * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRectAndLine(const SDL_FRect * rect, float *X1, diff --git a/include/SDL_render.h b/include/SDL_render.h index 5b7b059aff..657f2d4dcd 100644 --- a/include/SDL_render.h +++ b/include/SDL_render.h @@ -161,7 +161,7 @@ typedef struct SDL_Texture SDL_Texture; * \returns a number >= 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer * \sa SDL_GetRenderDriverInfo @@ -177,7 +177,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer * \sa SDL_GetNumRenderDrivers @@ -197,7 +197,7 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, * \returns 0 on success, or -1 on error; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer * \sa SDL_CreateWindow @@ -217,7 +217,7 @@ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( * \returns a valid rendering context or NULL if there was an error; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateSoftwareRenderer * \sa SDL_DestroyRenderer @@ -240,7 +240,7 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, * \returns a valid rendering context or NULL if there was an error; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer * \sa SDL_CreateWindowRenderer @@ -255,7 +255,7 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * * \returns the rendering context on success or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer */ @@ -268,7 +268,7 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); * \returns the window on success or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Window * SDLCALL SDL_RenderGetWindow(SDL_Renderer *renderer); @@ -281,7 +281,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_RenderGetWindow(SDL_Renderer *renderer) * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer */ @@ -301,7 +301,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderer */ @@ -323,7 +323,7 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, * was active, the format was unsupported, or the width or height * were out of range; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateTextureFromSurface * \sa SDL_DestroyTexture @@ -353,7 +353,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, * \returns the created texture or NULL on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateTexture * \sa SDL_DestroyTexture @@ -379,7 +379,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateTexture */ @@ -406,7 +406,7 @@ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureAlphaMod @@ -425,7 +425,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_SetTextureColorMod @@ -450,7 +450,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureAlphaMod * \sa SDL_SetTextureColorMod @@ -466,7 +466,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureAlphaMod @@ -485,7 +485,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureBlendMode * \sa SDL_RenderCopy @@ -501,7 +501,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextureBlendMode */ @@ -517,7 +517,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, * \param scaleMode the SDL_ScaleMode to use for texture scaling. * \returns 0 on success, or -1 if the texture is not valid. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureScaleMode */ @@ -531,7 +531,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture, * \param scaleMode a pointer filled in with the current scale mode. * \return 0 on success, or -1 if the texture is not valid. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextureScaleMode */ @@ -545,7 +545,7 @@ extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture, * \param userdata the pointer to associate with the texture. * \returns 0 on success, or -1 if the texture is not valid. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureUserData */ @@ -559,7 +559,7 @@ extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture * texture, * \return the pointer associated with the texture, or NULL if the texture is * not valid. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextureUserData */ @@ -588,7 +588,7 @@ extern DECLSPEC void * SDLCALL SDL_GetTextureUserData(SDL_Texture * texture); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateTexture * \sa SDL_LockTexture @@ -621,7 +621,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, * \returns 0 on success or -1 if the texture is not valid; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.1. + * \since This function is available since SDL 3.0.0. * * \sa SDL_UpdateTexture */ @@ -649,7 +649,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture, * plane. * \return 0 on success, or -1 if the texture is not valid. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture * texture, const SDL_Rect * rect, @@ -679,7 +679,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateNVTexture(SDL_Texture * texture, * or was not created with `SDL_TEXTUREACCESS_STREAMING`; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_UnlockTexture */ @@ -714,7 +714,7 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, * \returns 0 on success, or -1 if the texture is not valid or was not created * with `SDL_TEXTUREACCESS_STREAMING` * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LockTexture * \sa SDL_UnlockTexture @@ -736,7 +736,7 @@ extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, * * \param texture a texture locked by SDL_LockTexture() * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LockTexture */ @@ -748,7 +748,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); * \param renderer the renderer that will be checked * \returns SDL_TRUE if supported or SDL_FALSE if not. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderTarget */ @@ -772,7 +772,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *rendere * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderTarget */ @@ -788,7 +788,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, * \param renderer the rendering context * \returns the current render target or NULL for the default render target. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderTarget */ @@ -816,7 +816,7 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetLogicalSize */ @@ -837,7 +837,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in * \param w an int to be filled with the width * \param h an int to be filled with the height * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderSetLogicalSize */ @@ -855,7 +855,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, i * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetIntegerScale * \sa SDL_RenderSetLogicalSize @@ -870,7 +870,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer, * \returns SDL_TRUE if integer scales are forced or SDL_FALSE if not and on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderSetIntegerScale */ @@ -888,7 +888,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * render * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetViewport */ @@ -901,7 +901,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer, * \param renderer the rendering context * \param rect an SDL_Rect structure filled in with the current drawing area * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderSetViewport */ @@ -918,7 +918,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetClipRect * \sa SDL_RenderIsClipEnabled @@ -934,7 +934,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer, * \param rect an SDL_Rect structure filled in with the current clipping area * or an empty rectangle if clipping is disabled * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderIsClipEnabled * \sa SDL_RenderSetClipRect @@ -949,7 +949,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer, * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetClipRect * \sa SDL_RenderSetClipRect @@ -974,7 +974,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetScale * \sa SDL_RenderSetLogicalSize @@ -989,7 +989,7 @@ extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer, * \param scaleX a pointer filled in with the horizontal scaling factor * \param scaleY a pointer filled in with the vertical scaling factor * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderSetScale */ @@ -1010,7 +1010,7 @@ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer, * \param logicalX the pointer filled with the logical x coordinate * \param logicalY the pointer filled with the logical y coordinate * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetScale * \sa SDL_RenderSetScale @@ -1036,7 +1036,7 @@ extern DECLSPEC void SDLCALL SDL_RenderWindowToLogical(SDL_Renderer * renderer, * \param windowX the pointer filled with the real X coordinate in the window * \param windowY the pointer filled with the real Y coordinate in the window * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetScale * \sa SDL_RenderSetScale @@ -1063,7 +1063,7 @@ extern DECLSPEC void SDLCALL SDL_RenderLogicalToWindow(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderDrawColor * \sa SDL_RenderClear @@ -1095,7 +1095,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderDrawColor */ @@ -1113,7 +1113,7 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderDrawBlendMode * \sa SDL_RenderDrawLine @@ -1136,7 +1136,7 @@ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderDrawBlendMode */ @@ -1153,7 +1153,7 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderDrawColor */ @@ -1171,7 +1171,7 @@ extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLine * \sa SDL_RenderDrawLines @@ -1197,7 +1197,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLine * \sa SDL_RenderDrawLines @@ -1228,7 +1228,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLines * \sa SDL_RenderDrawPoint @@ -1254,7 +1254,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLine * \sa SDL_RenderDrawPoint @@ -1280,7 +1280,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLine * \sa SDL_RenderDrawLines @@ -1306,7 +1306,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLine * \sa SDL_RenderDrawLines @@ -1336,7 +1336,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLine * \sa SDL_RenderDrawLines @@ -1363,7 +1363,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderDrawLine * \sa SDL_RenderDrawLines @@ -1399,7 +1399,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderCopyEx * \sa SDL_SetTextureAlphaMod @@ -1443,7 +1443,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderCopy * \sa SDL_SetTextureAlphaMod @@ -1467,7 +1467,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, * \param y The y coordinate of the point. * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer, float x, float y); @@ -1480,7 +1480,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer, * \param count The number of points to draw * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer, const SDL_FPoint * points, @@ -1496,7 +1496,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer, * \param y2 The y coordinate of the end point. * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer, float x1, float y1, float x2, float y2); @@ -1510,7 +1510,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer, * \param count The number of points, drawing count-1 lines * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer, const SDL_FPoint * points, @@ -1524,7 +1524,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer, * entire rendering target. * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer, const SDL_FRect * rect); @@ -1538,7 +1538,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer, * \param count The number of rectangles. * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer, const SDL_FRect * rects, @@ -1553,7 +1553,7 @@ extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer, * rendering target. * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer, const SDL_FRect * rect); @@ -1567,7 +1567,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer, * \param count The number of rectangles. * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer, const SDL_FRect * rects, @@ -1585,7 +1585,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer, * entire rendering target. * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer, SDL_Texture * texture, @@ -1611,7 +1611,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer, * be performed on the texture * \return 0 on success, or -1 on error * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer, SDL_Texture * texture, @@ -1636,7 +1636,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer, * \param num_indices Number of indices. * \return 0 on success, or -1 if the operation is not supported * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGeometryRaw * \sa SDL_Vertex @@ -1666,7 +1666,7 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer, * \param size_indices Index size: 1 (byte), 2 (short), 4 (int) * \return 0 on success, or -1 if the operation is not supported * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGeometry * \sa SDL_Vertex @@ -1703,7 +1703,7 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, @@ -1731,7 +1731,7 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, * * \param renderer the rendering context * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderClear * \sa SDL_RenderDrawLine @@ -1755,7 +1755,7 @@ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer); * * \param texture the texture to destroy * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateTexture * \sa SDL_CreateTextureFromSurface @@ -1770,7 +1770,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); * * \param renderer the rendering context * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer */ @@ -1803,7 +1803,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer); @@ -1838,7 +1838,7 @@ extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer); * \returns 0 on success, or -1 if the operation is not supported; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_MakeCurrent * \sa SDL_GL_UnbindTexture @@ -1853,7 +1853,7 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw * \param texture the texture to unbind from the current OpenGL/ES/ES2 context * \returns 0 on success, or -1 if the operation is not supported * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_BindTexture * \sa SDL_GL_MakeCurrent @@ -1870,7 +1870,7 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a * Metal renderer * - * \since This function is available since SDL 2.0.8. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetMetalCommandEncoder */ @@ -1891,7 +1891,7 @@ extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); * \returns an `id` on success, or NULL if the * renderer isn't a Metal renderer or there was an error. * - * \since This function is available since SDL 2.0.8. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGetMetalLayer */ @@ -1904,7 +1904,7 @@ extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * re * \param vsync 1 for on, 0 for off. All other values are reserved * \returns a 0 int on success, or non-zero on failure * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_RenderSetVSync(SDL_Renderer* renderer, int vsync); diff --git a/include/SDL_revision.h b/include/SDL_revision.h index 3e9b63af9c..36691f5531 100644 --- a/include/SDL_revision.h +++ b/include/SDL_revision.h @@ -1,2 +1,6 @@ +#ifdef SDL_VENDOR_INFO +#define SDL_REVISION SDL_VENDOR_INFO +#else #define SDL_REVISION "" +#endif #define SDL_REVISION_NUMBER 0 diff --git a/include/SDL_revision.h.cmake b/include/SDL_revision.h.cmake index b27ec11bf9..84e5f414a8 100644 --- a/include/SDL_revision.h.cmake +++ b/include/SDL_revision.h.cmake @@ -1,6 +1,8 @@ -#cmakedefine SDL_REVISION "@SDL_REVISION@" +#cmakedefine SDL_VENDOR_INFO "@SDL_VENDOR_INFO@" #define SDL_REVISION_NUMBER 0 -#ifndef SDL_REVISION -#define SDL_REVISION "" +#ifdef SDL_VENDOR_INFO +#define SDL_REVISION "@SDL_REVISION@ (" SDL_VENDOR_INFO ")" +#else +#define SDL_REVISION "@SDL_REVISION@" #endif diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index 3960f567cb..b8da8fcbf8 100644 --- a/include/SDL_rwops.h +++ b/include/SDL_rwops.h @@ -192,7 +192,7 @@ typedef struct SDL_RWops * \returns a pointer to the SDL_RWops structure that is created, or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -231,7 +231,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose); * \returns a pointer to the SDL_RWops structure that is created, or NULL on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -265,7 +265,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp, * \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -300,7 +300,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size); * \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -336,7 +336,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, * \returns a pointer to the allocated memory on success, or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FreeRW */ @@ -360,7 +360,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); * * \param area the SDL_RWops structure to be freed * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AllocRW */ @@ -380,7 +380,7 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); * unknown or a negative error code on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context); @@ -408,7 +408,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context); * \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END` * \returns the final offset in the data stream after the seek or -1 on error. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -436,7 +436,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context, * \returns the current offset in the stream, or -1 if the information can not * be determined. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -469,7 +469,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context); * \returns the number of objects read, or 0 at error or end of file; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -503,7 +503,7 @@ extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context, * \returns the number of objects written, which will be less than **num** on * error; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWclose * \sa SDL_RWFromConstMem @@ -534,7 +534,7 @@ extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RWFromConstMem * \sa SDL_RWFromFile @@ -560,7 +560,7 @@ extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context); * \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning * \returns the data, or NULL if there was an error. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src, size_t *datasize, @@ -582,7 +582,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src, * \param datasize if not NULL, will store the number of bytes read * \returns the data, or NULL if there was an error. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize); @@ -600,7 +600,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize); * \returns the read byte on success or 0 on failure; call SDL_GetError() for * more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WriteU8 */ @@ -616,7 +616,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); * \param src the stream from which to read data * \returns 16 bits of data in the native byte order of the platform. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadBE16 */ @@ -632,7 +632,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); * \param src the stream from which to read data * \returns 16 bits of data in the native byte order of the platform. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadLE16 */ @@ -648,7 +648,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); * \param src the stream from which to read data * \returns 32 bits of data in the native byte order of the platform. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadBE32 */ @@ -664,7 +664,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src); * \param src the stream from which to read data * \returns 32 bits of data in the native byte order of the platform. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadLE32 */ @@ -680,7 +680,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); * \param src the stream from which to read data * \returns 64 bits of data in the native byte order of the platform. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadBE64 */ @@ -696,7 +696,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); * \param src the stream from which to read data * \returns 64 bits of data in the native byte order of the platform. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadLE64 */ @@ -718,7 +718,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); * \returns 1 on success or 0 on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadU8 */ @@ -736,7 +736,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); * \param value the data to be written, in native format * \returns 1 on successful write, 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WriteBE16 */ @@ -753,7 +753,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); * \param value the data to be written, in native format * \returns 1 on successful write, 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WriteLE16 */ @@ -771,7 +771,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); * \param value the data to be written, in native format * \returns 1 on successful write, 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WriteBE32 */ @@ -788,7 +788,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); * \param value the data to be written, in native format * \returns 1 on successful write, 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WriteLE32 */ @@ -806,7 +806,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); * \param value the data to be written, in native format * \returns 1 on successful write, 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WriteBE64 */ @@ -823,7 +823,7 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); * \param value the data to be written, in native format * \returns 1 on successful write, 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WriteLE64 */ diff --git a/include/SDL_scancode.h b/include/SDL_scancode.h index aaa782f8da..17e8fe2fd6 100644 --- a/include/SDL_scancode.h +++ b/include/SDL_scancode.h @@ -225,16 +225,16 @@ typedef enum SDL_SCANCODE_F23 = 114, SDL_SCANCODE_F24 = 115, SDL_SCANCODE_EXECUTE = 116, - SDL_SCANCODE_HELP = 117, - SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_HELP = 117, /**< AL Integrated Help Center */ + SDL_SCANCODE_MENU = 118, /**< Menu (show menu) */ SDL_SCANCODE_SELECT = 119, - SDL_SCANCODE_STOP = 120, - SDL_SCANCODE_AGAIN = 121, /**< redo */ - SDL_SCANCODE_UNDO = 122, - SDL_SCANCODE_CUT = 123, - SDL_SCANCODE_COPY = 124, - SDL_SCANCODE_PASTE = 125, - SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_STOP = 120, /**< AC Stop */ + SDL_SCANCODE_AGAIN = 121, /**< AC Redo/Repeat */ + SDL_SCANCODE_UNDO = 122, /**< AC Undo */ + SDL_SCANCODE_CUT = 123, /**< AC Cut */ + SDL_SCANCODE_COPY = 124, /**< AC Copy */ + SDL_SCANCODE_PASTE = 125, /**< AC Paste */ + SDL_SCANCODE_FIND = 126, /**< AC Find */ SDL_SCANCODE_MUTE = 127, SDL_SCANCODE_VOLUMEUP = 128, SDL_SCANCODE_VOLUMEDOWN = 129, @@ -265,9 +265,9 @@ typedef enum SDL_SCANCODE_LANG8 = 151, /**< reserved */ SDL_SCANCODE_LANG9 = 152, /**< reserved */ - SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ + SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ SDL_SCANCODE_SYSREQ = 154, - SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CANCEL = 155, /**< AC Cancel */ SDL_SCANCODE_CLEAR = 156, SDL_SCANCODE_PRIOR = 157, SDL_SCANCODE_RETURN2 = 158, @@ -345,6 +345,11 @@ typedef enum * \name Usage page 0x0C * * These values are mapped from usage page 0x0C (USB consumer page). + * See https://usb.org/sites/default/files/hut1_2.pdf + * + * There are way more keys in the spec than we can represent in the + * current scancode range, so pick the ones that commonly come up in + * real world usage. */ /* @{ */ @@ -354,17 +359,17 @@ typedef enum SDL_SCANCODE_AUDIOPLAY = 261, SDL_SCANCODE_AUDIOMUTE = 262, SDL_SCANCODE_MEDIASELECT = 263, - SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_WWW = 264, /**< AL Internet Browser */ SDL_SCANCODE_MAIL = 265, - SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_CALCULATOR = 266, /**< AL Calculator */ SDL_SCANCODE_COMPUTER = 267, - SDL_SCANCODE_AC_SEARCH = 268, - SDL_SCANCODE_AC_HOME = 269, - SDL_SCANCODE_AC_BACK = 270, - SDL_SCANCODE_AC_FORWARD = 271, - SDL_SCANCODE_AC_STOP = 272, - SDL_SCANCODE_AC_REFRESH = 273, - SDL_SCANCODE_AC_BOOKMARKS = 274, + SDL_SCANCODE_AC_SEARCH = 268, /**< AC Search */ + SDL_SCANCODE_AC_HOME = 269, /**< AC Home */ + SDL_SCANCODE_AC_BACK = 270, /**< AC Back */ + SDL_SCANCODE_AC_FORWARD = 271, /**< AC Forward */ + SDL_SCANCODE_AC_STOP = 272, /**< AC Stop */ + SDL_SCANCODE_AC_REFRESH = 273, /**< AC Refresh */ + SDL_SCANCODE_AC_BOOKMARKS = 274, /**< AC Bookmarks */ /* @} *//* Usage page 0x0C */ @@ -383,7 +388,7 @@ typedef enum SDL_SCANCODE_KBDILLUMDOWN = 279, SDL_SCANCODE_KBDILLUMUP = 280, SDL_SCANCODE_EJECT = 281, - SDL_SCANCODE_SLEEP = 282, + SDL_SCANCODE_SLEEP = 282, /**< SC System Sleep */ SDL_SCANCODE_APP1 = 283, SDL_SCANCODE_APP2 = 284, diff --git a/include/SDL_sensor.h b/include/SDL_sensor.h index 684d2c6eb6..0708ad9638 100644 --- a/include/SDL_sensor.h +++ b/include/SDL_sensor.h @@ -138,7 +138,7 @@ typedef enum * API functions that take a sensor index will be valid, and sensor events * will not be delivered. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_LockSensors(void); extern DECLSPEC void SDLCALL SDL_UnlockSensors(void); @@ -148,7 +148,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSensors(void); * * \returns the number of sensors detected. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_NumSensors(void); @@ -158,7 +158,7 @@ extern DECLSPEC int SDLCALL SDL_NumSensors(void); * \param device_index The sensor to obtain name from * \returns the sensor name, or NULL if `device_index` is out of range. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); @@ -169,7 +169,7 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is * out of range. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index); @@ -180,7 +180,7 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index) * \returns the sensor platform dependent type, or -1 if `device_index` is out * of range. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index); @@ -190,7 +190,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index) * \param device_index The sensor to get instance id from * \returns the sensor instance ID, or -1 if `device_index` is out of range. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index); @@ -200,7 +200,7 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_in * \param device_index The sensor to open * \returns an SDL_Sensor sensor object, or NULL if an error occurred. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); @@ -210,7 +210,7 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); * \param instance_id The sensor from instance id * \returns an SDL_Sensor object. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id); @@ -220,7 +220,7 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instan * \param sensor The SDL_Sensor object * \returns the sensor name, or NULL if `sensor` is NULL. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); @@ -231,7 +231,7 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is * NULL. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); @@ -241,7 +241,7 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); * \param sensor The SDL_Sensor object to inspect * \returns the sensor platform dependent type, or -1 if `sensor` is NULL. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); @@ -251,7 +251,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); * \param sensor The SDL_Sensor object to inspect * \returns the sensor instance ID, or -1 if `sensor` is NULL. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor); @@ -265,7 +265,7 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor) * \param num_values The number of values to write to data * \returns 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values); @@ -282,7 +282,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, i * \param num_values The number of values to write to data * \returns 0 or -1 if an error occurred. * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values); @@ -291,7 +291,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, U * * \param sensor The SDL_Sensor object to close * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor); @@ -304,7 +304,7 @@ extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor); * This needs to be called from the thread that initialized the sensor * subsystem. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_SensorUpdate(void); diff --git a/include/SDL_shape.h b/include/SDL_shape.h index 1bca9270e5..c03fe8bbcb 100644 --- a/include/SDL_shape.h +++ b/include/SDL_shape.h @@ -62,7 +62,7 @@ extern "C" { * and ::SDL_WINDOW_FULLSCREEN is always unset. * \return the window created, or NULL if window creation failed. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_DestroyWindow */ @@ -75,7 +75,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if * the window is unshaped or NULL. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateShapedWindow */ @@ -120,7 +120,7 @@ typedef struct SDL_WindowShapeMode { * argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window given does * not reference a valid shaped window. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WindowShapeMode * \sa SDL_GetShapedWindowMode @@ -139,7 +139,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s * window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window given is a * shapeable window currently lacking a shape. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WindowShapeMode * \sa SDL_SetWindowShape diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 5f79c95b31..68e75b6ad6 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -80,9 +80,9 @@ # include #endif #ifdef HAVE_MATH_H -# if defined(__WINRT__) +# if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on - WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx + Visual Studio. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx for more information. */ # define _USE_MATH_DEFINES @@ -410,7 +410,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS -#if !defined(__ANDROID__) && !defined(__VITA__) +#if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__) /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ typedef enum { @@ -436,9 +436,9 @@ extern "C" { #define SDL_stack_free(data) SDL_free(data) #endif -extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); -extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); -extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); +extern DECLSPEC SDL_MALLOC void *SDLCALL SDL_malloc(size_t size); +extern DECLSPEC SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void *SDLCALL SDL_calloc(size_t nmemb, size_t size); +extern DECLSPEC SDL_ALLOC_SIZE(2) void *SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); typedef void *(SDLCALL *SDL_malloc_func)(size_t size); @@ -449,7 +449,7 @@ typedef void (SDLCALL *SDL_free_func)(void *mem); /** * Get the original set of SDL memory functions * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, @@ -459,7 +459,7 @@ extern DECLSPEC void SDLCALL SDL_GetOriginalMemoryFunctions(SDL_malloc_func *mal /** * Get the current set of SDL memory functions * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, @@ -469,7 +469,7 @@ extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func /** * Replace SDL's memory allocation functions with a custom set * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, @@ -479,7 +479,7 @@ extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, /** * Get the number of outstanding (unfreed) allocations * - * \since This function is available since SDL 2.0.7. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); @@ -576,13 +576,14 @@ extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes); extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); -extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); +extern DECLSPEC SDL_MALLOC char *SDLCALL SDL_strdup(const char *str); extern DECLSPEC char *SDLCALL SDL_strrev(char *str); extern DECLSPEC char *SDLCALL SDL_strupr(char *str); extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC char *SDLCALL SDL_strcasestr(const char *haystack, const char *needle); extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr); extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes); @@ -632,7 +633,7 @@ extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list * \param x floating point value, in radians. * \returns arc cosine of `x`. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC double SDLCALL SDL_acos(double x); extern DECLSPEC float SDLCALL SDL_acosf(float x); @@ -696,7 +697,7 @@ extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, * This function converts a string between encodings in one pass, returning a * string that must be freed with SDL_free() or NULL on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, diff --git a/include/SDL_surface.h b/include/SDL_surface.h index 838de654ee..fdb1c8a892 100644 --- a/include/SDL_surface.h +++ b/include/SDL_surface.h @@ -151,7 +151,7 @@ typedef enum * \returns the new SDL_Surface structure that is created or NULL if it fails; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRGBSurfaceFrom * \sa SDL_CreateRGBSurfaceWithFormat @@ -179,7 +179,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface * \returns the new SDL_Surface structure that is created or NULL if it fails; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRGBSurface * \sa SDL_CreateRGBSurfaceFrom @@ -210,7 +210,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat * \returns the new SDL_Surface structure that is created or NULL if it fails; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRGBSurface * \sa SDL_CreateRGBSurfaceWithFormat @@ -248,7 +248,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, * \returns the new SDL_Surface structure that is created or NULL if it fails; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRGBSurfaceFrom * \sa SDL_CreateRGBSurfaceWithFormat @@ -264,7 +264,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom * * \param surface the SDL_Surface to free. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRGBSurface * \sa SDL_CreateRGBSurfaceFrom @@ -283,7 +283,7 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette); @@ -304,7 +304,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_MUSTLOCK * \sa SDL_UnlockSurface @@ -316,7 +316,7 @@ extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface); * * \param surface the SDL_Surface structure to be unlocked * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LockSurface */ @@ -337,7 +337,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface); * \returns a pointer to a new SDL_Surface structure or NULL if there was an * error; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FreeSurface * \sa SDL_RWFromFile @@ -369,7 +369,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadBMP_RW * \sa SDL_SaveBMP @@ -396,7 +396,7 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitSurface * \sa SDL_LockSurface @@ -413,7 +413,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, * \param surface the SDL_Surface structure to query * \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetSurfaceRLE */ @@ -438,7 +438,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitSurface * \sa SDL_GetColorKey @@ -454,7 +454,7 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, * \param surface the SDL_Surface structure to query * \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetColorKey * \sa SDL_GetColorKey @@ -474,7 +474,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitSurface * \sa SDL_SetColorKey @@ -498,7 +498,7 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod @@ -517,7 +517,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod @@ -539,7 +539,7 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod @@ -555,7 +555,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod @@ -575,7 +575,7 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceBlendMode */ @@ -590,7 +590,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetSurfaceBlendMode */ @@ -612,7 +612,7 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, * \returns SDL_TRUE if the rectangle intersects the surface, otherwise * SDL_FALSE and blits will be completely clipped. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitSurface * \sa SDL_GetClipRect @@ -631,7 +631,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, * \param rect an SDL_Rect structure filled in with the clipping rectangle for * the surface * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitSurface * \sa SDL_SetClipRect @@ -666,7 +666,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface) * \returns the new SDL_Surface structure that is created or NULL if it fails; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AllocFormat * \sa SDL_ConvertSurfaceFormat @@ -691,7 +691,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface * \returns the new SDL_Surface structure that is created or NULL if it fails; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AllocFormat * \sa SDL_ConvertSurface @@ -714,7 +714,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, Uint32 src_format, @@ -740,7 +740,7 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, Uint32 src_format, @@ -767,7 +767,7 @@ extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FillRects */ @@ -793,7 +793,7 @@ extern DECLSPEC int SDLCALL SDL_FillRect * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_FillRect */ @@ -866,7 +866,7 @@ extern DECLSPEC int SDLCALL SDL_FillRects * SDL_UpperBlit() has been replaced by SDL_BlitSurface(), which is merely a * macro for this function with a less confusing name. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitSurface */ @@ -892,7 +892,7 @@ extern DECLSPEC int SDLCALL SDL_UpperBlit * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitSurface */ @@ -907,7 +907,7 @@ extern DECLSPEC int SDLCALL SDL_LowerBlit * * Please use SDL_BlitScaled() instead. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, @@ -917,7 +917,7 @@ extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, /** * Perform bilinear scaling between two surfaces of the same format, 32BPP. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src, const SDL_Rect * srcrect, @@ -933,7 +933,7 @@ extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src, * SDL_UpperBlitScaled() has been replaced by SDL_BlitScaled(), which is * merely a macro for this function with a less confusing name. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitScaled */ @@ -956,7 +956,7 @@ extern DECLSPEC int SDLCALL SDL_UpperBlitScaled * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_BlitScaled */ @@ -967,14 +967,14 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled /** * Set the YUV conversion mode * - * \since This function is available since SDL 2.0.8. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); /** * Get the YUV conversion mode * - * \since This function is available since SDL 2.0.8. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); @@ -982,7 +982,7 @@ extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); * Get the YUV conversion mode, returning the correct mode for the resolution * when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC * - * \since This function is available since SDL 2.0.8. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); diff --git a/include/SDL_system.h b/include/SDL_system.h index 0edca635ba..bd60cf12f4 100644 --- a/include/SDL_system.h +++ b/include/SDL_system.h @@ -51,7 +51,7 @@ typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsi * \param callback The SDL_WindowsMessageHook function to call. * \param userdata a pointer to pass to every iteration of `callback` * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata); @@ -70,7 +70,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook ca * \returns the D3D9 adapter index on success or a negative error code on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.1. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); @@ -86,7 +86,7 @@ typedef struct IDirect3DDevice9 IDirect3DDevice9; * \returns the D3D9 device associated with given renderer or NULL if it is * not a D3D9 renderer; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.1. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer); @@ -102,7 +102,7 @@ typedef struct ID3D11Device ID3D11Device; * \returns the D3D11 device associated with given renderer or NULL if it is * not a D3D11 renderer; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC ID3D11Device* SDLCALL SDL_RenderGetD3D11Device(SDL_Renderer * renderer); @@ -122,7 +122,7 @@ typedef struct ID3D12Device ID3D12Device; * \returns the D3D12 device associated with given renderer or NULL if it is * not a D3D12 renderer; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* renderer); @@ -146,7 +146,7 @@ extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* ren * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex ); @@ -164,7 +164,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a * \param priority The new, Unix-specific, priority value. * \returns 0 on success, or -1 on error. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); @@ -179,7 +179,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio * SCHED_OTHER, etc...) * \returns 0 on success, or -1 on error. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); @@ -218,7 +218,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_iPhoneSetEventPump */ @@ -236,7 +236,7 @@ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, * * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_iPhoneSetAnimationCallback */ @@ -261,7 +261,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); * \returns a pointer to Java native interface object (JNIEnv) to which the * current thread is attached, or 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AndroidGetActivity */ @@ -283,7 +283,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); * \returns the jobject representing the instance of the Activity class of the * Android application, or NULL on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AndroidGetJNIEnv */ @@ -317,7 +317,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); * * \returns the Android API level. * - * \since This function is available since SDL 2.0.12. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); @@ -326,7 +326,7 @@ extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); * * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.8. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); @@ -335,7 +335,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); * * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); @@ -344,14 +344,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); * * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); /** * Trigger the Android system back button behavior. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); @@ -374,7 +374,7 @@ extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); * \returns the path used for internal storage or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AndroidGetExternalStorageState */ @@ -391,7 +391,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); * \returns the current state of external storage on success or 0 on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AndroidGetExternalStoragePath */ @@ -409,7 +409,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); * \returns the path used for external storage for this application on success * or NULL on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AndroidGetExternalStorageState */ @@ -423,7 +423,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); * \param permission The permission to request. * \returns SDL_TRUE if the permission was granted, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.14. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission); @@ -448,7 +448,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis * \param yoffset set this parameter only when gravity >=0 * \returns 0 if success, -1 if any error occurs. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset); @@ -460,7 +460,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int durati * \param command user command that must be greater or equal to 0x8000 * \param param user parameter * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param); @@ -563,7 +563,7 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT * * \returns a value from the SDL_WinRT_DeviceFamily enum. * - * \since This function is available since SDL 2.0.8. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); @@ -576,7 +576,7 @@ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); * * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); @@ -606,7 +606,7 @@ typedef struct XTaskQueueObject * XTaskQueueHandle; * \param outTaskQueue a pointer to be filled in with task queue handle. * \returns 0 if success, -1 if any error occurs. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue); diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 45f8e7540d..16ff408925 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -76,10 +76,6 @@ struct SDL_SysWMinfo; #endif /* defined(SDL_VIDEO_DRIVER_X11) */ -#if defined(SDL_VIDEO_DRIVER_DIRECTFB) -#include -#endif - #if defined(SDL_VIDEO_DRIVER_COCOA) #ifdef __OBJC__ @class NSWindow; @@ -111,10 +107,6 @@ typedef void *EGLSurface; #include "SDL_egl.h" #endif -#if defined(SDL_VIDEO_DRIVER_OS2) -#define INCL_WIN -#include -#endif #endif /* SDL_PROTOTYPES_ONLY */ #if defined(SDL_VIDEO_DRIVER_KMSDRM) @@ -137,15 +129,12 @@ typedef enum SDL_SYSWM_UNKNOWN, SDL_SYSWM_WINDOWS, SDL_SYSWM_X11, - SDL_SYSWM_DIRECTFB, SDL_SYSWM_COCOA, SDL_SYSWM_UIKIT, SDL_SYSWM_WAYLAND, - SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ SDL_SYSWM_WINRT, SDL_SYSWM_ANDROID, SDL_SYSWM_VIVANTE, - SDL_SYSWM_OS2, SDL_SYSWM_HAIKU, SDL_SYSWM_KMSDRM, SDL_SYSWM_RISCOS @@ -173,11 +162,6 @@ struct SDL_SysWMmsg XEvent event; } x11; #endif -#if defined(SDL_VIDEO_DRIVER_DIRECTFB) - struct { - DFBEvent event; - } dfb; -#endif #if defined(SDL_VIDEO_DRIVER_COCOA) struct { @@ -201,16 +185,6 @@ struct SDL_SysWMmsg int dummy; /* No Vivante window events yet */ } vivante; -#endif -#if defined(SDL_VIDEO_DRIVER_OS2) - struct - { - BOOL fFrame; /**< TRUE if hwnd is a frame window */ - HWND hwnd; /**< The window receiving the message */ - ULONG msg; /**< The message identifier */ - MPARAM mp1; /**< The first first message parameter */ - MPARAM mp2; /**< The second first message parameter */ - } os2; #endif /* Can't have an empty union */ int dummy; @@ -250,14 +224,6 @@ struct SDL_SysWMinfo Window window; /**< The X11 window */ } x11; #endif -#if defined(SDL_VIDEO_DRIVER_DIRECTFB) - struct - { - IDirectFB *dfb; /**< The directfb main interface */ - IDirectFBWindow *window; /**< The directfb window handle */ - IDirectFBSurface *surface; /**< The directfb client surface */ - } dfb; -#endif #if defined(SDL_VIDEO_DRIVER_COCOA) struct { @@ -302,13 +268,6 @@ struct SDL_SysWMinfo struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */ } wl; #endif -#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ - struct - { - void *connection; /**< Mir display server connection */ - void *surface; /**< Mir surface */ - } mir; -#endif #if defined(SDL_VIDEO_DRIVER_ANDROID) struct @@ -318,14 +277,6 @@ struct SDL_SysWMinfo } android; #endif -#if defined(SDL_VIDEO_DRIVER_OS2) - struct - { - HWND hwnd; /**< The window handle */ - HWND hwndFrame; /**< The frame window handle */ - } os2; -#endif - #if defined(SDL_VIDEO_DRIVER_VIVANTE) struct { @@ -369,7 +320,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; * of the `info` struct is valid, or SDL_FALSE if the information * could not be retrieved; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, SDL_SysWMinfo * info); diff --git a/include/SDL_test.h b/include/SDL_test.h index 8cc9d616a3..ae4eb5b236 100644 --- a/include/SDL_test.h +++ b/include/SDL_test.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ #ifndef SDL_test_h_ diff --git a/include/SDL_test_assert.h b/include/SDL_test_assert.h index 734230529e..dd820edef1 100644 --- a/include/SDL_test_assert.h +++ b/include/SDL_test_assert.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_common.h b/include/SDL_test_common.h index b86520d324..0d43070965 100644 --- a/include/SDL_test_common.h +++ b/include/SDL_test_common.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* Ported from original test\common.h file. */ diff --git a/include/SDL_test_compare.h b/include/SDL_test_compare.h index 8a7a07008f..400a9da891 100644 --- a/include/SDL_test_compare.h +++ b/include/SDL_test_compare.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_crc32.h b/include/SDL_test_crc32.h index 049da74061..86f6ce661b 100644 --- a/include/SDL_test_crc32.h +++ b/include/SDL_test_crc32.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_font.h b/include/SDL_test_font.h index 6e7247dd76..2f02ae937f 100644 --- a/include/SDL_test_font.h +++ b/include/SDL_test_font.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ #ifndef SDL_test_font_h_ diff --git a/include/SDL_test_fuzzer.h b/include/SDL_test_fuzzer.h index bbe8eb8749..ea0d14b2fd 100644 --- a/include/SDL_test_fuzzer.h +++ b/include/SDL_test_fuzzer.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_harness.h b/include/SDL_test_harness.h index 1fd4236bee..453fe336fc 100644 --- a/include/SDL_test_harness.h +++ b/include/SDL_test_harness.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_images.h b/include/SDL_test_images.h index e2bfc3600e..6cc3aaa991 100644 --- a/include/SDL_test_images.h +++ b/include/SDL_test_images.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_log.h b/include/SDL_test_log.h index e3d39ad279..5e670d151c 100644 --- a/include/SDL_test_log.h +++ b/include/SDL_test_log.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_md5.h b/include/SDL_test_md5.h index 17b1d2be71..3005b8bcd2 100644 --- a/include/SDL_test_md5.h +++ b/include/SDL_test_md5.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_test_memory.h b/include/SDL_test_memory.h index cc2edc1b9b..4158ce34e3 100644 --- a/include/SDL_test_memory.h +++ b/include/SDL_test_memory.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ #ifndef SDL_test_memory_h_ diff --git a/include/SDL_test_random.h b/include/SDL_test_random.h index b1d6060cb2..6da8b9ef5d 100644 --- a/include/SDL_test_random.h +++ b/include/SDL_test_random.h @@ -24,7 +24,7 @@ * * Include file for SDL test framework. * - * This code is a part of the SDL2_test library, not the main SDL library. + * This code is a part of the SDL test library, not the main SDL library. */ /* diff --git a/include/SDL_thread.h b/include/SDL_thread.h index 7364f81371..a5e1fe4ef7 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -38,13 +38,6 @@ #if defined(__WIN32__) || defined(__GDK__) #include /* _beginthreadex() and _endthreadex() */ #endif -#if defined(__OS2__) /* for _beginthread() and _endthread() */ -#ifndef __EMX__ -#include -#else -#include -#endif -#endif #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -94,15 +87,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL2.DLL will + * API. There is a problem with this, that only the RTL of the SDL3.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL2.DLL which uses this API, - * then the RTL of SDL2.DLL will be used to create the new thread, and if it's + * start a new thread. This way, if it's the SDL3.DLL which uses this API, + * then the RTL of SDL3.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: @@ -145,42 +138,6 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, #define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread) #endif -#elif defined(__OS2__) -/* - * just like the windows case above: We compile SDL2 - * into a dll with Watcom's runtime statically linked. - */ -#define SDL_PASSED_BEGINTHREAD_ENDTHREAD - -typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); -typedef void (*pfnSDL_CurrentEndThread)(void); - -#ifndef SDL_beginthread -#define SDL_beginthread _beginthread -#endif -#ifndef SDL_endthread -#define SDL_endthread _endthread -#endif - -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread); -extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, - pfnSDL_CurrentBeginThread pfnBeginThread, - pfnSDL_CurrentEndThread pfnEndThread); - -#if defined(SDL_CreateThread) && SDL_DYNAMIC_API -#undef SDL_CreateThread -#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#undef SDL_CreateThreadWithStackSize -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#else -#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) -#endif - #else /** @@ -199,7 +156,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz * new thread could not be created; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateThreadWithStackSize * \sa SDL_WaitThread @@ -246,7 +203,7 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); * new thread could not be created; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. * * \sa SDL_WaitThread */ @@ -265,7 +222,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz * \returns a pointer to a UTF-8 string that names the specified thread, or * NULL if it doesn't have a name. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateThread */ @@ -283,7 +240,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread); * * \returns the ID of the current thread. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetThreadID */ @@ -300,7 +257,7 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void); * \returns the ID of the specified thread, or the ID of the current thread if * `thread` is NULL. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ThreadID */ @@ -317,7 +274,7 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); @@ -349,7 +306,7 @@ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); * from the thread function by its 'return', or NULL to not * receive such value back. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateThread * \sa SDL_DetachThread @@ -385,7 +342,7 @@ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); * \param thread the SDL_Thread pointer that was returned from the * SDL_CreateThread() call that started this thread * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateThread * \sa SDL_WaitThread @@ -400,7 +357,7 @@ extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread); * * \returns the newly created thread local storage identifier or 0 on error. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_TLSGet * \sa SDL_TLSSet @@ -414,7 +371,7 @@ extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void); * \returns the value associated with the ID for the current thread or NULL if * no value has been set; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_TLSCreate * \sa SDL_TLSSet @@ -439,7 +396,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_TLSCreate * \sa SDL_TLSGet @@ -449,7 +406,7 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SD /** * Cleanup all TLS data for this thread. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_TLSCleanup(void); diff --git a/include/SDL_timer.h b/include/SDL_timer.h index 62f81d42db..36d5f43a24 100644 --- a/include/SDL_timer.h +++ b/include/SDL_timer.h @@ -51,7 +51,7 @@ extern "C" { * \returns an unsigned 32-bit value representing the number of milliseconds * since the SDL library initialized. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_TICKS_PASSED */ @@ -77,7 +77,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); * \returns an unsigned 64-bit value representing the number of milliseconds * since the SDL library initialized. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void); @@ -116,7 +116,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void); * * \returns the current counter value. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetPerformanceFrequency */ @@ -127,7 +127,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); * * \returns a platform-specific count per second. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetPerformanceCounter */ @@ -142,7 +142,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); * * \param ms the number of milliseconds to delay * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); @@ -189,7 +189,7 @@ typedef int SDL_TimerID; * \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RemoveTimer */ @@ -204,7 +204,7 @@ extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, * \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't * found. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_AddTimer */ diff --git a/include/SDL_touch.h b/include/SDL_touch.h index 95924135e1..2f76adacd2 100644 --- a/include/SDL_touch.h +++ b/include/SDL_touch.h @@ -76,7 +76,7 @@ typedef struct SDL_Finger * * \returns the number of registered touch devices. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTouchDevice */ @@ -89,7 +89,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); * \returns the touch ID with the given index on success or 0 if the index is * invalid; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumTouchDevices */ @@ -99,14 +99,14 @@ extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); * Get the touch device name as reported from the driver or NULL if the index * is invalid. * - * \since This function is available since SDL 2.0.22. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC const char* SDLCALL SDL_GetTouchName(int index); /** * Get the type of the given touch device. * - * \since This function is available since SDL 2.0.10. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID); @@ -117,7 +117,7 @@ extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID t * \returns the number of active fingers for a given touch device on success * or 0 on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTouchFinger */ @@ -133,7 +133,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); * \returns a pointer to the SDL_Finger object or NULL if no object at the * given ID and index could be found. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RecordGesture */ diff --git a/include/SDL_version.h b/include/SDL_version.h index b817be1a24..6f86ab7561 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -57,8 +57,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ -#define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 25 +#define SDL_MAJOR_VERSION 3 +#define SDL_MINOR_VERSION 0 #define SDL_PATCHLEVEL 0 /** @@ -83,44 +83,26 @@ typedef struct SDL_version (x)->patch = SDL_PATCHLEVEL; \ } -/* TODO: Remove this whole block in SDL 3 */ -#if SDL_MAJOR_VERSION < 3 /** * This macro turns the version numbers into a numeric value: * \verbatim - (1,2,3) -> (1203) + (1,2,3) -> (0x1000203) \endverbatim - * - * This assumes that there will never be more than 100 patchlevels. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300, - * and 2.255.99 would be encoded as 25799. - * This macro will not be available in SDL 3.x. */ -#define SDL_VERSIONNUM(X, Y, Z) \ - ((X)*1000 + (Y)*100 + (Z)) +#define SDL_VERSIONNUM(X, Y, Z) \ + ((X) << 24 | (Y) << 8 | (Z) << 0) /** * This is the version number macro for the current SDL version. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300. - * This macro will not be available in SDL 3.x. - * - * Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead. */ #define SDL_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) -#endif /* SDL_MAJOR_VERSION < 3 */ /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ - ((SDL_MAJOR_VERSION >= X) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION >= Y) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION > Y || SDL_PATCHLEVEL >= Z)) + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) /** * Get the version of SDL that is linked against your program. @@ -134,7 +116,7 @@ typedef struct SDL_version * * \param ver the SDL_version structure that contains the version information * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRevision */ @@ -163,7 +145,7 @@ extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); * \returns an arbitrary string, uniquely identifying the exact revision of * the SDL library in use. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetVersion */ @@ -186,7 +168,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); * * \returns zero, always, in modern SDL releases. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRevision */ diff --git a/include/SDL_video.h b/include/SDL_video.h index c2f3e2f300..ccd43394ed 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -287,7 +287,7 @@ typedef enum * \returns a number >= 1 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetVideoDriver */ @@ -302,7 +302,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); * \param index the index of a video driver * \returns the name of the video driver with the given **index**. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumVideoDrivers */ @@ -330,7 +330,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumVideoDrivers * \sa SDL_GetVideoDriver @@ -344,7 +344,7 @@ extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); * * This function closes all windows, and restores the original video mode. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_VideoInit */ @@ -356,7 +356,7 @@ extern DECLSPEC void SDLCALL SDL_VideoQuit(void); * \returns the name of the current video driver or NULL if no driver has been * initialized. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumVideoDrivers * \sa SDL_GetVideoDriver @@ -369,7 +369,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); * \returns a number >= 1 or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayBounds */ @@ -383,7 +383,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); * \returns the name of a display or NULL for an invalid display index or * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumVideoDisplays */ @@ -399,7 +399,7 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumVideoDisplays */ @@ -429,7 +429,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * re * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetNumVideoDisplays @@ -465,7 +465,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rec * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumVideoDisplays */ @@ -478,7 +478,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, fl * \returns The SDL_DisplayOrientation enum value of the display, or * `SDL_ORIENTATION_UNKNOWN` if it isn't available. * - * \since This function is available since SDL 2.0.9. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumVideoDisplays */ @@ -494,7 +494,7 @@ extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int dis * \returns a number >= 1 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayMode * \sa SDL_GetNumVideoDisplays @@ -519,7 +519,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumDisplayModes */ @@ -540,7 +540,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetCurrentDisplayMode * \sa SDL_GetDisplayMode @@ -562,7 +562,7 @@ extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_Disp * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDesktopDisplayMode * \sa SDL_GetDisplayMode @@ -590,7 +590,7 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp * \returns the passed in value `closest` or NULL if no matching video mode * was available; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayMode * \sa SDL_GetNumDisplayModes @@ -604,7 +604,7 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayI * \returns the index of the display containing the point or a negative error * code on failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetNumVideoDisplays @@ -619,7 +619,7 @@ extern DECLSPEC int SDLCALL SDL_GetPointDisplayIndex(const SDL_Point * point); * to the center of the rect on success or a negative error code on * failure; call SDL_GetError() for more information. * - * \since This function is available since SDL 2.24.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetNumVideoDisplays @@ -634,7 +634,7 @@ extern DECLSPEC int SDLCALL SDL_GetRectDisplayIndex(const SDL_Rect * rect); * success or a negative error code on failure; call SDL_GetError() * for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetNumVideoDisplays @@ -655,7 +655,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowDisplayMode * \sa SDL_SetWindowFullscreen @@ -672,7 +672,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowDisplayMode * \sa SDL_SetWindowFullscreen @@ -690,7 +690,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, * \returns the raw ICC profile data on success or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void* SDLCALL SDL_GetWindowICCProfile(SDL_Window * window, size_t* size); @@ -702,7 +702,7 @@ extern DECLSPEC void* SDLCALL SDL_GetWindowICCProfile(SDL_Window * window, size_ * SDL_PIXELFORMAT_UNKNOWN on failure; call SDL_GetError() for more * information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); @@ -772,7 +772,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * \returns the window that was created or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateWindowFrom * \sa SDL_DestroyWindow @@ -793,7 +793,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, * \returns the window that was created or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateWindow * \sa SDL_DestroyWindow @@ -810,7 +810,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); * \returns the ID of the window on success or 0 on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowFromID */ @@ -826,7 +826,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); * \returns the window associated with `id` or NULL if it doesn't exist; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowID */ @@ -838,7 +838,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); * \param window the window to query * \returns a mask of the SDL_WindowFlags associated with `window` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateWindow * \sa SDL_HideWindow @@ -858,7 +858,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); * \param window the window to change * \param title the desired window title in UTF-8 format * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowTitle */ @@ -872,7 +872,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, * \returns the title of the window in UTF-8 format or "" if there is no * title. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowTitle */ @@ -884,7 +884,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); * \param window the window to change * \param icon an SDL_Surface structure containing the icon for the window * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon); @@ -899,7 +899,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, * \param userdata the associated pointer * \returns the previous value associated with `name`. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowData */ @@ -914,7 +914,7 @@ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, * \param name the name of the pointer * \returns the value associated with `name`. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowData */ @@ -932,7 +932,7 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, * \param y the y coordinate of the window in screen coordinates, or * `SDL_WINDOWPOS_CENTERED` or `SDL_WINDOWPOS_UNDEFINED` * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowPosition */ @@ -951,7 +951,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, * \param y a pointer filled in with the y position of the window, in screen * coordinates, may be NULL * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowPosition */ @@ -975,7 +975,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * \param h the height of the window in pixels, in screen coordinates, must be * > 0 * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSize * \sa SDL_SetWindowDisplayMode @@ -1001,7 +1001,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, * \param h a pointer filled in with the height of the window, in screen * coordinates, may be NULL * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetDrawableSize * \sa SDL_Vulkan_GetDrawableSize @@ -1038,7 +1038,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSize */ @@ -1059,12 +1059,12 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, * \param h a pointer to variable for storing the height in pixels, may be * NULL * - * \since This function is available since SDL 2.26.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateWindow * \sa SDL_GetWindowSize */ -extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window, +extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window, int *w, int *h); /** @@ -1074,7 +1074,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window, * \param min_w the minimum width of the window in pixels * \param min_h the minimum height of the window in pixels * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize @@ -1091,7 +1091,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, * \param h a pointer filled in with the minimum height of the window, may be * NULL * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize @@ -1106,7 +1106,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, * \param max_w the maximum width of the window in pixels * \param max_h the maximum height of the window in pixels * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize @@ -1123,7 +1123,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, * \param h a pointer filled in with the maximum height of the window, may be * NULL * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize @@ -1143,7 +1143,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, * \param window the window of which to change the border state * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowFlags */ @@ -1162,7 +1162,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, * \param window the window of which to change the resizable state * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowFlags */ @@ -1179,7 +1179,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window, * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to * disable * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowFlags */ @@ -1191,7 +1191,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window * window, * * \param window the window to show * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_HideWindow * \sa SDL_RaiseWindow @@ -1203,7 +1203,7 @@ extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); * * \param window the window to hide * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_ShowWindow */ @@ -1214,7 +1214,7 @@ extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); * * \param window the window to raise * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); @@ -1223,7 +1223,7 @@ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); * * \param window the window to maximize * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_MinimizeWindow * \sa SDL_RestoreWindow @@ -1235,7 +1235,7 @@ extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); * * \param window the window to minimize * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_MaximizeWindow * \sa SDL_RestoreWindow @@ -1247,7 +1247,7 @@ extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); * * \param window the window to restore * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_MaximizeWindow * \sa SDL_MinimizeWindow @@ -1266,7 +1266,7 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowDisplayMode * \sa SDL_SetWindowDisplayMode @@ -1292,7 +1292,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, * \returns the surface associated with the window, or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_UpdateWindowSurface * \sa SDL_UpdateWindowSurfaceRects @@ -1311,7 +1311,7 @@ extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurfaceRects @@ -1333,7 +1333,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurface @@ -1355,7 +1355,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, * \param window the window for which the input grab mode should be set * \param grabbed SDL_TRUE to grab input or SDL_FALSE to release input * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGrabbedWindow * \sa SDL_GetWindowGrab @@ -1385,7 +1385,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, * \param window The window for which the keyboard grab mode should be set. * \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowKeyboardGrab * \sa SDL_SetWindowMouseGrab @@ -1402,7 +1402,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window, * \param window The window for which the mouse grab mode should be set. * \param grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMouseGrab * \sa SDL_SetWindowKeyboardGrab @@ -1417,7 +1417,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowMouseGrab(SDL_Window * window, * \param window the window to query * \returns SDL_TRUE if input is grabbed, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowGrab */ @@ -1429,7 +1429,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); * \param window the window to query * \returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowKeyboardGrab * \sa SDL_GetWindowGrab @@ -1442,7 +1442,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window * window); * \param window the window to query * \returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowKeyboardGrab * \sa SDL_GetWindowGrab @@ -1454,7 +1454,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window * window); * * \returns the window if input is grabbed or NULL otherwise. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowGrab * \sa SDL_SetWindowGrab @@ -1473,7 +1473,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_SetWindowMouseGrab @@ -1487,7 +1487,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowMouseRect(SDL_Window * window, const SD * \returns A pointer to the mouse confinement rectangle of a window, or NULL * if there isn't one. * - * \since This function is available since SDL 2.0.18. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowMouseRect */ @@ -1514,7 +1514,7 @@ extern DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window * win * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowBrightness * \sa SDL_SetWindowGammaRamp @@ -1534,7 +1534,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b * \returns the brightness for the display where 0.0 is completely dark and * 1.0 is normal brightness. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowBrightness */ @@ -1553,7 +1553,7 @@ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowOpacity */ @@ -1574,7 +1574,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opac * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowOpacity */ @@ -1588,7 +1588,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * ou * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); @@ -1603,7 +1603,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.5. + * \since This function is available since SDL 3.0.0. * * \sa SDL_RaiseWindow */ @@ -1635,7 +1635,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowGammaRamp */ @@ -1663,7 +1663,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowGammaRamp */ @@ -1743,7 +1743,7 @@ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, * \returns 0 on success or -1 on error (including unsupported); call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.4. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, @@ -1757,7 +1757,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window, * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.16. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, SDL_FlashOperation operation); @@ -1769,7 +1769,7 @@ extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window * window, SDL_FlashOperat * * \param window the window to destroy * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateWindow * \sa SDL_CreateWindowFrom @@ -1788,7 +1788,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); * \returns SDL_TRUE if the screensaver is enabled, SDL_FALSE if it is * disabled. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_DisableScreenSaver * \sa SDL_EnableScreenSaver @@ -1798,7 +1798,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); /** * Allow the screen to be blanked by a screen saver. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_DisableScreenSaver * \sa SDL_IsScreenSaverEnabled @@ -1811,7 +1811,10 @@ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); * If you disable the screensaver, it is automatically re-enabled when SDL * quits. * - * \since This function is available since SDL 2.0.0. + * The screensaver is disabled by default since SDL 2.0.2. Before SDL 2.0.2 + * the screensaver was enabled by default. + * + * \since This function is available since SDL 3.0.0. * * \sa SDL_EnableScreenSaver * \sa SDL_IsScreenSaverEnabled @@ -1839,7 +1842,7 @@ extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetProcAddress * \sa SDL_GL_UnloadLibrary @@ -1891,7 +1894,7 @@ extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); * \returns a pointer to the named OpenGL function. The returned pointer * should be cast to the appropriate function signature. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_ExtensionSupported * \sa SDL_GL_LoadLibrary @@ -1902,7 +1905,7 @@ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); /** * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_LoadLibrary */ @@ -1925,7 +1928,7 @@ extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); * \param extension the name of the extension to check * \returns SDL_TRUE if the extension is supported, SDL_FALSE otherwise. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char *extension); @@ -1933,7 +1936,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char /** * Reset all previously set OpenGL context attributes to their default values. * - * \since This function is available since SDL 2.0.2. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetAttribute * \sa SDL_GL_SetAttribute @@ -1953,7 +1956,7 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetAttribute * \sa SDL_GL_ResetAttributes @@ -1968,7 +1971,7 @@ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_ResetAttributes * \sa SDL_GL_SetAttribute @@ -1990,7 +1993,7 @@ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); * \returns the OpenGL context associated with `window` or NULL on error; call * SDL_GetError() for more details. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_DeleteContext * \sa SDL_GL_MakeCurrent @@ -2008,7 +2011,7 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * * \returns 0 on success or a negative error code on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_CreateContext */ @@ -2021,7 +2024,7 @@ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, * \returns the currently active OpenGL window on success or NULL on failure; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); @@ -2031,7 +2034,7 @@ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); * \returns the currently active OpenGL context or NULL on failure; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_MakeCurrent */ @@ -2052,7 +2055,7 @@ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); * \param h a pointer to variable for storing the height in pixels, may be * NULL * - * \since This function is available since SDL 2.0.1. + * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateWindow * \sa SDL_GetWindowSize @@ -2083,7 +2086,7 @@ extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, * \returns 0 on success or -1 if setting the swap interval is not supported; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetSwapInterval */ @@ -2100,7 +2103,7 @@ extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); * swaps happen immediately instead of waiting for the next retrace; * call SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_SetSwapInterval */ @@ -2118,7 +2121,7 @@ extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); * * \param window the window to change * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); @@ -2127,7 +2130,7 @@ extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); * * \param context the OpenGL context to be deleted * - * \since This function is available since SDL 2.0.0. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_CreateContext */ diff --git a/include/SDL_vulkan.h b/include/SDL_vulkan.h index ab86a0b865..7e52584896 100644 --- a/include/SDL_vulkan.h +++ b/include/SDL_vulkan.h @@ -101,7 +101,7 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ * \returns 0 on success or -1 if the library couldn't be loaded; call * SDL_GetError() for more information. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Vulkan_GetVkInstanceProcAddr * \sa SDL_Vulkan_UnloadLibrary @@ -116,14 +116,14 @@ extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); * * \returns the function pointer for `vkGetInstanceProcAddr` or NULL on error. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. */ extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); /** * Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary() * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Vulkan_LoadLibrary */ @@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * Vulkan instance extensions * \returns SDL_TRUE on success, SDL_FALSE on error. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Vulkan_CreateSurface */ @@ -174,7 +174,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window *wi * created surface * \returns SDL_TRUE on success, SDL_FALSE on error. * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. * * \sa SDL_Vulkan_GetInstanceExtensions * \sa SDL_Vulkan_GetDrawableSize @@ -195,7 +195,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window, * \param w Pointer to the variable to write the width to or NULL * \param h Pointer to the variable to write the height to or NULL * - * \since This function is available since SDL 2.0.6. + * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSize * \sa SDL_CreateWindow diff --git a/include/begin_code.h b/include/begin_code.h index b3e69e85c7..5bdcb1acc5 100644 --- a/include/begin_code.h +++ b/include/begin_code.h @@ -57,12 +57,6 @@ # else # define DECLSPEC # endif -# elif defined(__OS2__) -# ifdef BUILD_SDL -# define DECLSPEC __declspec(dllexport) -# else -# define DECLSPEC -# endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) @@ -76,11 +70,6 @@ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__) #define SDLCALL __cdecl -#elif defined(__OS2__) || defined(__EMX__) -#define SDLCALL _System -# if defined (__GNUC__) && !defined(_System) -# define _System /* for old EMX/GCC compat. */ -# endif #else #define SDLCALL #endif @@ -185,3 +174,34 @@ #undef _HAS_FALLTHROUGH #endif /* C++17 or C2x */ #endif /* SDL_FALLTHROUGH not defined */ + +#ifndef SDL_MALLOC +#if defined(__GNUC__) +#define SDL_MALLOC __attribute__((malloc)) +// FIXME +//#elif defined(_MSC_VER) +//#define SDL_MALLOC __declspec(allocator) __desclspec(restrict) +#else +#define SDL_MALLOC +#endif +#endif /* SDL_MALLOC not defined */ + +#ifndef SDL_ALLOC_SIZE +#if defined(__GNUC__) +#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p))) +#elif defined(_MSC_VER) +#define SDL_ALLOC_SIZE(p) +#else +#define SDL_ALLOC_SIZE(p) +#endif +#endif /* SDL_ALLOC_SIZE not defined */ + +#ifndef SDL_ALLOC_SIZE2 +#if defined(__GNUC__) +#define SDL_ALLOC_SIZE2(p1, p2) __attribute__((alloc_size(p1, p2))) +#elif defined(_MSC_VER) +#define SDL_ALLOC_SIZE2(p1, p2) +#else +#define SDL_ALLOC_SIZE2(p1, p2) +#endif +#endif /* SDL_ALLOC_SIZE2 not defined */ diff --git a/mingw/pkg-support/cmake/sdl2-config-version.cmake b/mingw/pkg-support/cmake/sdl2-config-version.cmake deleted file mode 100644 index 131ee3aaf4..0000000000 --- a/mingw/pkg-support/cmake/sdl2-config-version.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# SDL2 CMake version configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw - -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") -elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake") -else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") - set(PACKAGE_VERSION_UNSUITABLE TRUE) - return() -endif() - -if(NOT EXISTS "${sdl2_config_path}") - message(WARNING "${sdl2_config_path} does not exist: MinGW development package is corrupted") - set(PACKAGE_VERSION_UNSUITABLE TRUE) - return() -endif() - -include("${sdl2_config_path}") diff --git a/mingw/pkg-support/cmake/sdl2-config.cmake b/mingw/pkg-support/cmake/sdl2-config.cmake deleted file mode 100644 index 8becf71984..0000000000 --- a/mingw/pkg-support/cmake/sdl2-config.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# SDL2 CMake configuration file: -# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-mingw - -if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") -elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(sdl2_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake") -else("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") - set(SDL2_FOUND FALSE) - return() -endif() - -if(NOT EXISTS "${sdl2_config_path}") - message(WARNING "${sdl2_config_path} does not exist: MinGW development package is corrupted") - set(SDL2_FOUND FALSE) - return() -endif() - -include("${sdl2_config_path}") diff --git a/mingw/pkg-support/cmake/sdl3-config-version.cmake b/mingw/pkg-support/cmake/sdl3-config-version.cmake new file mode 100644 index 0000000000..2f2bdffd49 --- /dev/null +++ b/mingw/pkg-support/cmake/sdl3-config-version.cmake @@ -0,0 +1,19 @@ +# SDL3 CMake version configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-2.x.y-mingw + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/sdl3-config-version.cmake") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/sdl3-config-version.cmake") +else() + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() + +if(NOT EXISTS "${sdl3_config_path}") + message(WARNING "${sdl3_config_path} does not exist: MinGW development package is corrupted") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + return() +endif() + +include("${sdl3_config_path}") diff --git a/mingw/pkg-support/cmake/sdl3-config.cmake b/mingw/pkg-support/cmake/sdl3-config.cmake new file mode 100644 index 0000000000..291845f995 --- /dev/null +++ b/mingw/pkg-support/cmake/sdl3-config.cmake @@ -0,0 +1,19 @@ +# SDL3 CMake configuration file: +# This file is meant to be placed in a cmake subfolder of SDL3-devel-2.x.y-mingw + +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/sdl3-config.cmake") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/sdl3-config.cmake") +else() + set(SDL3_FOUND FALSE) + return() +endif() + +if(NOT EXISTS "${sdl3_config_path}") + message(WARNING "${sdl3_config_path} does not exist: MinGW development package is corrupted") + set(SDL3_FOUND FALSE) + return() +endif() + +include("${sdl3_config_path}") diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in deleted file mode 100644 index 5d6cf4335f..0000000000 --- a/sdl2-config.cmake.in +++ /dev/null @@ -1,206 +0,0 @@ -# sdl2 cmake project-config input for ./configure script - -include(FeatureSummary) -set_package_properties(SDL2 PROPERTIES - URL "https://www.libsdl.org/" - DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" -) - -# Copied from `configure_package_config_file` -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/@cmake_prefix_relpath@" ABSOLUTE) - -set(exec_prefix "@exec_prefix@") -set(bindir "@bindir@") -set(libdir "@libdir@") -set(includedir "@includedir@") - -set_and_check(SDL2_PREFIX "${prefix}") -set_and_check(SDL2_EXEC_PREFIX "${exec_prefix}") -set_and_check(SDL2_BINDIR "${bindir}") -set_and_check(SDL2_INCLUDE_DIR "${includedir}/SDL2") -set_and_check(SDL2_LIBDIR "${libdir}") -set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}") - -set(SDL2_LIBRARIES SDL2::SDL2) -set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) -set(SDL2MAIN_LIBRARY) -set(SDL2TEST_LIBRARY SDL2::SDL2test) - -unset(prefix) -unset(exec_prefix) -unset(bindir) -unset(libdir) -unset(includedir) - -set(_sdl2_libraries_in "@SDL_LIBS@") -set(_sdl2_static_private_libs_in "@SDL_STATIC_LIBS@") - -# Convert _sdl2_libraries to list and keep only libraries + library directories -string(REGEX MATCHALL "-[lm]([-a-zA-Z0-9._]+)" _sdl2_libraries "${_sdl2_libraries_in}") -string(REGEX REPLACE "^-l" "" _sdl2_libraries "${_sdl2_libraries}") -string(REGEX REPLACE ";-l" ";" _sdl2_libraries "${_sdl2_libraries}") -string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl2_libdirs "${_sdl2_libraries_in}") -string(REGEX REPLACE "^-L" "" _sdl2_libdirs "${_sdl2_libdirs}") -string(REGEX REPLACE ";-L" ";" _sdl2_libdirs "${_sdl2_libdirs}") -list(APPEND _sdl2_libdirs "${SDL2_LIBDIR}") - -# Convert _sdl2_static_private_libs to list and keep only libraries + library directories -string(REGEX MATCHALL "(-[lm]([-a-zA-Z0-9._]+))|(-Wl,[^ ]*framework[^ ]*)|(-pthread)" _sdl2_static_private_libs "${_sdl2_static_private_libs_in}") -string(REGEX REPLACE "^-l" "" _sdl2_static_private_libs "${_sdl2_static_private_libs}") -string(REGEX REPLACE ";-l" ";" _sdl2_static_private_libs "${_sdl2_static_private_libs}") -string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl2_static_private_libdirs "${_sdl2_static_private_libs_in}") -string(REGEX REPLACE "^-L" "" _sdl2_static_private_libdirs "${_sdl2_static_private_libdirs}") -string(REGEX REPLACE ";-L" ";" _sdl2_static_private_libdirs "${_sdl2_static_private_libdirs}") - -if(_sdl2_libraries MATCHES ".*SDL2main.*") - list(INSERT SDL2_LIBRARIES 0 SDL2::SDL2main) - list(INSERT SDL2_STATIC_LIBRARIES 0 SDL2::SDL2main) -endif() - -set(_sdl2main_library ${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}) -if(EXISTS "${_sdl2main_library}") - set(SDL2MAIN_LIBRARY SDL2::SDL2main) - if(NOT TARGET SDL2::SDL2main) - add_library(SDL2::SDL2main STATIC IMPORTED) - set_target_properties(SDL2::SDL2main - PROPERTIES - IMPORTED_LOCATION "${_sdl2main_library}" - ) - if(WIN32) - # INTERFACE_LINK_OPTIONS needs CMake 3.13 - cmake_minimum_required(VERSION 3.13) - # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker. - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set_target_properties(SDL2::SDL2main - PROPERTIES - INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>" - ) - else() - set_target_properties(SDL2::SDL2main - PROPERTIES - INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>" - ) - endif() - endif() - endif() - set(SDL2_SDL2main_FOUND TRUE) -else() - set(SDL2_SDL2main_FOUND FALSE) -endif() -unset(_sdl2main_library) - -# Remove SDL2 since this is the "central" library -# Remove SDL2main since this will be provided by SDL2::SDL2main (if available) -# Remove mingw32 and cygwin since these are not needed when using `-Wl,--undefined,WinMain` -set(_sdl2_link_libraries ${_sdl2_libraries}) -list(REMOVE_ITEM _sdl2_link_libraries SDL2 SDL2main mingw32 cygwin) - -if(WIN32) - set(_sdl2_implib "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") - set(_sdl2_dll "${SDL2_BINDIR}/SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") - if(EXISTS "${_sdl2_implib}" AND EXISTS "${_sdl2_dll}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_sdl2_libdirs}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_IMPLIB "${_sdl2_implib}" - IMPORTED_LOCATION "${_sdl2_dll}" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) - else() - set(SDL2_SDL2_FOUND FALSE) - endif() - unset(_sdl2_implib) - unset(_sdl2_dll) -else() - set(_sdl2_shared "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}") - if(EXISTS "${_sdl2_shared}") - if(NOT TARGET SDL2::SDL2) - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries}" - INTERFACE_LINK_DIRECTORIES "${_sdl2_libdirs}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${_sdl2_shared}" - ) - endif() - set(SDL2_SDL2_FOUND TRUE) - else() - set(SDL2_SDL2_FOUND FALSE) - endif() - unset(_sdl2_shared) -endif() - -set(_sdl2_static "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}") -if(EXISTS "${_sdl2_static}") - if(NOT TARGET SDL2::SDL2-static) - add_library(SDL2::SDL2-static STATIC IMPORTED) - set_target_properties(SDL2::SDL2-static - PROPERTIES - IMPORTED_LOCATION "${_sdl2_static}" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${_sdl2_link_libraries};${_sdl2_static_private_libs}" - INTERFACE_LINK_DIRECTORIES "${_sdl2_libdirs};${_sdl2_static_private_libdirs}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif() - set(SDL2_SDL2-static_FOUND TRUE) -else() - set(SDL2_SDL2-static_FOUND FALSE) -endif() -unset(_sdl2_static) - -unset(_sdl2_link_libraries) - -set(_sdl2test_library "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_test${CMAKE_STATIC_LIBRARY_SUFFIX}") -if(EXISTS "${_sdl2test_library}") - if(NOT TARGET SDL2::SDL2test) - add_library(SDL2::SDL2test STATIC IMPORTED) - set_target_properties(SDL2::SDL2test - PROPERTIES - IMPORTED_LOCATION "${_sdl2test_library}" - INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - ) - endif() - set(SDL2_SDL2test_FOUND TRUE) -else() - set(SDL2_SDL2test_FOUND FALSE) -endif() -unset(_sdl2test_library) - -# Copied from `configure_package_config_file` -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -check_required_components(SDL2) - -# Create SDL2::SDL2 alias for static-only builds -if(TARGET SDL2::SDL2-static AND NOT TARGET SDL2::SDL2) - if(CMAKE_VERSION VERSION_LESS "3.18") - # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. - add_library(SDL2::SDL2 INTERFACE IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL2::SDL2-static") - else() - add_library(SDL2::SDL2 ALIAS SDL2::SDL2-static) - endif() -endif() diff --git a/sdl2-config-version.cmake.in b/sdl3-config-version.cmake.in similarity index 81% rename from sdl2-config-version.cmake.in rename to sdl3-config-version.cmake.in index 5c6aee44d4..cdb37b1dda 100644 --- a/sdl2-config-version.cmake.in +++ b/sdl3-config-version.cmake.in @@ -1,4 +1,4 @@ -# sdl2 cmake project-config-version input for ./configure scripts +# sdl3 cmake project-config-version input for ./configure scripts set(PACKAGE_VERSION "@SDL_VERSION@") diff --git a/sdl3-config.cmake.in b/sdl3-config.cmake.in new file mode 100644 index 0000000000..0e1184fb51 --- /dev/null +++ b/sdl3-config.cmake.in @@ -0,0 +1,206 @@ +# sdl3 cmake project-config input for ./configure script + +include(FeatureSummary) +set_package_properties(SDL3 PROPERTIES + URL "https://www.libsdl.org/" + DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware" +) + +# Copied from `configure_package_config_file` +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +get_filename_component(prefix "${CMAKE_CURRENT_LIST_DIR}/@cmake_prefix_relpath@" ABSOLUTE) + +set(exec_prefix "@exec_prefix@") +set(bindir "@bindir@") +set(libdir "@libdir@") +set(includedir "@includedir@") + +set_and_check(SDL3_PREFIX "${prefix}") +set_and_check(SDL3_EXEC_PREFIX "${exec_prefix}") +set_and_check(SDL3_BINDIR "${bindir}") +set_and_check(SDL3_INCLUDE_DIR "${includedir}/SDL3") +set_and_check(SDL3_LIBDIR "${libdir}") +set(SDL3_INCLUDE_DIRS "${includedir};${SDL3_INCLUDE_DIR}") + +set(SDL3_LIBRARIES SDL3::SDL3) +set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static) +set(SDL3MAIN_LIBRARY) +set(SDL3TEST_LIBRARY SDL3::SDL3test) + +unset(prefix) +unset(exec_prefix) +unset(bindir) +unset(libdir) +unset(includedir) + +set(_sdl3_libraries_in "@SDL_LIBS@") +set(_sdl3_static_private_libs_in "@SDL_STATIC_LIBS@") + +# Convert _sdl3_libraries to list and keep only libraries + library directories +string(REGEX MATCHALL "-[lm]([-a-zA-Z0-9._]+)" _sdl3_libraries "${_sdl3_libraries_in}") +string(REGEX REPLACE "^-l" "" _sdl3_libraries "${_sdl3_libraries}") +string(REGEX REPLACE ";-l" ";" _sdl3_libraries "${_sdl3_libraries}") +string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl3_libdirs "${_sdl3_libraries_in}") +string(REGEX REPLACE "^-L" "" _sdl3_libdirs "${_sdl3_libdirs}") +string(REGEX REPLACE ";-L" ";" _sdl3_libdirs "${_sdl3_libdirs}") +list(APPEND _sdl3_libdirs "${SDL3_LIBDIR}") + +# Convert _sdl3_static_private_libs to list and keep only libraries + library directories +string(REGEX MATCHALL "(-[lm]([-a-zA-Z0-9._]+))|(-Wl,[^ ]*framework[^ ]*)|(-pthread)" _sdl3_static_private_libs "${_sdl3_static_private_libs_in}") +string(REGEX REPLACE "^-l" "" _sdl3_static_private_libs "${_sdl3_static_private_libs}") +string(REGEX REPLACE ";-l" ";" _sdl3_static_private_libs "${_sdl3_static_private_libs}") +string(REGEX MATCHALL "-L([-a-zA-Z0-9._/]+)" _sdl3_static_private_libdirs "${_sdl3_static_private_libs_in}") +string(REGEX REPLACE "^-L" "" _sdl3_static_private_libdirs "${_sdl3_static_private_libdirs}") +string(REGEX REPLACE ";-L" ";" _sdl3_static_private_libdirs "${_sdl3_static_private_libdirs}") + +if(_sdl3_libraries MATCHES ".*SDL3main.*") + list(INSERT SDL3_LIBRARIES 0 SDL3::SDL3main) + list(INSERT SDL3_STATIC_LIBRARIES 0 SDL3::SDL3main) +endif() + +set(_sdl3main_library ${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3main${CMAKE_STATIC_LIBRARY_SUFFIX}) +if(EXISTS "${_sdl3main_library}") + set(SDL3MAIN_LIBRARY SDL3::SDL3main) + if(NOT TARGET SDL3::SDL3main) + add_library(SDL3::SDL3main STATIC IMPORTED) + set_target_properties(SDL3::SDL3main + PROPERTIES + IMPORTED_LOCATION "${_sdl3main_library}" + ) + if(WIN32) + # INTERFACE_LINK_OPTIONS needs CMake 3.13 + cmake_minimum_required(VERSION 3.13) + # Mark WinMain/WinMain@16 as undefined, such that it will be withheld by the linker. + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set_target_properties(SDL3::SDL3main + PROPERTIES + INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=_WinMain@16>" + ) + else() + set_target_properties(SDL3::SDL3main + PROPERTIES + INTERFACE_LINK_OPTIONS "$<$,EXECUTABLE>:-Wl,--undefined=WinMain>" + ) + endif() + endif() + endif() + set(SDL3_SDL3main_FOUND TRUE) +else() + set(SDL3_SDL3main_FOUND FALSE) +endif() +unset(_sdl3main_library) + +# Remove SDL3 since this is the "central" library +# Remove SDL3main since this will be provided by SDL3::SDL3main (if available) +# Remove mingw32 and cygwin since these are not needed when using `-Wl,--undefined,WinMain` +set(_sdl3_link_libraries ${_sdl3_libraries}) +list(REMOVE_ITEM _sdl3_link_libraries SDL3 SDL3main mingw32 cygwin) + +if(WIN32) + set(_sdl3_implib "${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3${CMAKE_SHARED_LIBRARY_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(_sdl3_dll "${SDL3_BINDIR}/SDL3${CMAKE_SHARED_LIBRARY_SUFFIX}") + if(EXISTS "${_sdl3_implib}" AND EXISTS "${_sdl3_dll}") + if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 SHARED IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl3_link_libraries}" + INTERFACE_LINK_DIRECTORIES "${_sdl3_libdirs}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_IMPLIB "${_sdl3_implib}" + IMPORTED_LOCATION "${_sdl3_dll}" + ) + endif() + set(SDL3_SDL3_FOUND TRUE) + else() + set(SDL3_SDL3_FOUND FALSE) + endif() + unset(_sdl3_implib) + unset(_sdl3_dll) +else() + set(_sdl3_shared "${SDL3_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL3${CMAKE_SHARED_LIBRARY_SUFFIX}") + if(EXISTS "${_sdl3_shared}") + if(NOT TARGET SDL3::SDL3) + add_library(SDL3::SDL3 SHARED IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl3_link_libraries}" + INTERFACE_LINK_DIRECTORIES "${_sdl3_libdirs}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${_sdl3_shared}" + ) + endif() + set(SDL3_SDL3_FOUND TRUE) + else() + set(SDL3_SDL3_FOUND FALSE) + endif() + unset(_sdl3_shared) +endif() + +set(_sdl3_static "${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(EXISTS "${_sdl3_static}") + if(NOT TARGET SDL3::SDL3-static) + add_library(SDL3::SDL3-static STATIC IMPORTED) + set_target_properties(SDL3::SDL3-static + PROPERTIES + IMPORTED_LOCATION "${_sdl3_static}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_sdl3_link_libraries};${_sdl3_static_private_libs}" + INTERFACE_LINK_DIRECTORIES "${_sdl3_libdirs};${_sdl3_static_private_libdirs}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif() + set(SDL3_SDL3-static_FOUND TRUE) +else() + set(SDL3_SDL3-static_FOUND FALSE) +endif() +unset(_sdl3_static) + +unset(_sdl3_link_libraries) + +set(_sdl3test_library "${SDL3_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL3_test${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(EXISTS "${_sdl3test_library}") + if(NOT TARGET SDL3::SDL3test) + add_library(SDL3::SDL3test STATIC IMPORTED) + set_target_properties(SDL3::SDL3test + PROPERTIES + IMPORTED_LOCATION "${_sdl3test_library}" + INTERFACE_INCLUDE_DIRECTORIES "${SDL3_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + ) + endif() + set(SDL3_SDL3test_FOUND TRUE) +else() + set(SDL3_SDL3test_FOUND FALSE) +endif() +unset(_sdl3test_library) + +# Copied from `configure_package_config_file` +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +check_required_components(SDL3) + +# Create SDL3::SDL3 alias for static-only builds +if(TARGET SDL3::SDL3-static AND NOT TARGET SDL3::SDL3) + if(CMAKE_VERSION VERSION_LESS "3.18") + # FIXME: Aliasing local targets is not supported on CMake < 3.18, so make it global. + add_library(SDL3::SDL3 INTERFACE IMPORTED) + set_target_properties(SDL3::SDL3 PROPERTIES INTERFACE_LINK_LIBRARIES "SDL3::SDL3-static") + else() + add_library(SDL3::SDL3 ALIAS SDL3::SDL3-static) + endif() +endif() diff --git a/sdl2-config.in b/sdl3-config.in similarity index 94% rename from sdl2-config.in rename to sdl3-config.in index f6eca7668c..46aff2df66 100644 --- a/sdl2-config.in +++ b/sdl3-config.in @@ -46,14 +46,14 @@ while test $# -gt 0; do echo @SDL_VERSION@ ;; --cflags) - echo -I@includedir@/SDL2 @SDL_CFLAGS@ + echo -I@includedir@/SDL3 @SDL_CFLAGS@ ;; @ENABLE_SHARED_TRUE@ --libs) @ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@ @ENABLE_SHARED_TRUE@ ;; @ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs) @ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs) -@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g") +@ENABLE_STATIC_TRUE@ sdl_static_libs=$(echo "@SDL_LIBS@ @SDL_STATIC_LIBS@" | sed -E "s#-lSDL3[ $]#$libdir/libSDL3.a #g") @ENABLE_STATIC_TRUE@ echo -L@libdir@ $sdl_static_libs @ENABLE_STATIC_TRUE@ ;; *) diff --git a/sdl2.m4 b/sdl3.m4 similarity index 73% rename from sdl2.m4 rename to sdl3.m4 index 75b60f6ea9..88d426f135 100644 --- a/sdl2.m4 +++ b/sdl3.m4 @@ -6,18 +6,18 @@ # Shamelessly stolen from Owen Taylor # # Changelog: -# * also look for SDL2.framework under Mac OS X +# * also look for SDL3.framework under Mac OS X # * removed HP/UX 9 support. # * updated for newer autoconf. # serial 2 -dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl AM_PATH_SDL3([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl -AC_DEFUN([AM_PATH_SDL2], +AC_DEFUN([AM_PATH_SDL3], [dnl -dnl Get the cflags and libraries from the sdl2-config script +dnl Get the cflags and libraries from the sdl3-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") @@ -25,53 +25,53 @@ AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) -AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL2.framework], +AC_ARG_ENABLE(sdlframework, [ --disable-sdlframework Do not search for SDL3.framework], , search_sdl_framework=yes) -AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) +AC_ARG_VAR(SDL3_FRAMEWORK, [Path to SDL3.framework]) - min_sdl_version=ifelse([$1], ,2.0.0,$1) + min_sdl_version=ifelse([$1], ,3.0.0,$1) if test "x$sdl_prefix$sdl_exec_prefix" = x ; then - PKG_CHECK_MODULES([SDL], [sdl2 >= $min_sdl_version], + PKG_CHECK_MODULES([SDL], [sdl3 >= $min_sdl_version], [sdl_pc=yes], [sdl_pc=no]) else sdl_pc=no if test x$sdl_exec_prefix != x ; then sdl_config_args="$sdl_config_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_exec_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_exec_prefix/bin/sdl3-config fi fi if test x$sdl_prefix != x ; then sdl_config_args="$sdl_config_args --prefix=$sdl_prefix" - if test x${SDL2_CONFIG+set} != xset ; then - SDL2_CONFIG=$sdl_prefix/bin/sdl2-config + if test x${SDL3_CONFIG+set} != xset ; then + SDL3_CONFIG=$sdl_prefix/bin/sdl3-config fi fi fi if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL3_CONFIG="pkg-config sdl3" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi - AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no, [$PATH]) + AC_PATH_PROG(SDL3_CONFIG, sdl3-config, no, [$PATH]) PATH="$as_save_PATH" no_sdl="" - if test "$SDL2_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then - AC_MSG_CHECKING(for SDL2.framework) - if test "x$SDL2_FRAMEWORK" != x; then - sdl_framework=$SDL2_FRAMEWORK + if test "$SDL3_CONFIG" = "no" -a "x$search_sdl_framework" = "xyes"; then + AC_MSG_CHECKING(for SDL3.framework) + if test "x$SDL3_FRAMEWORK" != x; then + sdl_framework=$SDL3_FRAMEWORK else for d in / ~/ /System/; do - if test -d "${d}Library/Frameworks/SDL2.framework"; then - sdl_framework="${d}Library/Frameworks/SDL2.framework" + if test -d "${d}Library/Frameworks/SDL3.framework"; then + sdl_framework="${d}Library/Frameworks/SDL3.framework" fi done fi @@ -79,25 +79,25 @@ AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) if test x"$sdl_framework" != x && test -d "$sdl_framework"; then AC_MSG_RESULT($sdl_framework) sdl_framework_dir=`dirname $sdl_framework` - SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL2 -I$sdl_framework/include" - SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL2" + SDL_CFLAGS="-F$sdl_framework_dir -Wl,-framework,SDL3 -I$sdl_framework/include" + SDL_LIBS="-F$sdl_framework_dir -Wl,-framework,SDL3" else no_sdl=yes fi fi - if test "$SDL2_CONFIG" != "no"; then + if test "$SDL3_CONFIG" != "no"; then if test "x$sdl_pc" = "xno"; then AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) - SDL_CFLAGS=`$SDL2_CONFIG $sdl_config_args --cflags` - SDL_LIBS=`$SDL2_CONFIG $sdl_config_args --libs` + SDL_CFLAGS=`$SDL3_CONFIG $sdl_config_args --cflags` + SDL_LIBS=`$SDL3_CONFIG $sdl_config_args --libs` fi - sdl_major_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_major_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_minor_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL2_CONFIG $sdl_config_args --version | \ + sdl_micro_version=`$SDL3_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" @@ -108,7 +108,7 @@ AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl2-config to some extent +dnl checks the results of sdl3-config to some extent dnl rm -f conf.sdltest AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -136,11 +136,11 @@ int main (int argc, char *argv[]) } else { - printf("\n*** 'sdl2-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl2-config is correct, then it is\n", major, minor, micro); + printf("\n*** 'sdl3-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl3-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl2-config was wrong, set the environment variable SDL2_CONFIG\n"); - printf("*** to point to the correct copy of sdl2-config, and remove the file\n"); + printf("*** If sdl3-config was wrong, set the environment variable SDL3_CONFIG\n"); + printf("*** to point to the correct copy of sdl3-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } @@ -164,11 +164,11 @@ int main (int argc, char *argv[]) if test "x$no_sdl" = x ; then ifelse([$2], , :, [$2]) else - if test "$SDL2_CONFIG" = "no" ; then - echo "*** The sdl2-config script installed by SDL could not be found" + if test "$SDL3_CONFIG" = "no" ; then + echo "*** The sdl3-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL2_CONFIG environment variable to the" - echo "*** full path to sdl2-config." + echo "*** your path, or set the SDL3_CONFIG environment variable to the" + echo "*** full path to sdl3-config." else if test -f conf.sdltest ; then : @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl2-config script: $SDL2_CONFIG" ]) + echo "*** may want to edit the sdl3-config script: $SDL3_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" diff --git a/sdl2.pc.in b/sdl3.pc.in similarity index 86% rename from sdl2.pc.in rename to sdl3.pc.in index ad1a9574fe..96a480c86f 100644 --- a/sdl2.pc.in +++ b/sdl3.pc.in @@ -5,10 +5,10 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: sdl2 +Name: sdl3 Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. Version: @SDL_VERSION@ Requires: Conflicts: Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@ -Cflags: -I${includedir} -I${includedir}/SDL2 @SDL_CFLAGS@ +Cflags: -I${includedir} -I${includedir}/SDL3 @SDL_CFLAGS@ diff --git a/src/SDL.c b/src/SDL.c index 0e1c32a92c..90bf7a2cb4 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -22,17 +22,9 @@ #if defined(__WIN32__) || defined(__GDK__) #include "core/windows/SDL_windows.h" -#elif defined(__OS2__) -#include /* _exit() */ #elif !defined(__WINRT__) #include /* _exit(), etc. */ #endif -#if defined(__OS2__) -#include "core/os2/SDL_os2.h" -#if SDL_THREAD_OS2 -#include "thread/os2/SDL_systls_c.h" -#endif -#endif /* this checks for HAVE_DBUS_DBUS_H internally. */ #include "core/linux/SDL_dbus.h" @@ -124,17 +116,19 @@ static Uint8 SDL_SubsystemRefCount[ 32 ]; static void SDL_PrivateSubsystemRefCountIncr(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - ++SDL_SubsystemRefCount[subsystem_index]; + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + SDL_assert((subsystem_index < 0) || (SDL_SubsystemRefCount[subsystem_index] < 255)); + if (subsystem_index >= 0) { + ++SDL_SubsystemRefCount[subsystem_index]; + } } /* Private helper to decrement a subsystem's ref counter. */ static void SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (SDL_SubsystemRefCount[subsystem_index] > 0) { + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + if ((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] > 0)) { --SDL_SubsystemRefCount[subsystem_index]; } } @@ -143,23 +137,23 @@ SDL_PrivateSubsystemRefCountDecr(Uint32 subsystem) static SDL_bool SDL_PrivateShouldInitSubsystem(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE; + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + SDL_assert((subsystem_index < 0) || (SDL_SubsystemRefCount[subsystem_index] < 255)); + return ((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] == 0)) ? SDL_TRUE : SDL_FALSE; } /* Private helper to check if a system needs to be quit. */ static SDL_bool SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { - int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); - if (SDL_SubsystemRefCount[subsystem_index] == 0) { - return SDL_FALSE; + const int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + if ((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] == 0)) { + return SDL_FALSE; } /* If we're in SDL_Quit, we shut down every subsystem, even if refcount * isn't zero. */ - return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; + return (((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] == 1)) || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; } void @@ -196,10 +190,6 @@ SDL_InitSubSystem(Uint32 flags) flags |= SDL_INIT_EVENTS; } -#if SDL_THREAD_OS2 - SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */ -#endif - #if SDL_VIDEO_DRIVER_WINDOWS if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) { if (SDL_HelperWindowCreate() < 0) { @@ -357,13 +347,6 @@ SDL_Init(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags) { -#if defined(__OS2__) -#if SDL_THREAD_OS2 - SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */ -#endif - SDL_OS2Quit(); -#endif - /* Shut down requested initialized subsystems */ #if !SDL_SENSOR_DISABLED if ((flags & SDL_INIT_SENSOR)) { @@ -407,6 +390,9 @@ SDL_QuitSubSystem(Uint32 flags) #if !SDL_AUDIO_DISABLED if ((flags & SDL_INIT_AUDIO)) { + /* audio implies events */ + flags |= SDL_INIT_EVENTS; + if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) { SDL_AudioQuit(); } @@ -609,6 +595,8 @@ SDL_GetPlatform(void) return "PlayStation Vita"; #elif __NGAGE__ return "Nokia N-Gage"; +#elif __3DS__ + return "Nintendo 3DS"; #else return "Unknown (see SDL_platform.h)"; #endif diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 93bcc47cab..4341f8d203 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -100,7 +100,7 @@ SDL_bool SDL_ResetHint(const char *name) { const char *env; - SDL_Hint *hint, *prev; + SDL_Hint *hint; SDL_HintWatch *entry; if (!name) { @@ -108,11 +108,11 @@ SDL_ResetHint(const char *name) } env = SDL_getenv(name); - for (prev = NULL, hint = SDL_hints; hint; prev = hint, hint = hint->next) { + for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { if ((env == NULL && hint->value != NULL) || (env != NULL && hint->value == NULL) || - (env && SDL_strcmp(env, hint->value) != 0)) { + (env != NULL && SDL_strcmp(env, hint->value) != 0)) { for (entry = hint->callbacks; entry; ) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -120,19 +120,40 @@ SDL_ResetHint(const char *name) entry = next; } } - if (prev) { - prev->next = hint->next; - } else { - SDL_hints = hint->next; - } SDL_free(hint->value); - SDL_free(hint); + hint->value = NULL; + hint->priority = SDL_HINT_DEFAULT; return SDL_TRUE; } } return SDL_FALSE; } +void +SDL_ResetHints(void) +{ + const char *env; + SDL_Hint *hint; + SDL_HintWatch *entry; + + for (hint = SDL_hints; hint; hint = hint->next) { + env = SDL_getenv(hint->name); + if ((env == NULL && hint->value != NULL) || + (env != NULL && hint->value == NULL) || + (env != NULL && SDL_strcmp(env, hint->value) != 0)) { + for (entry = hint->callbacks; entry; ) { + /* Save the next entry in case this one is deleted */ + SDL_HintWatch *next = entry->next; + entry->callback(entry->userdata, hint->name, hint->value, env); + entry = next; + } + } + SDL_free(hint->value); + hint->value = NULL; + hint->priority = SDL_HINT_DEFAULT; + } +} + SDL_bool SDL_SetHint(const char *name, const char *value) { @@ -148,7 +169,7 @@ SDL_GetHint(const char *name) env = SDL_getenv(name); for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { - if (!env || hint->priority == SDL_HINT_OVERRIDE) { + if (env == NULL || hint->priority == SDL_HINT_OVERRIDE) { return hint->value; } break; diff --git a/src/SDL_internal.h b/src/SDL_internal.h index 43e407f87a..1055151d03 100644 --- a/src/SDL_internal.h +++ b/src/SDL_internal.h @@ -55,7 +55,7 @@ #define O_CLOEXEC 0 #endif -/* A few #defines to reduce SDL2 footprint. +/* A few #defines to reduce SDL footprint. Only effective when library is statically linked. You have to manually edit this file. */ #ifndef SDL_LEAN_AND_MEAN diff --git a/src/SDL_log.c b/src/SDL_log.c index 34c6fe8ae0..9a407fd72c 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -485,13 +485,17 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); fclose (pFile); } +#elif defined(__3DS__) + { + FILE *pFile; + pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a"); + fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); + fclose(pFile); + } #endif #if HAVE_STDIO_H && \ !(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); -#if __NACL__ - fflush(stderr); -#endif #endif } diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 21ba381d7d..a89134e1ae 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -128,6 +128,7 @@ SDL_bool SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) { #ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value)); return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval); #elif defined(HAVE_WATCOM_ATOMICS) return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval); @@ -135,10 +136,8 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval); #elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); -#elif defined(__SOLARIS__) && defined(_LP64) - return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval); -#elif defined(__SOLARIS__) && !defined(_LP64) - return (SDL_bool) ((int) atomic_cas_32((volatile uint32_t*)&a->value, (uint32_t)oldval, (uint32_t)newval) == oldval); +#elif defined(__SOLARIS__) + return (SDL_bool) ((int) atomic_cas_uint((volatile uint_t*)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); #elif EMULATE_CAS SDL_bool retval = SDL_FALSE; @@ -158,9 +157,7 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval) { -#if defined(HAVE_MSC_ATOMICS) && (_M_IX86) - return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval); -#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) +#if defined(HAVE_MSC_ATOMICS) return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval); #elif defined(HAVE_WATCOM_ATOMICS) return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval); @@ -192,15 +189,14 @@ int SDL_AtomicSet(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(long) == sizeof(a->value)); return _InterlockedExchange((long*)&a->value, v); #elif defined(HAVE_WATCOM_ATOMICS) return _SDL_xchg_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(&a->value, v); -#elif defined(__SOLARIS__) && defined(_LP64) - return (int) atomic_swap_64((volatile uint64_t*)&a->value, (uint64_t)v); -#elif defined(__SOLARIS__) && !defined(_LP64) - return (int) atomic_swap_32((volatile uint32_t*)&a->value, (uint32_t)v); +#elif defined(__SOLARIS__) + return (int) atomic_swap_uint((volatile uint_t*)&a->value, v); #else int value; do { @@ -213,9 +209,7 @@ SDL_AtomicSet(SDL_atomic_t *a, int v) void* SDL_AtomicSetPtr(void **a, void *v) { -#if defined(HAVE_MSC_ATOMICS) && (_M_IX86) - return (void *) _InterlockedExchange((long *)a, (long) v); -#elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) +#if defined(HAVE_MSC_ATOMICS) return _InterlockedExchangePointer(a, v); #elif defined(HAVE_WATCOM_ATOMICS) return (void *) _SDL_xchg_watcom((int *)a, (long)v); @@ -236,19 +230,16 @@ int SDL_AtomicAdd(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_add, sizeof(long) == sizeof(a->value)); return _InterlockedExchangeAdd((long*)&a->value, v); #elif defined(HAVE_WATCOM_ATOMICS) return _SDL_xadd_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_fetch_and_add(&a->value, v); #elif defined(__SOLARIS__) - int pv = a->value; - membar_consumer(); -#if defined(_LP64) - atomic_add_64((volatile uint64_t*)&a->value, v); -#elif !defined(_LP64) - atomic_add_32((volatile uint32_t*)&a->value, v); -#endif + int pv = a->value; + membar_consumer(); + atomic_add_int((volatile uint_t*)&a->value, v); return pv; #else int value; @@ -264,6 +255,17 @@ SDL_AtomicGet(SDL_atomic_t *a) { #ifdef HAVE_ATOMIC_LOAD_N return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); +#elif defined(HAVE_MSC_ATOMICS) + SDL_COMPILE_TIME_ASSERT(atomic_get, sizeof(long) == sizeof(a->value)); + return _InterlockedOr((long *)&a->value, 0); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xadd_watcom(&a->value, 0); +#elif defined(HAVE_GCC_ATOMICS) + return __sync_or_and_fetch(&a->value, 0); +#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return sizeof(a->value) == sizeof(uint32_t) ? OSAtomicOr32Barrier(0, (volatile uint32_t *)&a->value) : OSAtomicAdd64Barrier(0, (volatile int64_t *)&a->value); +#elif defined(__SOLARIS__) + return atomic_or_uint((volatile uint_t *)&a->value, 0); #else int value; do { @@ -278,6 +280,12 @@ SDL_AtomicGetPtr(void **a) { #ifdef HAVE_ATOMIC_LOAD_N return __atomic_load_n(a, __ATOMIC_SEQ_CST); +#elif defined(HAVE_MSC_ATOMICS) + return _InterlockedCompareExchangePointer(a, NULL, NULL); +#elif defined(HAVE_GCC_ATOMICS) + return __sync_val_compare_and_swap(a, (void *)0, (void *)0); +#elif defined(__SOLARIS__) + return atomic_cas_ptr(a, (void *)0, (void *)0); #else void *value; do { diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index e2f7412c99..5501ca141c 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -48,45 +48,18 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_NETBSD &NETBSDAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_QSA - &QSAAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_SUNAUDIO - &SUNAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ARTS - &ARTS_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_ESD - &ESD_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_NACL - &NACLAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_NAS - &NAS_bootstrap, -#endif #if SDL_AUDIO_DRIVER_WASAPI &WASAPI_bootstrap, #endif #if SDL_AUDIO_DRIVER_DSOUND &DSOUND_bootstrap, #endif -#if SDL_AUDIO_DRIVER_WINMM - &WINMM_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_PAUDIO - &PAUDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_HAIKU &HAIKUAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_COREAUDIO &COREAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_FUSIONSOUND - &FUSIONSOUND_bootstrap, -#endif #if SDL_AUDIO_DRIVER_AAUDIO &aaudio_bootstrap, #endif @@ -105,6 +78,9 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_VITA &VITAAUD_bootstrap, #endif +#if SDL_AUDIO_DRIVER_N3DS + &N3DSAUDIO_bootstrap, +#endif #if SDL_AUDIO_DRIVER_EMSCRIPTEN &EMSCRIPTENAUDIO_bootstrap, #endif @@ -117,9 +93,6 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OS2 - &OS2AUDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_DISK &DISKAUDIO_bootstrap, #endif @@ -141,6 +114,7 @@ int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data) = NULL; int (*SRC_src_reset)(SRC_STATE *state) = NULL; SRC_STATE* (*SRC_src_delete)(SRC_STATE *state) = NULL; const char* (*SRC_src_strerror)(int error) = NULL; +int (*SRC_src_simple)(SRC_DATA *data, int converter_type, int channels) = NULL; static SDL_bool LoadLibSampleRate(void) @@ -175,8 +149,9 @@ LoadLibSampleRate(void) SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset"); SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete"); SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror"); + SRC_src_simple = (int(*)(SRC_DATA *data, int converter_type, int channels))SDL_LoadFunction(SRC_lib, "src_simple"); - if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) { + if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror || !SRC_src_simple) { SDL_UnloadObject(SRC_lib); SRC_lib = NULL; return SDL_FALSE; @@ -187,6 +162,7 @@ LoadLibSampleRate(void) SRC_src_reset = src_reset; SRC_src_delete = src_delete; SRC_src_strerror = src_strerror; + SRC_src_simple = src_simple; #endif SRC_available = SDL_TRUE; @@ -1313,7 +1289,7 @@ open_audio_device(const char *devname, int iscapture, return 0; } - /* !!! FIXME: there is a race condition here if two devices open from two threads at once. */ + SDL_LockMutex(current_audio.detectionLock); /* Find an available device ID... */ for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) { if (open_devices[id] == NULL) { @@ -1323,6 +1299,7 @@ open_audio_device(const char *devname, int iscapture, if (id == SDL_arraysize(open_devices)) { SDL_SetError("Too many open audio devices"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1330,6 +1307,7 @@ open_audio_device(const char *devname, int iscapture, obtained = &_obtained; } if (!prepare_audiospec(desired, obtained)) { + SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1351,6 +1329,7 @@ open_audio_device(const char *devname, int iscapture, if ((iscapture) && (current_audio.impl.OnlyHasDefaultCaptureDevice)) { if ((devname) && (SDL_strcmp(devname, DEFAULT_INPUT_DEVNAME) != 0)) { SDL_SetError("No such device"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } devname = NULL; @@ -1358,11 +1337,13 @@ open_audio_device(const char *devname, int iscapture, for (i = 0; i < SDL_arraysize(open_devices); i++) { if ((open_devices[i]) && (open_devices[i]->iscapture)) { SDL_SetError("Audio device already open"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } } else if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) { if ((devname) && (SDL_strcmp(devname, DEFAULT_OUTPUT_DEVNAME) != 0)) { + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("No such device"); return 0; } @@ -1370,6 +1351,7 @@ open_audio_device(const char *devname, int iscapture, for (i = 0; i < SDL_arraysize(open_devices); i++) { if ((open_devices[i]) && (!open_devices[i]->iscapture)) { + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Audio device already open"); return 0; } @@ -1382,20 +1364,19 @@ open_audio_device(const char *devname, int iscapture, It might still need to open a device based on the string for, say, a network audio server, but this optimizes some cases. */ SDL_AudioDeviceItem *item; - SDL_LockMutex(current_audio.detectionLock); for (item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; item; item = item->next) { if ((item->handle != NULL) && (SDL_strcmp(item->name, devname) == 0)) { handle = item->handle; break; } } - SDL_UnlockMutex(current_audio.detectionLock); } if (!current_audio.impl.AllowsArbitraryDeviceNames) { /* has to be in our device list, or the default device. */ if ((handle == NULL) && (devname != NULL)) { SDL_SetError("No such device."); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } @@ -1403,6 +1384,7 @@ open_audio_device(const char *devname, int iscapture, device = (SDL_AudioDevice *) SDL_calloc(1, sizeof (SDL_AudioDevice)); if (device == NULL) { SDL_OutOfMemory(); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } device->id = id + 1; @@ -1419,6 +1401,7 @@ open_audio_device(const char *devname, int iscapture, device->mixer_lock = SDL_CreateMutex(); if (device->mixer_lock == NULL) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Couldn't create mixer lock"); return 0; } @@ -1433,6 +1416,7 @@ open_audio_device(const char *devname, int iscapture, if (current_audio.impl.OpenDevice(device, devname) < 0) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1488,6 +1472,7 @@ open_audio_device(const char *devname, int iscapture, if (!device->stream) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } @@ -1497,6 +1482,7 @@ open_audio_device(const char *devname, int iscapture, device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2); if (!device->buffer_queue) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Couldn't create audio buffer queue"); return 0; } @@ -1514,6 +1500,7 @@ open_audio_device(const char *devname, int iscapture, device->work_buffer = (Uint8 *) SDL_malloc(device->work_buffer_len); if (device->work_buffer == NULL) { close_audio_device(device); + SDL_UnlockMutex(current_audio.detectionLock); SDL_OutOfMemory(); return 0; } @@ -1534,9 +1521,11 @@ open_audio_device(const char *devname, int iscapture, if (device->thread == NULL) { close_audio_device(device); SDL_SetError("Couldn't create audio thread"); + SDL_UnlockMutex(current_audio.detectionLock); return 0; } } + SDL_UnlockMutex(current_audio.detectionLock); return device->id; } diff --git a/src/audio/SDL_audio_c.h b/src/audio/SDL_audio_c.h index a516c554a1..a976dfd09e 100644 --- a/src/audio/SDL_audio_c.h +++ b/src/audio/SDL_audio_c.h @@ -45,6 +45,7 @@ extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data); extern int (*SRC_src_reset)(SRC_STATE *state); extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state); extern const char* (*SRC_src_strerror)(int error); +extern int (*SRC_src_simple)(SRC_DATA *data, int converter_type, int channels); #endif /* Functions to get a list of "close" audio formats */ diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index 85faa4b0b7..196013e11e 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -247,7 +247,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate, *(dst++) = outsample; } - outtime += outtimeincr; + outtime = outtimeincr * i; } return outframes * chans * sizeof (float); @@ -403,7 +403,8 @@ SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) cvt->len_mult *= mult; cvt->len_ratio *= mult; } else if (src_bitsize > dst_bitsize) { - cvt->len_ratio /= (src_bitsize / dst_bitsize); + const int div = (src_bitsize / dst_bitsize); + cvt->len_ratio /= div; } retval = 1; /* added a converter. */ } @@ -418,6 +419,48 @@ SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) return retval; } +#ifdef HAVE_LIBSAMPLERATE_H + +static void +SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + const int srclen = cvt->len_cvt; + float *dst = (float *) (cvt->buf + srclen); + const int dstlen = (cvt->len * cvt->len_mult) - srclen; + const int framelen = sizeof(float) * chans; + int result = 0; + SRC_DATA data; + + SDL_zero(data); + + data.data_in = (float *)src; /* Older versions of libsamplerate had a non-const pointer, but didn't write to it */ + data.input_frames = srclen / framelen; + + data.data_out = dst; + data.output_frames = dstlen / framelen; + + data.src_ratio = cvt->rate_incr; + + result = SRC_src_simple(&data, SRC_converter, chans); /* Simple API converts the whole buffer at once. No need for initialization. */ + /* !!! FIXME: Handle library failures? */ + #ifdef DEBUG_CONVERT + if (result != 0) { + SDL_Log("src_simple() failed: %s", SRC_src_strerror(result)); + } + #endif + + cvt->len_cvt = data.output_frames_gen * framelen; + + SDL_memmove(cvt->buf, dst, cvt->len_cvt); + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +#endif /* HAVE_LIBSAMPLERATE_H */ + static void SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format) { @@ -478,9 +521,36 @@ RESAMPLER_FUNCS(6) RESAMPLER_FUNCS(8) #undef RESAMPLER_FUNCS +#ifdef HAVE_LIBSAMPLERATE_H +#define RESAMPLER_FUNCS(chans) \ + static void SDLCALL \ + SDL_ResampleCVT_SRC_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \ + SDL_ResampleCVT_SRC(cvt, chans, format); \ + } +RESAMPLER_FUNCS(1) +RESAMPLER_FUNCS(2) +RESAMPLER_FUNCS(4) +RESAMPLER_FUNCS(6) +RESAMPLER_FUNCS(8) +#undef RESAMPLER_FUNCS +#endif /* HAVE_LIBSAMPLERATE_H */ + static SDL_AudioFilter ChooseCVTResampler(const int dst_channels) { + #ifdef HAVE_LIBSAMPLERATE_H + if (SRC_available) { + switch (dst_channels) { + case 1: return SDL_ResampleCVT_SRC_c1; + case 2: return SDL_ResampleCVT_SRC_c2; + case 4: return SDL_ResampleCVT_SRC_c4; + case 6: return SDL_ResampleCVT_SRC_c6; + case 8: return SDL_ResampleCVT_SRC_c8; + default: break; + } + } + #endif /* HAVE_LIBSAMPLERATE_H */ + switch (dst_channels) { case 1: return SDL_ResampleCVT_c1; case 2: return SDL_ResampleCVT_c2; diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h index 6afaae195c..251ea9e3b6 100644 --- a/src/audio/SDL_sysaudio.h +++ b/src/audio/SDL_sysaudio.h @@ -188,29 +188,21 @@ extern AudioBootStrap JACK_bootstrap; extern AudioBootStrap SNDIO_bootstrap; extern AudioBootStrap NETBSDAUDIO_bootstrap; extern AudioBootStrap DSP_bootstrap; -extern AudioBootStrap QSAAUDIO_bootstrap; -extern AudioBootStrap SUNAUDIO_bootstrap; -extern AudioBootStrap ARTS_bootstrap; -extern AudioBootStrap ESD_bootstrap; -extern AudioBootStrap NACLAUDIO_bootstrap; -extern AudioBootStrap NAS_bootstrap; extern AudioBootStrap WASAPI_bootstrap; extern AudioBootStrap DSOUND_bootstrap; extern AudioBootStrap WINMM_bootstrap; -extern AudioBootStrap PAUDIO_bootstrap; extern AudioBootStrap HAIKUAUDIO_bootstrap; extern AudioBootStrap COREAUDIO_bootstrap; extern AudioBootStrap DISKAUDIO_bootstrap; extern AudioBootStrap DUMMYAUDIO_bootstrap; -extern AudioBootStrap FUSIONSOUND_bootstrap; extern AudioBootStrap aaudio_bootstrap; extern AudioBootStrap openslES_bootstrap; extern AudioBootStrap ANDROIDAUDIO_bootstrap; extern AudioBootStrap PS2AUDIO_bootstrap; extern AudioBootStrap PSPAUDIO_bootstrap; extern AudioBootStrap VITAAUD_bootstrap; +extern AudioBootStrap N3DSAUDIO_bootstrap; extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; -extern AudioBootStrap OS2AUDIO_bootstrap; #endif /* SDL_sysaudio_h_ */ diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c deleted file mode 100644 index ce74b7d4d2..0000000000 --- a/src/audio/arts/SDL_artsaudio.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ARTS - -/* Allow access to a raw mixing buffer */ - -#ifdef HAVE_SIGNAL_H -#include -#endif -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_artsaudio.h" - -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC - -static const char *arts_library = SDL_AUDIO_DRIVER_ARTS_DYNAMIC; -static void *arts_handle = NULL; - -/* !!! FIXME: I hate this SDL_NAME clutter...it makes everything so messy! */ -static int (*SDL_NAME(arts_init)) (void); -static void (*SDL_NAME(arts_free)) (void); -static arts_stream_t(*SDL_NAME(arts_play_stream)) (int rate, int bits, - int channels, - const char *name); -static int (*SDL_NAME(arts_stream_set)) (arts_stream_t s, - arts_parameter_t param, int value); -static int (*SDL_NAME(arts_stream_get)) (arts_stream_t s, - arts_parameter_t param); -static int (*SDL_NAME(arts_write)) (arts_stream_t s, const void *buffer, - int count); -static void (*SDL_NAME(arts_close_stream)) (arts_stream_t s); -static int (*SDL_NAME(arts_suspend))(void); -static int (*SDL_NAME(arts_suspended)) (void); -static const char *(*SDL_NAME(arts_error_text)) (int errorcode); - -#define SDL_ARTS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} arts_functions[] = { -/* *INDENT-OFF* */ - SDL_ARTS_SYM(arts_init), - SDL_ARTS_SYM(arts_free), - SDL_ARTS_SYM(arts_play_stream), - SDL_ARTS_SYM(arts_stream_set), - SDL_ARTS_SYM(arts_stream_get), - SDL_ARTS_SYM(arts_write), - SDL_ARTS_SYM(arts_close_stream), - SDL_ARTS_SYM(arts_suspend), - SDL_ARTS_SYM(arts_suspended), - SDL_ARTS_SYM(arts_error_text), -/* *INDENT-ON* */ -}; - -#undef SDL_ARTS_SYM - -static void -UnloadARTSLibrary() -{ - if (arts_handle != NULL) { - SDL_UnloadObject(arts_handle); - arts_handle = NULL; - } -} - -static int -LoadARTSLibrary(void) -{ - int i, retval = -1; - - if (arts_handle == NULL) { - arts_handle = SDL_LoadObject(arts_library); - if (arts_handle != NULL) { - retval = 0; - for (i = 0; i < SDL_arraysize(arts_functions); ++i) { - *arts_functions[i].func = - SDL_LoadFunction(arts_handle, arts_functions[i].name); - if (!*arts_functions[i].func) { - retval = -1; - UnloadARTSLibrary(); - break; - } - } - } - } - - return retval; -} - -#else - -static void -UnloadARTSLibrary() -{ - return; -} - -static int -LoadARTSLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -ARTS_WaitDevice(_THIS) -{ - Sint32 ticks; - - /* Check to see if the thread-parent process is still alive */ - { - static int cnt = 0; - /* Note that this only works with thread implementations - that use a different process id for each thread. - */ - /* Check every 10 loops */ - if (this->hidden->parent && (((++cnt) % 10) == 0)) { - if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) { - SDL_OpenedAudioDeviceDisconnected(this); - } - } - } - - /* Use timer for general audio synchronization */ - ticks = - ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } -} - -static void -ARTS_PlayDevice(_THIS) -{ - /* Write the audio data */ - int written = SDL_NAME(arts_write) (this->hidden->stream, - this->hidden->mixbuf, - this->hidden->mixlen); - - /* If timer synchronization is enabled, set the next write frame */ - if (this->hidden->frame_ticks) { - this->hidden->next_frame += this->hidden->frame_ticks; - } - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", written); -#endif -} - -static Uint8 * -ARTS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - - -static void -ARTS_CloseDevice(_THIS) -{ - if (this->hidden->stream) { - SDL_NAME(arts_close_stream) (this->hidden->stream); - } - SDL_NAME(arts_free) (); - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -static int -ARTS_Suspend(void) -{ - const Uint32 abortms = SDL_GetTicks() + 3000; /* give up after 3 secs */ - while ( (!SDL_NAME(arts_suspended)()) && !SDL_TICKS_PASSED(SDL_GetTicks(), abortms) ) { - if ( SDL_NAME(arts_suspend)() ) { - break; - } - } - return SDL_NAME(arts_suspended)(); -} - -static int -ARTS_OpenDevice(_THIS, const char *devname) -{ - int rc = 0; - int bits, frag_spec = 0; - SDL_AudioFormat test_format = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: - case AUDIO_S16LSB: - break; - default: - continue; - } - break; - } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "arts"); - } - this->spec.format = test_format; - bits = SDL_AUDIO_BITSIZE(test_format); - - if ((rc = SDL_NAME(arts_init) ()) != 0) { - return SDL_SetError("Unable to initialize ARTS: %s", - SDL_NAME(arts_error_text) (rc)); - } - - if (!ARTS_Suspend()) { - return SDL_SetError("ARTS can not open audio device"); - } - - this->hidden->stream = SDL_NAME(arts_play_stream) (this->spec.freq, - bits, - this->spec.channels, - "SDL"); - - /* Play nothing so we have at least one write (server bug workaround). */ - SDL_NAME(arts_write) (this->hidden->stream, "", 0); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Determine the power of two of the fragment size */ - for (frag_spec = 0; (0x01 << frag_spec) < this->spec.size; ++frag_spec); - if ((0x01 << frag_spec) != this->spec.size) { - return SDL_SetError("Fragment size must be a power of two"); - } - frag_spec |= 0x00020000; /* two fragments, for low latency */ - -#ifdef ARTS_P_PACKET_SETTINGS - SDL_NAME(arts_stream_set) (this->hidden->stream, - ARTS_P_PACKET_SETTINGS, frag_spec); -#else - SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_SIZE, - frag_spec & 0xffff); - SDL_NAME(arts_stream_set) (this->hidden->stream, ARTS_P_PACKET_COUNT, - frag_spec >> 16); -#endif - this->spec.size = SDL_NAME(arts_stream_get) (this->hidden->stream, - ARTS_P_PACKET_SIZE); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* Get the parent process id (we're the parent of the audio thread) */ - this->hidden->parent = getpid(); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static void -ARTS_Deinitialize(void) -{ - UnloadARTSLibrary(); -} - - -static SDL_bool -ARTS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadARTSLibrary() < 0) { - return SDL_FALSE; - } else { - if (SDL_NAME(arts_init) () != 0) { - UnloadARTSLibrary(); - SDL_SetError("ARTS: arts_init failed (no audio server?)"); - return SDL_FALSE; - } - - /* Play a stream so aRts doesn't crash */ - if (ARTS_Suspend()) { - arts_stream_t stream; - stream = SDL_NAME(arts_play_stream) (44100, 16, 2, "SDL"); - SDL_NAME(arts_write) (stream, "", 0); - SDL_NAME(arts_close_stream) (stream); - } - - SDL_NAME(arts_free) (); - } - - /* Set the function pointers */ - impl->OpenDevice = ARTS_OpenDevice; - impl->PlayDevice = ARTS_PlayDevice; - impl->WaitDevice = ARTS_WaitDevice; - impl->GetDeviceBuf = ARTS_GetDeviceBuf; - impl->CloseDevice = ARTS_CloseDevice; - impl->Deinitialize = ARTS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap ARTS_bootstrap = { - "arts", "Analog RealTime Synthesizer", ARTS_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_ARTS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/arts/SDL_artsaudio.h b/src/audio/arts/SDL_artsaudio.h deleted file mode 100644 index 0f6e1693c0..0000000000 --- a/src/audio/arts/SDL_artsaudio.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_artsaudio_h_ -#define SDL_artsaudio_h_ - -#include - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The stream descriptor for the audio device */ - arts_stream_t stream; - - /* The parent process id, to detect when application quits */ - pid_t parent; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - - /* Support for audio timing using a timer, in addition to SDL_IOReady() */ - float frame_ticks; - float next_frame; -}; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* SDL_artsaudio_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h index b426ea4045..9353046a4a 100644 --- a/src/audio/coreaudio/SDL_coreaudio.h +++ b/src/audio/coreaudio/SDL_coreaudio.h @@ -39,6 +39,14 @@ #include #include +/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ +#if MACOSX_COREAUDIO +#include +#ifndef MAC_OS_VERSION_12_0 +#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster +#endif +#endif + /* Hidden "this" pointer for the audio functions */ #define _THIS SDL_AudioDevice *this diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 1a6871904d..d223359122 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -53,7 +53,7 @@ static const AudioObjectPropertyAddress devlist_address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; typedef void (*addDevFn)(const char *name, SDL_AudioSpec *spec, const int iscapture, AudioDeviceID devId, void *data); @@ -131,17 +131,17 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata) const AudioObjectPropertyAddress addr = { kAudioDevicePropertyStreamConfiguration, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; const AudioObjectPropertyAddress nameaddr = { kAudioObjectPropertyName, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; const AudioObjectPropertyAddress freqaddr = { kAudioDevicePropertyNominalSampleRate, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); @@ -642,7 +642,7 @@ static const AudioObjectPropertyAddress alive_address = { kAudioDevicePropertyDeviceIsAlive, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; static OSStatus @@ -701,6 +701,19 @@ COREAUDIO_CloseDevice(_THIS) } #endif + /* if callback fires again, feed silence; don't call into the app. */ + SDL_AtomicSet(&this->paused, 1); + + /* dispose of the audio queue before waiting on the thread, or it might stall for a long time! */ + if (this->hidden->audioQueue) { + AudioQueueDispose(this->hidden->audioQueue, 0); + } + + if (this->hidden->thread) { + SDL_assert(SDL_AtomicGet(&this->shutdown) != 0); /* should have been set by SDL_audio.c */ + SDL_WaitThread(this->hidden->thread, NULL); + } + if (iscapture) { open_capture_devices--; } else { @@ -725,18 +738,6 @@ COREAUDIO_CloseDevice(_THIS) open_devices = NULL; } - /* if callback fires again, feed silence; don't call into the app. */ - SDL_AtomicSet(&this->paused, 1); - - if (this->hidden->audioQueue) { - AudioQueueDispose(this->hidden->audioQueue, 1); - } - - if (this->hidden->thread) { - SDL_assert(SDL_AtomicGet(&this->shutdown) != 0); /* should have been set by SDL_audio.c */ - SDL_WaitThread(this->hidden->thread, NULL); - } - if (this->hidden->ready_semaphore) { SDL_DestroySemaphore(this->hidden->ready_semaphore); } @@ -763,7 +764,7 @@ prepare_device(_THIS) AudioObjectPropertyAddress addr = { 0, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; if (handle == NULL) { @@ -810,7 +811,7 @@ assign_device_to_audioqueue(_THIS) const AudioObjectPropertyAddress prop = { kAudioDevicePropertyDeviceUID, this->iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; OSStatus result; @@ -959,7 +960,7 @@ audioqueue_thread(void *arg) const AudioObjectPropertyAddress default_device_address = { this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; if (this->handle == NULL) { /* opened the default device? Register to know if the user picks a new default. */ @@ -1177,30 +1178,31 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) char *devname; int usable; double sampleRate; + CFIndex len; AudioObjectPropertyAddress addr = { iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; AudioObjectPropertyAddress nameaddr = { kAudioObjectPropertyName, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; AudioObjectPropertyAddress freqaddr = { kAudioDevicePropertyNominalSampleRate, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; AudioObjectPropertyAddress bufaddr = { kAudioDevicePropertyStreamConfiguration, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster + kAudioObjectPropertyElementMain }; /* Get the Device ID */ @@ -1222,7 +1224,7 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) return SDL_SetError("%s: Default Device Name not found", "coreaudio"); } - CFIndex len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), kCFStringEncodingUTF8); devname = (char *) SDL_malloc(len + 1); usable = ((devname != NULL) && diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 531612a298..8734f79606 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -34,13 +34,7 @@ #include #include -#if SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H -/* This is installed on some systems */ -#include -#else -/* This is recommended by OSS */ #include -#endif #include "SDL_timer.h" #include "SDL_audio.h" diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index bfe42821a4..8a07f6c7fd 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/src/audio/emscripten/SDL_emscriptenaudio.c @@ -38,10 +38,10 @@ FeedAudioDevice(_THIS, const void *buf, const int buflen) { const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; - var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; + var SDL3 = Module['SDL3']; + var numChannels = SDL3.audio.currentOutputBuffer['numberOfChannels']; for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); + var channelData = SDL3.audio.currentOutputBuffer['getChannelData'](c); if (channelData.length != $1) { throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } @@ -107,10 +107,10 @@ HandleCaptureProcess(_THIS) } MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; - var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; + var SDL3 = Module['SDL3']; + var numChannels = SDL3.capture.currentCaptureBuffer.numberOfChannels; for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); + var channelData = SDL3.capture.currentCaptureBuffer.getChannelData(c); if (channelData.length != $1) { throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } @@ -153,45 +153,45 @@ static void EMSCRIPTENAUDIO_CloseDevice(_THIS) { MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; + var SDL3 = Module['SDL3']; if ($0) { - if (SDL2.capture.silenceTimer !== undefined) { - clearTimeout(SDL2.capture.silenceTimer); + if (SDL3.capture.silenceTimer !== undefined) { + clearTimeout(SDL3.capture.silenceTimer); } - if (SDL2.capture.stream !== undefined) { - var tracks = SDL2.capture.stream.getAudioTracks(); + if (SDL3.capture.stream !== undefined) { + var tracks = SDL3.capture.stream.getAudioTracks(); for (var i = 0; i < tracks.length; i++) { - SDL2.capture.stream.removeTrack(tracks[i]); + SDL3.capture.stream.removeTrack(tracks[i]); } - SDL2.capture.stream = undefined; + SDL3.capture.stream = undefined; } - if (SDL2.capture.scriptProcessorNode !== undefined) { - SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; - SDL2.capture.scriptProcessorNode.disconnect(); - SDL2.capture.scriptProcessorNode = undefined; + if (SDL3.capture.scriptProcessorNode !== undefined) { + SDL3.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; + SDL3.capture.scriptProcessorNode.disconnect(); + SDL3.capture.scriptProcessorNode = undefined; } - if (SDL2.capture.mediaStreamNode !== undefined) { - SDL2.capture.mediaStreamNode.disconnect(); - SDL2.capture.mediaStreamNode = undefined; + if (SDL3.capture.mediaStreamNode !== undefined) { + SDL3.capture.mediaStreamNode.disconnect(); + SDL3.capture.mediaStreamNode = undefined; } - if (SDL2.capture.silenceBuffer !== undefined) { - SDL2.capture.silenceBuffer = undefined + if (SDL3.capture.silenceBuffer !== undefined) { + SDL3.capture.silenceBuffer = undefined } - SDL2.capture = undefined; + SDL3.capture = undefined; } else { - if (SDL2.audio.scriptProcessorNode != undefined) { - SDL2.audio.scriptProcessorNode.disconnect(); - SDL2.audio.scriptProcessorNode = undefined; + if (SDL3.audio.scriptProcessorNode != undefined) { + SDL3.audio.scriptProcessorNode.disconnect(); + SDL3.audio.scriptProcessorNode = undefined; } - SDL2.audio = undefined; + SDL3.audio = undefined; } - if ((SDL2.audioContext !== undefined) && (SDL2.audio === undefined) && (SDL2.capture === undefined)) { - SDL2.audioContext.close(); - SDL2.audioContext = undefined; + if ((SDL3.audioContext !== undefined) && (SDL3.audio === undefined) && (SDL3.capture === undefined)) { + SDL3.audioContext.close(); + SDL3.audioContext = undefined; } }, this->iscapture); -#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL3 namespace? --ryan. */ SDL_free(this->hidden); #endif } @@ -207,27 +207,27 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) /* create context */ result = MAIN_THREAD_EM_ASM_INT({ - if(typeof(Module['SDL2']) === 'undefined') { - Module['SDL2'] = {}; + if(typeof(Module['SDL3']) === 'undefined') { + Module['SDL3'] = {}; } - var SDL2 = Module['SDL2']; + var SDL3 = Module['SDL3']; if (!$0) { - SDL2.audio = {}; + SDL3.audio = {}; } else { - SDL2.capture = {}; + SDL3.capture = {}; } - if (!SDL2.audioContext) { + if (!SDL3.audioContext) { if (typeof(AudioContext) !== 'undefined') { - SDL2.audioContext = new AudioContext(); + SDL3.audioContext = new AudioContext(); } else if (typeof(webkitAudioContext) !== 'undefined') { - SDL2.audioContext = new webkitAudioContext(); + SDL3.audioContext = new webkitAudioContext(); } - if (SDL2.audioContext) { - autoResumeAudioContext(SDL2.audioContext); + if (SDL3.audioContext) { + autoResumeAudioContext(SDL3.audioContext); } } - return SDL2.audioContext === undefined ? -1 : 0; + return SDL3.audioContext === undefined ? -1 : 0; }, iscapture); if (result < 0) { return SDL_SetError("Web Audio API is not available!"); @@ -250,7 +250,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) this->spec.format = test_format; /* Initialize all variables that we clean on shutdown */ -#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL3 namespace? --ryan. */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { @@ -262,8 +262,8 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) /* limit to native freq */ this->spec.freq = EM_ASM_INT_V({ - var SDL2 = Module['SDL2']; - return SDL2.audioContext.sampleRate; + var SDL3 = Module['SDL3']; + return SDL3.audioContext.sampleRate; }); SDL_CalculateAudioSpec(&this->spec); @@ -286,24 +286,24 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) to be honest. */ MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; + var SDL3 = Module['SDL3']; var have_microphone = function(stream) { //console.log('SDL audio capture: we have a microphone! Replacing silence callback.'); - if (SDL2.capture.silenceTimer !== undefined) { - clearTimeout(SDL2.capture.silenceTimer); - SDL2.capture.silenceTimer = undefined; + if (SDL3.capture.silenceTimer !== undefined) { + clearTimeout(SDL3.capture.silenceTimer); + SDL3.capture.silenceTimer = undefined; } - SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream); - SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1); - SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) { - if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; } + SDL3.capture.mediaStreamNode = SDL3.audioContext.createMediaStreamSource(stream); + SDL3.capture.scriptProcessorNode = SDL3.audioContext.createScriptProcessor($1, $0, 1); + SDL3.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) { + if ((SDL3 === undefined) || (SDL3.capture === undefined)) { return; } audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0); - SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; + SDL3.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; dynCall('vi', $2, [$3]); }; - SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode); - SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination); - SDL2.capture.stream = stream; + SDL3.capture.mediaStreamNode.connect(SDL3.capture.scriptProcessorNode); + SDL3.capture.scriptProcessorNode.connect(SDL3.audioContext.destination); + SDL3.capture.stream = stream; }; var no_microphone = function(error) { @@ -311,14 +311,14 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) }; /* we write silence to the audio callback until the microphone is available (user approves use, etc). */ - SDL2.capture.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); - SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0); + SDL3.capture.silenceBuffer = SDL3.audioContext.createBuffer($0, $1, SDL3.audioContext.sampleRate); + SDL3.capture.silenceBuffer.getChannelData(0).fill(0.0); var silence_callback = function() { - SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer; + SDL3.capture.currentCaptureBuffer = SDL3.capture.silenceBuffer; dynCall('vi', $2, [$3]); }; - SDL2.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); + SDL3.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL3.audioContext.sampleRate) * 1000); if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) { navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone); @@ -329,14 +329,14 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) } else { /* setup a ScriptProcessorNode */ MAIN_THREAD_EM_ASM({ - var SDL2 = Module['SDL2']; - SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); - SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { - if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; } - SDL2.audio.currentOutputBuffer = e['outputBuffer']; + var SDL3 = Module['SDL3']; + SDL3.audio.scriptProcessorNode = SDL3.audioContext['createScriptProcessor']($1, 0, $0); + SDL3.audio.scriptProcessorNode['onaudioprocess'] = function (e) { + if ((SDL3 === undefined) || (SDL3.audio === undefined)) { return; } + SDL3.audio.currentOutputBuffer = e['outputBuffer']; dynCall('vi', $2, [$3]); }; - SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); + SDL3.audio.scriptProcessorNode['connect'](SDL3.audioContext['destination']); }, this->spec.channels, this->spec.samples, HandleAudioProcess, this); } diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c deleted file mode 100644 index ccf07916c7..0000000000 --- a/src/audio/esd/SDL_esdaudio.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_ESD - -/* Allow access to an ESD network stream mixing buffer */ - -#include -#include -#include -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_esdaudio.h" - -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#ifdef SDL_AUDIO_DRIVER_ESD_DYNAMIC - -static const char *esd_library = SDL_AUDIO_DRIVER_ESD_DYNAMIC; -static void *esd_handle = NULL; - -static int (*SDL_NAME(esd_open_sound)) (const char *host); -static int (*SDL_NAME(esd_close)) (int esd); -static int (*SDL_NAME(esd_play_stream)) (esd_format_t format, int rate, - const char *host, const char *name); - -#define SDL_ESD_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} const esd_functions[] = { - SDL_ESD_SYM(esd_open_sound), - SDL_ESD_SYM(esd_close), SDL_ESD_SYM(esd_play_stream), -}; - -#undef SDL_ESD_SYM - -static void -UnloadESDLibrary() -{ - if (esd_handle != NULL) { - SDL_UnloadObject(esd_handle); - esd_handle = NULL; - } -} - -static int -LoadESDLibrary(void) -{ - int i, retval = -1; - - if (esd_handle == NULL) { - esd_handle = SDL_LoadObject(esd_library); - if (esd_handle) { - retval = 0; - for (i = 0; i < SDL_arraysize(esd_functions); ++i) { - *esd_functions[i].func = - SDL_LoadFunction(esd_handle, esd_functions[i].name); - if (!*esd_functions[i].func) { - retval = -1; - UnloadESDLibrary(); - break; - } - } - } - } - return retval; -} - -#else - -static void -UnloadESDLibrary() -{ - return; -} - -static int -LoadESDLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_ESD_DYNAMIC */ - - -/* This function waits until it is possible to write a full sound buffer */ -static void -ESD_WaitDevice(_THIS) -{ - Sint32 ticks; - - /* Check to see if the thread-parent process is still alive */ - { - static int cnt = 0; - /* Note that this only works with thread implementations - that use a different process id for each thread. - */ - /* Check every 10 loops */ - if (this->hidden->parent && (((++cnt) % 10) == 0)) { - if (kill(this->hidden->parent, 0) < 0 && errno == ESRCH) { - SDL_OpenedAudioDeviceDisconnected(this); - } - } - } - - /* Use timer for general audio synchronization */ - ticks = ((Sint32) (this->hidden->next_frame - SDL_GetTicks())) - FUDGE_TICKS; - if (ticks > 0) { - SDL_Delay(ticks); - } -} - -static void -ESD_PlayDevice(_THIS) -{ - int written = 0; - - /* Write the audio data, checking for EAGAIN on broken audio drivers */ - do { - written = write(this->hidden->audio_fd, - this->hidden->mixbuf, this->hidden->mixlen); - if ((written < 0) && ((errno == 0) || (errno == EAGAIN))) { - SDL_Delay(1); /* Let a little CPU time go by */ - } - } while ((written < 0) && - ((errno == 0) || (errno == EAGAIN) || (errno == EINTR))); - - /* Set the next write frame */ - this->hidden->next_frame += this->hidden->frame_ticks; - - /* If we couldn't write, assume fatal error for now */ - if (written < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - } -} - -static Uint8 * -ESD_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static void -ESD_CloseDevice(_THIS) -{ - if (this->hidden->audio_fd >= 0) { - SDL_NAME(esd_close) (this->hidden->audio_fd); - } - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -/* Try to get the name of the program */ -static char * -get_progname(void) -{ - char *progname = NULL; -#ifdef __LINUX__ - FILE *fp; - static char temp[BUFSIZ]; - - SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid()); - fp = fopen(temp, "r"); - if (fp != NULL) { - if (fgets(temp, sizeof(temp) - 1, fp)) { - progname = SDL_strrchr(temp, '/'); - if (progname == NULL) { - progname = temp; - } else { - progname = progname + 1; - } - } - fclose(fp); - } -#endif - return (progname); -} - - -static int -ESD_OpenDevice(_THIS, const char *devname) -{ - esd_format_t format = (ESD_STREAM | ESD_PLAY); - SDL_AudioFormat test_format = 0; - int found = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - this->hidden->audio_fd = -1; - - /* Convert audio spec to the ESD audio format */ - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); - !found && test_format; test_format = SDL_NextAudioFormat()) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - found = 1; - switch (test_format) { - case AUDIO_U8: - format |= ESD_BITS8; - break; - case AUDIO_S16SYS: - format |= ESD_BITS16; - break; - default: - found = 0; - break; - } - } - - if (!found) { - return SDL_SetError("Couldn't find any hardware audio formats"); - } - - if (this->spec.channels == 1) { - format |= ESD_MONO; - } else { - format |= ESD_STEREO; - } -#if 0 - this->spec.samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */ -#endif - - /* Open a connection to the ESD audio server */ - this->hidden->audio_fd = - SDL_NAME(esd_play_stream) (format, this->spec.freq, NULL, - get_progname()); - - if (this->hidden->audio_fd < 0) { - return SDL_SetError("Couldn't open ESD connection"); - } - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - this->hidden->frame_ticks = - (float) (this->spec.samples * 1000) / this->spec.freq; - this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks; - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* Get the parent process id (we're the parent of the audio thread) */ - this->hidden->parent = getpid(); - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -ESD_Deinitialize(void) -{ - UnloadESDLibrary(); -} - -static SDL_bool -ESD_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadESDLibrary() < 0) { - return SDL_FALSE; - } else { - int connection = 0; - - /* Don't start ESD if it's not running */ - SDL_setenv("ESD_NO_SPAWN", "1", 0); - - connection = SDL_NAME(esd_open_sound) (NULL); - if (connection < 0) { - UnloadESDLibrary(); - SDL_SetError("ESD: esd_open_sound failed (no audio server?)"); - return SDL_FALSE; - } - SDL_NAME(esd_close) (connection); - } - - /* Set the function pointers */ - impl->OpenDevice = ESD_OpenDevice; - impl->PlayDevice = ESD_PlayDevice; - impl->WaitDevice = ESD_WaitDevice; - impl->GetDeviceBuf = ESD_GetDeviceBuf; - impl->CloseDevice = ESD_CloseDevice; - impl->Deinitialize = ESD_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap ESD_bootstrap = { - "esd", "Enlightened Sound Daemon", ESD_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_ESD */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/esd/SDL_esdaudio.h b/src/audio/esd/SDL_esdaudio.h deleted file mode 100644 index 90b780059d..0000000000 --- a/src/audio/esd/SDL_esdaudio.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_esdaudio_h_ -#define SDL_esdaudio_h_ - -#include "../SDL_sysaudio.h" - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -struct SDL_PrivateAudioData -{ - /* The file descriptor for the audio device */ - int audio_fd; - - /* The parent process id, to detect when application quits */ - pid_t parent; - - /* Raw mixing buffer */ - Uint8 *mixbuf; - int mixlen; - - /* Support for audio timing using a timer */ - float frame_ticks; - float next_frame; -}; -#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ - -#endif /* SDL_esdaudio_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c deleted file mode 100644 index fbe684de85..0000000000 --- a/src/audio/fusionsound/SDL_fsaudio.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_FUSIONSOUND - -/* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */ - -/* Allow access to a raw mixing buffer */ - -#ifdef HAVE_SIGNAL_H -#include -#endif -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "SDL_fsaudio.h" - -#include - -/* #define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" */ - -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC -#include "SDL_name.h" -#include "SDL_loadso.h" -#else -#define SDL_NAME(X) X -#endif - -#if (FUSIONSOUND_MAJOR_VERSION == 1) && (FUSIONSOUND_MINOR_VERSION < 1) -typedef DFBResult DirectResult; -#endif - -/* Buffers to use - more than 2 gives a lot of latency */ -#define FUSION_BUFFERS (2) - -#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC - -static const char *fs_library = SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC; -static void *fs_handle = NULL; - -static DirectResult (*SDL_NAME(FusionSoundInit)) (int *argc, char *(*argv[])); -static DirectResult (*SDL_NAME(FusionSoundCreate)) (IFusionSound ** - ret_interface); - -#define SDL_FS_SYM(x) { #x, (void **) (char *) &SDL_NAME(x) } -static struct -{ - const char *name; - void **func; -} fs_functions[] = { -/* *INDENT-OFF* */ - SDL_FS_SYM(FusionSoundInit), - SDL_FS_SYM(FusionSoundCreate), -/* *INDENT-ON* */ -}; - -#undef SDL_FS_SYM - -static void -UnloadFusionSoundLibrary() -{ - if (fs_handle != NULL) { - SDL_UnloadObject(fs_handle); - fs_handle = NULL; - } -} - -static int -LoadFusionSoundLibrary(void) -{ - int i, retval = -1; - - if (fs_handle == NULL) { - fs_handle = SDL_LoadObject(fs_library); - if (fs_handle != NULL) { - retval = 0; - for (i = 0; i < SDL_arraysize(fs_functions); ++i) { - *fs_functions[i].func = - SDL_LoadFunction(fs_handle, fs_functions[i].name); - if (!*fs_functions[i].func) { - retval = -1; - UnloadFusionSoundLibrary(); - break; - } - } - } - } - - return retval; -} - -#else - -static void -UnloadFusionSoundLibrary() -{ - return; -} - -static int -LoadFusionSoundLibrary(void) -{ - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -SDL_FS_WaitDevice(_THIS) -{ - this->hidden->stream->Wait(this->hidden->stream, - this->hidden->mixsamples); -} - -static void -SDL_FS_PlayDevice(_THIS) -{ - DirectResult ret; - - ret = this->hidden->stream->Write(this->hidden->stream, - this->hidden->mixbuf, - this->hidden->mixsamples); - /* If we couldn't write, assume fatal error for now */ - if (ret) { - SDL_OpenedAudioDeviceDisconnected(this); - } -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); -#endif -} - - -static Uint8 * -SDL_FS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - - -static void -SDL_FS_CloseDevice(_THIS) -{ - if (this->hidden->stream) { - this->hidden->stream->Release(this->hidden->stream); - } - if (this->hidden->fs) { - this->hidden->fs->Release(this->hidden->fs); - } - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - - -static int -SDL_FS_OpenDevice(_THIS, const char *devname) -{ - int bytes; - SDL_AudioFormat test_format; - FSSampleFormat fs_format; - FSStreamDescription desc; - DirectResult ret; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { -#ifdef DEBUG_AUDIO - fprintf(stderr, "Trying format 0x%4.4x\n", test_format); -#endif - switch (test_format) { - case AUDIO_U8: - fs_format = FSSF_U8; - break; - case AUDIO_S16SYS: - fs_format = FSSF_S16; - break; - case AUDIO_S32SYS: - fs_format = FSSF_S32; - break; - case AUDIO_F32SYS: - fs_format = FSSF_FLOAT; - break; - default: - continue; - } - break; - } - - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "fusionsound"); - } - this->spec.format = test_format; - bytes = SDL_AUDIO_BITSIZE(test_format) / 8; - - /* Retrieve the main sound interface. */ - ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs); - if (ret) { - return SDL_SetError("Unable to initialize FusionSound: %d", ret); - } - - this->hidden->mixsamples = this->spec.size / bytes / this->spec.channels; - - /* Fill stream description. */ - desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE | - FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT | FSSDF_PREBUFFER; - desc.samplerate = this->spec.freq; - desc.buffersize = this->spec.size * FUSION_BUFFERS; - desc.channels = this->spec.channels; - desc.prebuffer = 10; - desc.sampleformat = fs_format; - - ret = - this->hidden->fs->CreateStream(this->hidden->fs, &desc, - &this->hidden->stream); - if (ret) { - return SDL_SetError("Unable to create FusionSoundStream: %d", ret); - } - - /* See what we got */ - desc.flags = FSSDF_SAMPLERATE | FSSDF_BUFFERSIZE | - FSSDF_CHANNELS | FSSDF_SAMPLEFORMAT; - ret = this->hidden->stream->GetDescription(this->hidden->stream, &desc); - - this->spec.freq = desc.samplerate; - this->spec.size = - desc.buffersize / FUSION_BUFFERS * bytes * desc.channels; - this->spec.channels = desc.channels; - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - /* Allocate mixing buffer */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - - /* We're ready to rock and roll. :-) */ - return 0; -} - - -static void -SDL_FS_Deinitialize(void) -{ - UnloadFusionSoundLibrary(); -} - - -static SDL_bool -SDL_FS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadFusionSoundLibrary() < 0) { - return SDL_FALSE; - } else { - DirectResult ret; - - ret = SDL_NAME(FusionSoundInit) (NULL, NULL); - if (ret) { - UnloadFusionSoundLibrary(); - SDL_SetError - ("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)", - ret); - return SDL_FALSE; - } - } - - /* Set the function pointers */ - impl->OpenDevice = SDL_FS_OpenDevice; - impl->PlayDevice = SDL_FS_PlayDevice; - impl->WaitDevice = SDL_FS_WaitDevice; - impl->GetDeviceBuf = SDL_FS_GetDeviceBuf; - impl->CloseDevice = SDL_FS_CloseDevice; - impl->Deinitialize = SDL_FS_Deinitialize; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - - -AudioBootStrap FUSIONSOUND_bootstrap = { - "fusionsound", "FusionSound", SDL_FS_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/n3ds/SDL_n3dsaudio.c b/src/audio/n3ds/SDL_n3dsaudio.c new file mode 100644 index 0000000000..484bec8ae9 --- /dev/null +++ b/src/audio/n3ds/SDL_n3dsaudio.c @@ -0,0 +1,363 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2022 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_AUDIO_DRIVER_N3DS + +#include "SDL_audio.h" + +/* N3DS Audio driver */ + +#include "../SDL_sysaudio.h" +#include "SDL_n3dsaudio.h" +#include "SDL_timer.h" + +#define N3DSAUDIO_DRIVER_NAME "n3ds" + +static dspHookCookie dsp_hook; +static SDL_AudioDevice *audio_device; + +static void FreePrivateData(_THIS); +static int FindAudioFormat(_THIS); + +static SDL_INLINE void +contextLock(_THIS) +{ + LightLock_Lock(&this->hidden->lock); +} + +static SDL_INLINE void +contextUnlock(_THIS) +{ + LightLock_Unlock(&this->hidden->lock); +} + +static void +N3DSAUD_LockAudio(_THIS) +{ + contextLock(this); +} + +static void +N3DSAUD_UnlockAudio(_THIS) +{ + contextUnlock(this); +} + +static void +N3DSAUD_DspHook(DSP_HookType hook) +{ + if (hook == DSPHOOK_ONCANCEL) { + contextLock(audio_device); + audio_device->hidden->isCancelled = SDL_TRUE; + SDL_AtomicSet(&audio_device->enabled, SDL_FALSE); + CondVar_Broadcast(&audio_device->hidden->cv); + contextUnlock(audio_device); + } +} + +static void +AudioFrameFinished(void *device) +{ + bool shouldBroadcast = false; + unsigned i; + SDL_AudioDevice *this = (SDL_AudioDevice *) device; + + contextLock(this); + + for (i = 0; i < NUM_BUFFERS; i++) { + if (this->hidden->waveBuf[i].status == NDSP_WBUF_DONE) { + this->hidden->waveBuf[i].status = NDSP_WBUF_FREE; + shouldBroadcast = SDL_TRUE; + } + } + + if (shouldBroadcast) { + CondVar_Broadcast(&this->hidden->cv); + } + + contextUnlock(this); +} + +static int +N3DSAUDIO_OpenDevice(_THIS, const char *devname) +{ + Result ndsp_init_res; + Uint8 *data_vaddr; + float mix[12]; + this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof *this->hidden); + + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + + /* Initialise the DSP service */ + ndsp_init_res = ndspInit(); + if (R_FAILED(ndsp_init_res)) { + if ((R_SUMMARY(ndsp_init_res) == RS_NOTFOUND) && (R_MODULE(ndsp_init_res) == RM_DSP)) { + SDL_SetError("DSP init failed: dspfirm.cdc missing!"); + } else { + SDL_SetError("DSP init failed. Error code: 0x%lX", ndsp_init_res); + } + return -1; + } + + /* Initialise internal state */ + LightLock_Init(&this->hidden->lock); + CondVar_Init(&this->hidden->cv); + + if (this->spec.channels > 2) { + this->spec.channels = 2; + } + + /* Should not happen but better be safe. */ + if (FindAudioFormat(this) < 0) { + return SDL_SetError("No supported audio format found."); + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + /* Allocate mixing buffer */ + if (this->spec.size >= SDL_MAX_UINT32 / 2) { + return SDL_SetError("Mixing buffer is too large."); + } + + this->hidden->mixlen = this->spec.size; + this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size); + if (this->hidden->mixbuf == NULL) { + return SDL_OutOfMemory(); + } + + SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); + + data_vaddr = (Uint8 *) linearAlloc(this->hidden->mixlen * NUM_BUFFERS); + if (data_vaddr == NULL) { + return SDL_OutOfMemory(); + } + + SDL_memset(data_vaddr, 0, this->hidden->mixlen * NUM_BUFFERS); + DSP_FlushDataCache(data_vaddr, this->hidden->mixlen * NUM_BUFFERS); + + this->hidden->nextbuf = 0; + this->hidden->channels = this->spec.channels; + this->hidden->samplerate = this->spec.freq; + + ndspChnReset(0); + + ndspChnSetInterp(0, NDSP_INTERP_LINEAR); + ndspChnSetRate(0, this->spec.freq); + ndspChnSetFormat(0, this->hidden->format); + + SDL_memset(mix, 0, sizeof(mix)); + mix[0] = 1.0; + mix[1] = 1.0; + ndspChnSetMix(0, mix); + + SDL_memset(this->hidden->waveBuf, 0, sizeof(ndspWaveBuf) * NUM_BUFFERS); + + for (unsigned i = 0; i < NUM_BUFFERS; i++) { + this->hidden->waveBuf[i].data_vaddr = data_vaddr; + this->hidden->waveBuf[i].nsamples = this->hidden->mixlen / this->hidden->bytePerSample; + data_vaddr += this->hidden->mixlen; + } + + /* Setup callback */ + audio_device = this; + ndspSetCallback(AudioFrameFinished, this); + dspHook(&dsp_hook, N3DSAUD_DspHook); + + return 0; +} + +static int +N3DSAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + /* Delay to make this sort of simulate real audio input. */ + SDL_Delay((this->spec.samples * 1000) / this->spec.freq); + + /* always return a full buffer of silence. */ + SDL_memset(buffer, this->spec.silence, buflen); + return buflen; +} + +static void +N3DSAUDIO_PlayDevice(_THIS) +{ + size_t nextbuf; + size_t sampleLen; + contextLock(this); + + nextbuf = this->hidden->nextbuf; + sampleLen = this->hidden->mixlen; + + if (this->hidden->isCancelled || + this->hidden->waveBuf[nextbuf].status != NDSP_WBUF_FREE) { + contextUnlock(this); + return; + } + + this->hidden->nextbuf = (nextbuf + 1) % NUM_BUFFERS; + + contextUnlock(this); + + memcpy((void *) this->hidden->waveBuf[nextbuf].data_vaddr, + this->hidden->mixbuf, sampleLen); + DSP_FlushDataCache(this->hidden->waveBuf[nextbuf].data_vaddr, sampleLen); + + ndspChnWaveBufAdd(0, &this->hidden->waveBuf[nextbuf]); +} + +static void +N3DSAUDIO_WaitDevice(_THIS) +{ + contextLock(this); + while (!this->hidden->isCancelled && + this->hidden->waveBuf[this->hidden->nextbuf].status != NDSP_WBUF_FREE) { + CondVar_Wait(&this->hidden->cv, &this->hidden->lock); + } + contextUnlock(this); +} + +static Uint8 * +N3DSAUDIO_GetDeviceBuf(_THIS) +{ + return this->hidden->mixbuf; +} + +static void +N3DSAUDIO_CloseDevice(_THIS) +{ + contextLock(this); + + dspUnhook(&dsp_hook); + ndspSetCallback(NULL, NULL); + + if (!this->hidden->isCancelled) { + ndspChnReset(0); + memset(this->hidden->waveBuf, 0, sizeof(ndspWaveBuf) * NUM_BUFFERS); + CondVar_Broadcast(&this->hidden->cv); + } + + contextUnlock(this); + + ndspExit(); + + FreePrivateData(this); +} + +static void +N3DSAUDIO_ThreadInit(_THIS) +{ + s32 current_priority; + svcGetThreadPriority(¤t_priority, CUR_THREAD_HANDLE); + current_priority--; + /* 0x18 is reserved for video, 0x30 is the default for main thread */ + current_priority = SDL_clamp(current_priority, 0x19, 0x2F); + svcSetThreadPriority(CUR_THREAD_HANDLE, current_priority); +} + +static SDL_bool +N3DSAUDIO_Init(SDL_AudioDriverImpl *impl) +{ + /* Set the function pointers */ + impl->OpenDevice = N3DSAUDIO_OpenDevice; + impl->PlayDevice = N3DSAUDIO_PlayDevice; + impl->WaitDevice = N3DSAUDIO_WaitDevice; + impl->GetDeviceBuf = N3DSAUDIO_GetDeviceBuf; + impl->CloseDevice = N3DSAUDIO_CloseDevice; + impl->ThreadInit = N3DSAUDIO_ThreadInit; + impl->LockDevice = N3DSAUD_LockAudio; + impl->UnlockDevice = N3DSAUD_UnlockAudio; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + + /* Should be possible, but micInit would fail */ + impl->HasCaptureSupport = SDL_FALSE; + impl->CaptureFromDevice = N3DSAUDIO_CaptureFromDevice; + + return SDL_TRUE; /* this audio target is available. */ +} + +AudioBootStrap N3DSAUDIO_bootstrap = { + N3DSAUDIO_DRIVER_NAME, + "SDL N3DS audio driver", + N3DSAUDIO_Init, + 0 +}; + +/** + * Cleans up all allocated memory, safe to call with null pointers + */ +static void +FreePrivateData(_THIS) +{ + if (!this->hidden) { + return; + } + + if (this->hidden->waveBuf[0].data_vaddr) { + linearFree((void *) this->hidden->waveBuf[0].data_vaddr); + } + + if (this->hidden->mixbuf) { + SDL_free(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } + + SDL_free(this->hidden); + this->hidden = NULL; +} + +static int +FindAudioFormat(_THIS) +{ + SDL_bool found_valid_format = SDL_FALSE; + Uint16 test_format = SDL_FirstAudioFormat(this->spec.format); + + while (!found_valid_format && test_format) { + this->spec.format = test_format; + switch (test_format) { + case AUDIO_S8: + /* Signed 8-bit audio supported */ + this->hidden->format = (this->spec.channels == 2) ? NDSP_FORMAT_STEREO_PCM8 : NDSP_FORMAT_MONO_PCM8; + this->hidden->isSigned = 1; + this->hidden->bytePerSample = this->spec.channels; + found_valid_format = SDL_TRUE; + break; + case AUDIO_S16: + /* Signed 16-bit audio supported */ + this->hidden->format = (this->spec.channels == 2) ? NDSP_FORMAT_STEREO_PCM16 : NDSP_FORMAT_MONO_PCM16; + this->hidden->isSigned = 1; + this->hidden->bytePerSample = this->spec.channels * 2; + found_valid_format = SDL_TRUE; + break; + default: + test_format = SDL_NextAudioFormat(); + break; + } + } + + return found_valid_format ? 0 : -1; +} + +#endif /* SDL_AUDIO_DRIVER_N3DS */ + +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/audio/fusionsound/SDL_fsaudio.h b/src/audio/n3ds/SDL_n3dsaudio.h similarity index 67% rename from src/audio/fusionsound/SDL_fsaudio.h rename to src/audio/n3ds/SDL_n3dsaudio.h index 2e7a59bcff..d01f17f539 100644 --- a/src/audio/fusionsound/SDL_fsaudio.h +++ b/src/audio/n3ds/SDL_n3dsaudio.h @@ -18,33 +18,33 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "../../SDL_internal.h" -#ifndef SDL_fsaudio_h_ -#define SDL_fsaudio_h_ +#ifndef _SDL_n3dsaudio_h_ +#define _SDL_n3dsaudio_h_ -#include - -#include "../SDL_sysaudio.h" +#include <3ds.h> /* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this +#define _THIS SDL_AudioDevice *this + +#define NUM_BUFFERS 2 /* -- Don't lower this! */ struct SDL_PrivateAudioData { - /* Interface */ - IFusionSound *fs; - - /* The stream interface for the audio device */ - IFusionSoundStream *stream; - - /* Raw mixing buffer */ + /* Speaker data */ Uint8 *mixbuf; - int mixlen; - int mixsamples; - + Uint32 mixlen; + Uint32 format; + Uint32 samplerate; + Uint32 channels; + Uint8 bytePerSample; + Uint32 isSigned; + Uint32 nextbuf; + ndspWaveBuf waveBuf[NUM_BUFFERS]; + LightLock lock; + CondVar cv; + SDL_bool isCancelled; }; -#endif /* SDL_fsaudio_h_ */ - -/* vi: set ts=4 sw=4 expandtab: */ +#endif /* _SDL_n3dsaudio_h_ */ +/* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/src/audio/nacl/SDL_naclaudio.c b/src/audio/nacl/SDL_naclaudio.c deleted file mode 100644 index c38070d8d8..0000000000 --- a/src/audio/nacl/SDL_naclaudio.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_NACL - -#include "SDL_naclaudio.h" - -#include "SDL_audio.h" -#include "SDL_mutex.h" -#include "../SDL_audio_c.h" -#include "../SDL_audiodev_c.h" - -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi_simple/ps.h" -#include "ppapi_simple/ps_interface.h" -#include "ppapi_simple/ps_event.h" - -/* The tag name used by NACL audio */ -#define NACLAUDIO_DRIVER_NAME "nacl" - -#define SAMPLE_FRAME_COUNT 4096 - -/* Audio driver functions */ -static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data); - -/* FIXME: Make use of latency if needed */ -static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) { - const int len = (int) buffer_size; - SDL_AudioDevice* _this = (SDL_AudioDevice*) data; - SDL_AudioCallback callback = _this->callbackspec.callback; - - SDL_LockMutex(_this->mixer_lock); - - /* Only do something if audio is enabled */ - if (!SDL_AtomicGet(&_this->enabled) || SDL_AtomicGet(&_this->paused)) { - if (_this->stream) { - SDL_AudioStreamClear(_this->stream); - } - SDL_memset(stream, _this->spec.silence, len); - } else { - SDL_assert(_this->spec.size == len); - - if (_this->stream == NULL) { /* no conversion necessary. */ - callback(_this->callbackspec.userdata, stream, len); - } else { /* streaming/converting */ - const int stream_len = _this->callbackspec.size; - while (SDL_AudioStreamAvailable(_this->stream) < len) { - callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); - if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { - SDL_AudioStreamClear(_this->stream); - SDL_AtomicSet(&_this->enabled, 0); - break; - } - } - - const int got = SDL_AudioStreamGet(_this->stream, stream, len); - SDL_assert((got < 0) || (got == len)); - if (got != len) { - SDL_memset(stream, _this->spec.silence, len); - } - } - } - - SDL_UnlockMutex(_this->mixer_lock); -} - -static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) { - const PPB_Core *core = PSInterfaceCore(); - const PPB_Audio *ppb_audio = PSInterfaceAudio(); - SDL_PrivateAudioData *hidden = (SDL_PrivateAudioData *) device->hidden; - - ppb_audio->StopPlayback(hidden->audio); - core->ReleaseResource(hidden->audio); -} - -static int -NACLAUDIO_OpenDevice(_THIS, const char *devname) { - PP_Instance instance = PSGetInstanceId(); - const PPB_Audio *ppb_audio = PSInterfaceAudio(); - const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig(); - - private = (SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *private)); - if (private == NULL) { - return SDL_OutOfMemory(); - } - - _this->spec.freq = 44100; - _this->spec.format = AUDIO_S16LSB; - _this->spec.channels = 2; - _this->spec.samples = ppb_audiocfg->RecommendSampleFrameCount( - instance, - PP_AUDIOSAMPLERATE_44100, - SAMPLE_FRAME_COUNT); - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&_this->spec); - - private->audio = ppb_audio->Create( - instance, - ppb_audiocfg->CreateStereo16Bit(instance, PP_AUDIOSAMPLERATE_44100, _this->spec.samples), - nacl_audio_callback, - _this); - - /* Start audio playback while we are still on the main thread. */ - ppb_audio->StartPlayback(private->audio); - - return 0; -} - -static SDL_bool -NACLAUDIO_Init(SDL_AudioDriverImpl * impl) -{ - if (PSGetInstanceId() == 0) { - return SDL_FALSE; - } - - /* Set the function pointers */ - impl->OpenDevice = NACLAUDIO_OpenDevice; - impl->CloseDevice = NACLAUDIO_CloseDevice; - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->ProvidesOwnCallbackThread = SDL_TRUE; - /* - * impl->WaitDevice = NACLAUDIO_WaitDevice; - * impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf; - * impl->PlayDevice = NACLAUDIO_PlayDevice; - * impl->Deinitialize = NACLAUDIO_Deinitialize; - */ - - return SDL_TRUE; -} - -AudioBootStrap NACLAUDIO_bootstrap = { - NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver", - NACLAUDIO_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_NACL */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/nas/SDL_nasaudio.c b/src/audio/nas/SDL_nasaudio.c deleted file mode 100644 index d6d8632329..0000000000 --- a/src/audio/nas/SDL_nasaudio.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_NAS - -/* Allow access to a raw mixing buffer */ - -#include -#include - -#include "SDL_timer.h" -#include "SDL_audio.h" -#include "SDL_loadso.h" -#include "../SDL_audio_c.h" -#include "SDL_nasaudio.h" - -static void (*NAS_AuCloseServer) (AuServer *); -static void (*NAS_AuNextEvent) (AuServer *, AuBool, AuEvent *); -static AuBool(*NAS_AuDispatchEvent) (AuServer *, AuEvent *); -static void (*NAS_AuHandleEvents) (AuServer *); -static AuFlowID(*NAS_AuCreateFlow) (AuServer *, AuStatus *); -static void (*NAS_AuStartFlow) (AuServer *, AuFlowID, AuStatus *); -static void (*NAS_AuSetElements) - (AuServer *, AuFlowID, AuBool, int, AuElement *, AuStatus *); -static void (*NAS_AuWriteElement) - (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuBool, AuStatus *); -static AuUint32 (*NAS_AuReadElement) - (AuServer *, AuFlowID, int, AuUint32, AuPointer, AuStatus *); -static AuServer *(*NAS_AuOpenServer) - (_AuConst char *, int, _AuConst char *, int, _AuConst char *, char **); -static AuEventHandlerRec *(*NAS_AuRegisterEventHandler) - (AuServer *, AuMask, int, AuID, AuEventHandlerCallback, AuPointer); - - -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC - -static const char *nas_library = SDL_AUDIO_DRIVER_NAS_DYNAMIC; -static void *nas_handle = NULL; - -static int -load_nas_sym(const char *fn, void **addr) -{ - *addr = SDL_LoadFunction(nas_handle, fn); - if (*addr == NULL) { - return 0; - } - return 1; -} - -/* cast funcs to char* first, to please GCC's strict aliasing rules. */ -#define SDL_NAS_SYM(x) \ - if (!load_nas_sym(#x, (void **) (char *) &NAS_##x)) return -1 -#else -#define SDL_NAS_SYM(x) NAS_##x = x -#endif - -static int -load_nas_syms(void) -{ - SDL_NAS_SYM(AuCloseServer); - SDL_NAS_SYM(AuNextEvent); - SDL_NAS_SYM(AuDispatchEvent); - SDL_NAS_SYM(AuHandleEvents); - SDL_NAS_SYM(AuCreateFlow); - SDL_NAS_SYM(AuStartFlow); - SDL_NAS_SYM(AuSetElements); - SDL_NAS_SYM(AuWriteElement); - SDL_NAS_SYM(AuReadElement); - SDL_NAS_SYM(AuOpenServer); - SDL_NAS_SYM(AuRegisterEventHandler); - return 0; -} - -#undef SDL_NAS_SYM - -#ifdef SDL_AUDIO_DRIVER_NAS_DYNAMIC - -static void -UnloadNASLibrary(void) -{ - if (nas_handle != NULL) { - SDL_UnloadObject(nas_handle); - nas_handle = NULL; - } -} - -static int -LoadNASLibrary(void) -{ - int retval = 0; - if (nas_handle == NULL) { - nas_handle = SDL_LoadObject(nas_library); - if (nas_handle == NULL) { - /* Copy error string so we can use it in a new SDL_SetError(). */ - const char *origerr = SDL_GetError(); - const size_t len = SDL_strlen(origerr) + 1; - char *err = SDL_stack_alloc(char, len); - SDL_strlcpy(err, origerr, len); - SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s", nas_library, err); - SDL_stack_free(err); - retval = -1; - } else { - retval = load_nas_syms(); - if (retval < 0) { - UnloadNASLibrary(); - } - } - } - return retval; -} - -#else - -static void -UnloadNASLibrary(void) -{ -} - -static int -LoadNASLibrary(void) -{ - load_nas_syms(); - return 0; -} - -#endif /* SDL_AUDIO_DRIVER_NAS_DYNAMIC */ - -/* This function waits until it is possible to write a full sound buffer */ -static void -NAS_WaitDevice(_THIS) -{ - while (this->hidden->buf_free < this->hidden->mixlen) { - AuEvent ev; - NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev); - NAS_AuDispatchEvent(this->hidden->aud, &ev); - } -} - -static void -NAS_PlayDevice(_THIS) -{ - while (this->hidden->mixlen > this->hidden->buf_free) { - /* - * We think the buffer is full? Yikes! Ask the server for events, - * in the hope that some of them is LowWater events telling us more - * of the buffer is free now than what we think. - */ - AuEvent ev; - NAS_AuNextEvent(this->hidden->aud, AuTrue, &ev); - NAS_AuDispatchEvent(this->hidden->aud, &ev); - } - this->hidden->buf_free -= this->hidden->mixlen; - - /* Write the audio data */ - NAS_AuWriteElement(this->hidden->aud, this->hidden->flow, 0, - this->hidden->mixlen, this->hidden->mixbuf, AuFalse, - NULL); - - this->hidden->written += this->hidden->mixlen; - -#ifdef DEBUG_AUDIO - fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); -#endif -} - -static Uint8 * -NAS_GetDeviceBuf(_THIS) -{ - return (this->hidden->mixbuf); -} - -static int -NAS_CaptureFromDevice(_THIS, void *buffer, int buflen) -{ - struct SDL_PrivateAudioData *h = this->hidden; - int retval; - - while (SDL_TRUE) { - /* just keep the event queue moving and the server chattering. */ - NAS_AuHandleEvents(h->aud); - - retval = (int) NAS_AuReadElement(h->aud, h->flow, 1, buflen, buffer, NULL); - /*printf("read %d capture bytes\n", (int) retval);*/ - if (retval == 0) { - SDL_Delay(10); /* don't burn the CPU if we're waiting for data. */ - } else { - break; - } - } - - return retval; -} - -static void -NAS_FlushCapture(_THIS) -{ - struct SDL_PrivateAudioData *h = this->hidden; - AuUint32 total = 0; - AuUint32 br; - Uint8 buf[512]; - - do { - /* just keep the event queue moving and the server chattering. */ - NAS_AuHandleEvents(h->aud); - br = NAS_AuReadElement(h->aud, h->flow, 1, sizeof (buf), buf, NULL); - /*printf("flushed %d capture bytes\n", (int) br);*/ - total += br; - } while ((br == sizeof (buf)) && (total < this->spec.size)); -} - -static void -NAS_CloseDevice(_THIS) -{ - if (this->hidden->aud) { - NAS_AuCloseServer(this->hidden->aud); - } - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -static AuBool -event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) hnd->data; - struct SDL_PrivateAudioData *h = this->hidden; - if (this->iscapture) { - return AuTrue; /* we don't (currently) care about any of this for capture devices */ - } - - switch (ev->type) { - case AuEventTypeElementNotify: - { - AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev; - - switch (event->kind) { - case AuElementNotifyKindLowWater: - if (h->buf_free >= 0) { - h->really += event->num_bytes; - gettimeofday(&h->last_tv, 0); - h->buf_free += event->num_bytes; - } else { - h->buf_free = event->num_bytes; - } - break; - case AuElementNotifyKindState: - switch (event->cur_state) { - case AuStatePause: - if (event->reason != AuReasonUser) { - if (h->buf_free >= 0) { - h->really += event->num_bytes; - gettimeofday(&h->last_tv, 0); - h->buf_free += event->num_bytes; - } else { - h->buf_free = event->num_bytes; - } - } - break; - } - } - } - } - return AuTrue; -} - -static AuDeviceID -find_device(_THIS) -{ - /* These "Au" things are all macros, not functions... */ - struct SDL_PrivateAudioData *h = this->hidden; - const unsigned int devicekind = this->iscapture ? AuComponentKindPhysicalInput : AuComponentKindPhysicalOutput; - const int numdevs = AuServerNumDevices(h->aud); - const int nch = this->spec.channels; - int i; - - /* Try to find exact match on channels first... */ - for (i = 0; i < numdevs; i++) { - const AuDeviceAttributes *dev = AuServerDevice(h->aud, i); - if ((AuDeviceKind(dev) == devicekind) && (AuDeviceNumTracks(dev) == nch)) { - return AuDeviceIdentifier(dev); - } - } - - /* Take anything, then... */ - for (i = 0; i < numdevs; i++) { - const AuDeviceAttributes *dev = AuServerDevice(h->aud, i); - if (AuDeviceKind(dev) == devicekind) { - this->spec.channels = AuDeviceNumTracks(dev); - return AuDeviceIdentifier(dev); - } - } - return AuNone; -} - -static int -NAS_OpenDevice(_THIS, const char *devname) -{ - AuElement elms[3]; - int buffer_size; - SDL_bool iscapture = this->iscapture; - SDL_AudioFormat test_format, format = 0; - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - /* Try for a closest match on audio format */ - for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) { - switch (test_format) { - case AUDIO_U8: - format = AuFormatLinearUnsigned8; - break; - case AUDIO_S8: - format = AuFormatLinearSigned8; - break; - case AUDIO_U16LSB: - format = AuFormatLinearUnsigned16LSB; - break; - case AUDIO_U16MSB: - format = AuFormatLinearUnsigned16MSB; - break; - case AUDIO_S16LSB: - format = AuFormatLinearSigned16LSB; - break; - case AUDIO_S16MSB: - format = AuFormatLinearSigned16MSB; - break; - default: - continue; - } - break; - } - if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "nas"); - } - this->spec.format = test_format; - - this->hidden->aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); - if (this->hidden->aud == 0) { - return SDL_SetError("NAS: Couldn't open connection to NAS server"); - } - - this->hidden->dev = find_device(this); - if ((this->hidden->dev == AuNone) - || (!(this->hidden->flow = NAS_AuCreateFlow(this->hidden->aud, 0)))) { - return SDL_SetError("NAS: Couldn't find a fitting device on NAS server"); - } - - buffer_size = this->spec.freq; - if (buffer_size < 4096) - buffer_size = 4096; - - if (buffer_size > 32768) - buffer_size = 32768; /* So that the buffer won't get unmanageably big. */ - - /* Calculate the final parameters for this audio specification */ - SDL_CalculateAudioSpec(&this->spec); - - if (iscapture) { - AuMakeElementImportDevice(elms, this->spec.freq, this->hidden->dev, - AuUnlimitedSamples, 0, NULL); - AuMakeElementExportClient(elms + 1, 0, this->spec.freq, format, - this->spec.channels, AuTrue, buffer_size, - buffer_size, 0, NULL); - } else { - AuMakeElementImportClient(elms, this->spec.freq, format, - this->spec.channels, AuTrue, buffer_size, - buffer_size / 4, 0, NULL); - AuMakeElementExportDevice(elms + 1, 0, this->hidden->dev, this->spec.freq, - AuUnlimitedSamples, 0, NULL); - } - - NAS_AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, - 2, elms, NULL); - - NAS_AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, - this->hidden->flow, event_handler, - (AuPointer) this); - - NAS_AuStartFlow(this->hidden->aud, this->hidden->flow, NULL); - - /* Allocate mixing buffer */ - if (!iscapture) { - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); - } - - /* We're ready to rock and roll. :-) */ - return 0; -} - -static void -NAS_Deinitialize(void) -{ - UnloadNASLibrary(); -} - -static SDL_bool -NAS_Init(SDL_AudioDriverImpl * impl) -{ - if (LoadNASLibrary() < 0) { - return SDL_FALSE; - } else { - AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); - if (aud == NULL) { - SDL_SetError("NAS: AuOpenServer() failed (no audio server?)"); - return SDL_FALSE; - } - NAS_AuCloseServer(aud); - } - - /* Set the function pointers */ - impl->OpenDevice = NAS_OpenDevice; - impl->PlayDevice = NAS_PlayDevice; - impl->WaitDevice = NAS_WaitDevice; - impl->GetDeviceBuf = NAS_GetDeviceBuf; - impl->CaptureFromDevice = NAS_CaptureFromDevice; - impl->FlushCapture = NAS_FlushCapture; - impl->CloseDevice = NAS_CloseDevice; - impl->Deinitialize = NAS_Deinitialize; - - impl->OnlyHasDefaultOutputDevice = SDL_TRUE; - impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; - impl->HasCaptureSupport = SDL_TRUE; - - return SDL_TRUE; /* this audio target is available. */ -} - -AudioBootStrap NAS_bootstrap = { - "nas", "Network Audio System", NAS_Init, SDL_FALSE -}; - -#endif /* SDL_AUDIO_DRIVER_NAS */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/nas/SDL_nasaudio.h b/src/audio/nas/SDL_nasaudio.h deleted file mode 100644 index 7c9506d917..0000000000 --- a/src/audio/nas/SDL_nasaudio.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2022 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef SDL_nasaudio_h_ -#define SDL_nasaudio_h_ - -#ifdef __sgi -#include -#else -#include