4dd8b822e6
This in-game download manager allows users to fetch assets, such as cars, tracks or drivers, from a configurable list of servers following a specific JSON schema. Several smaller classes have been designed to assist the download manager: - entry: defines an entry in the assets lists and its state. - thumbnail: defines a visible entry on the list, will always match one entry. - writebuf: allows dumping a file downloaded over HTTP{S} to memory. - writefile: allows dumping a file downloaded over HTTP{S} to a file. - unzip: a higher-level, C++ wrapper to minizip. It was also required to implement a function that removed directories recursively, namely rmdir_r. Since this is not portable accross POSIX and Windows systems, their respective implementations have been provided on src/libs/portability. The following dependencies have been added: - libcurl: HTTP{S} operations, already required by webserver. - OpenSSL: hash calculation. - minizip: zip extraction, it required its on Findminizip.cmake as it is not provided by upstream CMake. - zlib: required by minizip. git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9490 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 915908c54f5ea8d7f6926943b2fea670e9973bea Former-commit-id: 9cb2a8874779f6b4d9d6201f3d8af8b29c067a13
54 lines
1.4 KiB
CMake
54 lines
1.4 KiB
CMake
# Copyright (C) 2024 Xavier Del Campo Romero
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
find_path(minizip_INCLUDE_DIRS
|
|
NAMES
|
|
minizip/crypt.h
|
|
minizip/ioapi.h
|
|
minizip/mztools.h
|
|
minizip/unzip.h
|
|
minizip/zip.h
|
|
HINTS
|
|
ENV minizip_PATH
|
|
PATH_SUFFIXES
|
|
include
|
|
)
|
|
|
|
find_library(minizip_LIBRARIES
|
|
NAMES
|
|
minizip
|
|
HINTS
|
|
ENV minizip_PATH
|
|
PATH_SUFFIXES
|
|
lib
|
|
)
|
|
|
|
set(regex_path "${minizip_INCLUDE_DIRS}/minizip/unzip.h")
|
|
|
|
if(minizip_INCLUDE_DIRS AND EXISTS ${regex_path})
|
|
set(version_regex "^[ \t]+Version ([0-9\.]+).+$")
|
|
file(STRINGS ${regex_path} minizip_VERSION_LINE REGEX ${version_regex})
|
|
string(REGEX REPLACE ${version_regex} "\\1" minizip_VERSION "${minizip_VERSION_LINE}")
|
|
unset(minizip_VERSION_LINE)
|
|
unset(version_regex)
|
|
endif()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(minizip
|
|
REQUIRED_VARS
|
|
minizip_LIBRARIES minizip_INCLUDE_DIRS
|
|
VERSION_VAR
|
|
minizip_VERSION
|
|
)
|
|
|
|
if(minizip_FOUND)
|
|
if(NOT TARGET minizip::minizip)
|
|
add_library(minizip::minizip INTERFACE IMPORTED)
|
|
target_include_directories(minizip::minizip
|
|
INTERFACE "${minizip_INCLUDE_DIRS}")
|
|
set_target_properties(minizip::minizip PROPERTIES
|
|
IMPORTED_LOCATION "${minizip_LIBRARIES}")
|
|
endif()
|
|
endif()
|