Merge branch 'sdl2_cmake' into 'master'

Use SDL2 generate cmake files to find the package

See merge request OpenMW/openmw!3612
macos_ci_fix
jvoisin 1 year ago
commit d1fc34a0d9

@ -902,8 +902,7 @@ printf "Qt ${QT_VER}... "
fi
cd $QT_SDK
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
-DCMAKE_PREFIX_PATH="$QT_SDK"
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then
DLLSUFFIX="d"
@ -930,7 +929,7 @@ printf "SDL 2.24.0... "
rm -rf SDL2-2.24.0
eval 7z x -y SDL2-devel-2.24.0-VC.zip $STRIP
fi
export SDL2DIR="$(real_pwd)/SDL2-2.24.0"
SDL2DIR="$(real_pwd)/SDL2-2.24.0"
for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/SDL2-2.24.0/lib/x${ARCHSUFFIX}/SDL2.dll"
done
@ -1025,6 +1024,8 @@ printf "zlib 1.2.11... "
echo Done.
}
add_cmake_opts -DCMAKE_PREFIX_PATH="\"${QT_SDK};${SDL2DIR}\""
echo
cd $DEPS_INSTALL/..
echo

@ -114,7 +114,6 @@ include(WholeArchive)
configure_file ("${OpenMW_SOURCE_DIR}/docs/mainpage.hpp.cmake" "${OpenMW_BINARY_DIR}/docs/mainpage.hpp")
option(BOOST_STATIC "Link static build of Boost into the binaries" FALSE)
option(SDL2_STATIC "Link static build of SDL into the binaries" FALSE)
option(QT_STATIC "Link static build of Qt into the binaries" FALSE)
option(OPENMW_USE_SYSTEM_BULLET "Use system provided bullet physics library" ON)
@ -483,7 +482,6 @@ set(SOL_CONFIG_DIR ${OpenMW_SOURCE_DIR}/extern/sol_config)
include_directories(
BEFORE SYSTEM
"."
${SDL2_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${MyGUI_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIR}
@ -495,7 +493,7 @@ include_directories(
${ICU_INCLUDE_DIRS}
)
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${COLLADA_DOM_LIBRARY_DIRS})
link_directories(${Boost_LIBRARY_DIRS} ${COLLADA_DOM_LIBRARY_DIRS})
if(MYGUI_STATIC)
add_definitions(-DMYGUI_STATIC)

@ -77,7 +77,7 @@ if (WIN32)
endif (WIN32)
target_link_libraries(openmw-launcher
${SDL2_LIBRARY_ONLY}
SDL2::SDL2
${OPENAL_LIBRARY}
components_qt
)

@ -150,7 +150,7 @@ target_link_libraries(openmw
${OPENAL_LIBRARY}
${FFmpeg_LIBRARIES}
${MyGUI_LIBRARIES}
${SDL2_LIBRARY}
SDL2::SDL2
${RecastNavigation_LIBRARIES}
"osg-ffmpeg-videoplayer"
"oics"

@ -1,129 +0,0 @@
# Locate SDL2 library
# This module defines
# SDL2_LIBRARY, the SDL2 library, with no other libraries
# SDL2_LIBRARIES, the SDL library and required components with compiler flags
# SDL2_FOUND, if false, do not try to link to SDL2
# SDL2_INCLUDE_DIR, where to find SDL.h
# SDL2_VERSION, the version of the found library
#
# This module accepts the following env variables
# SDL2DIR - Can be set to ./configure --prefix=$SDL2DIR used in building SDL2. l.e.galup 9-20-02
# This module responds to the the flag:
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2_main 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_LIBRARIES variable.
#
# Don't forget to include SDL2main.h and SDL2main.m your project for the
# OS X framework based version. (Other versions link to -lSDL2main which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# 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 OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL2 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" SDL2 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).
#
# 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.
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt 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.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_sdl_lib_suffix lib/x64)
else()
set(_sdl_lib_suffix lib/x86)
endif()
libfind_pkg_detect(SDL2 sdl2
FIND_PATH SDL.h
HINTS $ENV{SDL2DIR}
PATH_SUFFIXES include SDL2 include/SDL2
FIND_LIBRARY SDL2
HINTS $ENV{SDL2DIR}
PATH_SUFFIXES lib ${_sdl_lib_suffix}
)
libfind_version_n_header(SDL2 NAMES SDL_version.h DEFINES SDL_MAJOR_VERSION SDL_MINOR_VERSION SDL_PATCHLEVEL)
IF(NOT SDL2_BUILDING_LIBRARY AND NOT APPLE)
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
libfind_pkg_detect(SDL2MAIN sdl2
FIND_LIBRARY SDL2main
HINTS $ENV{SDL2DIR}
PATH_SUFFIXES lib ${_sdl_lib_suffix}
)
set(SDL2MAIN_FIND_QUIETLY TRUE)
libfind_process(SDL2MAIN)
list(APPEND SDL2_PROCESS_LIBS SDL2MAIN_LIBRARY)
ENDIF()
set(SDL2_TARGET_SPECIFIC)
if (APPLE)
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
list(APPEND SDL2_TARGET_SPECIFIC "-framework Cocoa")
else()
# 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.
libfind_package(SDL2 Threads)
list(APPEND SDL2_TARGET_SPECIFIC ${CMAKE_THREAD_LIBS_INIT})
endif()
# 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)
list(APPEND SDL2_TARGET_SPECIFIC mingw32)
endif()
if(WIN32)
list(APPEND SDL2_TARGET_SPECIFIC winmm imm32 version msimg32)
endif()
set(SDL2_PROCESS_LIBS SDL2_TARGET_SPECIFIC)
libfind_process(SDL2)
if (SDL2_STATIC AND UNIX AND NOT APPLE)
execute_process(COMMAND sdl2-config --static-libs OUTPUT_VARIABLE SDL2_STATIC_FLAGS)
string(REGEX REPLACE "(\r?\n)+$" "" SDL2_STATIC_FLAGS "${SDL2_STATIC_FLAGS}")
set(SDL2_LIBRARIES ${SDL2_STATIC_FLAGS})
endif()

@ -556,7 +556,7 @@ target_link_libraries(components
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_IOSTREAMS_LIBRARY}
${SDL2_LIBRARIES}
SDL2::SDL2
${OPENGL_gl_LIBRARY}
${MyGUI_LIBRARIES}
${LUA_LIBRARIES}

@ -20,6 +20,8 @@ else()
target_link_libraries(oics local_tinyxml)
endif()
target_link_libraries(oics SDL2::SDL2)
if (MSVC)
target_precompile_headers(oics PUBLIC <algorithm> <string>)
endif()

@ -14,6 +14,7 @@ include_directories(${FFmpeg_INCLUDE_DIRS})
add_library(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} STATIC ${OSG_FFMPEG_VIDEOPLAYER_SOURCE_FILES})
target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${FFmpeg_LIBRARIES})
target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${OSG_LIBRARIES})
target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} SDL2::SDL2)
link_directories(${CMAKE_CURRENT_BINARY_DIR})

Loading…
Cancel
Save