From 78c5f2e77e6caf192c400f940f8a29f96382aaf6 Mon Sep 17 00:00:00 2001 From: Bin Zhang Date: Tue, 30 Jun 2015 16:45:55 +0800 Subject: [PATCH] Build simulator project when generating prebuilt libs for android. --- tools/framework-compile/bin/gen_cocos_libs.py | 22 +++++-------------- .../bin/template_binary_config.json | 7 ++++++ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index f0b538eae7..9fa8e6c454 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -90,8 +90,7 @@ class CocosLibsCompiler(object): if self.build_mac: self.compile_mac_ios() if self.build_android: - self.compile_android("js") - self.compile_android("lua") + self.compile_android() # generate prebuilt mk files self.modify_binary_mk() @@ -281,7 +280,7 @@ class CocosLibsCompiler(object): mac_strip_cmd = "xcrun strip -S %s/*.a" % mac_out_dir utils_cocos.execute_command(mac_strip_cmd) - def compile_android(self, language): + def compile_android(self): print("compile android") # build .so for android CONSOLE_PATH = "tools/cocos2d-console/bin" @@ -295,17 +294,9 @@ class CocosLibsCompiler(object): else: cmd_path = os.path.join(console_dir, "cocos") - proj_name = "My%sGame" % language - proj_dir = engine_dir - proj_path = os.path.join(proj_dir, proj_name) - utils_cocos.rmdir(proj_path) - - # create a runtime project - create_cmd = "%s new -l %s -t runtime -d %s %s" % (cmd_path, language, proj_dir, proj_name) - utils_cocos.execute_command(create_cmd) - - # build it - build_cmd = "%s compile -s %s -p android --ndk-mode release -j 4 --app-abi %s" % (cmd_path, proj_path, self.app_abi) + # build the simulator project + proj_path = os.path.join(engine_dir, 'tools/simulator') + build_cmd = "%s compile -s %s -p android --ndk-mode release --app-abi %s" % (cmd_path, proj_path, self.app_abi) utils_cocos.execute_command(build_cmd) # copy .a to prebuilt dir @@ -353,9 +344,6 @@ class CocosLibsCompiler(object): if os.path.exists(strip_cmd_path) and os.path.exists(os.path.join(android_out_dir, "x86")): self.trip_libs(strip_cmd_path, os.path.join(android_out_dir, 'x86')) - # remove the project - utils_cocos.rmdir(proj_path) - def trip_libs(self, strip_cmd, folder): if not os.path.isdir(folder): return diff --git a/tools/framework-compile/bin/template_binary_config.json b/tools/framework-compile/bin/template_binary_config.json index d590820df7..02fd876cf2 100755 --- a/tools/framework-compile/bin/template_binary_config.json +++ b/tools/framework-compile/bin/template_binary_config.json @@ -105,6 +105,13 @@ "SimulatorWin.h" ] }, + { + "from": "tools/simulator/frameworks/runtime-src/Classes", + "to": "js-template-binary/frameworks/runtime-src/Classes", + "include": [ + "js_module_register.h" + ] + }, { "from": "tools/simulator/frameworks/runtime-src/Classes/ide-support", "to": "js-template-binary/frameworks/runtime-src/Classes/ide-support/",