fix: allow everything to build/test without FLAC support

This commit is contained in:
Marcus Holland-Moritz 2023-12-28 20:57:44 +01:00
parent 17295ffdad
commit fa60881ad9
4 changed files with 22 additions and 2 deletions

View File

@ -31,6 +31,7 @@ option(WITH_TESTS "build with tests" OFF)
option(WITH_BENCHMARKS "build with benchmarks" OFF)
option(WITH_FUZZ "build with fuzzing binaries" OFF)
option(ENABLE_PERFMON "enable performance monitor in all tools" ON)
option(ENABLE_FLAC "build with FLAC support" ON)
if(WIN32)
set(PREFER_SYSTEM_LIBFMT ON)
set(PREFER_SYSTEM_ZSTD ON)
@ -223,7 +224,9 @@ if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBBROTLIENC IMPORTED_TARGET libbrotlienc>=1.0.9)
pkg_check_modules(LIBARCHIVE IMPORTED_TARGET libarchive>=3.6.0)
# pkg_check_modules(LIBMAGIC IMPORTED_TARGET libmagic>=5.38)
pkg_check_modules(FLAC IMPORTED_TARGET flac++>=1.4.2)
if(ENABLE_FLAC)
pkg_check_modules(FLAC IMPORTED_TARGET flac++>=1.4.2)
endif()
pkg_check_modules(ZSTD IMPORTED_TARGET libzstd>=1.5.2)
pkg_check_modules(XXHASH IMPORTED_TARGET libxxhash>=0.8.1)
endif()

View File

@ -251,7 +251,11 @@ const std::unordered_map<std::string, std::vector<std::string>>
// clang-format off
{"--order", {"pcmaudio/waveform::revpath"}},
{"--window-size", {"pcmaudio/waveform::0"}},
#ifdef DWARFS_HAVE_FLAC
{"--compression", {"pcmaudio/waveform::flac:level=3"}},
#else
{"--compression", {"pcmaudio/waveform::zstd:level=3"}},
#endif
// clang-format on
};
@ -260,7 +264,11 @@ const std::unordered_map<std::string, std::vector<std::string>>
// clang-format off
{"--order", {"pcmaudio/waveform::revpath"}},
{"--window-size", {"pcmaudio/waveform::20"}},
#ifdef DWARFS_HAVE_FLAC
{"--compression", {"pcmaudio/waveform::flac:level=5"}},
#else
{"--compression", {"pcmaudio/waveform::zstd:level=5"}},
#endif
// clang-format on
};
@ -268,7 +276,11 @@ const std::unordered_map<std::string, std::vector<std::string>>
categorize_defaults_slow{
// clang-format off
{"--window-size", {"pcmaudio/waveform::16"}},
#ifdef DWARFS_HAVE_FLAC
{"--compression", {"pcmaudio/waveform::flac:level=8"}},
#else
{"--compression", {"pcmaudio/waveform::zstd:level=8"}},
#endif
// clang-format on
};

Binary file not shown.

View File

@ -1249,7 +1249,12 @@ TEST_P(tools_test, categorize) {
"--recompress=block",
"--recompress-categories=pcmaudio/waveform",
"-C",
"pcmaudio/waveform::flac:level=8"};
#ifdef DWARFS_HAVE_FLAC
"pcmaudio/waveform::flac:level=8"
#else
"pcmaudio/waveform::zstd:level=19"
#endif
};
ASSERT_TRUE(subprocess::check_run(*mkdwarfs_test_bin, mkdwarfs_tool_arg,
mkdwarfs_args_recompress));