diff --git a/cad/freecad/Makefile b/cad/freecad/Makefile index 4f8d87554a63..b10760856548 100644 --- a/cad/freecad/Makefile +++ b/cad/freecad/Makefile @@ -1,134 +1,137 @@ PORTNAME= FreeCAD DISTVERSION= 1.0.0 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= cad MAINTAINER= cmt@FreeBSD.org COMMENT= General purpose 3D CAD modeller WWW= https://www.freecadweb.org/ LICENSE= LGPL20+ LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= doxygen:devel/doxygen \ pybind11-config:devel/py-pybind11@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyside6-tools>0:devel/pyside6-tools@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pivy>0:graphics/py-pivy@${PY_FLAVOR} \ ${PYTHON_SITELIBDIR}/matplotlib/__init__.py:math/py-matplotlib@${PY_FLAVOR} \ ${PYTHON_INCLUDEDIR}/CXX/Config.hxx:devel/py-cxx \ microsoft-gsl>0:devel/microsoft-gsl \ googletest>0:devel/googletest \ swig:devel/swig # the ffmpeg4 dependency is inherited via cad/opencascade LIB_DEPENDS= libexpat.so:textproc/expat2 \ libyaml-cpp.so:devel/yaml-cpp \ libfreetype.so:print/freetype2 \ libtbb.so:devel/onetbb \ ${PY_BOOST} \ libpyside6.abi3.so:devel/pyside6@${PY_FLAVOR} \ libCoin.so:graphics/Coin \ libfmt.so:devel/libfmt \ libpng.so:graphics/png \ libtiff.so:graphics/tiff \ libvtksys-${VTK_VER}.so:math/vtk${VTK_VER:R} \ libTKernel.so:cad/opencascade \ libxerces-c.so:textproc/xerces-c3 \ libboost_thread.so:devel/boost-libs \ libfontconfig.so:x11-fonts/fontconfig \ libfreeimage.so:graphics/freeimage \ libavutil.so.58:multimedia/ffmpeg \ libavformat.so.58:multimedia/ffmpeg4 \ libmed.so:french/med \ libshiboken6.abi3.so:devel/shiboken6@${PY_FLAVOR} \ libhdf5.so:science/hdf5 RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pivy>0:graphics/py-pivy@${PY_FLAVOR} \ ${PYTHON_SITELIBDIR}/matplotlib/__init__.py:math/py-matplotlib@${PY_FLAVOR} USES= dos2unix compiler:c++17-lang cmake cpe gl eigen:3 fortran gmake jpeg \ localbase:ldflags mpi:openmpi pkgconfig python localbase qt:6 xorg \ desktop-file-utils shared-mime-info shebangfix USE_GITHUB= yes GH_ACCOUNT= Ondsel-Development:ondselsolver GH_PROJECT= OndselSolver:ondselsolver GH_TAGNAME= 91f70382beeb58b32432b5a82da3802e4c19199c:ondselsolver GH_SUBDIR= src/3rdParty/OndselSolver:ondselsolver USE_XORG= ice sm x11 xext xt USE_GL= gl glu USE_QT= base declarative location svg tools webchannel USE_LDCONFIG= yes CPE_VENDOR= freecad_project VTK_VER= 9.2 DOS2UNIX_GLOB= *.txt *.h *.cpp *.py *.qss *.csv *.pov *.stp *.ui *.wrl *.WRL SHEBANG_FILES= src/Tools/freecad-thumbnailer # our HDF5/CMake integration is messy, so workarounds are required below CMAKE_ARGS+= -DOCC_INCLUDE_DIR="${LOCALBASE}/include/OpenCASCADE" \ -DOPENMPI_INCLUDE_DIRS="${LOCALBASE}/mpi/openmpi/include" \ -DFREECAD_QT_VERSION="6" \ -DPYTHON_LIBRARY="${PYTHONBASE}/lib/libpython${PYTHON_VER}${PYTHON_ABIVER}.so" \ -DPYTHON_INCLUDE_DIR="${PYTHON_INCLUDEDIR}" \ -DPYTHON_PACKAGES_PATH="${PYTHON_SITELIBDIR}" \ -DPYTHON_EXECUTABLE="${PYTHON_CMD}" \ -DPYCXX_INCLUDE_DIR="${PYTHON_INCLUDEDIR}" \ -DBUILD_ASSEMBLY="ON" \ -DBUILD_DESIGNER_PLUGIN="ON" \ -DBUILD_FLAT_MESH="ON" \ -DBUILD_TEST="OFF" \ -DENABLE_DEVELOPER_TESTS="OFF" \ -DBUILD_VR="OFF" \ -DFREECAD_LIBPACK_USE="OFF" \ -DFREECAD_USE_EXTERNAL_FMT="ON" \ -DFREECAD_CREATE_MAC_APP="OFF" \ -DFREECAD_FREECAD_LIBPACK_USE="OFF" \ -DFREECAD_USE_EXTERNAL_KDL="OFF" \ -DFREECAD_USE_EXTERNAL_SMESH="OFF" \ -DFREECAD_USE_FREETYPE="ON" \ -DFREECAD_USE_PYBIND11="ON" \ -DUSE_CUDA="OFF" \ -DUSE_OPENCV="OFF" \ -Dpybind11_DIR="${PYTHON_SITELIBDIR}/pybind11/share/cmake/pybind11" \ -DHDF5_CFLAGS="-I${LOCALBASE}/include" \ -DHDF5_FOUND=TRUE \ -DHDF5_VERSION="1.12.2" \ -DHDF5_INCLUDE_DIRS="${LOCALBASE}/include/hdf5" \ -DHDF5_LIBRARIES="-L${LOCALBASE}/lib -lhdf5" \ -DHDF5_LIBRARY_DIRS="${LOCALBASE}/lib" \ -DBUILD_ENABLE_CXX_STD=C++17 \ -DXDG_DATADIR="${PREFIX}/share" CMAKE_INSTALL_PREFIX= ${PREFIX}/${PORTNAME} -OPTIONS_DEFINE= COLLADA +OPTIONS_DEFINE= COLLADA SPNAV COLLADA_DESC= Install pycollada for Collada files import COLLADA_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pycollada>0:graphics/py-pycollada@${PY_FLAVOR} +SPNAV_DESC= Enable libspnav (SpaceMouse) support +SPNAV_CMAKE_BOOL= FREECAD_SPNAV_SUPPORT +SPNAV_LIB_DEPENDS= libspnav.so:misc/libspnav .include .if ${ARCH} == aarch64 || ${ARCH} == amd64 || ${ARCH} == i386 PLIST_SUB= WEBENGINE="" USE_QT+= webengine .else CMAKE_ARGS+= -DBUILD_WEB:BOOL=OFF PLIST_SUB= WEBENGINE="@comment " .endif pre-configure: @${REINPLACE_CMD} -e '/self\.rev/s/Unknown/${DISTVERSION:C/.*-//}/' \ ${WRKSRC}/src/Tools/SubWCRev.py # Install XDG icons and files to the standard path @${REINPLACE_CMD} -e 's/CMAKE_INSTALL_DATAROOTDIR/XDG_DATADIR/g' \ ${WRKSRC}/src/XDGData/CMakeLists.txt \ ${WRKSRC}/src/Gui/CMakeLists.txt post-install: ${LN} -s ../${PORTNAME}/bin/FreeCAD ${STAGEDIR}${LOCALBASE}/bin/FreeCAD ${LN} -s ../${PORTNAME}/bin/FreeCADCmd ${STAGEDIR}${LOCALBASE}/bin/FreeCADCmd ${INSTALL_SCRIPT} ${WRKSRC}/src/Tools/freecad-thumbnailer \ ${STAGEDIR}${PREFIX}/bin/freecad-thumbnailer .include diff --git a/cad/freecad/files/patch-spnav-support b/cad/freecad/files/patch-spnav-support new file mode 100644 index 000000000000..e9b364d61f60 --- /dev/null +++ b/cad/freecad/files/patch-spnav-support @@ -0,0 +1,94 @@ +commit f2b872ba4dc509622bda2d86ce42e2464d40832b +Author: Christoph Moench-Tegeder +Date: Mon Mar 24 01:03:53 2025 +0100 + + attempt to fix building with libspnav + +diff --git cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake +index e9aa47fd6e..826c510ef0 100644 +--- cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake ++++ cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake +@@ -142,6 +142,7 @@ macro(InitializeFreeCADBuildOptions) + option(BUILD_CLOUD "Build the FreeCAD cloud module" OFF) + option(ENABLE_DEVELOPER_TESTS "Build the FreeCAD unit tests suit" ON) + ++ option(FREECAD_SPNAV_SUPPORT "Enable libspnav support" OFF) + if(MSVC) + set(FREECAD_3DCONNEXION_SUPPORT "NavLib" CACHE STRING "Select version of the 3Dconnexion device integration") + set_property(CACHE FREECAD_3DCONNEXION_SUPPORT PROPERTY STRINGS "NavLib" "Raw input") +diff --git src/Gui/CMakeLists.txt src/Gui/CMakeLists.txt +index 642f58568f..52cc393875 100644 +--- src/Gui/CMakeLists.txt ++++ src/Gui/CMakeLists.txt +@@ -133,7 +133,8 @@ if(${Qt5WinExtras_FOUND}) + ) + endif() + +-IF(SPNAV_FOUND) ++IF(FREECAD_SPNAV_SUPPORT AND SPNAV_FOUND) ++ add_definitions(-D_USE_3DCONNEXION_SDK) + if(SPNAV_USE_X11) + add_definitions(-DSPNAV_USE_X11) + if (FREECAD_QT_MAJOR_VERSION EQUAL 5 AND UNIX AND NOT APPLE) +@@ -175,7 +176,11 @@ IF(SPNAV_FOUND) + list(APPEND FreeCADGui_LIBS + ${SPNAV_LIBRARIES} + ) +-ENDIF(SPNAV_FOUND) ++ENDIF(FREECAD_SPNAV_SUPPORT AND SPNAV_FOUND) ++ ++IF(FREECAD_SPNAV_SUPPORT AND NOT SPNAV_FOUND) ++ MESSAGE(FATAL_ERROR "libspnav support requested but libspnav not found") ++ENDIF(FREECAD_SPNAV_SUPPORT AND NOT SPNAV_FOUND) + + IF(OCULUS_FOUND) + add_definitions(-DOCULUS_FOUND) +diff --git src/Gui/GuiApplicationNativeEventAware.cpp src/Gui/GuiApplicationNativeEventAware.cpp +index ba41901472..c0cf3c7666 100644 +--- src/Gui/GuiApplicationNativeEventAware.cpp ++++ src/Gui/GuiApplicationNativeEventAware.cpp +@@ -33,7 +33,7 @@ + + + #if defined(_USE_3DCONNEXION_SDK) || defined(SPNAV_FOUND) +-#if defined(Q_OS_LINUX) ++#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) + #if defined(SPNAV_USE_X11) + #include "3Dconnexion/GuiNativeEventLinuxX11.h" + #else +@@ -59,7 +59,15 @@ Gui::GUIApplicationNativeEventAware::~GUIApplicationNativeEventAware() = default + void Gui::GUIApplicationNativeEventAware::initSpaceball(QMainWindow *window) + { + #if defined(_USE_3DCONNEXION_SDK) || defined(SPNAV_FOUND) ++# if defined(USE_3DCONNEXION_NAVLIB) ++ ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath( ++ "User parameter:BaseApp/Preferences/View"); ++ if (nativeEvent && hViewGrp->GetBool("LegacySpaceMouseDevices", false)) { ++ nativeEvent->initSpaceball(window); ++ } ++# else + nativeEvent->initSpaceball(window); ++# endif + #else + Q_UNUSED(window); + #endif +diff --git src/Gui/View3DInventorViewer.cpp src/Gui/View3DInventorViewer.cpp +index 694f834583..d32c2486b5 100644 +--- src/Gui/View3DInventorViewer.cpp ++++ src/Gui/View3DInventorViewer.cpp +@@ -555,7 +555,15 @@ void View3DInventorViewer::init() + //filter a few qt events + viewerEventFilter = new ViewerEventFilter; + installEventFilter(viewerEventFilter); ++#if defined(USE_3DCONNEXION_NAVLIB) ++ ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath( ++ "User parameter:BaseApp/Preferences/View"); ++ if (hViewGrp->GetBool("LegacySpaceMouseDevices", false)) { ++ getEventFilter()->registerInputDevice(new SpaceNavigatorDevice); ++ } ++#else + getEventFilter()->registerInputDevice(new SpaceNavigatorDevice); ++#endif + getEventFilter()->registerInputDevice(new GesturesDevice(this)); + + try{