Skip to content

Commit

Permalink
feat: update libsdl2 to 2.30.11+dfsg
Browse files Browse the repository at this point in the history
Signed-off-by: lhdjply <[email protected]>
  • Loading branch information
lhdjply authored and Zeno-sole committed Jan 20, 2025
1 parent 68c4caa commit d11cea7
Show file tree
Hide file tree
Showing 1,194 changed files with 18,651 additions and 3,034 deletions.
90 changes: 90 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
AlignConsecutiveMacros: Consecutive
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true

AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false

AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine

# Custom brace breaking
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeElse: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true

# Make the closing brace of container literals go to a new line
Cpp11BracedListStyle: false

# Never format includes
IncludeBlocks: Preserve
# clang-format version 4.0 through 12.0:
#SortIncludes: false
# clang-format version 13.0+:
#SortIncludes: Never

# No length limit, in case it breaks macros, you can
# disable it with /* clang-format off/on */ comments
ColumnLimit: 0

IndentWidth: 4
ContinuationIndentWidth: 4
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: NoIndent

PointerAlignment: Right
SpaceAfterCStyleCast: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false

UseCRLF: false
UseTab: Never

ForEachMacros:
[
"spa_list_for_each",
"spa_list_for_each_safe",
"wl_list_for_each",
"wl_array_for_each",
"udev_list_entry_foreach",
]

---

79 changes: 79 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# For format see editorconfig.org
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: Zlib

root = true

[*.{c,cg,cpp,gradle,h,java,m,metal,pl,py,S,sh,txt}]
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{html,js,json,m4,yml,yaml,vcxproj,vcxproj.filters}]
indent_size = 2
indent_style = space

[*.xml]
indent_size = 4
indent_style = space

