opencascade-occt: add optional vtk dependency

+38 -4
+24 -4
pkgs/by-name/op/opencascade-occt/package.nix
··· 13 13 libXext, 14 14 libXmu, 15 15 libXi, 16 - }: 16 + vtk, 17 + withVtk ? false, 17 18 19 + # used in passthru.tests 20 + opencascade-occt, 21 + }: 18 22 stdenv.mkDerivation rec { 19 23 pname = "opencascade-occt"; 20 24 version = "7.8.1"; ··· 33 37 url = "https://github.com/Open-Cascade-SAS/OCCT/commit/7236e83dcc1e7284e66dc61e612154617ef715d6.diff"; 34 38 hash = "sha256-NoC2mE3DG78Y0c9UWonx1vmXoU4g5XxFUT3eVXqLU60="; 35 39 }) 40 + 41 + # patch does not apply against 7.9+, it was submitted upstream for future 42 + # inclusion: https://github.com/Open-Cascade-SAS/OCCT/pull/683 43 + ./vtk-draw-conditional-glx.patch 36 44 ]; 37 45 38 46 nativeBuildInputs = [ ··· 49 57 libXmu 50 58 libXi 51 59 rapidjson 52 - ]; 60 + ] 61 + ++ lib.optional withVtk vtk; 53 62 54 63 NIX_CFLAGS_COMPILE = [ "-fpermissive" ]; 55 - cmakeFlags = [ "-DUSE_RAPIDJSON=ON" ]; 64 + cmakeFlags = [ 65 + "-DUSE_RAPIDJSON=ON" 66 + ] 67 + ++ lib.optionals withVtk [ 68 + (lib.cmakeBool "USE_VTK" true) 69 + (lib.cmakeFeature "3RDPARTY_VTK_INCLUDE_DIR" "${lib.getDev vtk}/include/vtk") 70 + ]; 71 + 72 + passthru = { 73 + tests = { 74 + withVtk = opencascade-occt.override ({ withVtk = true; }); 75 + }; 76 + }; 56 77 57 78 meta = with lib; { 58 79 description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation"; ··· 63 84 maintainers = with maintainers; [ amiloradovsky ]; 64 85 platforms = platforms.all; 65 86 }; 66 - 67 87 }
+14
pkgs/by-name/op/opencascade-occt/vtk-draw-conditional-glx.patch
··· 1 + diff --git a/CMakeLists.txt b/CMakeLists.txt 2 + index 86905287dc..19214e8f2d 100644 3 + --- a/CMakeLists.txt 4 + +++ b/CMakeLists.txt 5 + @@ -623,5 +623,9 @@ if (USE_VTK) 6 + add_definitions (-DHAVE_VTK) 7 + set (OCCT_VTK_USED_TARGETS "" CACHE INTERNAL "" FORCE) 8 + OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk") 9 + + if (DEFINED VTK_USE_X AND NOT VTK_USE_X) 10 + + message (STATUS "Info: TKIVtkDraw toolkits excluded due to VTK has no glx support") 11 + + list (REMOVE_ITEM BUILD_TOOLKITS TKIVtkDraw) 12 + + endif() 13 + else() 14 + OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK")