Skip to content

Commit

Permalink
Remove custom FindSDL2.cmake
Browse files Browse the repository at this point in the history
SDL2 supports CMake natively and installs an SDL2Config.cmake file. Hence we do
not need a find module. The custom module was not handling linking to macOS
frameworks, which was hard coded into client CMakeLists.txt instead. Just
switch to the native module, which does all of this for us natively.

See #2075.
  • Loading branch information
lmoureaux committed Dec 15, 2023
1 parent 9eda2ba commit 4e2a3cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 185 deletions.
9 changes: 5 additions & 4 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ target_link_libraries(freeciv21-client PRIVATE tolua)

target_link_libraries(freeciv21-client PRIVATE Qt5::Widgets)
target_link_libraries(freeciv21-client PRIVATE Qt5::Svg)
target_link_libraries(freeciv21-client PRIVATE ${SDL2_MIXER_LIBRARIES} ${SDL2_LIBRARY})

if(NOT EMSCRIPTEN)
target_sources(freeciv21-client PRIVATE servers.cpp)
Expand All @@ -168,13 +167,15 @@ if (AUDIO_SDL)
target_sources(freeciv21-client PRIVATE audio/audio_sdl.cpp)
if (NOT EMSCRIPTEN)
# SDL comes with the -s option on emscripten
target_include_directories(freeciv21-client PRIVATE ${SDL2_INCLUDE_DIR})
# See https://github.com/microsoft/vcpkg/blob/2023.12.12/ports/sdl2/usage
target_link_libraries(freeciv21-client
PRIVATE $<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>)
target_link_libraries(freeciv21-client PRIVATE ${SDL2_MIXER_LIBRARIES})
target_include_directories(freeciv21-client PRIVATE ${SDL2_MIXER_INCLUDE_DIR})
endif()
endif()

if(APPLE)
target_link_libraries(freeciv21-client PRIVATE "-framework AudioUnit" "-framework CoreAudio" "-framework ForceFeedback" "-framework AudioToolbox")
if (APPLE)
qt5_import_plugins(freeciv21-client INCLUDE Qt5::QCocoaIntegrationPlugin Qt5::QSvgPlugin)
endif()

Expand Down
181 changes: 0 additions & 181 deletions cmake/FindSDL2.cmake

This file was deleted.

0 comments on commit 4e2a3cd

Please sign in to comment.