From 4308069bf1b3d5207e6f69472a05444ca9fa2d7a Mon Sep 17 00:00:00 2001 From: ckie Date: Wed, 9 Feb 2022 13:03:43 +0200 Subject: [PATCH] rtabmap: init at unstable-2022-02-07 --- .../rtabmap/0001-remove-printer-support.patch | 139 ++++++++++++++++++ pkgs/applications/video/rtabmap/default.nix | 59 ++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 200 insertions(+) create mode 100644 pkgs/applications/video/rtabmap/0001-remove-printer-support.patch create mode 100644 pkgs/applications/video/rtabmap/default.nix diff --git a/pkgs/applications/video/rtabmap/0001-remove-printer-support.patch b/pkgs/applications/video/rtabmap/0001-remove-printer-support.patch new file mode 100644 index 00000000000..f3b31ed9586 --- /dev/null +++ b/pkgs/applications/video/rtabmap/0001-remove-printer-support.patch @@ -0,0 +1,139 @@ +From c04ce502d29f7769efbff730d1f9060b8c24629a Mon Sep 17 00:00:00 2001 +From: ckie +Date: Tue, 8 Feb 2022 19:18:49 +0200 +Subject: [PATCH] remove printer support + +--- + app/src/CMakeLists.txt | 4 ++-- + guilib/src/CMakeLists.txt | 4 ++-- + guilib/src/GraphViewer.cpp | 12 +----------- + guilib/src/ImageView.cpp | 16 ---------------- + guilib/src/utilite/UPlot.cpp | 9 --------- + 5 files changed, 5 insertions(+), 40 deletions(-) + +diff --git a/app/src/CMakeLists.txt b/app/src/CMakeLists.txt +index b20a07d4..2cad8c1e 100644 +--- a/app/src/CMakeLists.txt ++++ b/app/src/CMakeLists.txt +@@ -63,9 +63,9 @@ ENDIF() + TARGET_LINK_LIBRARIES(rtabmap rtabmap_core rtabmap_gui rtabmap_utilite ${LIBRARIES}) + IF(Qt5_FOUND) + IF(Qt5Svg_FOUND) +- QT5_USE_MODULES(rtabmap Widgets Core Gui Svg PrintSupport) ++ QT5_USE_MODULES(rtabmap Widgets Core Gui Svg) + ELSE() +- QT5_USE_MODULES(rtabmap Widgets Core Gui PrintSupport) ++ QT5_USE_MODULES(rtabmap Widgets Core Gui) + ENDIF() + ENDIF(Qt5_FOUND) + +diff --git a/guilib/src/CMakeLists.txt b/guilib/src/CMakeLists.txt +index 3711205b..a393aa25 100644 +--- a/guilib/src/CMakeLists.txt ++++ b/guilib/src/CMakeLists.txt +@@ -208,9 +208,9 @@ ADD_LIBRARY(rtabmap_gui ${SRC_FILES}) + TARGET_LINK_LIBRARIES(rtabmap_gui rtabmap_core rtabmap_utilite ${LIBRARIES}) + IF(Qt5_FOUND) + IF(Qt5Svg_FOUND) +- QT5_USE_MODULES(rtabmap_gui Widgets Core Gui Svg PrintSupport) ++ QT5_USE_MODULES(rtabmap_gui Widgets Core Gui Svg) + ELSE() +- QT5_USE_MODULES(rtabmap_gui Widgets Core Gui PrintSupport) ++ QT5_USE_MODULES(rtabmap_gui Widgets Core Gui) + ENDIF() + ENDIF(Qt5_FOUND) + +diff --git a/guilib/src/GraphViewer.cpp b/guilib/src/GraphViewer.cpp +index 58907c34..7b41061f 100644 +--- a/guilib/src/GraphViewer.cpp ++++ b/guilib/src/GraphViewer.cpp +@@ -38,7 +38,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + #include + #include +-#include + #include + #ifdef QT_SVG_LIB + #include +@@ -2011,16 +2010,7 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event) + this->scene()->setSceneRect(this->scene()->itemsBoundingRect()); // Re-shrink the scene to it's bounding contents + QSize sceneSize = this->scene()->sceneRect().size().toSize(); + +- if(QFileInfo(filePath).suffix().compare("pdf") == 0) +- { +- QPrinter printer(QPrinter::HighResolution); +- printer.setOrientation(QPrinter::Portrait); +- printer.setOutputFileName( filePath ); +- QPainter p(&printer); +- scene()->render(&p); +- p.end(); +- } +- else if(QFileInfo(filePath).suffix().compare("svg") == 0) ++ if(QFileInfo(filePath).suffix().compare("svg") == 0) + { + #ifdef QT_SVG_LIB + QSvgGenerator svgGen; +diff --git a/guilib/src/ImageView.cpp b/guilib/src/ImageView.cpp +index 714f2d36..887e7bdc 100644 +--- a/guilib/src/ImageView.cpp ++++ b/guilib/src/ImageView.cpp +@@ -37,7 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + #include + #include +-#include + #include + #include "rtabmap/utilite/ULogger.h" + #include "rtabmap/gui/KeypointItem.h" +@@ -843,21 +842,6 @@ void ImageView::contextMenuEvent(QContextMenuEvent * e) + } + + _savedFileName = text; +- if(QFileInfo(text).suffix().compare("pdf") == 0) +- { +- QPrinter printer(QPrinter::HighResolution); +- printer.setOrientation(QPrinter::Portrait); +- printer.setOutputFileName( text ); +- QPainter p(&printer); +- p.begin(&printer); +- double xscale = printer.pageRect().width()/double(_graphicsView->sceneRect().width()); +- double yscale = printer.pageRect().height()/double(_graphicsView->sceneRect().height()); +- double scale = qMin(xscale, yscale); +- p.scale(scale, scale); +- _graphicsView->scene()->render(&p, _graphicsView->sceneRect(), _graphicsView->sceneRect()); +- p.end(); +- } +- else + { + QImage img(_graphicsView->sceneRect().width(), _graphicsView->sceneRect().height(), QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); +diff --git a/guilib/src/utilite/UPlot.cpp b/guilib/src/utilite/UPlot.cpp +index 1b11c65e..8bf94841 100644 +--- a/guilib/src/utilite/UPlot.cpp ++++ b/guilib/src/utilite/UPlot.cpp +@@ -42,7 +42,6 @@ + #include + #include + #include +-#include + #include + #include + #ifdef QT_SVG_LIB +@@ -2849,14 +2848,6 @@ void UPlot::contextMenuEvent(QContextMenuEvent * event) + else + { + #endif +- if(QFileInfo(text).suffix().compare("pdf") == 0) +- { +- QPrinter printer; +- printer.setOutputFormat(QPrinter::PdfFormat); +- printer.setOutputFileName(text); +- this->render(&printer); +- } +- else + { + QPixmap figure = QPixmap::grabWidget(this); + figure.save(text); +-- +2.34.1 + diff --git a/pkgs/applications/video/rtabmap/default.nix b/pkgs/applications/video/rtabmap/default.nix new file mode 100644 index 00000000000..c6429b09348 --- /dev/null +++ b/pkgs/applications/video/rtabmap/default.nix @@ -0,0 +1,59 @@ +{ lib, stdenv, fetchFromGitHub, pkg-config, cmake, opencv, pcl, libusb1, eigen +, wrapQtAppsHook, qtbase, g2o, ceres-solver, libpointmatcher, octomap, freenect +, libdc1394, librealsense, libGL, libGLU, vtkWithQt5, wrapGAppsHook }: + +stdenv.mkDerivation rec { + pname = "rtabmap"; + version = "unstable-2022-02-07"; + + src = fetchFromGitHub { + owner = "introlab"; + repo = "rtabmap"; + rev = "f584f42ea423c44138aa0668b5c8eb18f2978fe2"; + sha256 = "sha256-xotOcaz5XrmzwEKuVEQZoeq6fEVbACK7PSUW9kULH40="; + }; + + patches = [ + # Our Qt5 seems to be missing PrintSupport.. I think? + ./0001-remove-printer-support.patch + ]; + + nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook wrapGAppsHook ]; + buildInputs = [ + ## Required + opencv + pcl + ## Optional + libusb1 + eigen + g2o + ceres-solver + # libpointmatcher - ABI mismatch + octomap + freenect + libdc1394 + # librealsense - missing includedir + qtbase + libGL + libGLU + vtkWithQt5 + ]; + + # Disable warnings that are irrelevant to us as packagers + cmakeFlags = "-Wno-dev"; + + # We run one of the executables we build while the build is + # still running (and patchelf hasn't been invoked) which means + # the RPATH is not set correctly. This hacks around that error: + # + # build/bin/rtabmap-res_tool: error while loading shared libraries: librtabmap_utilite.so.0.20: cannot open shared object file: No such file or directory + LD_LIBRARY_PATH = "/build/source/build/bin"; + + meta = with lib; { + description = "Real-Time Appearance-Based 3D Mapping"; + homepage = "https://introlab.github.io/rtabmap/"; + license = licenses.bsd3; + maintainers = with maintainers; [ ckie ]; + platforms = with platforms; linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 82bd5f88666..37d66c2088f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9033,6 +9033,8 @@ with pkgs; rocket = libsForQt5.callPackage ../tools/graphics/rocket { }; + rtabmap = libsForQt5.callPackage ../applications/video/rtabmap/default.nix { }; + rtaudio = callPackage ../development/libraries/audio/rtaudio { jack = libjack2; inherit (darwin.apple_sdk.frameworks) CoreAudio;