Generating prebuilt Android.mk when generating prebuilt libs.

This commit is contained in:
Bin Zhang 2015-06-29 16:00:35 +08:00
parent a680638de2
commit d3e9403f20
4 changed files with 36 additions and 33 deletions

View File

@ -5,7 +5,6 @@ import os
import json
import excopy
import utils_cocos
import gen_prebuilt_mk
import modify_template
import re
@ -14,7 +13,6 @@ from argparse import ArgumentParser
class CocosBinTemplateGenerator(object):
KEY_COPY_CONFIG = 'template_copy_config'
KEY_ANDROID_MKS = "android_mks"
def __init__(self, args):
print("Generate cocos binary template")
@ -39,7 +37,6 @@ class CocosBinTemplateGenerator(object):
def generate(self):
self.clean_template()
self.copy_template()
self.modify_binary_mk()
self.gen_templates()
def clean_template(self):
@ -51,15 +48,6 @@ class CocosBinTemplateGenerator(object):
for item in self.config_json[CocosBinTemplateGenerator.KEY_COPY_CONFIG]:
excopy.copy_files_with_config(item, self.repo_x, self.engine_template_dir)
def modify_binary_mk(self):
android_libs = os.path.join(self.lib_dir, "android")
android_mks = self.config_json[CocosBinTemplateGenerator.KEY_ANDROID_MKS]
for mk_file in android_mks:
mk_file_path = os.path.join(self.repo_x, mk_file)
dst_file_path = os.path.join(os.path.dirname(mk_file_path), "prebuilt-mk", os.path.basename(mk_file_path))
tmp_obj = gen_prebuilt_mk.MKGenerator(mk_file_path, android_libs, dst_file_path)
tmp_obj.do_generate()
def getConfigJson(self):
cfg_json_path = os.path.join(self.cur_dir, "template_binary_config.json")
f = open(cfg_json_path)

View File

@ -8,6 +8,7 @@ import shutil
import excopy
import json
import utils_cocos
import gen_prebuilt_mk
from custom_error import CustomError
from custom_error import Logging
@ -21,11 +22,13 @@ class CocosLibsCompiler(object):
KEY_XCODE_PROJS_INFO = 'xcode_projs_info'
KEY_VS_PROJS_INFO = 'vs_projs_info'
KEY_SUPPORT_VS_VERSIONS = 'support_vs_versions'
KEY_ANDROID_MKS = "android_mks"
CHECK_KEYS = [
KEY_LIBS_OUTPUT,
KEY_XCODE_PROJS_INFO,
KEY_VS_PROJS_INFO,
KEY_SUPPORT_VS_VERSIONS
KEY_SUPPORT_VS_VERSIONS,
KEY_ANDROID_MKS
]
KEY_XCODE_TARGETS = 'targets'
@ -90,6 +93,8 @@ class CocosLibsCompiler(object):
self.compile_android("js")
self.compile_android("lua")
# generate prebuilt mk files
self.modify_binary_mk()
def build_win32_proj(self, cmd_path, sln_path, proj_name, mode):
build_cmd = " ".join([
@ -366,6 +371,16 @@ class CocosLibsCompiler(object):
strip_cmd = "%s -S %s/*.a" % (strip_cmd, folder)
utils_cocos.execute_command(strip_cmd)
def modify_binary_mk(self):
android_libs = os.path.join(self.lib_dir, "android")
android_mks = self.cfg_info[CocosLibsCompiler.KEY_ANDROID_MKS]
for mk_file in android_mks:
mk_file_path = os.path.join(self.repo_x, mk_file)
print('gen %s' % mk_file_path)
dst_file_path = os.path.join(os.path.dirname(mk_file_path), "prebuilt-mk", os.path.basename(mk_file_path))
tmp_obj = gen_prebuilt_mk.MKGenerator(mk_file_path, android_libs, dst_file_path)
tmp_obj.do_generate()
def clean_libs(self):
print("to clean libs")
utils_cocos.rmdir(self.lib_dir)

View File

@ -26,5 +26,25 @@
]
}
},
"android_mks" : [
"cocos/Android.mk",
"cocos/audio/android/Android.mk",
"cocos/scripting/js-bindings/proj.android/Android.mk",
"cocos/scripting/lua-bindings/proj.android/Android.mk",
"cocos/storage/local-storage/Android.mk",
"external/bullet/Android.mk",
"external/recast/Android.mk",
"external/flatbuffers/Android.mk",
"external/Box2D/Android.mk",
"cocos/editor-support/cocosbuilder/Android.mk",
"extensions/Android.mk",
"cocos/3d/Android.mk",
"cocos/ui/Android.mk",
"cocos/editor-support/cocostudio/Android.mk",
"cocos/network/Android.mk",
"cocos/platform/android/Android.mk",
"cocos/editor-support/spine/Android.mk",
"tools/simulator/libsimulator/proj.android/Android.mk"
],
"support_vs_versions" : [ 2015, 2013 ]
}

View File

@ -180,25 +180,5 @@
"pattern": "libSpine\\.lib;",
"replace_string": ""
}
],
"android_mks" : [
"cocos/Android.mk",
"cocos/audio/android/Android.mk",
"cocos/scripting/js-bindings/proj.android/Android.mk",
"cocos/scripting/lua-bindings/proj.android/Android.mk",
"cocos/storage/local-storage/Android.mk",
"external/bullet/Android.mk",
"external/recast/Android.mk",
"external/flatbuffers/Android.mk",
"external/Box2D/Android.mk",
"cocos/editor-support/cocosbuilder/Android.mk",
"extensions/Android.mk",
"cocos/3d/Android.mk",
"cocos/ui/Android.mk",
"cocos/editor-support/cocostudio/Android.mk",
"cocos/network/Android.mk",
"cocos/platform/android/Android.mk",
"cocos/editor-support/spine/Android.mk",
"tools/simulator/libsimulator/proj.android/Android.mk"
]
}