opencascade-occt: add optional vtk dependency

+38 -4
+24 -4
pkgs/by-name/op/opencascade-occt/package.nix
··· 13 libXext, 14 libXmu, 15 libXi, 16 - }: 17 18 stdenv.mkDerivation rec { 19 pname = "opencascade-occt"; 20 version = "7.8.1"; ··· 33 url = "https://github.com/Open-Cascade-SAS/OCCT/commit/7236e83dcc1e7284e66dc61e612154617ef715d6.diff"; 34 hash = "sha256-NoC2mE3DG78Y0c9UWonx1vmXoU4g5XxFUT3eVXqLU60="; 35 }) 36 ]; 37 38 nativeBuildInputs = [ ··· 49 libXmu 50 libXi 51 rapidjson 52 - ]; 53 54 NIX_CFLAGS_COMPILE = [ "-fpermissive" ]; 55 - cmakeFlags = [ "-DUSE_RAPIDJSON=ON" ]; 56 57 meta = with lib; { 58 description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation"; ··· 63 maintainers = with maintainers; [ amiloradovsky ]; 64 platforms = platforms.all; 65 }; 66 - 67 }
··· 13 libXext, 14 libXmu, 15 libXi, 16 + vtk, 17 + withVtk ? false, 18 19 + # used in passthru.tests 20 + opencascade-occt, 21 + }: 22 stdenv.mkDerivation rec { 23 pname = "opencascade-occt"; 24 version = "7.8.1"; ··· 37 url = "https://github.com/Open-Cascade-SAS/OCCT/commit/7236e83dcc1e7284e66dc61e612154617ef715d6.diff"; 38 hash = "sha256-NoC2mE3DG78Y0c9UWonx1vmXoU4g5XxFUT3eVXqLU60="; 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 44 ]; 45 46 nativeBuildInputs = [ ··· 57 libXmu 58 libXi 59 rapidjson 60 + ] 61 + ++ lib.optional withVtk vtk; 62 63 NIX_CFLAGS_COMPILE = [ "-fpermissive" ]; 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 + }; 77 78 meta = with lib; { 79 description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation"; ··· 84 maintainers = with maintainers; [ amiloradovsky ]; 85 platforms = platforms.all; 86 }; 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")