Ease requirements on library versions

This commit is contained in:
Marcus Holland-Moritz 2020-11-22 17:48:19 +01:00
parent 7c1b048f66
commit 4d26b50c36
2 changed files with 16 additions and 7 deletions

View File

@ -18,7 +18,7 @@
project(dwarfs) project(dwarfs)
cmake_minimum_required(VERSION 3.18) cmake_minimum_required(VERSION 3.13.4)
option(WITH_TESTS "build with tests" OFF) option(WITH_TESTS "build with tests" OFF)
@ -43,10 +43,10 @@ find_package(PkgConfig REQUIRED)
find_package(Boost 1.67 REQUIRED COMPONENTS date_time filesystem find_package(Boost 1.67 REQUIRED COMPONENTS date_time filesystem
program_options system) program_options system)
pkg_check_modules(FUSE3 REQUIRED IMPORTED_TARGET fuse3>=3.9.1) pkg_check_modules(FUSE3 REQUIRED IMPORTED_TARGET fuse3>=3.4.1)
pkg_check_modules(LIBLZ4 IMPORTED_TARGET liblz4>=1.9.2) pkg_check_modules(LIBLZ4 IMPORTED_TARGET liblz4>=1.8.3)
pkg_check_modules(LIBLZMA IMPORTED_TARGET liblzma>=5.2.5) pkg_check_modules(LIBLZMA IMPORTED_TARGET liblzma>=5.2.4)
pkg_check_modules(LIBZSTD IMPORTED_TARGET libzstd>=1.4.4) pkg_check_modules(LIBZSTD IMPORTED_TARGET libzstd>=1.3.8)
add_subdirectory(folly EXCLUDE_FROM_ALL) add_subdirectory(folly EXCLUDE_FROM_ALL)

View File

@ -38,7 +38,7 @@
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/gen/String.h> #include <folly/gen/String.h>
#if DWARFS_HAVE_LIBZSTD #ifdef DWARFS_HAVE_LIBZSTD
#include <zstd.h> #include <zstd.h>
#endif #endif
@ -63,6 +63,15 @@ using namespace dwarfs;
namespace { namespace {
#ifdef DWARFS_HAVE_LIBZSTD
#if ZSTD_VERSION_MAJOR > 1 || \
(ZSTD_VERSION_MAJOR == 1 && ZSTD_VERSION_MINOR >= 4)
#define ZSTD_MIN_LEVEL ZSTD_minCLevel()
#else
#define ZSTD_MIN_LEVEL 1
#endif
#endif
#ifdef DWARFS_HAVE_LUA #ifdef DWARFS_HAVE_LUA
constexpr const char* script_name = "dwarfs.lua"; constexpr const char* script_name = "dwarfs.lua";
#endif #endif
@ -322,7 +331,7 @@ int mkdwarfs(int argc, char** argv) {
#ifdef DWARFS_HAVE_LIBZSTD #ifdef DWARFS_HAVE_LIBZSTD
" zstd ZSTD compression\n" " zstd ZSTD compression\n"
" level=[" " level=["
<< ZSTD_minCLevel() << ".." << ZSTD_maxCLevel() << ZSTD_MIN_LEVEL << ".." << ZSTD_maxCLevel()
<< "]\n" << "]\n"
#endif #endif
#ifdef DWARFS_HAVE_LIBLZMA #ifdef DWARFS_HAVE_LIBLZMA