-
-
Notifications
You must be signed in to change notification settings - Fork 83
/
qtfirebase_target.pri
328 lines (261 loc) · 10.5 KB
/
qtfirebase_target.pri
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
message("QtFirebase: configuring build for supported Firebase target platform...")
isEmpty(QTFIREBASE_SDK_PATH) {
QTFIREBASE_SDK_PATH = $$PWD/firebase_cpp_sdk
message("No QTFIREBASE_SDK_PATH path set. Using default (firebase_cpp_sdk) $$QTFIREBASE_SDK_PATH")
} else {
message("Using QTFIREBASE_SDK_PATH ($$QTFIREBASE_SDK_PATH)")
}
QTFIREBASE_SDK_LIBS_PREFIX = "firebase_"
QML_IMPORT_PATH += $$PWD
INCLUDEPATH += $$PWD
INCLUDEPATH += \
$$QTFIREBASE_SDK_PATH/include \
\
HEADERS += \
$$PWD/src/platformutils.h \
$$PWD/src/qtfirebase.h \
$$PWD/src/qtfirebaseservice.h \
\
SOURCES += \
$$PWD/src/qtfirebase.cpp \
$$PWD/src/qtfirebaseservice.cpp \
\
contains(QTPLUGIN,qtfirebase) {
HEADERS += $$PWD/src/qtfirebase_plugin.h
SOURCES += $$PWD/src/qtfirebase_plugin.cpp
}
!ios: {
SOURCES += \
$$PWD/src/platformutils.cpp \
\
}
RESOURCES += \
$$PWD/qtfirebase.qrc \
\
android: {
# Setup tips
#
# Add services to xml file
# https://github.com/firebase/quickstart-cpp/blob/e8c20f678a06a28ebb73132abcd79d93b27622d9/messaging/testapp/AndroidManifest.xml
#
# Add the 'onNewIntent' function to your Qt Activity
# https://github.com/firebase/quickstart-cpp/blob/e8c20f678a06a28ebb73132abcd79d93b27622d9/messaging/testapp/src/android/java/com/google/firebase/example/TestappNativeActivity.java
message("QtFirebase Android base")
QT += androidextras gui-private
# Specify the STL variant that is to be used in the app .pro file with the $$QTFIREBASE_STL_VARIANT variable
# c++: LLVM libc++ runtime
# gnustl: GNU STL
# stlport: STLPort runtime
android-clang {
QTFIREBASE_STL_VARIANT = c++
}
isEmpty(QTFIREBASE_STL_VARIANT){
QTFIREBASE_STL_VARIANT = gnustl
}
# Firebase C++ SDK 9.0.0
exists($$QTFIREBASE_SDK_PATH/libs/android/$$ANDROID_TARGET_ARCH/$$QTFIREBASE_STL_VARIANT) {
message("Using QTFIREBASE_STL_VARIANT ($$QTFIREBASE_STL_VARIANT)")
QTFIREBASE_SDK_LIBS_PATH = $$QTFIREBASE_SDK_PATH/libs/android/$$ANDROID_TARGET_ARCH/$$QTFIREBASE_STL_VARIANT
} else {
QTFIREBASE_SDK_LIBS_PATH = $$QTFIREBASE_SDK_PATH/libs/android/$$ANDROID_TARGET_ARCH
}
DEPENDPATH += $$QTFIREBASE_SDK_LIBS_PATH
}
ios: {
# Setup tips
#
# Download the Google Firebase Framework link for Ios
# and extract the files to this folder $$PWD/src/ios/Firebase/
# or use your own folder QTFIREBASE_FRAMEWORKS_ROOT = YOUR/PWD
# https://firebase.google.com/docs/ios/setup#frameworks
message("QtFirebase iOS base")
QT += gui_private
QTFIREBASE_SDK_LIBS_PATH = $$QTFIREBASE_SDK_PATH/libs/ios/universal/
isEmpty(QTFIREBASE_FRAMEWORKS_ROOT) {
QTFIREBASE_FRAMEWORKS_ROOT = $$PWD/src/ios/Firebase/
message("No QTFIREBASE_FRAMEWORKS_ROOT path set. Using default $$QTFIREBASE_FRAMEWORKS_ROOT")
} else {
message("Using QTFIREBASE_FRAMEWORKS_ROOT ($$QTFIREBASE_FRAMEWORKS_ROOT)")
}
!exists($$QTFIREBASE_FRAMEWORKS_ROOT) {
error("$$QTFIREBASE_FRAMEWORKS_ROOT path does not exist. To download iOS SDK run download_firebase_ios.sh\
in $$PWD/src/ios directory using command line or set the proper path to SDK by setting QTFIREBASE_FRAMEWORKS_ROOT in your project's .pro file")
}
QMAKE_LFLAGS += -ObjC
HEADERS += \
$$PWD/src/ios/AppDelegate.h \
\
OBJECTIVE_SOURCES += \
$$PWD/src/ios/platformutils.mm \
$$PWD/src/ios/AppDelegate.mm \
\
LIBS += \
-ObjC \
-lsqlite3 \
-lz \
-L$$QTFIREBASE_SDK_LIBS_PATH \
-framework MediaPlayer \
-framework CoreMotion \
-framework CoreTelephony \
-framework MessageUI \
-framework GLKit \
-framework AddressBook \
-framework UIKit \
-framework SystemConfiguration \
\
INCLUDEPATH += \
$$QTFIREBASE_SDK_PATH/include \
$$QTFIREBASE_FRAMEWORKS_ROOT/../ \
$$PWD/src \
$$PWD/src/ios \
\
defineTest(includeFirebaseFramework) {
catalog = $$1
framework = $$2
FW_PATH = $$QTFIREBASE_FRAMEWORKS_ROOT/$${catalog}/$${framework}.xcframework
FW_PATH_ARM64_ARMV7 = $$FW_PATH/ios-arm64_armv7
FW_PATH_ARM64 = $$FW_PATH/ios-arm64
FW_PATH =
exists($$FW_PATH_ARM64): FW_PATH = $$FW_PATH_ARM64
exists($$FW_PATH_ARM64_ARMV7): FW_PATH = $$FW_PATH_ARM64_ARMV7
isEmpty(FW_PATH) {
return (false)
}
LIBS += -F$$FW_PATH -framework $$framework
export(LIBS)
return (true)
}
}
# Desktop platforms
linux:!android {
contains(QMAKE_TARGET.arch, x86_64) {
QTFIREBASE_LINUX_ARCH = x86_64
} else {
QTFIREBASE_LINUX_ARCH = i386
}
exists($$QTFIREBASE_SDK_PATH/libs/linux/$$QTFIREBASE_LINUX_ARCH/cxx11) {
QTFIREBASE_SDK_LIBS_PATH = $$QTFIREBASE_SDK_PATH/libs/linux/$$QTFIREBASE_LINUX_ARCH/cxx11
} else {
QTFIREBASE_SDK_LIBS_PATH = $$QTFIREBASE_SDK_PATH/libs/linux/$$QTFIREBASE_LINUX_ARCH
}
}
# NOTE the order of linking is important!
PRE_TARGETDEPS += $$QTFIREBASE_SDK_LIBS_PATH/lib$${QTFIREBASE_SDK_LIBS_PREFIX}app.a
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}app
# AdMob
contains(DEFINES,QTFIREBASE_BUILD_ADMOB) {
message( "QtFirebase including AdMob" )
ios: {
includeFirebaseFramework(Google-Mobile-Ads-SDK, GoogleMobileAds)
LIBS += \
-framework AdSupport \
-framework StoreKit \
\
}
HEADERS += \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobtestdevices.h \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmob.h \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobrequest.h \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobbase.h \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobbanner.h \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobinterstitial.h \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobrewardedvideoad.h \
\
SOURCES += \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobtestdevices.cpp \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmob.cpp \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobrequest.cpp \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobbase.cpp \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobbanner.cpp \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobinterstitial.cpp \
$$PWD/src/qtfirebaseadmob/qtfirebaseadmobrewardedvideoad.cpp \
\
PRE_TARGETDEPS += $$QTFIREBASE_SDK_LIBS_PATH/lib$${QTFIREBASE_SDK_LIBS_PREFIX}admob.a
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}admob
}
# Remote Config
contains(DEFINES,QTFIREBASE_BUILD_REMOTE_CONFIG) {
message( "QtFirebase including RemoteConfig" )
ios: {
includeFirebaseFramework(FirebaseRemoteConfig, FirebaseRemoteConfig)
includeFirebaseFramework(FirebaseRemoteConfig, FirebaseABTesting) # Required for Firebase iOS >= 4.5.0
}
HEADERS += $$PWD/src/qtfirebaseremoteconfig.h
SOURCES += $$PWD/src/qtfirebaseremoteconfig.cpp
PRE_TARGETDEPS += $$QTFIREBASE_SDK_LIBS_PATH/lib$${QTFIREBASE_SDK_LIBS_PREFIX}remote_config.a
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}remote_config
}
# Messaging
contains(DEFINES,QTFIREBASE_BUILD_MESSAGING) {
message( "QtFirebase including Messaging" )
ios: {
message( "QtFirebase Messaging requires iOS v10.x+ to build." )
message( "Remember to set QMAKE_IOS_DEPLOYMENT_TARGET in your .pro" )
# Removed due to Qt 5.12 - see https://github.com/Larpon/QtFirebase/issues/106
# QMAKE_IOS_DEPLOYMENT_TARGET = 10.0
includeFirebaseFramework(FirebaseMessaging, FirebaseInstanceID)
includeFirebaseFramework(FirebasePerformance, Protobuf)
includeFirebaseFramework(FirebaseMessaging, FirebaseMessaging)
LIBS += \
-framework UserNotifications \
\
}
HEADERS += $$PWD/src/qtfirebasemessaging.h
SOURCES += $$PWD/src/qtfirebasemessaging.cpp
PRE_TARGETDEPS += $$QTFIREBASE_SDK_LIBS_PATH/lib$${QTFIREBASE_SDK_LIBS_PREFIX}messaging.a
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}messaging
}
# Analytics
contains(DEFINES,QTFIREBASE_BUILD_ANALYTICS) {
message( "QtFirebase including Analytics" )
ios: {
# -framework FirebaseCoreDiagnostics \
#-framework GoogleDataTransportCCTSupport \
includeFirebaseFramework(FirebaseAnalytics, FirebaseAnalytics)
includeFirebaseFramework(FirebaseAnalytics, FirebaseCore)
includeFirebaseFramework(FirebaseAnalytics, GoogleUtilities)
includeFirebaseFramework(FirebaseAnalytics, nanopb)
includeFirebaseFramework(FirebaseAnalytics, PromisesObjC)
includeFirebaseFramework(FirebaseAnalytics, FirebaseInstallations)
includeFirebaseFramework(FirebaseAnalytics, GoogleDataTransport)
includeFirebaseFramework(FirebaseAnalytics, GoogleAppMeasurement)
LIBS += \
-framework StoreKit \
\
}
HEADERS += $$PWD/src/qtfirebaseanalytics.h
SOURCES += $$PWD/src/qtfirebaseanalytics.cpp
PRE_TARGETDEPS += $$QTFIREBASE_SDK_LIBS_PATH/lib$${QTFIREBASE_SDK_LIBS_PREFIX}analytics.a
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}analytics
}
# Auth
contains(DEFINES,QTFIREBASE_BUILD_AUTH) {
message( "QtFirebase including Auth" )
ios: {
includeFirebaseFramework(FirebaseAuth, FirebaseAuth)
includeFirebaseFramework(FirebaseAuth, GTMSessionFetcher)
LIBS += \
-framework SafariServices \ # Required for Firebase iOS >= 4.4.0
\
}
HEADERS += $$PWD/src/qtfirebaseauth.h
SOURCES += $$PWD/src/qtfirebaseauth.cpp
PRE_TARGETDEPS += $$QTFIREBASE_SDK_LIBS_PATH/lib$${QTFIREBASE_SDK_LIBS_PREFIX}auth.a
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}auth
}
# Database
contains(DEFINES,QTFIREBASE_BUILD_DATABASE) {
message( "QtFirebase including Database" )
ios: {
LIBS += \
-licucore \
\
includeFirebaseFramework(FirebaseDatabase, FirebaseDatabase)
includeFirebaseFramework(FirebaseDatabase, leveldb-library)
}
HEADERS += $$PWD/src/qtfirebasedatabase.h
SOURCES += $$PWD/src/qtfirebasedatabase.cpp
PRE_TARGETDEPS += $$QTFIREBASE_SDK_LIBS_PATH/lib$${QTFIREBASE_SDK_LIBS_PREFIX}database.a
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}database
}
LIBS += -L$$QTFIREBASE_SDK_LIBS_PATH -l$${QTFIREBASE_SDK_LIBS_PREFIX}app