Skip to content

Commit

Permalink
WIP: Try to update SDL to 2.0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
o01eg committed Dec 22, 2024
1 parent cb1bf23 commit 2bda204
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ set(FREETYPE_VERSION 2.9)
set(FREETYPE_URL http://downloads.sourceforge.net/project/freetype/freetype2/${FREETYPE_VERSION}/freetype-${FREETYPE_VERSION}.tar.gz)
set(FREETYPE_MD5 d23a1b246e78890458c6672cb45eacd0)

set(SDL_VERSION 2.0.14)
set(SDL_VERSION 2.0.16)
set(SDL_URL https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
set(SDL_MD5 76ed4e6da9c07bd168b2acd9bfefab1b)
set(SDL_MD5 98b8a1535a757ea1d03ae44e2fb20247)

set(LIBOGG_VERSION 1.3.2)
set(LIBOGG_URL http://downloads.xiph.org/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz)
Expand Down
14 changes: 9 additions & 5 deletions patches/sdl/0002-Never-build-and-install-SDL2main-library.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa17932b6..3fe76072c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2196,15 +2196,15 @@ endif()
@@ -2540,16 +2540,16 @@ endif()
# Ensure that the extra cflags are used at compile time
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")

-# Always build SDLmain
-if(NOT WINDOWS_STORE)
-add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
-target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
-# alias target for in-tree builds
-add_library(SDL2::SDL2main ALIAS SDL2main)
-target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
-set(_INSTALL_LIBS "SDL2main")
-if (NOT ANDROID)
- set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
-endif()
-endif()
+# Never build SDLmain
+# Always build SDLmain
+#if(NOT WINDOWS_STORE)
+#add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
+#target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
+# alias target for in-tree builds
+#add_library(SDL2::SDL2main ALIAS SDL2main)
+#target_include_directories(SDL2main PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
+#set(_INSTALL_LIBS "SDL2main")
+#if (NOT ANDROID)
+# set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
+# set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
+#endif()
+#endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Subject: [PATCH] CMake: Use PUBLIC_HEADER property to install headers
1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a420993..ec2cdd4 100644
index 18bcfc2..0937ac9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2206,17 +2206,23 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
@@ -2552,19 +2552,25 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
#endif()
#endif()

Expand All @@ -29,40 +29,44 @@ index a420993..ec2cdd4 100644

if(SDL_SHARED)
- add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
+ add_library(SDL2 SHARED ${INCLUDE_FILES} ${SOURCE_FILES} ${VERSION_SOURCES})
# alias target for in-tree builds
add_library(SDL2::SDL2 ALIAS SDL2)
- if(APPLE)
- set_target_properties(SDL2 PROPERTIES
- MACOSX_RPATH 1
- OUTPUT_NAME "SDL2-${LT_RELEASE}")
- elseif(UNIX AND NOT ANDROID)
+ add_library(SDL2 SHARED ${INCLUDE_FILES} ${SOURCE_FILES} ${VERSION_SOURCES})
+ set_target_properties(SDL2 PROPERTIES
+ PUBLIC_HEADER "${INCLUDE_FILES}")
+ if(UNIX AND NOT ANDROID)
set_target_properties(SDL2 PROPERTIES
VERSION ${LT_VERSION}
SOVERSION ${LT_REVISION}
@@ -2269,7 +2275,9 @@ endif()
SOVERSION ${LT_MAJOR}
@@ -2620,9 +2626,11 @@ endif()

if(SDL_STATIC)
set (BUILD_SHARED_LIBS FALSE)
- add_library(SDL2-static STATIC ${SOURCE_FILES})
+ add_library(SDL2-static STATIC ${INCLUDE_FILES} ${SOURCE_FILES})
# alias target for in-tree builds
add_library(SDL2::SDL2-static ALIAS SDL2-static)
+ set_target_properties(SDL2-static PROPERTIES
+ PUBLIC_HEADER "${INCLUDE_FILES}")
if (NOT SDL_SHARED OR NOT WIN32)
set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2")
# Note: Apparently, OUTPUT_NAME must really be unique; even when
@@ -2311,7 +2319,8 @@ endif()
@@ -2664,7 +2672,8 @@ endif()
install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
- RUNTIME DESTINATION bin)
+ RUNTIME DESTINATION bin
+ PUBLIC_HEADER DESTINATION include/SDL2)
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL2")

##### Export files #####
if (WINDOWS)
@@ -2339,15 +2348,6 @@ install(
@@ -2692,15 +2701,6 @@ install(
COMPONENT Devel
)

Expand All @@ -73,16 +77,16 @@ index a420993..ec2cdd4 100644
- list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME})
-endforeach()
-list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
-install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2)
-install(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2)
-
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
if (UPPER_BUILD_TYPE MATCHES DEBUG)
set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
@@ -2355,7 +2355,7 @@ else()
@@ -2708,7 +2708,7 @@ else()
set(SOPOSTFIX "")
endif()

-if(NOT (WINDOWS OR CYGWIN))
-if(NOT (WINDOWS OR CYGWIN OR MINGW))
+if((NOT WINDOWS OR CYGWIN) AND (NOT BUILD_FRAMEWORK))
if(SDL_SHARED)
set(SOEXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) # ".so", ".dylib", etc.
Expand Down
6 changes: 3 additions & 3 deletions patches/sdl/0004-CMake-Add-MacOSX-Framework-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec2cdd4..c3185d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -399,6 +399,9 @@ option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal
option_string(FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF")
@@ -419,6 +419,9 @@ option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal
set_option(HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI})
set_option(JOYSTICK_VIRTUAL "Enable the virtual-joystick driver" ON)
set_option(ASAN "Use AddressSanitizer to detect memory errors" OFF)
+if(APPLE)
+ set_option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
+endif()
Expand All @@ -36,7 +36,7 @@ index ec2cdd4..c3185d3 100644
+ OUTPUT_NAME "SDL2")
+ endif()
target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>)
if(ANDROID)
--
2.14.3
Expand Down
10 changes: 5 additions & 5 deletions patches/sdl/0005-CMake-Set-framework-install-directory.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index f32165cb7..50446f868 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1793,6 +1793,7 @@ install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
RUNTIME DESTINATION bin
@@ -2686,6 +2686,7 @@ install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
PUBLIC_HEADER DESTINATION include/SDL2)
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/SDL2")

##### Export files #####
--
Expand Down

0 comments on commit 2bda204

Please sign in to comment.