From 527a7c63f61376a12f51c9190ea63c67c0c6d02b Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 17 Feb 2024 22:52:55 +0100 Subject: [PATCH] add zstd dep --- external/CMakeLists.txt | 19 +++++++++++++++++++ flake.nix | 2 ++ 2 files changed, 21 insertions(+) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 0748b3fd..cbcdf2c6 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -28,3 +28,22 @@ if (NOT TARGET nlohmann_json::nlohmann_json) FetchContent_MakeAvailable(json) endif() +if (NOT TARGET zstd::zstd) + # TODO: try find_package() first + # TODO: try pkg-config next (will work on most distros) + + set(ZSTD_BUILD_STATIC ON) + set(ZSTD_BUILD_SHARED OFF) + set(ZSTD_BUILD_PROGRAMS OFF) + set(ZSTD_BUILD_CONTRIB OFF) + set(ZSTD_BUILD_TESTS OFF) + FetchContent_Declare(zstd + URL "https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz" + DOWNLOAD_EXTRACT_TIMESTAMP TRUE + SOURCE_SUBDIR build/cmake + EXCLUDE_FROM_ALL + ) + FetchContent_MakeAvailable(zstd) + + add_library(zstd::zstd ALIAS libzstd_static) +endif() diff --git a/flake.nix b/flake.nix index 9f580c7a..8210243e 100644 --- a/flake.nix +++ b/flake.nix @@ -58,8 +58,10 @@ cmakeFlags = [ "-DTOMATO_ASAN=OFF" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" + "-DFETCHCONTENT_SOURCE_DIR_JSON=${pkgs.nlohmann_json.src}" # we care less about version here # do we really care less about the version? do we need a stable abi? + "-DFETCHCONTENT_SOURCE_DIR_ZSTD=${pkgs.zstd.src}" ]; # TODO: replace with install command