From 1ce47e2fec8f250cce64e5e4c277793663c95983 Mon Sep 17 00:00:00 2001 From: Marcus Minhorst Date: Sat, 20 Sep 2025 20:51:21 -0400 Subject: [PATCH] Standardize SDL2 include --- cmake/FindSDL2.cmake | 15 +++------ src/common/platform/posix/sdl/gl_sysfb.h | 3 +- src/common/platform/posix/sdl/hardware.cpp | 14 ++++----- src/common/platform/posix/sdl/i_gui.cpp | 3 +- src/common/platform/posix/sdl/i_input.cpp | 4 +-- src/common/platform/posix/sdl/i_joystick.cpp | 4 +-- src/common/platform/posix/sdl/i_main.cpp | 19 ++++++----- src/common/platform/posix/sdl/i_system.cpp | 33 ++++++++++---------- src/common/platform/posix/sdl/sdlglvideo.cpp | 17 +++++----- src/d_anonstats.cpp | 2 +- 10 files changed, 55 insertions(+), 59 deletions(-) diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake index 00157979d..b2399ee28 100644 --- a/cmake/FindSDL2.cmake +++ b/cmake/FindSDL2.cmake @@ -48,31 +48,26 @@ # SDL2_LIBRARY to override this selection or set the CMake environment # CMAKE_INCLUDE_PATH to modify the search paths. # -# Note that the header path has changed from SDL2/SDL.h to just SDL.h -# This needed to change because "proper" SDL2 convention -# is #include "SDL.h", not . This is done for portability -# reasons because not all systems place things in SDL2/ (see FreeBSD). -# # Ported by Johnny Patterson. This is a literal port for SDL2 of the FindSDL.cmake # module with the minor edit of changing "SDL" to "SDL2" where necessary. This # was not created for redistribution, and exists temporarily pending official # SDL2 CMake modules. -FIND_PATH(SDL2_INCLUDE_DIR SDL.h +FIND_PATH(SDL2_INCLUDE_DIR SDL2/SDL.h HINTS $ENV{SDL2DIR} - PATH_SUFFIXES include/SDL2 include + PATH_SUFFIXES include PATHS ~/Library/Frameworks /Library/Frameworks - /usr/local/include/SDL2 - /usr/include/SDL2 + /usr/local + /usr /sw # Fink /opt/local # DarwinPorts /opt/csw # Blastwave /opt/homebrew /opt - /boot/system/develop/headers/SDL2 #Haiku OS + /boot/system/develop/headers #Haiku OS ) #MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}") diff --git a/src/common/platform/posix/sdl/gl_sysfb.h b/src/common/platform/posix/sdl/gl_sysfb.h index e9491d098..b88411e34 100644 --- a/src/common/platform/posix/sdl/gl_sysfb.h +++ b/src/common/platform/posix/sdl/gl_sysfb.h @@ -1,7 +1,7 @@ #ifndef __POSIX_SDL_GL_SYSFB_H__ #define __POSIX_SDL_GL_SYSFB_H__ -#include +#include #include "v_video.h" @@ -46,4 +46,3 @@ protected: }; #endif // __POSIX_SDL_GL_SYSFB_H__ - diff --git a/src/common/platform/posix/sdl/hardware.cpp b/src/common/platform/posix/sdl/hardware.cpp index 46daca4f9..a5255e147 100644 --- a/src/common/platform/posix/sdl/hardware.cpp +++ b/src/common/platform/posix/sdl/hardware.cpp @@ -4,6 +4,7 @@ ** **--------------------------------------------------------------------------- ** Copyright 1998-2006 Randy Heit +** Copyright 2017-2025 GZDoom Maintainers and Contributors ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -32,22 +33,21 @@ ** */ -#include +#include #include -#include "i_system.h" -#include "hardware.h" -#include "c_dispatch.h" -#include "v_text.h" -#include "m_argv.h" #include "c_console.h" +#include "c_dispatch.h" +#include "hardware.h" +#include "i_system.h" +#include "m_argv.h" #include "printf.h" +#include "v_text.h" IVideo *Video; void I_RestartRenderer(); - void I_ShutdownGraphics () { if (screen) diff --git a/src/common/platform/posix/sdl/i_gui.cpp b/src/common/platform/posix/sdl/i_gui.cpp index 9290f063f..3fa7b777b 100644 --- a/src/common/platform/posix/sdl/i_gui.cpp +++ b/src/common/platform/posix/sdl/i_gui.cpp @@ -3,6 +3,7 @@ ** **--------------------------------------------------------------------------- ** Copyright 2008 Randy Heit +** Copyright 2017-2025 GZDoom Maintainers and Contributors ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -33,7 +34,7 @@ #include -#include +#include #include "bitmap.h" #include "textures.h" diff --git a/src/common/platform/posix/sdl/i_input.cpp b/src/common/platform/posix/sdl/i_input.cpp index 159bfe393..09880ffc6 100644 --- a/src/common/platform/posix/sdl/i_input.cpp +++ b/src/common/platform/posix/sdl/i_input.cpp @@ -34,8 +34,8 @@ ** */ -#include -#include +#include +#include #include "c_buttons.h" #include "c_console.h" diff --git a/src/common/platform/posix/sdl/i_joystick.cpp b/src/common/platform/posix/sdl/i_joystick.cpp index c26d6b1ae..112658578 100644 --- a/src/common/platform/posix/sdl/i_joystick.cpp +++ b/src/common/platform/posix/sdl/i_joystick.cpp @@ -36,8 +36,8 @@ ** */ -#include -#include +#include +#include #include #include diff --git a/src/common/platform/posix/sdl/i_main.cpp b/src/common/platform/posix/sdl/i_main.cpp index a8ee3bf80..39a063f95 100644 --- a/src/common/platform/posix/sdl/i_main.cpp +++ b/src/common/platform/posix/sdl/i_main.cpp @@ -35,25 +35,24 @@ // HEADER FILES ------------------------------------------------------------ -#include -#include -#include -#include -#include +#include +#include #include +#include +#include +#include #include #include -#include +#include -#include "engineerrors.h" -#include "m_argv.h" #include "c_console.h" -#include "version.h" #include "cmdlib.h" #include "engineerrors.h" -#include "i_system.h" #include "i_interface.h" +#include "i_system.h" +#include "m_argv.h" #include "printf.h" +#include "version.h" // MACROS ------------------------------------------------------------------ diff --git a/src/common/platform/posix/sdl/i_system.cpp b/src/common/platform/posix/sdl/i_system.cpp index e5dcd5e7b..df819aa9d 100644 --- a/src/common/platform/posix/sdl/i_system.cpp +++ b/src/common/platform/posix/sdl/i_system.cpp @@ -5,6 +5,7 @@ **--------------------------------------------------------------------------- ** Copyright 1999-2016 Randy Heit ** Copyright 2019-2020 Christoph Oelckers +** Copyright 2017-2025 GZDoom Maintainers and Contributors ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -34,18 +35,18 @@ */ #include -#include -#include -#include -#include #include +#include +#include +#include +#include #include -#include #include +#include +#include #include #include -#include #ifdef __linux__ #include @@ -57,19 +58,19 @@ #include #endif -#include +#include -#include "version.h" -#include "cmdlib.h" -#include "m_argv.h" -#include "i_sound.h" -#include "i_interface.h" -#include "v_font.h" #include "c_cvars.h" -#include "palutil.h" -#include "st_start.h" -#include "printf.h" +#include "cmdlib.h" +#include "i_interface.h" +#include "i_sound.h" #include "launcherwindow.h" +#include "m_argv.h" +#include "palutil.h" +#include "printf.h" +#include "st_start.h" +#include "v_font.h" +#include "version.h" #ifndef NO_GTK bool I_GtkAvailable (); diff --git a/src/common/platform/posix/sdl/sdlglvideo.cpp b/src/common/platform/posix/sdl/sdlglvideo.cpp index 276181a07..cd7000171 100644 --- a/src/common/platform/posix/sdl/sdlglvideo.cpp +++ b/src/common/platform/posix/sdl/sdlglvideo.cpp @@ -34,39 +34,40 @@ // HEADER FILES ------------------------------------------------------------ +#include "c_console.h" +#include "c_dispatch.h" #include "i_module.h" #include "i_soundinternal.h" #include "i_system.h" #include "i_video.h" #include "m_argv.h" +#include "printf.h" #include "v_video.h" #include "version.h" -#include "c_console.h" -#include "c_dispatch.h" -#include "printf.h" -#include "hardware.h" #include "gl_sysfb.h" #include "gl_system.h" +#include "hardware.h" -#include "gl_renderer.h" #include "gl_framebuffer.h" +#include "gl_renderer.h" + #ifdef HAVE_GLES2 #include "gles_framebuffer.h" #endif #ifdef HAVE_VULKAN #include "vulkan/system/vk_renderdevice.h" +#include +#include #include #include -#include -#include #endif // MACROS ------------------------------------------------------------------ #if defined HAVE_VULKAN -#include +#include #endif // HAVE_VULKAN // TYPES ------------------------------------------------------------------- diff --git a/src/d_anonstats.cpp b/src/d_anonstats.cpp index b302ad189..41431a4b2 100644 --- a/src/d_anonstats.cpp +++ b/src/d_anonstats.cpp @@ -22,7 +22,7 @@ extern FString sys_ostype; #ifdef __APPLE__ #include #else // !__APPLE__ -#include +#include #endif // __APPLE__ #include #include