This repository was archived by the owner on Jul 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.py
More file actions
136 lines (102 loc) · 4.58 KB
/
Copy pathconfig.py
File metadata and controls
136 lines (102 loc) · 4.58 KB
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
import sys
import json
import os
import re
import shutil
from colors import *
# Set your Android app ID
p_app_id = "games.misu.greatalchemist"
p_firebase_sdk = "/firebase_cpp_sdk/libs"
# Update this to customize the module
_config = {
"Analytics" : True,
"AdMob" : True,
"Invites" : False,
"RemoteConfig" : True,
"Notification" : True,
"Storage" : True,
"Firestore" : True,
"Authentication" : True,
"AuthGoogle" : True,
"AuthFacebook" : True,
"AuthTwitter" : True
}
cpp_defines = ['GD_FIREBASE_ANALYTICS']
linkflags = ['app', 'analytics']
def can_build(plat):
return (plat == "android" or plat == "x11" or plat == "iphone")
def configure(env):
cur_dir = os.path.dirname(os.path.abspath(__file__))
if _config["AdMob"]:
if env["platform"] == "android":
env.android_add_dependency("compile 'com.google.firebase:firebase-ads:15.0.1'")
cpp_defines.append('GD_FIREBASE_ADMOB')
linkflags.append('admob')
if _config["RemoteConfig"]:
if env["platform"] == "android":
env.android_add_dependency("compile 'com.google.firebase:firebase-config:16.0.0'")
cpp_defines.append('GD_FIREBASE_REMOTECONFIG')
linkflags.append('remote_config')
if _config["Notification"]:
if env["platform"] == "android":
env.android_add_dependency("compile 'com.google.firebase:firebase-messaging:17.3.0'")
env.android_add_dependency("compile 'com.google.firebase.messaging.cpp:firebase_messaging_cpp@aar'")
env.android_add_dependency("compile 'com.firebase:firebase-jobdispatcher:0.8.5'")
cpp_defines.append('GD_FIREBASE_NOTIFICATION')
linkflags.append('messaging')
if _config["Invites"]:
if env["platform"] == "android":
env.android_add_dependency("compile 'com.google.firebase:firebase-invites:16.0.3'")
cpp_defines.append('GD_FIREBASE_INVITES')
linkflags.append('invites')
if _config["Storage"]:
if env["platform"] == "android":
env.android_add_dependency("compile 'com.google.firebase:firebase-storage:16.0.1'")
cpp_defines.append('GD_FIREBASE_STORAGE')
linkflags.append('storage')
if _config["Authentication"]:
if env["platform"] == "android":
env.android_add_dependency("compile 'com.google.firebase:firebase-auth:16.0.3'")
cpp_defines.append('GD_FIREBASE_AUTHENTICATION')
linkflags.append('auth')
env.Append(CPPDEFINES=cpp_defines);
if env["platform"] == "android":
env.android_add_maven_repository("url 'https://maven.google.com'")
env.android_add_maven_repository("url 'https://oss.sonatype.org/content/repositories/snapshots'")
env.android_add_flat_dir(cur_dir + p_firebase_sdk + "/android/")
env.android_add_gradle_classpath("com.google.gms:google-services:4.1.0")
env.android_add_gradle_plugin("com.google.gms.google-services")
env.android_add_dependency("compile 'com.google.firebase:firebase-core:16.0.1'")
env.android_add_dependency("compile 'com.google.firebase:firebase-analytics:16.0.1'")
env.android_add_dependency("compile 'com.google.android.gms:play-services-base:15.0.1'")
env.android_add_dependency("compile 'commons-codec:commons-codec:1.10'")
env.android_add_default_config("applicationId '"+ p_app_id +"'")
ARCH = "armeabi"
if env["android_arch"] == "armv7": ARCH = "armeabi-v7a"
elif env["android_arch"] == "x86": ARCH = "x86"
else:
print("ERR: Arch not supported by godot..!")
return
firebase_sdk_libs = cur_dir + p_firebase_sdk + '/android/'+ ARCH +'/c++/'
_linkflags = []
for l in linkflags:
_linkflags.append("firebase_" + l)
pass
print(firebase_sdk_libs)
print(GREEN + "FireBase: " + RESET + "[" + _linkflags[1:-1] + "]")
env.Append(LIBPATH=[firebase_sdk_libs])
env.Append(LIBS=_linkflags)
elif env["platform"] == "iphone":
ARCH = 'i386'
if env["arch"] == "arm64": ARCH = "arm64"
elif env["arch"] == "x86": ARCH = "x86_64"
else:
print("ERR: Arch not supported by godot..!")
return
firebase_sdk_libs = cur_dir + p_firebase_sdk + '/ios/'+ ARCH
# Not tested (Need Help)
env.Append(LIBPATH=[firebase_sdk_libs])
env.Append(LIBS=linkflags)
env.Append(LINKFLAGS=['-ObjC', '-framework', 'Firebase', '-framework', 'FirebaseAdmob'])
env.Append(FRAMEWORKPATH=['modules/gdfirebase/frameworks/ios/'+ARCH])
pass