CMake: Include zip/7z deps for updater

This commit is contained in:
Vicki Pfau 2022-10-11 19:52:02 -07:00
parent ff772fce9d
commit ded409f0da
2 changed files with 21 additions and 14 deletions

View File

@ -640,14 +640,15 @@ endif()
if(USE_LIBZIP) if(USE_LIBZIP)
if(TARGET libzip::zip) if(TARGET libzip::zip)
list(APPEND DEPENDENCY_LIB libzip::zip) set(ZIP_LIBRARIES libzip::zip)
elseif(TARGET zip) elseif(TARGET zip)
list(APPEND DEPENDENCY_LIB zip) set(ZIP_LIBRARIES zip)
else() else()
include_directories(AFTER ${LIBZIP_INCLUDE_DIRS}) include_directories(AFTER ${LIBZIP_INCLUDE_DIRS})
link_directories(${LIBZIP_LIBRARY_DIRS}) link_directories(${LIBZIP_LIBRARY_DIRS})
list(APPEND DEPENDENCY_LIB ${LIBZIP_LIBRARIES}) set(ZIP_LIBRARIES ${LIBZIP_LIBRARIES})
endif() endif()
list(APPEND DEPENDENCY_LIB ${ZIP_LIBRARIES})
list(APPEND FEATURES LIBZIP) list(APPEND FEATURES LIBZIP)
list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c) list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c)
string(REGEX MATCH "^[0-9]+" LIBZIP_VERSION_MAJOR "${libzip_VERSION}") string(REGEX MATCH "^[0-9]+" LIBZIP_VERSION_MAJOR "${libzip_VERSION}")
@ -661,6 +662,7 @@ if(USE_LIBZIP)
elseif(USE_MINIZIP) elseif(USE_MINIZIP)
include_directories(AFTER ${MINIZIP_INCLUDE_DIRS}) include_directories(AFTER ${MINIZIP_INCLUDE_DIRS})
link_directories(${MINIZIP_LIBRARY_DIRS}) link_directories(${MINIZIP_LIBRARY_DIRS})
set(ZIP_LIBRARIES ${MINIZIP_LIBRARIES})
list(APPEND DEPENDENCY_LIB ${MINIZIP_LIBRARIES}) list(APPEND DEPENDENCY_LIB ${MINIZIP_LIBRARIES})
list(APPEND FEATURES MINIZIP) list(APPEND FEATURES MINIZIP)
list(APPEND VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/util/vfs/vfs-zip.c) 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) add_subdirectory(src/util)
list(APPEND GUI_SRC ${EXTRA_GUI_SRC}) 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) list(APPEND UTIL_SRC ${CMAKE_CURRENT_BINARY_DIR}/version.c)
set(TEST_SRC ${CORE_TEST_SRC}) set(TEST_SRC ${CORE_TEST_SRC})
@ -979,12 +982,12 @@ if(BUILD_QT AND (WIN32 OR APPLE OR CMAKE_SYSTEM_NAME STREQUAL "Linux"))
endif() endif()
if(BUILD_UPDATER) 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/core/config.c
${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater.c ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater.c
${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater-main.c) ${CMAKE_CURRENT_SOURCE_DIR}/src/feature/updater-main.c)
target_link_libraries(updater-stub ${OS_LIB} ${PLATFORM_LIBRARY}) 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};BUILD_STATIC") set_target_properties(updater-stub PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FUNCTION_DEFINES};${FEATURE_DEFINES};BUILD_STATIC")
if(MSVC) if(MSVC)
set_target_properties(updater-stub PROPERTIES LINK_FLAGS /ENTRY:mainCRTStartup) set_target_properties(updater-stub PROPERTIES LINK_FLAGS /ENTRY:mainCRTStartup)
else() else()

View File

@ -1,24 +1,27 @@
include(ExportDirectory) include(ExportDirectory)
set(SOURCE_FILES set(BASE_SOURCE_FILES
circle-buffer.c circle-buffer.c
configuration.c configuration.c
convolve.c
crc32.c crc32.c
elf-read.c
export.c
formatting.c formatting.c
gbk-table.c gbk-table.c
hash.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.c
patch-fast.c patch-fast.c
patch-ips.c patch-ips.c
patch-ups.c patch-ups.c
png-io.c png-io.c
ring-fifo.c ring-fifo.c
string.c text-codec.c)
table.c
text-codec.c
vfs.c)
set(GUI_FILES set(GUI_FILES
gui.c gui.c
@ -43,6 +46,7 @@ source_group("Utilities" FILES ${SOURCE_FILES})
source_group("GUI source" FILES ${GUI_FILES}) source_group("GUI source" FILES ${GUI_FILES})
source_group("Utilities tests" FILES ${TEST_FILES}) source_group("Utilities tests" FILES ${TEST_FILES})
export_directory(UTIL_BASE BASE_SOURCE_FILES)
export_directory(UTIL SOURCE_FILES) export_directory(UTIL SOURCE_FILES)
export_directory(GUI GUI_FILES) export_directory(GUI GUI_FILES)
export_directory(UTIL_TEST TEST_FILES) export_directory(UTIL_TEST TEST_FILES)