-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
130 lines (102 loc) · 2.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
cmake_minimum_required(VERSION 2.8.3)
project(pubsub)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
)
# Find Qt5 libraries
find_package(Qt5 REQUIRED COMPONENTS
Core
Qml
Quick
Widgets
)
# Configuration to make Qt compiles go smoother
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
include_directories( ${CMAKE_BINARY_DIR} )
# Configure Catkin dependencies
catkin_package(
CATKIN_DEPENDS
roscpp
std_msgs
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
###############################
# Basic, non-qt talker/listener
add_executable(listener src/listener.cpp)
add_executable(talker src/talker.cpp)
target_link_libraries(listener
${catkin_LIBRARIES}
)
target_link_libraries(talker
${catkin_LIBRARIES}
)
################################################
# Cmd line talker/listener running qt event loop
add_executable(listener_qt src/listener_qt.cpp)
add_executable(talker_qt src/talker_qt.cpp)
# Configure Qt5 Modules
# Equivalent to doing
# Qt += Core
# In Qt .pro file
qt5_use_modules(listener_qt Core)
qt5_use_modules(talker_qt Core)
target_link_libraries(listener_qt
${catkin_LIBRARIES}
)
target_link_libraries(talker_qt
${catkin_LIBRARIES}
)
######################################
# Talker and Listener using QML gui
# Run MOC on headers of Q_OBJECT classes
set(MOC_HDRS include/qml_mediator.h)
qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
# Run RCC on QRC file
set(RCC_FILES src/display.qrc)
qt5_add_resources(RCC_SOURCES ${RCC_FILES})
# Build executables with source, MOC result files, RCC result files
add_executable(listener_qml src/listener_qml.cpp ${MOC_SRCS} ${RCC_SOURCES})
add_executable(talker_qml src/talker_qml.cpp ${MOC_SRCS} ${RCC_SOURCES})
# Configure Qt5 Modules
# Equivalent to doing
# Qt += Core Qml Quick
# In Qt .pro file
qt5_use_modules(listener_qml Core Qml Quick)
qt5_use_modules(talker_qml Core Qml Quick)
target_link_libraries(listener_qml
${catkin_LIBRARIES}
)
target_link_libraries(talker_qml
${catkin_LIBRARIES}
)
########################################
# Talker and Listener using QWidgets gui
# Run MOC on headers of Q_OBJECT classes
set(MOC_HDRS include/mainwindow.h)
qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
# Run UIC on ui definitions
set(UI_FILES ui/mainwindow.ui)
qt5_wrap_ui(UI_SRCS ${UI_FILES})
# Build executables with source, MOC result files, UIC result files
add_executable(talker_wig src/talker_wig.cpp src/mainwindow.cpp ${MOC_SRCS} ${UI_SRCS})
add_executable(listener_wig src/listener_wig.cpp src/mainwindow.cpp ${MOC_SRCS} ${UI_SRCS})
# Configure Qt5 Modules
# Equivalent to doing
# Qt += Core Widgets
# In Qt .pro file
qt5_use_modules(talker_wig Core Widgets)
qt5_use_modules(listener_wig Core Widgets)
target_link_libraries(talker_wig
${catkin_LIBRARIES}
)
target_link_libraries(listener_wig
${catkin_LIBRARIES}
)