Commit 3378e522 authored by ppenguin's avatar ppenguin Committed by Weijia Wang
Browse files

freecad-qt6: init (with wayland per default)

Includes following changes:

- remove duplicates with freecad (Qt5)
- refactor to use one derivation for both Qt5 and Qt6 builds
- add py-slvs (runtime dep for ondsel assy solver) -> will also fix
freecad (Qt5) upon merge
parent 7de50b43
Loading
Loading
Loading
Loading
+81 −53
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
  ninja,
  ode,
  opencascade-occt_7_6,
  opencascade-occt,
  pkg-config,
  python311Packages,
  spaceNavSupport ? stdenv.hostPlatform.isLinux,
@@ -33,19 +34,11 @@
  yaml-cpp,
  zlib,
  withWayland ? false,
  qtVersion ? 5,
  qt5,
  qt6,
}:
let
  opencascade-occt = opencascade-occt_7_6;
  inherit (libsForQt5)
    qtbase
    qttools
    qtwebengine
    qtx11extras
    qtxmlpatterns
    soqt
    wrapQtAppsHook
    ;
  inherit (libsForQt5.qt5) qtwayland;
  inherit (python311Packages)
    boost
    gitpython
@@ -53,14 +46,17 @@ let
    matplotlib
    pivy
    ply
    py-slvs
    pybind11
    pycollada
    pyside2
    pyside2-tools
    pyside6
    python
    pyyaml
    scipy
    shiboken2
    shiboken6
    ;
  freecad-utils = callPackage ./freecad-utils.nix { };
in
@@ -77,24 +73,28 @@ freecad-utils.makeCustomizable (
      fetchSubmodules = true;
    };

    nativeBuildInputs = [
    nativeBuildInputs =
      [
        cmake
        ninja
        pkg-config
      pyside2-tools
        gfortran
      wrapQtAppsHook
        wrapGAppsHook3
    ];
      ]
      ++ lib.optionals (qtVersion == 5) [
        pyside2-tools
        qt5.wrapQtAppsHook
      ]
      ++ lib.optionals (qtVersion == 6) [ qt6.wrapQtAppsHook ];

    buildInputs =
      [
        gitpython # for addon manager
        boost
        coin3d
        doxygen
        eigen
        fmt
        gitpython # for addon manager
        gts
        hdf5
        libGLU
@@ -104,36 +104,48 @@ freecad-utils.makeCustomizable (
        medfile
        mpi
        ode
        opencascade-occt
        pivy
        ply # for openSCAD file support
        py-slvs
        pybind11
        pycollada
        pyside2
        pyside2-tools
        python
        pyyaml # (at least for) PyrateWorkbench
        qtbase
        qttools
        qtwayland
        qtwebengine
        qtxmlpatterns
        scipy
        shiboken2
        soqt
        swig
        vtk
        xercesc
        yaml-cpp
        zlib
      ]
      ++ lib.optionals spaceNavSupport [
        libspnav
        qtx11extras
      ++ lib.optionals (qtVersion == 5) [
        libsForQt5.soqt
        opencascade-occt_7_6
        pyside2
        pyside2-tools
        shiboken2
        qt5.qtbase
        qt5.qttools
        qt5.qtwayland
        qt5.qtwebengine
        qt5.qtxmlpatterns
      ]
      ++ lib.optionals (qtVersion == 6) [
        opencascade-occt
        pyside6
        shiboken6
        qt6.qtbase
        qt6.qtsvg
        qt6.qttools
        qt6.qtwayland
        qt6.qtwebengine
      ]
      ++ lib.optionals ifcSupport [
        ifcopenshell
      ];
      ]
      ++ lib.optionals spaceNavSupport (
        [ libspnav ] ++ lib.optionals (qtVersion == 5) [ libsForQt5.qtx11extras ]
      );

    patches = [
      ./0001-NIXOS-don-t-ignore-PYTHONPATH.patch
@@ -141,14 +153,17 @@ freecad-utils.makeCustomizable (
      ./0003-Gui-take-in-account-module-path-argument.patch
    ];

    cmakeFlags = [
    cmakeFlags =
      [
        "-Wno-dev" # turns off warnings which otherwise makes it hard to see what is going on
        "-DBUILD_FLAT_MESH:BOOL=ON"
      "-DBUILD_QT5=ON"
        "-DBUILD_DRAWING=ON"
        "-DBUILD_FLAT_MESH:BOOL=ON"
        "-DINSTALL_TO_SITEPACKAGES=OFF"
        "-DFREECAD_USE_PYBIND11=ON"
      ]
      ++ lib.optionals (qtVersion == 5) [
        "-DBUILD_QT5=ON"
        "-DSHIBOKEN_INCLUDE_DIR=${shiboken2}/include"
        "-DSHIBOKEN_LIBRARY=Shiboken2::libshiboken"
        (
@@ -158,6 +173,19 @@ freecad-utils.makeCustomizable (
          + ";${pyside2}/include/PySide2/QtGui"
        )
        "-DPYSIDE_LIBRARY=PySide2::pyside2"
      ]
      ++ lib.optionals (qtVersion == 6) [
        "-DBUILD_QT5=OFF"
        "-DBUILD_QT6=ON"
        "-DSHIBOKEN_INCLUDE_DIR=${shiboken6}/include"
        "-DSHIBOKEN_LIBRARY=Shiboken6::libshiboken"
        (
          "-DPYSIDE_INCLUDE_DIR=${pyside6}/include"
          + ";${pyside6}/include/PySide6/QtCore"
          + ";${pyside6}/include/PySide6/QtWidgets"
          + ";${pyside6}/include/PySide6/QtGui"
        )
        "-DPYSIDE_LIBRARY=PySide6::pyside6"
      ];

    # This should work on both x86_64, and i686 linux
+1 −0
Original line number Diff line number Diff line
@@ -16129,6 +16129,7 @@ with pkgs;
  flightgear = libsForQt5.callPackage ../games/flightgear { };
  freecad-wayland = freecad.override { withWayland = true; };
  freecad-qt6 = freecad.override { withWayland = true; qtVersion = 6; };
  freeciv = callPackage ../games/freeciv {
    sdl2Client = false;