1{ lib, stdenv, fetchFromGitHub, cmake, fmt
2, staticBuild ? stdenv.hostPlatform.isStatic
3}:
4
5stdenv.mkDerivation rec {
6 pname = "spdlog";
7 version = "1.11.0";
8
9 src = fetchFromGitHub {
10 owner = "gabime";
11 repo = "spdlog";
12 rev = "v${version}";
13 hash = "sha256-kA2MAb4/EygjwiLEjF9EA7k8Tk//nwcKB1+HlzELakQ=";
14 };
15
16 nativeBuildInputs = [ cmake ];
17 propagatedBuildInputs = [ fmt ];
18
19 cmakeFlags = [
20 "-DSPDLOG_BUILD_SHARED=${if staticBuild then "OFF" else "ON"}"
21 "-DSPDLOG_BUILD_STATIC=${if staticBuild then "ON" else "OFF"}"
22 "-DSPDLOG_BUILD_EXAMPLE=OFF"
23 "-DSPDLOG_BUILD_BENCH=OFF"
24 "-DSPDLOG_BUILD_TESTS=ON"
25 "-DSPDLOG_FMT_EXTERNAL=ON"
26 ];
27
28 outputs = [ "out" "doc" "dev" ] ;
29
30 postInstall = ''
31 mkdir -p $out/share/doc/spdlog
32 cp -rv ../example $out/share/doc/spdlog
33 '';
34
35 doCheck = true;
36
37 meta = with lib; {
38 description = "Very fast, header only, C++ logging library";
39 homepage = "https://github.com/gabime/spdlog";
40 license = licenses.mit;
41 maintainers = with maintainers; [ obadz ];
42 platforms = platforms.all;
43 };
44}