Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / spdlog / default.nix
blobff42a5ba3b5c39be5184edb6582f4902790fd25f
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , cmake
6 , fmt
7 , catch2_3
8 , staticBuild ? stdenv.hostPlatform.isStatic
10 # tests
11 , bear, tiledb
14 stdenv.mkDerivation rec {
15   pname = "spdlog";
16   version = "1.12.0";
18   src = fetchFromGitHub {
19     owner = "gabime";
20     repo  = "spdlog";
21     rev   = "v${version}";
22     hash  = "sha256-cxTaOuLXHRU8xMz9gluYz0a93O0ez2xOxbloyc1m1ns=";
23   };
25   patches = [
26     # Fix a broken test, remove with the next release.
27     (fetchpatch {
28       url = "https://github.com/gabime/spdlog/commit/2ee8bac78e6525a8ad9a9196e65d502ce390d83a.patch";
29       hash = "sha256-L79yOkm3VY01jmxNctfneTLmOA5DEQeNNGC8LbpJiOc=";
30     })
31   ];
33   nativeBuildInputs = [ cmake ];
34   # Required to build tests, even if they aren't executed
35   buildInputs = [ catch2_3 ];
36   propagatedBuildInputs = [ fmt ];
38   cmakeFlags = [
39     "-DSPDLOG_BUILD_SHARED=${if staticBuild then "OFF" else "ON"}"
40     "-DSPDLOG_BUILD_STATIC=${if staticBuild then "ON" else "OFF"}"
41     "-DSPDLOG_BUILD_EXAMPLE=OFF"
42     "-DSPDLOG_BUILD_BENCH=OFF"
43     "-DSPDLOG_BUILD_TESTS=ON"
44     "-DSPDLOG_FMT_EXTERNAL=ON"
45   ];
47   outputs = [ "out" "doc" "dev" ] ;
49   postInstall = ''
50     mkdir -p $out/share/doc/spdlog
51     cp -rv ../example $out/share/doc/spdlog
52   '';
54   doCheck = true;
56   passthru.tests = {
57     inherit bear tiledb;
58   };
60   meta = with lib; {
61     description    = "Very fast, header only, C++ logging library";
62     homepage       = "https://github.com/gabime/spdlog";
63     license        = licenses.mit;
64     maintainers    = with maintainers; [ obadz ];
65     platforms      = platforms.all;
66   };