gentoo-overlay/games-util/mcpelauncher-ui-qt/files/0001-cmake-Fix-compatibility-with-newer-protobuf-versions.patch

51 lines
3.5 KiB
Diff

From b7ef6146f63ba3b9c6fa7e65fd43b83819561fae Mon Sep 17 00:00:00 2001
From: TheGreatMcPain <james@thegreatmcpain.xyz>
Date: Fri, 13 Dec 2024 19:44:02 -0600
Subject: [PATCH] cmake: Fix compatibility with newer protobuf versions
---
CMakeLists.txt | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/google-play-api/CMakeLists.txt b/google-play-api/CMakeLists.txt
index 02dcf1e..a6d83aa 100644
--- a/google-play-api/CMakeLists.txt
+++ b/google-play-api/CMakeLists.txt
@@ -9,20 +9,24 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
find_package(CURL REQUIRED)
-find_package(Protobuf REQUIRED)
+find_package(Protobuf CONFIG REQUIRED)
-if (NOT DEFINED Protobuf_LIBRARIES)
- set(Protobuf_LIBRARIES ${PROTOBUF_LIBRARIES})
- set(Protobuf_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS})
-endif()
+add_library(proto-objects OBJECT proto/gsf.proto proto/play_common.proto proto/play_document.proto proto/play_respone.proto proto/play_settings.proto proto/play_toc.proto proto/play_download.proto proto/play_filter_rules.proto proto/play_ownership.proto proto/play_containers.proto proto/play_link.proto proto/play_device_config.proto proto/play_search.proto proto/play_browse.proto proto/play_details.proto)
-protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS proto/gsf.proto proto/play_common.proto proto/play_document.proto proto/play_respone.proto proto/play_settings.proto proto/play_toc.proto proto/play_download.proto proto/play_filter_rules.proto proto/play_ownership.proto proto/play_containers.proto proto/play_link.proto proto/play_device_config.proto proto/play_search.proto proto/play_browse.proto proto/play_details.proto)
+target_link_libraries(proto-objects PUBLIC protobuf::libprotobuf)
+
+#set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
+set(PROTO_IMPORT_DIRS "${CMAKE_CURRENT_LIST_DIR}/proto")
+
+protobuf_generate(
+ TARGET proto-objects
+ IMPORT_DIRS ${PROTO_IMPORT_DIRS})
set(LIB_UTIL_SOURCE_FILES lib/playapi/util/http.cpp include/playapi/util/http.h lib/playapi/util/config.cpp include/playapi/util/config.h lib/playapi/util/rand.cpp include/playapi/util/rand.h lib/playapi/util/base64.cpp include/playapi/util/base64.h)
set(LIB_SOURCE_FILES lib/playapi/login.cpp include/playapi/login.h lib/playapi/device_info.cpp include/playapi/device_info.h lib/playapi/checkin.cpp include/playapi/checkin.h include/playapi/api.h lib/playapi/api.cpp lib/playapi/experiments.cpp include/playapi/experiments.h include/playapi/login_cache.h include/playapi/file_login_cache.h lib/playapi/file_login_cache.cpp include/playapi/task.h include/playapi/http_task.h)
-add_library(gplayapi STATIC ${LIB_SOURCE_FILES} ${LIB_UTIL_SOURCE_FILES} ${PROTO_SRCS})
-target_link_libraries(gplayapi ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} ${Protobuf_LIBRARIES} Threads::Threads)
-target_include_directories(gplayapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CURL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ${Protobuf_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
+add_library(gplayapi STATIC ${LIB_SOURCE_FILES} ${LIB_UTIL_SOURCE_FILES})
+target_link_libraries(gplayapi ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} proto-objects Threads::Threads)
+target_include_directories(gplayapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CURL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} "$<BUILD_INTERFACE:${PROTO_BINARY_DIR}>" ${CMAKE_CURRENT_BINARY_DIR})
add_executable(gplaydl src/gplaydl.cpp src/common.cpp src/config.cpp src/config.h)
target_link_libraries(gplaydl gplayapi)
--
2.45.2