From a1d43d23533e0846c1dd3d8eb264c54b63112ac9 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sun, 19 Nov 2023 19:40:20 -0800 Subject: [PATCH] Remove default AUTOUIC=ON from all non-ui targets. Fixed yaml target not added correctly on Vcpkg. Fixed gui odom processing time. --- CMakeLists.txt | 8 +++++--- examples/NoEventsExample/CMakeLists.txt | 8 ++++++++ examples/RGBDMapping/CMakeLists.txt | 8 ++++++++ examples/WifiMapping/CMakeLists.txt | 8 ++++++++ guilib/src/CMakeLists.txt | 3 +++ guilib/src/MainWindow.cpp | 3 ++- tools/EurocDataset/CMakeLists.txt | 7 +++++-- 7 files changed, 39 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c14cb659b7..3fdc00062a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,9 +325,11 @@ IF(WITH_QT) ENDIF() IF(QT4_FOUND OR Qt5_FOUND OR Qt6_FOUND) - set(CMAKE_AUTOUIC ON) - set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTORCC ON) + # For VCPKG build, set those global variables to off, + # we will enable them for jsut specific targets + set(CMAKE_AUTOMOC OFF) + set(CMAKE_AUTORCC OFF) + set(CMAKE_AUTOUIC OFF) IF("${VTK_MAJOR_VERSION}" EQUAL 5) FIND_PACKAGE(QVTK REQUIRED) # only for VTK 5 ELSE() diff --git a/examples/NoEventsExample/CMakeLists.txt b/examples/NoEventsExample/CMakeLists.txt index e72092e00b..e7e074d34a 100644 --- a/examples/NoEventsExample/CMakeLists.txt +++ b/examples/NoEventsExample/CMakeLists.txt @@ -23,6 +23,14 @@ ADD_EXECUTABLE(noEventsExample main.cpp ${moc_srcs}) TARGET_LINK_LIBRARIES(noEventsExample rtabmap::gui) +SET_TARGET_PROPERTIES( + noEventsExample + PROPERTIES + AUTOUIC ON + AUTOMOC ON + AUTORCC ON +) + if(internal) SET_TARGET_PROPERTIES( noEventsExample PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-noEventsExample) diff --git a/examples/RGBDMapping/CMakeLists.txt b/examples/RGBDMapping/CMakeLists.txt index b0ee3b01f4..6f6a53104a 100644 --- a/examples/RGBDMapping/CMakeLists.txt +++ b/examples/RGBDMapping/CMakeLists.txt @@ -23,6 +23,14 @@ ADD_EXECUTABLE(rgbd_mapping main.cpp ${moc_srcs}) TARGET_LINK_LIBRARIES(rgbd_mapping rtabmap::gui) +SET_TARGET_PROPERTIES( + rgbd_mapping + PROPERTIES + AUTOUIC ON + AUTOMOC ON + AUTORCC ON +) + if(internal) SET_TARGET_PROPERTIES( rgbd_mapping PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-rgbd_mapping) diff --git a/examples/WifiMapping/CMakeLists.txt b/examples/WifiMapping/CMakeLists.txt index c6e3e6c418..0614c99e1c 100644 --- a/examples/WifiMapping/CMakeLists.txt +++ b/examples/WifiMapping/CMakeLists.txt @@ -42,6 +42,14 @@ ENDIF(APPLE) ADD_EXECUTABLE(wifi_mapping ${srcs} ${moc_srcs}) TARGET_LINK_LIBRARIES(wifi_mapping rtabmap::gui ${LIBRARIES}) +SET_TARGET_PROPERTIES( + wifi_mapping + PROPERTIES + AUTOUIC ON + AUTOMOC ON + AUTORCC ON +) + if(internal) SET_TARGET_PROPERTIES( wifi_mapping PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-wifi_mapping) diff --git a/guilib/src/CMakeLists.txt b/guilib/src/CMakeLists.txt index 45012a2fb1..e53c105411 100644 --- a/guilib/src/CMakeLists.txt +++ b/guilib/src/CMakeLists.txt @@ -199,6 +199,9 @@ SET_TARGET_PROPERTIES( VERSION ${RTABMAP_VERSION} SOVERSION ${RTABMAP_MAJOR_VERSION}.${RTABMAP_MINOR_VERSION} EXPORT_NAME "gui" + AUTOUIC ON + AUTOMOC ON + AUTORCC ON ) INSTALL(TARGETS rtabmap_gui EXPORT rtabmap_guiTargets diff --git a/guilib/src/MainWindow.cpp b/guilib/src/MainWindow.cpp index 8a5908497e..059a1dfdb8 100644 --- a/guilib/src/MainWindow.cpp +++ b/guilib/src/MainWindow.cpp @@ -1018,6 +1018,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI UDEBUG(""); _processingOdometry = true; UTimer time; + UTimer timeTotal; // Process Data // Set color code as tooltip @@ -1898,7 +1899,7 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataI _ui->statsToolBox->updateStat("Odometry/Distance/m", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), odom.info().distanceTravelled, _preferencesDialog->isCacheSavedInFigures()); } - _ui->statsToolBox->updateStat("GUI/Refresh odom/ms", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), time.elapsed()*1000.0, _preferencesDialog->isCacheSavedInFigures()); + _ui->statsToolBox->updateStat("GUI/Refresh odom/ms", _preferencesDialog->isTimeUsedInFigures()?data->stamp()-_firstStamp:(float)data->id(), timeTotal.elapsed()*1000.0, _preferencesDialog->isCacheSavedInFigures()); UDEBUG("Time updating Stats toolbox: %fs", time.ticks()); } _processingOdometry = false; diff --git a/tools/EurocDataset/CMakeLists.txt b/tools/EurocDataset/CMakeLists.txt index 6598decbdc..e766ee1321 100644 --- a/tools/EurocDataset/CMakeLists.txt +++ b/tools/EurocDataset/CMakeLists.txt @@ -2,9 +2,12 @@ FIND_PACKAGE(yaml-cpp QUIET) IF(yaml-cpp_FOUND) - # yaml-cpp 0.8.0 uses the wrong target in YAML_CPP_LIBRARIES. - IF(yaml-cpp_VERSION VERSION_EQUAL "0.8.0") + IF (TARGET yaml-cpp::yaml-cpp) + # yaml-cpp 0.8.0 uses target yaml-cpp::yaml-cpp. SET(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp) + ELSEIF (TARGET yaml-cpp) + # yaml-cpp 0.7.0 uses target yaml-cpp (VCPKG). + SET(YAML_CPP_LIBRARIES yaml-cpp) ENDIF() ELSE() find_package(PkgConfig QUIET)