66from os import environ
77from 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):
9696def 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
127127def 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
152152def 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
177177def 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 ,
0 commit comments