Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 62 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 python3, 7}: 8 9stdenv.mkDerivation rec { 10 pname = "catch2"; 11 version = "3.8.1"; 12 13 src = fetchFromGitHub { 14 owner = "catchorg"; 15 repo = "Catch2"; 16 rev = "v${version}"; 17 hash = "sha256-blhSdtNXwe4wKPVKlopsE0omgikMdl12JjwqASwJM2w="; 18 }; 19 20 nativeBuildInputs = [ 21 cmake 22 ]; 23 24 hardeningDisable = [ "trivialautovarinit" ]; 25 26 cmakeFlags = 27 [ 28 "-DCATCH_DEVELOPMENT_BUILD=ON" 29 "-DCATCH_BUILD_TESTING=${if doCheck then "ON" else "OFF"}" 30 "-DCATCH_ENABLE_WERROR=OFF" 31 ] 32 ++ lib.optionals (stdenv.hostPlatform.isDarwin && doCheck) [ 33 # test has a faulty path normalization technique that won't work in 34 # our darwin build environment https://github.com/catchorg/Catch2/issues/1691 35 "-DCMAKE_CTEST_ARGUMENTS=-E;ApprovalTests" 36 ]; 37 38 env = 39 lib.optionalAttrs stdenv.hostPlatform.isx86_32 { 40 # Tests fail on x86_32 if compiled with x87 floats: https://github.com/catchorg/Catch2/issues/2796 41 NIX_CFLAGS_COMPILE = "-msse2 -mfpmath=sse"; 42 } 43 // lib.optionalAttrs (stdenv.hostPlatform.isRiscV || stdenv.hostPlatform.isAarch32) { 44 # Build failure caused by -Werror: https://github.com/catchorg/Catch2/issues/2808 45 NIX_CFLAGS_COMPILE = "-Wno-error=cast-align"; 46 }; 47 48 doCheck = true; 49 50 nativeCheckInputs = [ 51 python3 52 ]; 53 54 meta = { 55 description = "Modern, C++-native, test framework for unit-tests"; 56 homepage = "https://github.com/catchorg/Catch2"; 57 changelog = "https://github.com/catchorg/Catch2/blob/${src.rev}/docs/release-notes.md"; 58 license = lib.licenses.boost; 59 maintainers = with lib.maintainers; [ dotlambda ]; 60 platforms = with lib.platforms; unix ++ windows; 61 }; 62}