Skip to content

Commit fe269fb

Browse files
committed
SDL2 -> SDL3
1 parent cc1d5fc commit fe269fb

110 files changed

Lines changed: 2861 additions & 1734 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -539,18 +539,9 @@ if(ENABLE_GAME OR ENABLE_TESTS)
539539
find_package(VorbisFile REQUIRED)
540540
find_package(PkgConfig REQUIRED)
541541
find_package(Fontconfig REQUIRED)
542-
find_package(SDL2 2.0.18 REQUIRED)
543-
if(NOT MSVC)
544-
# for everything else, use pkgconfig
545-
# SDL2_image and SDL2_mixer don't seem to have any cmake configuration available at all
546-
pkg_check_modules(SDL2IMAGE REQUIRED SDL2_image>=2.0.2)
547-
pkg_check_modules(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0)
548-
else()
549-
# for MSVC, vcpkg builds and provides custom SDL2-related modules for cmake to use, so use those
550-
# this also fixes the issue with our previous FindSDL2* scripts incorrectly using the Release version of these libs instead of the Debug version
551-
find_package(SDL2_image CONFIG REQUIRED)
552-
find_package(SDL2_mixer CONFIG REQUIRED)
553-
endif()
542+
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
543+
find_package(SDL3_image CONFIG REQUIRED)
544+
find_package(SDL3_mixer CONFIG REQUIRED)
554545
pkg_check_modules(CAIRO REQUIRED cairo>=1.10)
555546
pkg_check_modules(PANGOCAIRO REQUIRED pangocairo>=1.50.0)
556547
pkg_check_modules(PANGO REQUIRED pango>=1.50.0)

SConstruct

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,9 @@ if env["prereqs"]:
373373

374374
def have_sdl_other():
375375
return \
376-
conf.CheckSDL2('2.0.18') & \
377-
conf.CheckSDL2Mixer() & \
378-
conf.CheckSDL2Image()
376+
conf.CheckSDL3('3.1.0') & \
377+
conf.CheckSDL3Mixer() & \
378+
conf.CheckSDL3Image()
379379

380380
if sys.platform == "msys":
381381
env["PKG_CONFIG_FLAGS"] = "--dont-define-prefix"

cmake/FindSDL2.cmake

Lines changed: 0 additions & 104 deletions
This file was deleted.

scons/sdl.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from os import environ
77
from SCons.Util import PrependPath
88

9-
def CheckSDL2(context, require_version):
9+
def CheckSDL3(context, require_version):
1010
version = require_version.split(".", 2)
1111
major_version = version[0]
1212
minor_version = version[1]
@@ -22,8 +22,8 @@ def CheckSDL2(context, require_version):
2222

2323
if env["PLATFORM"] != "win32" or sys.platform == "msys":
2424
for foo_config in [
25-
"pkg-config --cflags --libs $PKG_CONFIG_FLAGS sdl2",
26-
"sdl2-config --cflags --libs"
25+
"pkg-config --cflags --libs $PKG_CONFIG_FLAGS sdl3",
26+
"sdl3-config --cflags --libs"
2727
]:
2828
try:
2929
env.ParseConfig(foo_config)
@@ -33,14 +33,14 @@ def CheckSDL2(context, require_version):
3333
break
3434
else:
3535
if sdldir:
36-
env.AppendUnique(CPPPATH = [os.path.join(sdldir, "include/SDL2")], LIBPATH = [os.path.join(sdldir, "lib")])
37-
env.AppendUnique(CCFLAGS = ["-D_GNU_SOURCE", "-DREQ_MAJOR="+major_version, "-DREQ_MINOR="+minor_version, "-DREQ_PATCH="+patchlevel])
38-
env.AppendUnique(LIBS = Split("mingw32 SDL2main SDL2"))
36+
env.AppendUnique(CPPPATH = [os.path.join(sdldir, "include/SDL3")], LIBPATH = [os.path.join(sdldir, "lib")])
37+
env.AppendUnique(CCFLAGS = ["-D_GNU_SOURCE"])
38+
env.AppendUnique(LIBS = Split("mingw32 SDL3main SDL3"))
3939
env.AppendUnique(LINKFLAGS = ["-mwindows", "-fstack-protector"])
4040

41-
cpp_file = File("src/conftests/sdl2.cpp").rfile().abspath
41+
cpp_file = File("src/conftests/sdl3.cpp").rfile().abspath
4242
if not os.path.isfile(cpp_file):
43-
cpp_file = "src/conftests/sdl2.cpp"
43+
cpp_file = "src/conftests/sdl3.cpp"
4444

4545
with open(cpp_file, 'r') as file:
4646
test_program = file.read()
@@ -53,14 +53,14 @@ def CheckSDL2(context, require_version):
5353
restore_env(context.env, backup)
5454
return False
5555

