forked from telldus/telldus-live-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
295 lines (258 loc) · 7.65 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
PROJECT( TelldusLiveMobile )
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
SET(PACKAGE_MAJOR_VERSION 2)
SET(PACKAGE_MINOR_VERSION 0)
SET(PACKAGE_PATCH_VERSION 10)
OPTION(RELEASE_BUILD "Is this a release build?" TRUE)
# Feature options
OPTION(ENABLE_FEATURE_WEBSOCKETS "Should websocket support be built in?" FALSE)
OPTION(ENABLE_FEATURE_LOGGING "Should console logging be enabled? (automatically disabled in release builds)" FALSE)
IF(ENABLE_FEATURE_LOGGING)
OPTION(ENABLE_FEATURE_GOOGLEANALYTICS "Should logging send to google analytics?" FALSE)
IF(ENABLE_FEATURE_GOOGLEANALYTICS)
SET(GOOGLE_ANALYTICS_TRACKER "" CACHE STRING "Google Analytics tracker")
ENDIF()
ENDIF()
OPTION(ENABLE_FEATURE_PUSH "Should support for push be built in?" FALSE)
# Environment settings
SET(TARGET_PLATFORM "" CACHE STRING "Sets the target platform. Valid values are 'iOS', 'Android', 'Desktop', or 'BB10'")
SET(UI_TYPES "Mobile;TV")
SET(UI_TYPE "Mobile" CACHE STRING "The type of UI, currently mobile or TV")
SET_PROPERTY(CACHE UI_TYPE PROPERTY STRINGS ${UI_TYPES})
SET(TELLDUS_LIVE_API_ENDPOINT "https://api.telldus.com" CACHE STRING "Telldus Live! api endpoint")
SET(TELLDUS_LIVE_PUBLIC_KEY "" CACHE STRING "Telldus Live! public key")
SET(TELLDUS_LIVE_PRIVATE_KEY "" CACHE STRING "Telldus Live! private key")
IF(RELEASE_BUILD)
SET(IS_RELEASE_BUILD 1)
ELSE()
SET(IS_RELEASE_BUILD 0)
ENDIF()
IF(ENABLE_FEATURE_WEBSOCKETS)
SET(IS_FEATURE_WEBSOCKETS_ENABLED 1)
ELSE()
SET(IS_FEATURE_WEBSOCKETS_ENABLED 0)
ENDIF()
IF(ENABLE_FEATURE_PUSH)
SET(IS_FEATURE_PUSH_ENABLED 1)
SET(PUSH_SERVICE_ID "" CACHE STRING "Push Notification Service Id")
ELSE()
SET(IS_FEATURE_PUSH_ENABLED 0)
ENDIF()
IF(ENABLE_FEATURE_LOGGING)
SET(IS_FEATURE_LOGGING_ENABLED 1)
ELSE()
SET(IS_FEATURE_LOGGING_ENABLED 0)
ENDIF()
IF(ENABLE_FEATURE_GOOGLEANALYTICS)
SET(IS_FEATURE_GOOGLEANALYTICS_ENABLED 1)
ELSE()
SET(IS_FEATURE_GOOGLEANALYTICS_ENABLED 0)
ENDIF()
IF((NOT IS_FEATURE_LOGGING_ENABLED) OR IS_RELEASE_BUILD)
ADD_DEFINITIONS(-DQT_NO_DEBUG_OUTPUT)
ENDIF()
SET(USE_QMAKE TRUE)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
SET(PRODUCT_NAME TelldusCenter-light )
SET( SOURCES
src/abstractview.cpp
src/client.cpp
src/commonview.cpp
src/ColorImageProvider.cpp
src/device.cpp
src/main.cpp
src/schedulerjob.cpp
src/sensor.cpp
src/tellduscenter.cpp
src/tellduslive.cpp
src/user.cpp
src/models/abstractfiltereddevicemodel.cpp
src/models/clientmodel.cpp
src/models/dashboardmodel.cpp
src/models/DrawerMenuModel.cpp
src/models/devicemodel.cpp
src/models/DeviceListSortFilterModel.cpp
src/models/favoritedevicemodel.cpp
src/models/favoritesensormodel.cpp
src/models/filtereddevicemodel.cpp
src/models/groupdevicemodel.cpp
src/models/SchedulerDayModel.cpp
src/models/SchedulerDaySortFilterModel.cpp
src/models/schedulermodel.cpp
src/models/sensormodel.cpp
src/models/SensorListSortFilterModel.cpp
src/models/tlistmodel.cpp
src/objects/DashboardItem.cpp
src/objects/DrawerMenuItem.cpp
src/objects/SchedulerJobInstance.cpp
src/utils/dev.cpp
src/utils/Logger.cpp
src/properties/Properties.cpp
src/properties/PropertiesTheme.cpp
src/properties/PropertiesThemeColors.cpp
src/properties/PropertiesThemeCore.cpp
src/properties/PropertiesUi.cpp
)
IF(ENABLE_FEATURE_PUSH)
LIST(APPEND SOURCES
src/AbstractNotification.cpp
src/AbstractPush.cpp
)
LIST(APPEND MOC_HEADERS
src/AbstractNotification.h
src/AbstractPush.h
)
ENDIF()
SET( HEADERS
${CMAKE_CURRENT_BINARY_DIR}/parsed/config.h
src/config.h.in
)
SET( MOC_HEADERS
src/abstractview.h
src/client.h
src/commonview.h
src/ColorImageProvider.h
src/device.h
src/schedulerjob.h
src/sensor.h
src/TdQueue.h
src/tellduscenter.h
src/tellduslive.h
src/user.h
src/models/abstractfiltereddevicemodel.h
src/models/clientmodel.h
src/models/dashboardmodel.h
src/models/DrawerMenuModel.h
src/models/devicemodel.h
src/models/DeviceListSortFilterModel.h
src/models/favoritedevicemodel.h
src/models/favoritesensormodel.h
src/models/filtereddevicemodel.h
src/models/groupdevicemodel.h
src/models/SchedulerDayModel.h
src/models/SchedulerDaySortFilterModel.h
src/models/schedulermodel.h
src/models/sensormodel.h
src/models/SensorListSortFilterModel.h
src/models/tlistmodel.h
src/objects/DashboardItem.h
src/objects/DrawerMenuItem.h
src/objects/SchedulerJobInstance.h
src/utils/dev.h
src/utils/Logger.h
src/properties/Properties.h
src/properties/PropertiesTheme.h
src/properties/PropertiesThemeColors.h
src/properties/PropertiesThemeCore.h
src/properties/PropertiesUi.h
)
SET(RESOURCES
)
SET(COPY_RESOURCES
)
SET(QT_USE_QTNETWORK TRUE)
SET(QT_USE_QTDECLARATIVE TRUE)
SET(QT_USE_QTOPENGL TRUE)
SET(QT_USE_QTSCRIPT TRUE)
SET(QT_USE_QTSVG TRUE)
SET(QT_USE_QTWEBSOCKETS TRUE)
SET(HAVE_WEBKIT 0)
FILE(GLOB_RECURSE QML RELATIVE ${CMAKE_SOURCE_DIR} *.qml)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/src/rules.cmake)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/src )
INCLUDE_DIRECTORIES( qmlapplicationviewer )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/parsed )
INCLUDE( 3rdparty/kqoauth.cmake NO_POLICY_SCOPE )
IF (NOT TARGET_PLATFORM)
MESSAGE(FATAL_ERROR "Please set the target platform with -DTARGET_PLATFORM='platform'")
ELSE ()
STRING(TOUPPER ${TARGET_PLATFORM} UPLATFORM)
ADD_DEFINITIONS( -DPLATFORM_${UPLATFORM} )
INCLUDE_DIRECTORIES( platforms/${TARGET_PLATFORM} )
INCLUDE( platforms/${TARGET_PLATFORM}/rules.cmake NO_POLICY_SCOPE )
IF (COMMAND CONFIGURE)
CONFIGURE()
ENDIF(COMMAND CONFIGURE)
ENDIF()
CONFIGURE_FILE(
src/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/parsed/config.h
)
IF (USE_QMAKE)
FIND_PACKAGE( Qt5Core REQUIRED )
FIND_PACKAGE( Qt5Network REQUIRED )
FIND_PACKAGE( Qt5Quick REQUIRED )
FIND_PACKAGE( Qt5Sql REQUIRED )
FIND_PACKAGE( Qt5Svg REQUIRED )
FIND_PACKAGE( Qt5WebSockets REQUIRED )
LIST(APPEND LIBRARIES Qt5::Network Qt5::Quick Qt5::Sql Qt5::Svg Qt5::WebSockets)
IF(HAVE_WEBKIT)
FIND_PACKAGE( Qt5WebView REQUIRED )
LIST(APPEND LIBRARIES Qt5::WebView)
ENDIF()
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(QTRESOURCES src/resources.qrc)
QT5_ADD_RESOURCES(QTRESOURCES src/resources/modules/modules.qrc)
ENDIF()
FIND_PACKAGE( Qt5LinguistTools REQUIRED )
SET(TRANSLATIONS
src/resources/translations/core_cs.ts
src/resources/translations/core_da.ts
src/resources/translations/core_de.ts
src/resources/translations/core_en.ts
src/resources/translations/core_el.ts
src/resources/translations/core_es.ts
src/resources/translations/core_fi.ts
src/resources/translations/core_fr.ts
src/resources/translations/core_it.ts
src/resources/translations/core_mt.ts
src/resources/translations/core_nb.ts
src/resources/translations/core_nl.ts
src/resources/translations/core_pl.ts
src/resources/translations/core_pt.ts
src/resources/translations/core_ru.ts
src/resources/translations/core_sv.ts
src/resources/translations/core_th.ts
)
CONFIGURE_FILE(
src/translations.qrc
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
)
QT5_CREATE_TRANSLATION(TRANSLATED_FILES ${QML} ${TRANSLATIONS})
QT5_ADD_RESOURCES(QTRESOURCES ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
FOREACH(F ${QML})
LIST(APPEND RESOURCES ${F})
ENDFOREACH()
IF (COMMAND PREPARE_TARGET)
PREPARE_TARGET(TelldusLiveMobile)
ENDIF()
IF (${TARGET_PLATFORM} MATCHES "Android")
ADD_LIBRARY(TelldusLiveMobile SHARED
${SOURCES}
${HEADERS}
${MOC_SOURCES}
${RESOURCES}
${QTRESOURCES}
${TRANSLATIONS}
${TRANSLATED_FILES}
${RSRCS}
)
ELSE ()
ADD_EXECUTABLE(TelldusLiveMobile MACOSX_BUNDLE
${SOURCES}
${HEADERS}
${MOC_SOURCES}
${RESOURCES}
${QTRESOURCES}
${TRANSLATIONS}
${TRANSLATED_FILES}
${RSRCS}
)
ENDIF ()
IF (COMMAND COMPILE)
COMPILE(TelldusLiveMobile)
ENDIF(COMMAND COMPILE)
TARGET_LINK_LIBRARIES( TelldusLiveMobile ${LIBRARIES} )