ladybird/Ports/fheroes2/patches/0002-Use-pkg-config-for-SDL_-and-SDL2.patch

66 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Michael Manganiello <adamantike@users.noreply.github.com>
Date: Sun, 27 Mar 2022 12:52:11 -0300
Subject: [PATCH] Use pkg-config for SDL_* and SDL2
---
CMakeLists.txt | 9 ++++++---
src/engine/CMakeLists.txt | 12 +++++++-----
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8728264..ebed16e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,13 +26,16 @@ option(FHEROES2_STRICT_COMPILATION "Enable -Werror strict compilation" OFF)
#
# Library & feature detection
#
-find_package(${USE_SDL_VERSION} REQUIRED)
-find_package(${USE_SDL_VERSION}_mixer REQUIRED)
+INCLUDE(FindPkgConfig)
+
+PKG_SEARCH_MODULE(${USE_SDL_VERSION} REQUIRED sdl2)
+PKG_SEARCH_MODULE(${USE_SDL_VERSION}MIXER REQUIRED SDL2_mixer)
+
find_package(ZLIB REQUIRED)
find_package(Threads)
if(ENABLE_IMAGE)
- find_package(${USE_SDL_VERSION}_image REQUIRED)
+ PKG_SEARCH_MODULE(${USE_SDL_VERSION}IMAGE REQUIRED SDL2_image)
find_package(PNG REQUIRED)
endif(ENABLE_IMAGE)
diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt
index 8a1fbeb..b9df312 100644
--- a/src/engine/CMakeLists.txt
+++ b/src/engine/CMakeLists.txt
@@ -5,19 +5,21 @@ target_compile_definitions(engine PRIVATE
$<$<BOOL:${ENABLE_IMAGE}>:FHEROES2_IMAGE_SUPPORT>
)
target_include_directories(engine PUBLIC
- $<$<BOOL:${ENABLE_IMAGE}>:${${USE_SDL_VERSION}_IMAGE_INCLUDE_DIR}>
- ${${USE_SDL_VERSION}_MIXER_INCLUDE_DIR}
- ${${USE_SDL_VERSION}_INCLUDE_DIR}
+ $<$<BOOL:${ENABLE_IMAGE}>:${${USE_SDL_VERSION}_IMAGE_INCLUDE_DIRS}>
+ ${${USE_SDL_VERSION}_MIXER_INCLUDE_DIRS}
+ ${${USE_SDL_VERSION}_INCLUDE_DIRS}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(engine
smacker
- ${${USE_SDL_VERSION}MAIN_LIBRARY}
- ${${USE_SDL_VERSION}_LIBRARY}
+ ${${USE_SDL_VERSION}MAIN_LIBRARIES}
+ ${${USE_SDL_VERSION}_LIBRARIES}
${${USE_SDL_VERSION}_MIXER_LIBRARIES}
$<$<BOOL:${ENABLE_IMAGE}>:${${USE_SDL_VERSION}_IMAGE_LIBRARIES}>
$<$<BOOL:${ENABLE_IMAGE}>:PNG::PNG>
+ $<$<BOOL:${ENABLE_IMAGE}>:-lSDL2_image>
+ -lSDL2_mixer
Threads::Threads # To match the build settings of the main app
ZLIB::ZLIB
)