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
|
import shutil
Import('env')
android_files = [
'os_android.cpp',
'godot_android.cpp',
'file_access_android.cpp',
'dir_access_android.cpp',
'audio_driver_opensl.cpp',
'file_access_jandroid.cpp',
'dir_access_jandroid.cpp',
'thread_jandroid.cpp',
'audio_driver_jandroid.cpp',
'ifaddrs_android.cpp',
'android_native_app_glue.c',
'java_glue.cpp',
'cpu-features.c',
'java_class_wrapper.cpp'
]
#env.Depends('#core/math/vector3.h', 'vector3_psp.h')
#obj = env.SharedObject('godot_android.cpp')
env_android = env.Clone()
if env['target'] == "profile":
env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
android_objects=[]
for x in android_files:
android_objects.append( env_android.SharedObject( x ) )
prog = None
abspath=env.Dir(".").abspath
gradle_basein = open(abspath+"/build.gradle.template","rb")
gradle_baseout = open(abspath+"/java/build.gradle","wb")
gradle_text = gradle_basein.read()
gradle_maven_repos_text=""
for x in env.android_maven_repos:
gradle_maven_repos_text+=x+"\n"
gradle_maven_dependencies_text=""
for x in env.android_dependencies:
gradle_maven_dependencies_text+=x+"\n"
gradle_java_dirs_text=""
for x in env.android_java_dirs:
gradle_java_dirs_text+=",'"+x+"'"
gradle_res_dirs_text=""
for x in env.android_res_dirs:
gradle_res_dirs_text+=",'"+x+"'"
gradle_aidl_dirs_text=""
for x in env.android_aidl_dirs:
gradle_aidl_dirs_text+=",'"+x+"'"
gradle_jni_dirs_text=""
for x in env.android_jni_dirs:
gradle_jni_dirs_text+=",'"+x+"'"
gradle_asset_dirs_text=""
gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$",gradle_maven_repos_text)
gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$",gradle_maven_dependencies_text)
gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$",gradle_java_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_RES_DIRS$$",gradle_res_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_ASSET_DIRS$$",gradle_asset_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_AIDL_DIRS$$",gradle_aidl_dirs_text)
gradle_text = gradle_text.replace("$$GRADLE_JNI_DIRS$$",gradle_jni_dirs_text)
gradle_baseout.write( gradle_text )
gradle_baseout.close()
pp_basein = open(abspath+"/AndroidManifest.xml.template","rb")
pp_baseout = open(abspath+"/java/AndroidManifest.xml","wb")
manifest = pp_basein.read()
manifest = manifest.replace("$$ADD_APPLICATION_CHUNKS$$",env.android_manifest_chunk)
manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk)
manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk)
pp_baseout.write( manifest )
env_android.SharedLibrary("#bin/libgodot",[android_objects],SHLIBSUFFIX=env["SHLIBSUFFIX"])
#env.Command('#bin/libgodot_android.so', '#platform/android/libgodot_android.so', Copy('bin/libgodot_android.so', 'platform/android/libgodot_android.so'))
|