lol

opencascade-occt: add optional vtk dependency (#433252)

authored by

Nick Cao and committed by
GitHub
6b64d134 e446c93d

+40 -4
+26 -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 + (lib.cmakeBool "USE_RAPIDJSON" true) 66 + # Enable exception handling for release builds. 67 + (lib.cmakeBool "BUILD_RELEASE_DISABLE_EXCEPTIONS" false) 68 + ] 69 + ++ lib.optionals withVtk [ 70 + (lib.cmakeBool "USE_VTK" true) 71 + (lib.cmakeFeature "3RDPARTY_VTK_INCLUDE_DIR" "${lib.getDev vtk}/include/vtk") 72 + ]; 73 + 74 + passthru = { 75 + tests = { 76 + withVtk = opencascade-occt.override ({ withVtk = true; }); 77 + }; 78 + }; 56 79 57 80 meta = with lib; { 58 81 description = "Open CASCADE Technology, libraries for 3D modeling and numerical simulation"; ··· 63 86 maintainers = with maintainers; [ amiloradovsky ]; 64 87 platforms = platforms.all; 65 88 }; 66 - 67 89 }
+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")