forked from ev3dev/brickman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
206 lines (185 loc) · 6.31 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
cmake_policy (SET CMP0048 NEW)
project ("brickman" LANGUAGES C VERSION 0.10.0)
if (CMAKE_CROSSCOMPILING)
# we are depending on CMAKE_SYSROOT feature introduce in CMake 3.x
# and we only support cross compiling using Ubuntu 16.04
cmake_minimum_required (VERSION 3.5)
else (CMAKE_CROSSCOMPILING)
cmake_minimum_required (VERSION 3.0)
endif (CMAKE_CROSSCOMPILING)
option (BRICKMAN_TEST "Build the desktop test version.")
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
set (EXEC_NAME "brickman")
set (RELEASE_NAME "Brick Manager")
# Comment this out to enable C compiler warnings
add_definitions (-w)
add_subdirectory (data)
set (XDG_DATA_DIR data)
configure_file (src/Version.vala.in Version.vala)
if (BRICKMAN_TEST)
set (BRICKMAN_TEST_PACKAGES gtk+-3.0)
set (BRICKMAN_SOURCE_FILES
test/main.vala
test/ControlPanel.vala
test/FakeBluez5.vala
test/FakeConnman.vala
test/controller/FakeAboutController.vala
test/controller/FakeBatteryController.vala
test/controller/FakeBluetoothController.vala
test/controller/FakeDeviceBrowserController.vala
test/controller/FakeFileBrowserController.vala
test/controller/FakeNetworkController.vala
test/controller/FakeOpenRobertaController.vala
)
else (BRICKMAN_TEST)
set (BRICKMAN_SOURCE_FILES
lib/bluez5/Adapter.vala
lib/bluez5/AgentManager.vala
lib/bluez5/Device.vala
lib/bluez5/Manager.vala
lib/connman/Manager.vala
lib/connman/Peer.vala
lib/connman/Service.vala
lib/connman/Technology.vala
src/controller/AboutController.vala
src/controller/BatteryController.vala
src/controller/BluetoothController.vala
src/controller/DeviceBrowserController.vala
src/controller/FileBrowserController.vala
src/controller/NetworkController.vala
src/controller/OpenRobertaController.vala
src/GlobalManager.vala
src/main.vala
)
endif (BRICKMAN_TEST)
set (BRICKMAN_COMMON_SOURCE_FILES
lib/bluez5/Error.vala
lib/bluez5/Uuid.vala
lib/dbus/Properties.vala
lib/systemd/Logind.vala
lib/systemd/Systemd.vala
lib/systemd/logind-interfaces.vala
lib/systemd/systemd-interfaces.vala
src/controller/IBrickManagerModule.vala
src/dbus/Bluez5Agent.vala
src/dbus/ConnmanAgent.vala
src/view/AboutWindow.vala
src/view/BatteryInfoWindow.vala
src/view/BatteryStatusBarItem.vala
src/view/BluetoothDeviceMenuItem.vala
src/view/BluetoothDeviceWindow.vala
src/view/BluetoothStatusBarItem.vala
src/view/BluetoothWindow.vala
src/view/BrickManagerWindow.vala
src/view/ConnmanAgentInputDialog.vala
src/view/DeviceBrowserWindow.vala
src/view/FileBrowserWindow.vala
src/view/HomeWindow.vala
src/view/MotorBrowserWindow.vala
src/view/MotorInfoWindow.vala
src/view/MotorValueDialog.vala
src/view/NetworkConnectionDnsWindow.vala
src/view/NetworkConnectionEnetWindow.vala
src/view/NetworkConnectionIpv4Window.vala
src/view/NetworkConnectionMenuItem.vala
src/view/NetworkConnectionWindow.vala
src/view/NetworkConnectionsWindow.vala
src/view/NetworkStatusBarItem.vala
src/view/NetworkStatusWindow.vala
src/view/OpenRobertaStatusBarItem.vala
src/view/OpenRobertaWindow.vala
src/view/PortBrowserWindow.vala
src/view/PortInfoWindow.vala
src/view/SelectFromListDialog.vala
src/view/SensorBrowserWindow.vala
src/view/SensorInfoWindow.vala
src/view/SensorValueDialog.vala
src/view/ShutdownDialog.vala
src/view/SignalBars.vala
src/view/TetheringInfoWindow.vala
src/view/TetheringWindow.vala
src/view/WifiMenuItem.vala
src/view/WifiNetworkStatusWindow.vala
src/view/WifiNetworkWindow.vala
src/view/WifiStatusBarItem.vala
src/view/WifiWindow.vala
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(DEPS REQUIRED
ev3devkit-0.5
glib-2.0
gobject-2.0
gmodule-2.0
gio-2.0
gio-unix-2.0
grx-3.0
gudev-1.0
)
add_definitions(${DEPS_CFLAGS})
link_libraries(${DEPS_LIBRARIES})
link_directories(${DEPS_LIBRARY_DIRS})
if (BRICKMAN_TEST)
pkg_check_modules(BRICKMAN_TEST_DEPS gtk+-3.0)
add_definitions(${BRICKMAN_TEST_DEPS_CFLAGS})
link_libraries(${BRICKMAN_TEST_DEPS_LIBRARIES})
link_directories(${BRICKMAN_TEST_DEPS_LIBRARY_DIRS})
endif (BRICKMAN_TEST)
link_libraries(m)
if (CMAKE_CROSSCOMPILING)
# These need to be added manually for some reason. It is important that they
# come after other calls to link_libraries or you will get linker errors.
link_libraries(pcre resolv pthread)
endif(CMAKE_CROSSCOMPILING)
find_package(Vala REQUIRED)
include(ValaVersion)
ensure_vala_version("0.24" MINIMUM)
include(ValaPrecompile)
# if the binary directory is a subdirectory of the source directory, it causes
# the build to fail when including generated .vala files that are in the binary
# directory. The solution is to use the relative path.
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" BRICKMAN_RELATIVE_BINARY_DIR
${CMAKE_CURRENT_BINARY_DIR})
vala_precompile(VALA_C ${EXEC_NAME}
${BRICKMAN_RELATIVE_BINARY_DIR}/Version.vala
${BRICKMAN_SOURCE_FILES}
${BRICKMAN_COMMON_SOURCE_FILES}
PACKAGES
ev3devkit-0.5
glib-2.0
gobject-2.0
gmodule-2.0
gio-2.0
gio-unix-2.0
grx-3.0
gudev-1.0
posix
linux
${BRICKMAN_TEST_PACKAGES}
CUSTOM_VAPIS
bindings/*.vapi
OPTIONS
--target-glib=2.40
--thread
)
add_executable(${EXEC_NAME} ${VALA_C})
if (BRICKMAN_TEST)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/test/glade/ControlPanel.glade
${CMAKE_CURRENT_BINARY_DIR}/ControlPanel.glade COPYONLY )
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/test/glade/ConnmanServiceIPv4Dialog.glade
${CMAKE_CURRENT_BINARY_DIR}/ConnmanServiceIPv4Dialog.glade COPYONLY )
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/test/glade/ConnmanAgentRequestInputDialog.glade
${CMAKE_CURRENT_BINARY_DIR}/ConnmanAgentRequestInputDialog.glade COPYONLY )
endif (BRICKMAN_TEST)
add_dependencies(${EXEC_NAME} brickman_data)
install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION sbin)
add_custom_target(run
COMMAND
XDG_DATA_DIRS=${XDG_DATA_DIR}:/usr/local/share:/usr/share
./${EXEC_NAME}
DEPENDS ${EXEC_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)