nixpkgs/pkgs/development/libraries/nlohmann_json/default.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

2021-09-07 19:30:30 +01:00
{ stdenv
, lib
, fetchFromGitHub
, cmake
2017-06-28 21:23:34 +01:00
}:
2021-09-07 19:30:30 +01:00
let
testData = fetchFromGitHub {
owner = "nlohmann";
repo = "json_test_data";
rev = "v3.0.0";
sha256 = "O6p2PFB7c2KE9VqWvmTaFywbW1hSzAP5V42EuemX+ls=";
};
in stdenv.mkDerivation rec {
pname = "nlohmann_json";
2021-09-07 19:35:22 +01:00
version = "3.10.2";
src = fetchFromGitHub {
owner = "nlohmann";
repo = "json";
rev = "v${version}";
2021-09-07 19:35:22 +01:00
sha256 = "/OFNfukrIyfJmD0ko174aud9T6ZOesHANJjyfk4q/Vs=";
};
nativeBuildInputs = [ cmake ];
2018-07-23 20:47:09 +01:00
cmakeFlags = [
"-DBuildTests=${if doCheck then "ON" else "OFF"}"
"-DJSON_MultipleHeaders=ON"
2021-09-07 19:30:30 +01:00
] ++ lib.optional doCheck "-DJSON_TestDataDirectory=${testData}";
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
2021-09-07 19:30:30 +01:00
# skip tests that require git or modify “installed files”
preCheck = ''
checkFlagsArray+=("ARGS=-LE 'not_reproducible|git_required'")
'';
2018-08-08 19:57:55 +01:00
postInstall = "rm -rf $out/lib64";
meta = with lib; {
description = "JSON for Modern C++";
homepage = "https://json.nlohmann.me";
changelog = "https://github.com/nlohmann/json/blob/develop/ChangeLog.md";
license = licenses.mit;
platforms = platforms.all;
};
}