From ded409f0da14ccc83dcd6d62d5756e0b75b382e1 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 11 Oct 2022 19:52:02 -0700 Subject: [PATCH] CMake: Include zip/7z deps for updater --- CMakeLists.txt | 15 +++++++++------ src/util/CMakeLists.txt | 20 ++++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c6ee194b..ce8e4d687 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -640,14 +640,15 @@ endif() if(USE_LIBZIP) if(TARGET libzip::zip) - list(APPEND DEPENDENCY_LIB libzip::zip) + set(ZIP_LIBRARIES libzip::zip) elseif(TARGET zip) - list(APPEND DEPENDENCY_LIB zip) + set(ZIP_LIBRARIES zip) else() include_directories(AFTER ${LIBZIP_INCLUDE_DIRS}) link_directories(${LIBZIP_LIBRARY_DIRS}) - list(APPEND DEPENDENCY_LIB ${LIBZIP_LIBRARIES}) + set(ZIP_LIBRARIES ${LIBZIP_LIBRARIES}) endif() + list(APPEND DEPENDENCY_LIB ${ZIP_LIBRARIES}) list(APPEND FEATURES LIBZIP) list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c) string(REGEX MATCH "^[0-9]+" LIBZIP_VERSION_MAJOR "${libzip_VERSION}") @@ -661,6 +662,7 @@ if(USE_LIBZIP) elseif(USE_MINIZIP) include_directories(AFTER ${MINIZIP_INCLUDE_DIRS}) link_directories(${MINIZIP_LIBRARY_DIRS}) + set(ZIP_LIBRARIES ${MINIZIP_LIBRARIES}) list(APPEND DEPENDENCY_LIB ${MINIZIP_LIBRARIES}) list(APPEND FEATURES MINIZIP) list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c) @@ -789,6 +791,7 @@ add_subdirectory(src/sm83) add_subdirectory(src/util) list(APPEND GUI_SRC ${EXTRA_GUI_SRC}) +list(APPEND UTIL_BASE_SRC ${CMAKE_CURRENT_BINARY_DIR}/version.c) list(APPEND UTIL_SRC ${CMAKE_CURRENT_BINARY_DIR}/version.c) set(TEST_SRC ${CORE_TEST_SRC}) @@ -979,12 +982,12 @@ if(BUILD_QT AND (WIN32 OR APPLE OR CMAKE_SYSTEM_NAME STREQUAL "Linux")) endif() if(BUILD_UPDATER) - add_executable(updater-stub WIN32 ${CORE_VFS_SRC} ${OS_SRC} ${UTIL_SRC} ${THIRD_PARTY_SRC} + add_executable(updater-stub WIN32 ${CORE_VFS_SRC} ${VFS_SRC} ${OS_SRC} ${UTIL_BASE_SRC} ${THIRD_PARTY_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/core/config.c ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater.c ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater-main.c) - target_link_libraries(updater-stub ${OS_LIB} ${PLATFORM_LIBRARY}) - set_target_properties(updater-stub PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FUNCTION_DEFINES};BUILD_STATIC") + target_link_libraries(updater-stub ${ZLIB_LIBRARY} ${ZLIB_LIBRARY} ${ZIP_LIBRARIES} ${OS_LIB} ${PLATFORM_LIBRARY}) + set_target_properties(updater-stub PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FUNCTION_DEFINES};${FEATURE_DEFINES};BUILD_STATIC") if(MSVC) set_target_properties(updater-stub PROPERTIES LINK_FLAGS /ENTRY:mainCRTStartup) else() diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 8d86f7b60..e4d03d343 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -1,24 +1,27 @@ include(ExportDirectory) -set(SOURCE_FILES +set(BASE_SOURCE_FILES circle-buffer.c configuration.c - convolve.c crc32.c - elf-read.c - export.c formatting.c gbk-table.c hash.c + string.c + table.c + vfs.c) + +set(SOURCE_FILES + ${BASE_SOURCE_FILES} + convolve.c + elf-read.c + export.c patch.c patch-fast.c patch-ips.c patch-ups.c png-io.c ring-fifo.c - string.c - table.c - text-codec.c - vfs.c) + text-codec.c) set(GUI_FILES gui.c @@ -43,6 +46,7 @@ source_group("Utilities" FILES ${SOURCE_FILES}) source_group("GUI source" FILES ${GUI_FILES}) source_group("Utilities tests" FILES ${TEST_FILES}) +export_directory(UTIL_BASE BASE_SOURCE_FILES) export_directory(UTIL SOURCE_FILES) export_directory(GUI GUI_FILES) export_directory(UTIL_TEST TEST_FILES)