2023-02-16 17:41:37 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, static ? stdenv.hostPlatform.isStatic,
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gtest";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "1.12.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "googletest";
|
|
|
|
rev = "release-${version}";
|
2022-08-12 12:06:08 +00:00
|
|
|
hash = "sha256-W+OxRTVtemt2esw4P7IyGWXOonUN5ZuscjvzqkYvZbM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./fix-cmake-config-includedir.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
|
2023-03-04 12:14:45 +00:00
|
|
|
] ++ lib.optionals (
|
|
|
|
(stdenv.cc.isGNU && (lib.versionOlder stdenv.cc.version "11.0"))
|
|
|
|
|| (stdenv.cc.isClang && (lib.versionOlder stdenv.cc.version "16.0"))
|
|
|
|
) [
|
2023-02-16 17:41:37 +00:00
|
|
|
# Enable C++17 support
|
|
|
|
# https://github.com/google/googletest/issues/3081
|
|
|
|
"-DCMAKE_CXX_STANDARD=17"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Google's framework for writing C++ tests";
|
|
|
|
homepage = "https://github.com/google/googletest";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ ivan-tkatchev ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|