1 { lib, stdenv, fetchFromGitHub, cmake, fmt_8, fetchpatch
2 , staticBuild ? stdenv.hostPlatform.isStatic
6 generic = { version, sha256 }:
11 src = fetchFromGitHub {
18 # in master post 1.10.0, see https://github.com/gabime/spdlog/issues/2380
19 patches = lib.optional (lib.versionAtLeast version "1.4.1") (fetchpatch {
20 name = "fix-pkg-config.patch";
21 url = "https://github.com/gabime/spdlog/commit/afb69071d5346b84e38fbcb0c8c32eddfef02a55.patch";
22 sha256 = "0cab2bbv8zyfhrhfvcyfwf5p2fddlq5hs2maampn5w18f6jhvk6q";
25 nativeBuildInputs = [ cmake ];
26 # spdlog <1.3 uses a bundled version of fmt
27 propagatedBuildInputs = lib.optional (lib.versionAtLeast version "1.3") fmt_8;
30 "-DSPDLOG_BUILD_SHARED=${if staticBuild then "OFF" else "ON"}"
31 "-DSPDLOG_BUILD_STATIC=${if staticBuild then "ON" else "OFF"}"
32 "-DSPDLOG_BUILD_EXAMPLE=OFF"
33 "-DSPDLOG_BUILD_BENCH=OFF"
34 "-DSPDLOG_BUILD_TESTS=ON"
35 "-DSPDLOG_FMT_EXTERNAL=ON"
38 outputs = [ "out" "doc" ]
39 # spdlog <1.4 is header only, no need to split libraries and headers
40 ++ lib.optional (lib.versionAtLeast version "1.4") "dev";
43 mkdir -p $out/share/doc/spdlog
44 cp -rv ../example $out/share/doc/spdlog
50 description = "Very fast, header only, C++ logging library";
51 homepage = "https://github.com/gabime/spdlog";
52 license = licenses.mit;
53 maintainers = with maintainers; [ obadz ];
54 platforms = platforms.all;
61 sha256 = "sha256-c6s27lQCXKx6S1FhZ/LiKh14GnXMhZtD1doltU4Avws=";
66 sha256 = "112kfh4fbpm5cvrmgbgz4d8s802db91mhyjpg7cwhlywffnzkwr9";