From d3e9403f2020683d4d5257bdcf1baa83f9752c6b Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Mon, 29 Jun 2015 16:00:35 +0800 Subject: [PATCH] Generating prebuilt Android.mk when generating prebuilt libs. --- .../bin/gen_cocos_binary_template.py | 12 ----------- tools/framework-compile/bin/gen_cocos_libs.py | 17 +++++++++++++++- .../bin/gen_libs_config.json | 20 +++++++++++++++++++ .../bin/template_binary_config.json | 20 ------------------- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/tools/framework-compile/bin/gen_cocos_binary_template.py b/tools/framework-compile/bin/gen_cocos_binary_template.py index 90073a2c2a..e006bf676d 100755 --- a/tools/framework-compile/bin/gen_cocos_binary_template.py +++ b/tools/framework-compile/bin/gen_cocos_binary_template.py @@ -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) diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index 6188287ed7..f0b538eae7 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -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) diff --git a/tools/framework-compile/bin/gen_libs_config.json b/tools/framework-compile/bin/gen_libs_config.json index 48eebcc034..dbe9ffb87b 100755 --- a/tools/framework-compile/bin/gen_libs_config.json +++ b/tools/framework-compile/bin/gen_libs_config.json @@ -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 ] } diff --git a/tools/framework-compile/bin/template_binary_config.json b/tools/framework-compile/bin/template_binary_config.json index 6280cbe507..300cc36c45 100755 --- a/tools/framework-compile/bin/template_binary_config.json +++ b/tools/framework-compile/bin/template_binary_config.json @@ -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" ] }