diff --git a/CMakeLists.txt b/CMakeLists.txt index 92fac13d4f..1e6da80afd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,6 +325,9 @@ 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) 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 5ddb54dfbd..e72092e00b 100644 --- a/examples/NoEventsExample/CMakeLists.txt +++ b/examples/NoEventsExample/CMakeLists.txt @@ -15,12 +15,8 @@ if(NOT internal) FIND_PACKAGE(RTABMap REQUIRED COMPONENTS gui) endif() -IF(QT4_FOUND) - QT4_WRAP_CPP(moc_srcs MapBuilder.h) -ELSEIF(Qt5_FOUND) - QT5_WRAP_CPP(moc_srcs MapBuilder.h) -ELSE() - QT6_WRAP_CPP(moc_srcs MapBuilder.h) +IF(QT4_FOUND OR Qt5_FOUND OR Qt6_FOUND) + SET(moc_srcs MapBuilder.h) ENDIF() ADD_EXECUTABLE(noEventsExample main.cpp ${moc_srcs}) diff --git a/examples/RGBDMapping/CMakeLists.txt b/examples/RGBDMapping/CMakeLists.txt index 33a30466ee..b0ee3b01f4 100644 --- a/examples/RGBDMapping/CMakeLists.txt +++ b/examples/RGBDMapping/CMakeLists.txt @@ -15,12 +15,8 @@ if(NOT internal) FIND_PACKAGE(RTABMap REQUIRED COMPONENTS gui) endif() -IF(QT4_FOUND) - QT4_WRAP_CPP(moc_srcs MapBuilder.h) -ELSEIF(Qt5_FOUND) - QT5_WRAP_CPP(moc_srcs MapBuilder.h) -ELSE() - QT6_WRAP_CPP(moc_srcs MapBuilder.h) +IF(QT4_FOUND OR Qt5_FOUND OR Qt6_FOUND) + SET(moc_srcs MapBuilder.h) ENDIF() ADD_EXECUTABLE(rgbd_mapping main.cpp ${moc_srcs}) diff --git a/examples/WifiMapping/CMakeLists.txt b/examples/WifiMapping/CMakeLists.txt index 8b029fa1e4..c6e3e6c418 100644 --- a/examples/WifiMapping/CMakeLists.txt +++ b/examples/WifiMapping/CMakeLists.txt @@ -15,12 +15,8 @@ if(NOT internal) FIND_PACKAGE(RTABMap REQUIRED) endif() -IF(QT4_FOUND) - QT4_WRAP_CPP(moc_srcs MapBuilder.h MapBuilderWifi.h) -ELSEIF(Qt5_FOUND) - QT5_WRAP_CPP(moc_srcs MapBuilder.h MapBuilderWifi.h) -ELSE() - QT6_WRAP_CPP(moc_srcs MapBuilder.h MapBuilderWifi.h) +IF(QT4_FOUND OR Qt5_FOUND OR Qt6_FOUND) + SET(moc_srcs MapBuilder.h MapBuilderWifi.h) ENDIF() SET(srcs diff --git a/guilib/src/CMakeLists.txt b/guilib/src/CMakeLists.txt index 349f6f9e10..45012a2fb1 100644 --- a/guilib/src/CMakeLists.txt +++ b/guilib/src/CMakeLists.txt @@ -38,46 +38,12 @@ SET(headers_ui ../include/${PROJECT_PREFIX}/gui/MultiSessionLocSubView.h ) -SET(uis - ./ui/mainWindow.ui - ./ui/preferencesDialog.ui - ./ui/aboutDialog.ui - ./ui/consoleWidget.ui - ./ui/DatabaseViewer.ui - ./ui/loopClosureViewer.ui - ./ui/exportDialog.ui - ./ui/postProcessingDialog.ui - ./ui/exportCloudsDialog.ui - ./ui/calibrationDialog.ui - ./ui/createSimpleCalibrationDialog.ui - ./ui/depthCalibrationDialog.ui - ./ui/exportBundlerDialog.ui - ./ui/editConstraintDialog.ui - ./ui/multiSessionLocSubView.ui -) - SET(qrc ./GuiLib.qrc ) -IF(QT4_FOUND) - # generate rules for building source files from the resources - QT4_ADD_RESOURCES(srcs_qrc ${qrc}) - - #Generate .h files from the .ui files - QT4_WRAP_UI(moc_uis ${uis}) - - #This will generate moc_* for Qt - QT4_WRAP_CPP(moc_srcs ${headers_ui}) - ### Qt Gui stuff end### -ELSEIF(Qt5_FOUND) - QT5_ADD_RESOURCES(srcs_qrc ${qrc}) - QT5_WRAP_UI(moc_uis ${uis}) - QT5_WRAP_CPP(moc_srcs ${headers_ui}) -ELSE() - QT6_ADD_RESOURCES(srcs_qrc ${qrc}) - QT6_WRAP_UI(moc_uis ${uis}) - QT6_WRAP_CPP(moc_srcs ${headers_ui}) +IF(QT4_FOUND OR Qt5_FOUND OR Qt6_FOUND) + set(CMAKE_AUTOUIC_SEARCH_PATHS ./ui/) ENDIF() @@ -117,10 +83,8 @@ SET(SRC_FILES ./DepthCalibrationDialog.cpp ./3rdParty/QMultiComboBox.cpp ./opencv/vtkImageMatSource.cpp - - ${moc_srcs} - ${moc_uis} - ${srcs_qrc} + ${qrc} + ${headers_ui} ) # to get includes in visual studio