Skip to content

Commit

Permalink
use CMAKE_AUTOUIC, CMAKE_AUTOMOC and CMAKE_AUTORCC (#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdb0y511 authored Sep 14, 2023
1 parent 01c2e70 commit 49daa21
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 58 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 2 additions & 6 deletions examples/NoEventsExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
8 changes: 2 additions & 6 deletions examples/RGBDMapping/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
8 changes: 2 additions & 6 deletions examples/WifiMapping/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 4 additions & 40 deletions guilib/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49daa21

Please sign in to comment.