summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <huth@tuxfamily.org>2022-09-18 16:44:45 (GMT)
committerThomas Huth <huth@tuxfamily.org>2022-09-24 07:15:00 (GMT)
commit79ed0ebc9d2a3bc7b77ba18f75b10352c5e886dd (patch)
tree4d55d27e2043b8be1ffc3353beb6463845ec4c18
parentbd5ba4ae6076574f48385f53c1ba30b8f6f1cae8 (diff)
downloadhatari-79ed0ebc9d2a3bc7b77ba18f75b10352c5e886dd.zip
hatari-79ed0ebc9d2a3bc7b77ba18f75b10352c5e886dd.tar.gz
Switch to the official SDL2 CMake config and drop our FindSDL2.cmake file
Recent versions of SDL2 ship with a SDL2Config.cmake file, so we do not need to supply our own FindSDL2.cmake anymore.
-rw-r--r--.cirrus.yml8
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/FindSDL2.cmake177
-rw-r--r--readme.txt2
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--tests/debugger/CMakeLists.txt2
-rw-r--r--tools/debugger/CMakeLists.txt2
-rw-r--r--tools/hmsa/CMakeLists.txt2
8 files changed, 10 insertions, 193 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index 2c32ac6..42d1cf7 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -110,17 +110,15 @@ visualstudio_task:
- del %temp%\chocolatey\windowssdk\*.log
- del %temp%\chocolatey\VSLogs\*.svclog
# Install the required libraries and headers:
- - curl -O "https://www.libsdl.org/release/SDL2-devel-2.0.14-VC.zip"
- - powershell -command "Expand-Archive -Force '%cd%\SDL2-devel-2.0.14-VC.zip' '%cd%'"
+ - curl -O "https://www.libsdl.org/release/SDL2-devel-2.24.0-VC.zip"
+ - powershell -command "Expand-Archive -Force '%cd%\SDL2-devel-2.24.0-VC.zip' '%cd%'"
- curl -O https://raw.githubusercontent.com/barrysteyn/scrypt-windows/master/win/include/unistd.h
- curl -O https://raw.githubusercontent.com/tronkko/dirent/master/include/dirent.h
- echo // > getopt.h
script:
- refreshenv
- cmake -G "Visual Studio 16 2019" -A X64 -DCMAKE_BUILD_TYPE="Release"
- -DSDL2_INCLUDE_DIR="%cd%\SDL2-2.0.14\include"
- -DSDL2_LIBRARY="%cd%\SDL2-2.0.14\lib\x64\SDL2.lib"
- -DSDL2MAIN_LIBRARY="%cd%\SDL2-2.0.14\lib\x64\SDL2main.lib" .
+ -DSDL2_DIR:PATH=SDL2-2.24.0\cmake .
- cmake --build . --verbose --target ALL_BUILD --config Release -j4
test_script:
- refreshenv
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b0ac8e..042ad98 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -368,7 +368,7 @@ Libraries summary :
-------------------
")
-message(" - sdl :\tusing SDL2 v${SDL2_VERSION_STRING}")
+message(" - sdl :\tusing SDL2 v${SDL2_VERSION}")
if(Readline_FOUND)
message( " - readline :\tfound, enables history/completion in the debugger" )
diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake
deleted file mode 100644
index 5856493..0000000
--- a/cmake/FindSDL2.cmake
+++ /dev/null
@@ -1,177 +0,0 @@
-# Locate SDL2 library
-# This module defines
-# SDL2_LIBRARY, the name of the library to link against
-# SDL2_FOUND, if false, do not try to link to SDL2
-# SDL2_INCLUDE_DIR, where to find SDL.h
-#
-# This module responds to the the flag:
-# SDL2_BUILDING_LIBRARY
-# If this is defined, then no SDL2main will be linked in because
-# only applications need main().
-# Otherwise, it is assumed you are building an application and this
-# module will attempt to locate and set the the proper link flags
-# as part of the returned SDL2_LIBRARY variable.
-#
-# Don't forget to include SDLmain.h and SDLmain.m your project for the
-# macOS framework based version. (Other versions link to -lSDL2main which
-# this module will try to find on your behalf.) Also for macOS, this
-# module will automatically add the -framework Cocoa on your behalf.
-#
-#
-# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
-# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
-# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
-# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
-# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
-# as appropriate. These values are used to generate the final SDL2_LIBRARY
-# variable, but when these values are unset, SDL2_LIBRARY does not get created.
-#
-#
-# $SDL2DIR is an environment variable that would
-# correspond to the ./configure --prefix=$SDL2DIR
-# used in building SDL2.
-# l.e.galup 9-20-02
-#
-# Modified by Eric Wing.
-# Added code to assist with automated building by using environmental variables
-# and providing a more controlled/consistent search behavior.
-# Added new modifications to recognize macOS frameworks and
-# additional Unix paths (FreeBSD, etc).
-# Also corrected the header search path to follow "proper" SDL guidelines.
-# Added a search for SDL2main which is needed by some platforms.
-# Added a search for threads which is needed by some platforms.
-# Added needed compile switches for MinGW.
-#
-# On OSX, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of
-# 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" SDL convention
-# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
-# reasons because not all systems place things in SDL2/ (see FreeBSD).
-
-#=============================================================================
-# Copyright 2003-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see http://www.cmake.org/cmake/project/license.html for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-
-SET(SDL2_SEARCH_PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
-)
-
-FIND_PATH(SDL2_INCLUDE_DIR SDL_scancode.h
- HINTS
- $ENV{SDL2DIR}
- PATH_SUFFIXES SDL2 include/SDL2 include
- PATHS ${SDL2_SEARCH_PATHS}
-)
-
-FIND_LIBRARY(SDL2_LIBRARY_TEMP
- NAMES SDL2
- HINTS
- $ENV{SDL2DIR}
- PATH_SUFFIXES lib64 lib
- PATHS ${SDL2_SEARCH_PATHS}
-)
-
-IF(NOT SDL2_BUILDING_LIBRARY)
- IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
- # Non-macOS framework versions expect you to also dynamically link to
- # SDL2main. This is mainly for Windows and macOS. Other (Unix) platforms
- # seem to provide SDL2main for compatibility even though they don't
- # necessarily need it.
- FIND_LIBRARY(SDL2MAIN_LIBRARY
- NAMES SDL2main
- HINTS
- $ENV{SDL2DIR}
- PATH_SUFFIXES lib64 lib
- PATHS ${SDL2_SEARCH_PATHS}
- )
- ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
-ENDIF(NOT SDL2_BUILDING_LIBRARY)
-
-# SDL2 may require threads on your system.
-# The Apple build may not need an explicit flag because one of the
-# frameworks may already provide it.
-# But for non-OSX systems, I will use the CMake Threads package.
-IF(NOT APPLE)
- FIND_PACKAGE(Threads)
-ENDIF(NOT APPLE)
-
-# MinGW needs an additional library, mwindows
-# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
-# (Actually on second look, I think it only needs one of the m* libraries.)
-IF(MINGW)
- SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
-ENDIF(MINGW)
-
-IF(SDL2_LIBRARY_TEMP)
- # For SDL2main
- IF(NOT SDL2_BUILDING_LIBRARY)
- IF(SDL2MAIN_LIBRARY)
- SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
- ENDIF(SDL2MAIN_LIBRARY)
- ENDIF(NOT SDL2_BUILDING_LIBRARY)
-
- # For macOS, SDL2 uses Cocoa as a backend so it must link to Cocoa.
- # CMake doesn't display the -framework Cocoa string in the UI even
- # though it actually is there if I modify a pre-used variable.
- # I think it has something to do with the CACHE STRING.
- # So I use a temporary variable until the end so I can set the
- # "real" variable in one-shot.
- IF(APPLE)
- SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
- ENDIF(APPLE)
-
- # For threads, as mentioned Apple doesn't need this.
- # In fact, there seems to be a problem if I used the Threads package
- # and try using this line, so I'm just skipping it entirely for macOS.
- IF(NOT APPLE)
- SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
- ENDIF(NOT APPLE)
-
- # For MinGW library
- IF(MINGW)
- SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
- ENDIF(MINGW)
-
- # Set the final string here so the GUI reflects the final state.
- SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
- # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
- SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
-ENDIF(SDL2_LIBRARY_TEMP)
-
-if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL_version.h")
- file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$")
- file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$")
- file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$")
- string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
- string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
- string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
- set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH})
- unset(SDL2_VERSION_MAJOR_LINE)
- unset(SDL2_VERSION_MINOR_LINE)
- unset(SDL2_VERSION_PATCH_LINE)
- unset(SDL2_VERSION_MAJOR)
- unset(SDL2_VERSION_MINOR)
- unset(SDL2_VERSION_PATCH)
-endif()
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
diff --git a/readme.txt b/readme.txt
index 967959d..106b381 100644
--- a/readme.txt
+++ b/readme.txt
@@ -77,7 +77,7 @@ To build and use Hatari, you first need to install its dependent libraries.
3.1) Installing Hatari dependencies
Required:
-- The SDL library v2.0 (http://www.libsdl.org)
+- The SDL library v2.0.6 or newer (http://www.libsdl.org)
Optional:
- The zlib compression library (https://zlib.net/)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e2b12a4..9b789cc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -45,7 +45,7 @@ if(WIN32)
endif(WIN32)
include_directories(includes debug falcon
- ${CMAKE_BINARY_DIR} ${SDL2_INCLUDE_DIR} cpu)
+ ${CMAKE_BINARY_DIR} ${SDL2_INCLUDE_DIRS} cpu)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
@@ -153,16 +153,12 @@ if(SDL2_OTHER_CFLAGS)
# message(STATUS "Additional CFLAGS of SDL: ${SDL2_OTHER_CFLAGS}")
endif(SDL2_OTHER_CFLAGS)
-target_link_libraries(hatari Falcon UaeCpu GuiSdl Floppy Debug ${SDL2_LIBRARY})
+target_link_libraries(hatari Falcon UaeCpu GuiSdl Floppy Debug ${SDL2_LIBRARIES})
if(Math_FOUND AND NOT APPLE)
target_link_libraries(hatari ${MATH_LIBRARY})
endif()
-if(SDL2MAIN_LIBRARY)
- target_link_libraries(hatari ${SDL2MAIN_LIBRARY})
-endif(SDL2MAIN_LIBRARY)
-
if(Readline_FOUND)
target_link_libraries(hatari ${READLINE_LIBRARY})
endif(Readline_FOUND)
diff --git a/tests/debugger/CMakeLists.txt b/tests/debugger/CMakeLists.txt
index 9fe4546..51faf5d 100644
--- a/tests/debugger/CMakeLists.txt
+++ b/tests/debugger/CMakeLists.txt
@@ -3,7 +3,7 @@ set(TEST_SOURCE_DIR ${CMAKE_SOURCE_DIR}/tests/debugger)
include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src/includes
${CMAKE_SOURCE_DIR}/src/debug ${CMAKE_SOURCE_DIR}/src/falcon
- ${CMAKE_SOURCE_DIR}/src/debug ${SDL2_INCLUDE_DIR}
+ ${CMAKE_SOURCE_DIR}/src/debug ${SDL2_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/src/cpu)
add_library(DebuggerTestLib test-dummies.c ${CMAKE_SOURCE_DIR}/src/str.c
diff --git a/tools/debugger/CMakeLists.txt b/tools/debugger/CMakeLists.txt
index 334a3bc..c3558bd 100644
--- a/tools/debugger/CMakeLists.txt
+++ b/tools/debugger/CMakeLists.txt
@@ -1,5 +1,5 @@
-include_directories(${SDL2_INCLUDE_DIR})
+include_directories(${SDL2_INCLUDE_DIRS})
add_executable(gst2ascii gst2ascii.c)
diff --git a/tools/hmsa/CMakeLists.txt b/tools/hmsa/CMakeLists.txt
index b0d7f09..ae13449 100644
--- a/tools/hmsa/CMakeLists.txt
+++ b/tools/hmsa/CMakeLists.txt
@@ -1,6 +1,6 @@
include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src/includes
- ${CMAKE_SOURCE_DIR}/src/debug ${SDL2_INCLUDE_DIR})
+ ${CMAKE_SOURCE_DIR}/src/debug ${SDL2_INCLUDE_DIRS})
set(HMSA_SOURCES hmsa.c floppy.c ../../src/file.c)