Merge pull request #186559 from NickCao/rapidjson

rapidjson: fix cross compilation, cleanup checkPhase
This commit is contained in:
Nick Cao 2023-01-27 08:24:32 +08:00 committed by GitHub
commit 0a216732d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,7 @@
, pkg-config
, cmake
, gtest
, valgrind
}:
stdenv.mkDerivation rec {
@ -36,24 +37,12 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config cmake ];
cmakeFlags = [
"-DGTEST_SOURCE_DIR=${gtest.dev}/include"
] ++ lib.optionals (!doCheck) [
"-DRAPIDJSON_BUILD_TESTS=OFF"
];
nativeCheckInputs = [
gtest
];
checkPhase = ''
runHook preCheck
ctest -E '.*valgrind.*'
runHook postCheck
'';
# for tests, adding gtest to checkInputs does not work
# https://github.com/NixOS/nixpkgs/pull/212200
buildInputs = [ gtest ];
cmakeFlags = [ "-DGTEST_SOURCE_DIR=${gtest.dev}/include" ];
nativeCheckInputs = [ valgrind ];
doCheck = !stdenv.hostPlatform.isStatic;
meta = with lib; {