1
1
2
- if(OCTOVIS_QT5)
2
+ if(OCTOVIS_QT6)
3
+ find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGLWidgets Widgets Xml)
4
+ set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::OpenGLWidgets Qt6::Widgets Qt6::Xml "${OPENGL_gl_LIBRARY}" "${OPENGL_glu_LIBRARY}")
5
+ set(CMAKE_AUTOMOC ON)
6
+ else(OCTOVIS_QT6)
3
7
find_package(Qt5Core REQUIRED)
4
8
find_package(Qt5Gui REQUIRED)
5
9
find_package(Qt5OpenGL REQUIRED)
@@ -13,14 +17,7 @@ if(OCTOVIS_QT5)
13
17
"${Qt5Widgets_INCLUDE_DIRS}"
14
18
"${Qt5Xml_INCLUDE_DIRS}"
15
19
)
16
- else(OCTOVIS_QT5)
17
- # Qt4-support (more info: http://qtnode.net/wiki?title=Qt_with_cmake)
18
- find_package(Qt4 REQUIRED)
19
- set(QT_USE_QTOPENGL TRUE)
20
- set(QT_USE_QTXML TRUE)
21
- # include the files enabled above
22
- include(${QT_USE_FILE})
23
- endif(OCTOVIS_QT5)
20
+ endif(OCTOVIS_QT6)
24
21
25
22
# Mac OS X seems to require special linker flags:
26
23
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -51,11 +48,11 @@ set(viewer_SRCS
51
48
)
52
49
53
50
# Resource files (icons, ...)
54
- if(OCTOVIS_QT5)
51
+ if(OCTOVIS_QT6)
52
+ QT6_ADD_RESOURCES(viewer_RES src/icons.qrc)
53
+ else(OCTOVIS_QT6)
55
54
QT5_ADD_RESOURCES(viewer_RES src/icons.qrc)
56
- else(OCTOVIS_QT5)
57
- QT4_ADD_RESOURCES(viewer_RES src/icons.qrc)
58
- endif(OCTOVIS_QT5)
55
+ endif(OCTOVIS_QT6)
59
56
60
57
#found QGLViewer lib dir
61
58
link_directories(${QGLViewer_LIBRARY_DIR})
@@ -74,11 +71,11 @@ SET(viewer_MOC_HDRS
74
71
)
75
72
76
73
# generate list of MOC srcs:
77
- if(OCTOVIS_QT5)
74
+ if(OCTOVIS_QT6)
75
+ QT6_WRAP_CPP(viewer_MOC_SRCS ${viewer_MOC_HDRS})
76
+ else(OCTOVIS_QT6)
78
77
QT5_WRAP_CPP(viewer_MOC_SRCS ${viewer_MOC_HDRS})
79
- else(OCTOVIS_QT5)
80
- QT4_WRAP_CPP(viewer_MOC_SRCS ${viewer_MOC_HDRS})
81
- endif(OCTOVIS_QT5)
78
+ endif(OCTOVIS_QT6)
82
79
83
80
# let cmake generate ui*.h files from .ui files (Qt Designer):
84
81
SET(viewer_UIS
@@ -87,11 +84,11 @@ SET(viewer_UIS
87
84
${PROJECT_SOURCE_DIR}/include/octovis/ViewerSettingsPanel.ui
88
85
${PROJECT_SOURCE_DIR}/include/octovis/ViewerSettingsPanelCamera.ui
89
86
)
90
- if(OCTOVIS_QT5)
87
+ if(OCTOVIS_QT6)
88
+ QT6_WRAP_UI(viewer_UIS_H ${viewer_UIS})
89
+ else(OCTOVIS_QT6)
91
90
QT5_WRAP_UI(viewer_UIS_H ${viewer_UIS})
92
- else(OCTOVIS_QT5)
93
- QT4_WRAP_UI(viewer_UIS_H ${viewer_UIS})
94
- endif(OCTOVIS_QT5)
91
+ endif(OCTOVIS_QT6)
95
92
96
93
# Don't forget to include output directory, otherwise
97
94
# the UI file won't be wrapped!
@@ -101,6 +98,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR})
101
98
# Library target
102
99
add_library(octovis-static STATIC ${viewerlib_SRCS})
103
100
target_link_libraries(octovis-static
101
+ ${QT_LIBRARIES}
104
102
${OPENGL_gl_LIBRARY}
105
103
${OPENGL_glu_LIBRARY}
106
104
${OCTOMAP_LIBRARIES}
@@ -110,6 +108,7 @@ set_target_properties(octovis-static PROPERTIES OUTPUT_NAME octovis)
110
108
111
109
add_library(octovis-shared SHARED ${viewerlib_SRCS})
112
110
target_link_libraries(octovis-shared
111
+ ${QT_LIBRARIES}
113
112
${OPENGL_gl_LIBRARY}
114
113
${OPENGL_glu_LIBRARY}
115
114
${OCTOMAP_LIBRARIES}
@@ -135,7 +134,6 @@ add_executable(octovis ${viewer_SRCS} ${viewer_UIS_H} ${viewer_MOC_SRCS} ${viewe
135
134
136
135
target_link_libraries(octovis
137
136
# ${QGLViewer_LIBRARIES}
138
- ${QT_LIBRARIES}
139
137
${OCTOMAP_LIBRARIES}
140
138
octovis-shared
141
139
)
0 commit comments