Skip to content

Commit

Permalink
WIP: trying to fix SDL issue
Browse files Browse the repository at this point in the history
  • Loading branch information
o01eg committed Dec 22, 2024
1 parent 4a7c239 commit cb1bf23
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function(ExternalProject_PatchSet TARGET_NAME RESULT)
else()
set(${RESULT} ${${RESULT}} COMMAND)
endif()
set(${RESULT} ${${RESULT}} ${CMAKE_COMMAND} -E echo "Appliying patch ${_PATCH} ..." COMMAND)
set(${RESULT} ${${RESULT}} ${PATCH_EXECUTABLE} -p1 < ${_PATCH})
endforeach()
if(NOT ${RESULT})
Expand Down
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.12)
set(SDL_VERSION 2.0.14)
set(SDL_URL https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
set(SDL_MD5 783b6f2df8ff02b19bb5ce492b99c8ff)
set(SDL_MD5 76ed4e6da9c07bd168b2acd9bfefab1b)

set(LIBOGG_VERSION 1.3.2)
set(LIBOGG_URL http://downloads.xiph.org/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz)
Expand Down
12 changes: 8 additions & 4 deletions patches/sdl/0002-Never-build-and-install-SDL2main-library.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa17932b6..3fe76072c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2199,13 +2199,13 @@ endif()
@@ -2196,15 +2196,15 @@ 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>)
-set(_INSTALL_LIBS "SDL2main")
-if (NOT ANDROID)
- set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
-endif()
-endif()
+# Never 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>)
+#set(_INSTALL_LIBS "SDL2main")
+#if (NOT ANDROID)
+# set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
+#endif()

if(SDL_SHARED)
add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
+#endif()

if (ANDROID AND HAVE_HIDAPI)
set(_INSTALL_LIBS ${_INSTALL_LIBS} "hidapi")
--
2.14.3

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ 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 3fe76072c..56cced0f0 100644
index a420993..ec2cdd4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1795,13 +1795,19 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
# set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX})
@@ -2206,17 +2206,23 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
#endif()
#endif()

+file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h)
Expand All @@ -23,6 +23,10 @@ index 3fe76072c..56cced0f0 100644
+endforeach()
+list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
+
if (ANDROID AND HAVE_HIDAPI)
set(_INSTALL_LIBS ${_INSTALL_LIBS} "hidapi")
endif()

if(SDL_SHARED)
- add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES})
- if(APPLE)
Expand All @@ -37,7 +41,7 @@ index 3fe76072c..56cced0f0 100644
set_target_properties(SDL2 PROPERTIES
VERSION ${LT_VERSION}
SOVERSION ${LT_REVISION}
@@ -1848,7 +1854,9 @@ endif()
@@ -2269,7 +2275,9 @@ endif()

if(SDL_STATIC)
set (BUILD_SHARED_LIBS FALSE)
Expand All @@ -48,7 +52,7 @@ index 3fe76072c..56cced0f0 100644
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
@@ -1887,7 +1897,8 @@ endif()
@@ -2311,7 +2319,8 @@ endif()
install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
Expand All @@ -57,8 +61,8 @@ index 3fe76072c..56cced0f0 100644
+ PUBLIC_HEADER DESTINATION include/SDL2)

##### Export files #####
if (APPLE)
@@ -1799,23 +1810,15 @@ install(
if (WINDOWS)
@@ -2339,15 +2348,6 @@ install(
COMPONENT Devel
)

Expand All @@ -70,14 +74,14 @@ index 3fe76072c..56cced0f0 100644
-endforeach()
-list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
-install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2)
-
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_BUILD_TYPE)
if (UPPER_BUILD_TYPE MATCHES DEBUG)
set(SOPOSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
else()
@@ -2355,7 +2355,7 @@ else()
set(SOPOSTFIX "")
endif()

-if(NOT (WINDOWS OR CYGWIN))
+if((NOT WINDOWS OR CYGWIN) AND (NOT BUILD_FRAMEWORK))
if(SDL_SHARED)
Expand Down
14 changes: 7 additions & 7 deletions patches/sdl/0004-CMake-Add-MacOSX-Framework-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ Subject: [PATCH] CMake: Add MacOSX Framework support
1 file changed, 13 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56cced0f0..f32165cb7 100644
index ec2cdd4..c3185d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -373,6 +373,9 @@ dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF)
option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" "OFF")
@@ -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")
set_option(HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI})
set_option(JOYSTICK_VIRTUAL "Enable the virtual-joystick driver" ON)
+if(APPLE)
+ set_option(BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
+endif()

set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static version of the library")
@@ -1819,6 +1822,16 @@ if(SDL_SHARED)
@@ -2244,6 +2247,16 @@ if(SDL_SHARED)
set_target_properties(SDL2 PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
endif()
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
Expand All @@ -35,9 +35,9 @@ index 56cced0f0..f32165cb7 100644
+ MACOSX_RPATH ON
+ OUTPUT_NAME "SDL2")
+ endif()
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include/SDL2>)
if (NOT ANDROID)
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>)
if(ANDROID)
--
2.14.3

0 comments on commit cb1bf23

Please sign in to comment.