[{CMakeLists.txt,sdl2-config*.cmake.in,cmake/*.cmake}]
indent_size = 2
indent_style = space

[{cmake_uninstall.cmake.in,test/CMakeLists.txt}]
indent_size = 4
indent_style = space

[configure.ac]
# Inconsistently 2-, 4- or occasionally 3-space indented, but mostly 4,
# so let's use 4 for new code
indent_size = 4
indent_style = space

[{Makefile.*,*.mk,*.sln,*.pbxproj,*.plist}]
indent_size = 8
indent_style = tab
tab_width = 8

[Makefile.os2]
indent_size = 4
indent_style = space

[test/Makefile.os2]
indent_size = 2
indent_style = space

[{src/core/os2/geniconv/makefile,src/core/os2/geniconv/os2cp.c}]
indent_size = 2
indent_style = space

[src/joystick/controller_type.*]
indent_style = tab

[src/joystick/hidapi/steam/*.h]
indent_style = tab

[src/libm/*.c]
indent_style = tab

[src/test/SDL_test_{crc32,md5,random}.c]
indent_size = 2
indent_style = space

[src/video/yuv2rgb/*.{c,h}]
indent_style = tab

[wayland-protocols/*.xml]
indent_size = 2
indent_style = space

[*.{markdown,md}]
indent_size = 4
indent_style = space
# Markdown syntax treats tabs as 4 spaces
tab_width = 4

[{*.bat,*.rc}]
end_of_line = crlf
1 change: 1 addition & 0 deletions .git-hash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fa24d868ac2f8fd558e4e914c9863411245db8fd
17 changes: 17 additions & 0 deletions .wikiheaders-options
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
projectfullname = SDL2
projectshortname = SDL2
incsubdir = include
wikisubdir = SDL2
readmesubdir = docs
apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_)
mainincludefname = SDL.h
versionfname = include/SDL_version.h
versionmajorregex = \A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z
versionminorregex = \A\#define\s+SDL_MINOR_VERSION\s+(\d+)\Z
versionpatchregex = \A\#define\s+SDL_PATCHLEVEL\s+(\d+)\Z
selectheaderregex = \ASDL.*?\.h\Z
projecturl = https://libsdl.org/
wikiurl = https://wiki.libsdl.org/SDL2
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0
wikipreamble = (This is the legacy documentation for stable SDL2, the current stable version; [SDL3](https://wiki.libsdl.org/SDL3/) is the current development version.)
75 changes: 36 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ endif()
# MSVC runtime library flags are selected by an abstraction.
set(CMAKE_POLICY_DEFAULT_CMP0091 NEW)

cmake_minimum_required(VERSION 3.0.0...3.5)
cmake_minimum_required(VERSION 3.0.0...3.10)
project(SDL2 C CXX)

if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
Expand Down Expand Up @@ -33,8 +33,8 @@ set(PKGCONFIG_DEPENDS)
add_library(sdl-build-options INTERFACE)

if(WINDOWS_STORE)
target_compile_definitions(sdl-build-options INTERFACE "-DSDL_BUILDING_WINRT=1")
target_compile_options(sdl-build-options INTERFACE "-ZW")
target_compile_definitions(sdl-build-options INTERFACE "-DSDL_BUILDING_WINRT=1" "WINAPI_FAMILY=WINAPI_FAMILY_APP")
target_compile_options(sdl-build-options INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:-ZW>" "$<$<COMPILE_LANGUAGE:CXX>:-EHsc>")
endif()

# CMake 3.0 expands the "if(${A})" in "set(OFF 1);set(A OFF);if(${A})" to "if(1)"
Expand Down Expand Up @@ -87,7 +87,7 @@ endif()
# See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 30)
set(SDL_MICRO_VERSION 0)
set(SDL_MICRO_VERSION 11)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")

# Set defaults preventing destination file conflicts
Expand Down Expand Up @@ -241,7 +241,7 @@ endif()
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()
if(WINDOWS OR IOS OR TVOS)
if(WINDOWS OR DARWIN OR MACOSX OR IOS OR TVOS)
set(SDL_SYSTEM_ICONV_DEFAULT OFF)
else()
set(SDL_SYSTEM_ICONV_DEFAULT ON)
Expand Down Expand Up @@ -409,7 +409,7 @@ dep_option(SDL_SSE "Use SSE assembly routines" ON "SDL_ASSEMBLY;
dep_option(SDL_SSE2 "Use SSE2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_SSE3 "Use SSE3 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" OFF "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY" OFF)
dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
dep_option(SDL_ARMNEON "Use NEON assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
Expand Down Expand Up @@ -926,22 +926,6 @@ if(SDL_ASSEMBLY)
endif()
endif()

if(SDL_LASX)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "-mlasx")
check_c_source_compiles("
#ifndef __loongarch_asx
#error Assembler CPP flag not enabled
#endif
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_LASX)
check_include_file("lasxintrin.h" HAVE_LASXINTRIN_H)
cmake_pop_check_state()
if(CPU_SUPPORTS_LASX AND HAVE_LASXINTRIN_H)
list(APPEND EXTRA_CFLAGS "-mlasx")
set(HAVE_LASX TRUE)
endif()
endif()

if(SDL_ARMSIMD)
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
Expand Down Expand Up @@ -1107,6 +1091,8 @@ if(SDL_LIBC)
check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL)
check_symbol_exists(elf_aux_info "sys/auxv.h" HAVE_ELF_AUX_INFO)
check_symbol_exists(poll "poll.h" HAVE_POLL)
check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE)
check_symbol_exists(posix_fallocate "fcntl.h" HAVE_POSIX_FALLOCATE)

check_library_exists(m pow "" HAVE_LIBM)
if(HAVE_LIBM)
Expand Down Expand Up @@ -1688,7 +1674,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
if(FREEBSD OR NETBSD OR OPENBSD OR BSDI)
CheckUSBHID()
endif()
if(LINUX AND HAVE_LINUX_INPUT_H AND NOT ANDROID)
if((LINUX OR FREEBSD) 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)
list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES})
Expand Down Expand Up @@ -1791,14 +1777,6 @@ elseif(WINDOWS)
list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES})
endif()

if(MSVC AND NOT SDL_LIBC)
# Prevent codegen that would use the VC runtime libraries.
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-;/Gs1048576")
if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE")
endif()
endif()

if(SDL_MISC)
if(WINDOWS_STORE)
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp)
Expand All @@ -1824,13 +1802,11 @@ elseif(WINDOWS)
check_include_file(d3d9.h HAVE_D3D_H)
check_include_file(d3d11_1.h HAVE_D3D11_H)
check_c_source_compiles("
#include <winsdkver.h>
#include <sdkddkver.h>
#include <d3d12.h>
#include <d3d12sdklayers.h>
ID3D12Device1 *device;
#if WDK_NTDDI_VERSION > 0x0A000008
int main(int argc, char **argv) { return 0; }
#endif" HAVE_D3D12_H)
int main(int argc, char **argv) {return 0; }
" HAVE_D3D12_H)
check_include_file(ddraw.h HAVE_DDRAW_H)
check_include_file(dsound.h HAVE_DSOUND_H)
check_include_file(dinput.h HAVE_DINPUT_H)
Expand Down Expand Up @@ -2689,6 +2665,11 @@ elseif(PSP)
list(APPEND SOURCE_FILES ${PSP_THREAD_SOURCES})
set(HAVE_SDL_THREADS TRUE)
endif()
if(SDL_LOCALE)
file(GLOB PSP_LOCALE_SOURCES ${SDL2_SOURCE_DIR}/src/locale/psp/*.c)
list(APPEND SOURCE_FILES ${PSP_LOCALE_SOURCES})
set(HAVE_SDL_LOCALE TRUE)
endif()
if(SDL_TIMERS)
set(SDL_TIMER_PSP 1)
file(GLOB PSP_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/psp/*.c)
Expand Down Expand Up @@ -2721,7 +2702,6 @@ elseif(PSP)
endif()

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)
set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PS2_MAIN_SOURCES})
Expand Down Expand Up @@ -3077,8 +3057,8 @@ endif()

# Compat helpers for the configuration files

if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION.txt")
file(READ "${PROJECT_SOURCE_DIR}/VERSION.txt" SDL_SOURCE_VERSION)
if(EXISTS "${PROJECT_SOURCE_DIR}/REVISION.txt")
file(READ "${PROJECT_SOURCE_DIR}/REVISION.txt" SDL_SOURCE_VERSION)
string(STRIP "${SDL_SOURCE_VERSION}" SDL_SOURCE_VERSION)
endif()

Expand Down Expand Up @@ -3543,6 +3523,23 @@ if(SDL_TEST)
set_property(TARGET SDL2_test PROPERTY INTERFACE_SDL_VERSION "SDL2")
endif()

if(MSVC AND NOT SDL_LIBC)
set(targets )
if(TARGET SDL2)
list(APPEND targets SDL2)
endif()
if(TARGET SDL2-static)
list(APPEND targets SDL2-static)
endif()
if(TARGET SDL2_test)
list(APPEND targets SDL2_test)
endif()
set_property(TARGET ${targets} APPEND PROPERTY COMPILE_OPTIONS "/GS-;/Gs1048576")
if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM")
set_property(TARGET ${targets} APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE")
endif()
endif()

##### Installation targets #####
if(NOT SDL2_DISABLE_INSTALL)
if(SDL_SHARED)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
Copyright (C) 1997-2025 Sam Lantinga <[email protected]>

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@

INSTALL_SDL2_CONFIG = @INSTALL_SDL2_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
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-GDK VisualC-WinRT Xcode Xcode-iOS wayland-protocols
GEN_DIST = SDL2.spec

ifneq ($V,1)
Expand Down
2 changes: 1 addition & 1 deletion Makefile.os2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 30
MICRO_VERSION = 0
MICRO_VERSION = 11
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2

Expand Down
2 changes: 1 addition & 1 deletion Makefile.w32
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
LIBNAME = SDL2
MAJOR_VERSION = 2
MINOR_VERSION = 30
MICRO_VERSION = 0
MICRO_VERSION = 11
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)

LIBHOME = .
Expand Down
Loading

0 comments on commit d11cea7

Please sign in to comment.