56-
def CheckSDL2Image(context):
56+
def CheckSDL3Image(context):
5757
backup = backup_env(context.env, ["CPPPATH", "LIBPATH", "LIBS"])
58-
context.Message("Checking for SDL2_image library... ")
59-
context.env.AppendUnique(LIBS = ["SDL2_image"])
58+
context.Message("Checking for SDL3_image library... ")
59+
context.env.AppendUnique(LIBS = ["SDL3_image"])
6060

61-
cpp_file = File("src/conftests/sdl2_image.cpp").rfile().abspath
61+
cpp_file = File("src/conftests/sdl3_image.cpp").rfile().abspath
6262
if not os.path.isfile(cpp_file):
63-
cpp_file = "src/conftests/sdl2_image.cpp"
63+
cpp_file = "src/conftests/sdl3_image.cpp"
6464

6565
with open(cpp_file, 'r') as file:
6666
test_program = file.read()
@@ -73,14 +73,14 @@ def CheckSDL2Image(context):
7373
restore_env(context.env, backup)
7474
return False
7575

76-
def CheckSDL2Mixer(context):
76+
def CheckSDL3Mixer(context):
7777
backup = backup_env(context.env, ["CPPPATH", "LIBPATH", "LIBS"])
78-
context.Message("Checking for SDL2_mixer library... ")
79-
context.env.AppendUnique(LIBS = ["SDL2_mixer"])
78+
context.Message("Checking for SDL3_mixer library... ")
79+
context.env.AppendUnique(LIBS = ["SDL3_mixer"])
8080

81-
cpp_file = File("src/conftests/sdl2_mixer.cpp").rfile().abspath
81+
cpp_file = File("src/conftests/sdl3_mixer.cpp").rfile().abspath
8282
if not os.path.isfile(cpp_file):
83-
cpp_file = "src/conftests/sdl2_mixer.cpp"
83+
cpp_file = "src/conftests/sdl3_mixer.cpp"
8484

8585
with open(cpp_file, 'r') as file:
8686
test_program = file.read()
@@ -96,7 +96,7 @@ def CheckSDL2Mixer(context):
9696
def CheckOgg(context):
9797
context.env["ENV"]["SDL_AUDIODRIVER"] = "dummy"
9898

99-
cpp_file = File("src/conftests/sdl2_audio.cpp").rfile().get_contents().decode()
99+
cpp_file = File("src/conftests/sdl3_audio.cpp").rfile().get_contents().decode()
100100

101101
# file1 (absolute path) works most places
102102
# file2 (relative path) is required for msys2 on windows
@@ -125,7 +125,7 @@ def CheckOgg(context):
125125
return False
126126

127127
def CheckPNG(context):
128-
cpp_file = File("src/conftests/sdl2_png.cpp").rfile().get_contents().decode()
128+
cpp_file = File("src/conftests/sdl3_png.cpp").rfile().get_contents().decode()
129129

130130
img_file1 = File("data/core/images/scons_conftest_images/end-n.png").rfile().abspath
131131
img_file2 = "data/core/images/scons_conftest_images/end-n.png"
@@ -150,7 +150,7 @@ def CheckPNG(context):
150150
return False
151151

152152
def CheckWebP(context):
153-
cpp_file = File("src/conftests/sdl2_webp.cpp").rfile().get_contents().decode()
153+
cpp_file = File("src/conftests/sdl3_webp.cpp").rfile().get_contents().decode()
154154

155155
img_file1 = File("data/core/images/scons_conftest_images/end-n.webp").rfile().abspath
156156
img_file2 = "data/core/images/scons_conftest_images/end-n.webp"
@@ -175,7 +175,7 @@ def CheckWebP(context):
175175
return False
176176

177177
def CheckJPG(context):
178-
cpp_file = File("src/conftests/sdl2_jpg.cpp").rfile().get_contents().decode()
178+
cpp_file = File("src/conftests/sdl3_jpg.cpp").rfile().get_contents().decode()
179179

180180
img_file1 = File("data/core/images/scons_conftest_images/end-n.jpg").rfile().abspath
181181
img_file2 = "data/core/images/scons_conftest_images/end-n.jpg"
@@ -199,9 +199,9 @@ def CheckJPG(context):
199199
context.Result("no")
200200
return False
201201

202-
config_checks = { 'CheckSDL2Image' : CheckSDL2Image,
203-
'CheckSDL2Mixer' : CheckSDL2Mixer,
204-
'CheckSDL2': CheckSDL2,
202+
config_checks = { 'CheckSDL3Image' : CheckSDL3Image,
203+
'CheckSDL3Mixer' : CheckSDL3Mixer,
204+
'CheckSDL3': CheckSDL3,
205205
'CheckOgg' : CheckOgg,
206206
'CheckPNG' : CheckPNG,
207207
'CheckJPG' : CheckJPG,

source_lists/wesnoth

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ editor/toolkit/brush.cpp
9898
editor/toolkit/editor_toolkit.cpp
9999
fake_unit_manager.cpp
100100
fake_unit_ptr.cpp
101-
filesystem_sdl.cpp
102101
floating_textbox.cpp
103102
formula/callable_objects.cpp
104103
formula/debugger.cpp

0 commit comments

Comments
 (0)