2014-02-10 09:10:30 +08:00
|
|
|
import shutil
|
|
|
|
|
|
|
|
Import('env')
|
|
|
|
|
|
|
|
android_files = [
|
|
|
|
|
|
|
|
'os_android.cpp',
|
|
|
|
'godot_android.cpp',
|
|
|
|
'file_access_android.cpp',
|
|
|
|
'dir_access_android.cpp',
|
2014-03-14 09:57:24 +08:00
|
|
|
'audio_driver_opensl.cpp',
|
2014-02-10 09:10:30 +08:00
|
|
|
'file_access_jandroid.cpp',
|
|
|
|
'dir_access_jandroid.cpp',
|
|
|
|
'thread_jandroid.cpp',
|
|
|
|
'audio_driver_jandroid.cpp',
|
2014-05-24 12:35:47 +08:00
|
|
|
'ifaddrs_android.cpp',
|
2014-02-10 09:10:30 +08:00
|
|
|
'android_native_app_glue.c',
|
2014-09-03 10:13:40 +08:00
|
|
|
'java_glue.cpp',
|
2014-09-15 22:33:30 +08:00
|
|
|
'cpu-features.c',
|
2014-09-03 10:13:40 +08:00
|
|
|
'java_class_wrapper.cpp'
|
2014-02-10 09:10:30 +08:00
|
|
|
]
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
2016-01-09 00:36:44 +08:00
|
|
|
gradle_basein = open(abspath+"/build.gradle.template","rb")
|
|
|
|
gradle_baseout = open(abspath+"/java/build.gradle","wb")
|
2014-03-14 09:57:24 +08:00
|
|
|
|
2016-01-09 00:36:44 +08:00
|
|
|
gradle_text = gradle_basein.read()
|
2014-03-14 09:57:24 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2016-01-09 00:36:44 +08:00
|
|
|
gradle_maven_repos_text=""
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2016-01-09 21:21:22 +08:00
|
|
|
if len(env.android_maven_repos) > 0:
|
|
|
|
gradle_maven_repos_text+="maven {\n"
|
|
|
|
for x in env.android_maven_repos:
|
|
|
|
gradle_maven_repos_text+="\t\t"+x+"\n"
|
|
|
|
gradle_maven_repos_text+="\t}\n"
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2016-01-09 00:36:44 +08:00
|
|
|
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:
|
2016-03-02 11:15:39 +08:00
|
|
|
gradle_java_dirs_text+=",'"+x.replace("\\","/")+"'"
|
2016-01-09 00:36:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
gradle_res_dirs_text=""
|
|
|
|
|
|
|
|
for x in env.android_res_dirs:
|
2016-05-24 04:25:22 +08:00
|
|
|
gradle_res_dirs_text+=",'"+x.replace("\\","/")+"'"
|
2016-01-09 00:36:44 +08:00
|
|
|
|
|
|
|
gradle_aidl_dirs_text=""
|
|
|
|
|
|
|
|
for x in env.android_aidl_dirs:
|
2016-05-24 04:25:22 +08:00
|
|
|
gradle_aidl_dirs_text+=",'"+x.replace("\\","/")+"'"
|
2016-01-09 00:36:44 +08:00
|
|
|
|
|
|
|
gradle_jni_dirs_text=""
|
|
|
|
|
|
|
|
for x in env.android_jni_dirs:
|
2016-05-24 04:25:22 +08:00
|
|
|
gradle_jni_dirs_text+=",'"+x.replace("\\","/")+"'"
|
2016-01-09 00:36:44 +08:00
|
|
|
|
|
|
|
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()
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
2015-03-04 01:39:13 +08:00
|
|
|
manifest = manifest.replace("$$ADD_PERMISSION_CHUNKS$$",env.android_permission_chunk)
|
|
|
|
manifest = manifest.replace("$$ADD_APPATTRIBUTE_CHUNKS$$",env.android_appattributes_chunk)
|
2014-02-10 09:10:30 +08:00
|
|
|
pp_baseout.write( manifest )
|
|
|
|
|
|
|
|
|
2014-10-08 14:37:04 +08:00
|
|
|
env_android.SharedLibrary("#bin/libgodot",[android_objects],SHLIBSUFFIX=env["SHLIBSUFFIX"])
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2014-10-07 12:31:49 +08:00
|
|
|
#env.Command('#bin/libgodot_android.so', '#platform/android/libgodot_android.so', Copy('bin/libgodot_android.so', 'platform/android/libgodot_android.so'))
|