From 7dcb506183a36db2e044879301765619bef9add4 Mon Sep 17 00:00:00 2001 From: cpasjuste Date: Thu, 18 Apr 2024 15:19:07 +0200 Subject: [PATCH] cmake: hopefully fix minizip dep --- CMakeLists.txt | 1 - src/skeleton/CMakeLists.txt | 15 +++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79c782c..6be2ba2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,6 @@ add_subdirectory(external/libcross2d) #################### set(OPTION_EMU OFF CACHE STRING "Emulator to build (pfbneo, pnes, psnes)") set(OPTION_BUILTIN_LIBCONFIG OFF CACHE BOOL "Build libconfig from sources") -set(OPTION_BUILTIN_MINIZIP OFF CACHE BOOL "Build minizip from sources") set(OPTION_MPV_PLAYER ON CACHE BOOL "Add support for video snaps (mpv)") set(OPTION_UPDATE_CONFIG OFF CACHE BOOL "Force config file updating") #################### diff --git a/src/skeleton/CMakeLists.txt b/src/skeleton/CMakeLists.txt index 37939c7..ecdd7e0 100644 --- a/src/skeleton/CMakeLists.txt +++ b/src/skeleton/CMakeLists.txt @@ -6,6 +6,8 @@ project(cross2dui) ################# # libcross2dui ################# +include(FindPkgConfig) + set(CROSS2DUI_INCLUDE ..) file(GLOB CROSS2DUI_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/*.c* @@ -26,7 +28,6 @@ if (OPTION_MPV_PLAYER) if (PLATFORM_WINDOWS) list(APPEND LDFLAGS mpv.dll.a) else () - include(FindPkgConfig) pkg_search_module(MPV REQUIRED mpv) list(APPEND CROSS2DUI_INCLUDE ${MPV_INCLUDE_DIRS}) list(APPEND LDFLAGS ${MPV_LIBRARIES}) @@ -34,17 +35,19 @@ if (OPTION_MPV_PLAYER) list(APPEND FLAGS -D__MPV__) endif () -if (OPTION_BUILTIN_MINIZIP) +# minizip +pkg_search_module(MINIZIP minizip) +if (MINIZIP_FOUND) + list(APPEND CROSS2DUI_INCLUDE ${MINIZIP_INCLUDE_DIRS}) + list(APPEND LDFLAGS ${MINIZIP_LIBRARIES}) +else () + message(WARNING "minizip not found, using embedded one...") list(APPEND CROSS2DUI_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/external) list(APPEND CROSS2DUI_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/ioapi.c ${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/zip.c ${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/unzip.c) list(APPEND FLAGS -DIOAPI_NO_64 -DUSE_FILE32API) -else () - pkg_search_module(MINIZIP REQUIRED minizip) - list(APPEND CROSS2DUI_INCLUDE ${MINIZIP_INCLUDE_DIRS}) - list(APPEND LDFLAGS ${MINIZIP_LIBRARIES}) endif () if (PLATFORM_LINUX OR PLATFORM_WINDOWS)