linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / spdlog / default.nix
blob0c75bdb9dd846f4cf4d0b14e40ac5c3da050406d
1 { lib, stdenv, fetchFromGitHub, cmake, fmt }:
3 let
4   generic = { version, sha256 }:
5     stdenv.mkDerivation {
6       pname = "spdlog";
7       inherit version;
9       src = fetchFromGitHub {
10         owner  = "gabime";
11         repo   = "spdlog";
12         rev    = "v${version}";
13         inherit sha256;
14       };
16       nativeBuildInputs = [ cmake ];
17       # spdlog <1.3 uses a bundled version of fmt
18       propagatedBuildInputs = lib.optional (lib.versionAtLeast version "1.3") fmt;
20       cmakeFlags = [
21         "-DSPDLOG_BUILD_SHARED=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
22         "-DSPDLOG_BUILD_STATIC=${if stdenv.hostPlatform.isStatic then "ON" else "OFF"}"
23         "-DSPDLOG_BUILD_EXAMPLE=OFF"
24         "-DSPDLOG_BUILD_BENCH=OFF"
25         "-DSPDLOG_BUILD_TESTS=ON"
26         "-DSPDLOG_FMT_EXTERNAL=ON"
27       ];
29       outputs = [ "out" "doc" ]
30         # spdlog <1.4 is header only, no need to split libraries and headers
31         ++ lib.optional (lib.versionAtLeast version "1.4") "dev";
33       postInstall = ''
34         mkdir -p $out/share/doc/spdlog
35         cp -rv ../example $out/share/doc/spdlog
36       '';
38       doCheck = true;
39       preCheck = "export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH";
41       meta = with lib; {
42         description    = "Very fast, header only, C++ logging library";
43         homepage       = "https://github.com/gabime/spdlog";
44         license        = licenses.mit;
45         maintainers    = with maintainers; [ obadz ];
46         platforms      = platforms.all;
47       };
48     };
51   spdlog_1 = generic {
52     version = "1.8.5";
53     sha256 = "sha256-D29jvDZQhPscaOHlrzGN1s7/mXlcsovjbqYpXd7OM50=";
54   };
56   spdlog_0 = generic {
57     version = "0.17.0";
58     sha256 = "112kfh4fbpm5cvrmgbgz4d8s802db91mhyjpg7cwhlywffnzkwr9";
59   };