Unverified Commit 4c36f071 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

freecad-qt6: Qt6 version (with wayland per default) (#360531)

parents 8e3b25f1 3378e522
Loading
Loading
Loading
Loading
+202 −173
Original line number Diff line number Diff line
{ lib
, callPackage
, cmake
, coin3d
, doxygen
, eigen
, fetchFromGitHub
, fmt
, gfortran
, gts
, hdf5
, libf2c
, libGLU
, libredwg
, libsForQt5
, libspnav
, libXmu
, medfile
, mpi
, ninja
, ode
, opencascade-occt_7_6
, pkg-config
, python311Packages
, spaceNavSupport ? stdenv.hostPlatform.isLinux
, ifcSupport ? false
, stdenv
, swig
, vtk
, wrapGAppsHook3
, xercesc
, yaml-cpp
, zlib
, withWayland ? false
{
  lib,
  callPackage,
  cmake,
  coin3d,
  doxygen,
  eigen,
  fetchFromGitHub,
  fmt,
  gfortran,
  gts,
  hdf5,
  libf2c,
  libGLU,
  libredwg,
  libsForQt5,
  libspnav,
  libXmu,
  medfile,
  mpi,
  ninja,
  ode,
  opencascade-occt_7_6,
  opencascade-occt,
  pkg-config,
  python311Packages,
  spaceNavSupport ? stdenv.hostPlatform.isLinux,
  ifcSupport ? false,
  stdenv,
  swig,
  vtk,
  wrapGAppsHook3,
  xercesc,
  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
@@ -52,18 +46,22 @@ let
    matplotlib
    pivy
    ply
    py-slvs
    pybind11
    pycollada
    pyside2
    pyside2-tools
    pyside6
    python
    pyyaml
    scipy
    shiboken2
    shiboken6
    ;
  freecad-utils = callPackage ./freecad-utils.nix { };
in
freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
freecad-utils.makeCustomizable (
  stdenv.mkDerivation (finalAttrs: {
    pname = "freecad";
    version = "1.0.0";

@@ -75,24 +73,28 @@ freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
      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
@@ -102,36 +104,48 @@ freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
        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
@@ -139,14 +153,17 @@ freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
      ./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"
        (
@@ -156,6 +173,19 @@ freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
          + ";${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
@@ -167,12 +197,10 @@ freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
      qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH")
    '';

  qtWrapperArgs =
    [
    qtWrapperArgs = [
      "--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1"
      "--prefix PATH : ${libredwg}/bin"
    ]
    ++ lib.optionals (!withWayland) [ "--set QT_QPA_PLATFORM xcb" ];
    ] ++ lib.optionals (!withWayland) [ "--set QT_QPA_PLATFORM xcb" ];

    postFixup = ''
      mv $out/share/doc $out
@@ -205,4 +233,5 @@ freecad-utils.makeCustomizable (stdenv.mkDerivation (finalAttrs: {
      maintainers = with lib.maintainers; [ srounce ];
      platforms = lib.platforms.linux;
    };
}))
  })
)
+1 −0
Original line number Diff line number Diff line
@@ -16074,6 +16074,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;