diff --git a/cocos/scripting/js-bindings/proj.android/Android.mk b/cocos/scripting/js-bindings/proj.android/Android.mk old mode 100755 new mode 100644 diff --git a/cocos/scripting/lua-bindings/proj.android/Android.mk b/cocos/scripting/lua-bindings/proj.android/Android.mk index 8b6f7e02b1..8f27c50bdc 100644 --- a/cocos/scripting/lua-bindings/proj.android/Android.mk +++ b/cocos/scripting/lua-bindings/proj.android/Android.mk @@ -31,6 +31,10 @@ LOCAL_MODULE := cocos2d_lua_static LOCAL_MODULE_FILENAME := libluacocos2d +ifeq ($(COCOS_SIMULATOR_BUILD),1) +LOCAL_ARM_MODE := arm +endif + LOCAL_SRC_FILES := ../manual/CCLuaBridge.cpp \ ../manual/CCLuaEngine.cpp \ ../manual/CCLuaStack.cpp \ diff --git a/templates/js-template-runtime/cocos-project-template.json b/templates/js-template-runtime/cocos-project-template.json index b55c15e5ba..bd0493afb6 100644 --- a/templates/js-template-runtime/cocos-project-template.json +++ b/templates/js-template-runtime/cocos-project-template.json @@ -170,6 +170,13 @@ "tojs" ] }, + { + "from": "tools/simulator/frameworks/runtime-src/Classes", + "to": "frameworks/runtime-src/Classes", + "include": [ + "js_module_register.h" + ] + }, { "from": "tools/simulator/frameworks/runtime-src/Classes/ide-support", "to": "frameworks/runtime-src/Classes/ide-support", @@ -196,44 +203,17 @@ ] }, { - "from": "tools/simulator/frameworks/runtime-src/proj.win32/build-cfg.json", + "from": "tools/simulator/frameworks/runtime-src/proj.win32/", "to": "frameworks/runtime-src/proj.win32/", - "exclude": [] - }, - { - "from": "templates/lua-template-default/frameworks/runtime-src/proj.win32/game.rc", - "to": "frameworks/runtime-src/proj.win32/", - "exclude": [] - }, - { - "from": "tools/simulator/frameworks/runtime-src/proj.win32/main.cpp", - "to": "frameworks/runtime-src/proj.win32/", - "exclude": [] - }, - { - "from": "tools/simulator/frameworks/runtime-src/proj.win32/main.h", - "to": "frameworks/runtime-src/proj.win32/", - "exclude": [] - }, - { - "from": "tools/simulator/frameworks/runtime-src/proj.win32/res", - "to": "frameworks/runtime-src/proj.win32/res", - "exclude": [] - }, - { - "from": "tools/simulator/frameworks/runtime-src/proj.win32/resource.h", - "to": "frameworks/runtime-src/proj.win32/", - "exclude": [] - }, - { - "from": "tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp", - "to": "frameworks/runtime-src/proj.win32/", - "exclude": [] - }, - { - "from": "tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.h", - "to": "frameworks/runtime-src/proj.win32/", - "exclude": [] + "include": [ + "build-cfg.json", + "game.rc", + "main.cpp", + "main.h", + "res/", + "resource.h", + "SimulatorWin.*" + ] } ], "append_x_engine":{ diff --git a/templates/js-template-runtime/frameworks/runtime-src/Classes/js_module_register.h b/templates/js-template-runtime/frameworks/runtime-src/Classes/js_module_register.h deleted file mode 100644 index 561b63bdc7..0000000000 --- a/templates/js-template-runtime/frameworks/runtime-src/Classes/js_module_register.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_HELPER_H__ -#define __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_HELPER_H__ - -#include "scripting/js-bindings/manual/ScriptingCore.h" -#include "jsb_cocos2dx_auto.hpp" -#include "jsb_cocos2dx_ui_auto.hpp" -#include "jsb_cocos2dx_studio_auto.hpp" -#include "jsb_cocos2dx_builder_auto.hpp" -#include "jsb_cocos2dx_spine_auto.hpp" -#include "jsb_cocos2dx_extension_auto.hpp" -#include "ui/jsb_cocos2dx_ui_manual.h" -#include "cocostudio/jsb_cocos2dx_studio_manual.h" -#include "cocosbuilder/js_bindings_ccbreader.h" -#include "spine/jsb_cocos2dx_spine_manual.h" -#include "extension/jsb_cocos2dx_extension_manual.h" -#include "localstorage/js_bindings_system_registration.h" -#include "chipmunk/js_bindings_chipmunk_registration.h" -#include "jsb_opengl_registration.h" -#include "network/XMLHTTPRequest.h" -#include "network/jsb_websocket.h" -#include "network/jsb_socketio.h" -#include "cocos2d_specifics.hpp" - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) -#include "platform/android/CCJavascriptJavaBridge.h" -#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) -#include "platform/ios/JavaScriptObjCBridge.h" -#endif - -USING_NS_CC; -int js_module_register() -{ - ScriptingCore* sc = ScriptingCore::getInstance(); - sc->addRegisterCallback(register_all_cocos2dx); - sc->addRegisterCallback(register_cocos2dx_js_core); - //sc->addRegisterCallback(register_cocos2dx_js_extensions); - sc->addRegisterCallback(jsb_register_system); - - // extension can be commented out to reduce the package - sc->addRegisterCallback(register_all_cocos2dx_extension); - sc->addRegisterCallback(register_all_cocos2dx_extension_manual); - - // chipmunk can be commented out to reduce the package - sc->addRegisterCallback(jsb_register_chipmunk); - // opengl can be commented out to reduce the package - sc->addRegisterCallback(JSB_register_opengl); - - // builder can be commented out to reduce the package - sc->addRegisterCallback(register_all_cocos2dx_builder); - sc->addRegisterCallback(register_CCBuilderReader); - - // ui can be commented out to reduce the package, attension studio need ui module - sc->addRegisterCallback(register_all_cocos2dx_ui); - sc->addRegisterCallback(register_all_cocos2dx_ui_manual); - - // studio can be commented out to reduce the package, - sc->addRegisterCallback(register_all_cocos2dx_studio); - sc->addRegisterCallback(register_all_cocos2dx_studio_manual); - - // spine can be commented out to reduce the package - sc->addRegisterCallback(register_all_cocos2dx_spine); - sc->addRegisterCallback(register_all_cocos2dx_spine_manual); - - // XmlHttpRequest can be commented out to reduce the package - sc->addRegisterCallback(MinXmlHttpRequest::_js_register); - // websocket can be commented out to reduce the package - sc->addRegisterCallback(register_jsb_websocket); - // sokcet io can be commented out to reduce the package - sc->addRegisterCallback(register_jsb_socketio); - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) - sc->addRegisterCallback(JavascriptJavaBridge::_js_register); -#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS|| CC_TARGET_PLATFORM == CC_PLATFORM_MAC) - sc->addRegisterCallback(JavaScriptObjCBridge::_js_register); -#endif - return 1; -} - -#endif // __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_HELPER_H__ - diff --git a/tools/framework-compile/bin/gen_cocos_libs.py b/tools/framework-compile/bin/gen_cocos_libs.py index f0b538eae7..eacb80612e 100755 --- a/tools/framework-compile/bin/gen_cocos_libs.py +++ b/tools/framework-compile/bin/gen_cocos_libs.py @@ -90,11 +90,9 @@ class CocosLibsCompiler(object): if self.build_mac: self.compile_mac_ios() if self.build_android: - self.compile_android("js") - self.compile_android("lua") - - # generate prebuilt mk files - self.modify_binary_mk() + self.compile_android() + # generate prebuilt mk files + self.modify_binary_mk() def build_win32_proj(self, cmd_path, sln_path, proj_name, mode): build_cmd = " ".join([ @@ -281,7 +279,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 +293,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 +343,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/", diff --git a/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk b/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk index 6e446c46fd..5627a199df 100644 --- a/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk +++ b/tools/simulator/frameworks/runtime-src/proj.android/jni/Application.mk @@ -1,6 +1,6 @@ APP_STL := gnustl_static -APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char +APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCC_ENABLE_BULLET_INTEGRATION=1 -std=c++11 -fsigned-char APP_LDFLAGS := -latomic @@ -13,4 +13,5 @@ else APP_OPTIM := release endif -COCOS_SIMULATOR_BUILD := 1 \ No newline at end of file +COCOS_SIMULATOR_BUILD := 1 +USE_ARM_MODE := 1 diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj/project.pbxproj b/tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj/project.pbxproj index c5a2e406ed..18b4ea23b8 100644 --- a/tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj/project.pbxproj +++ b/tools/simulator/frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj/project.pbxproj @@ -896,6 +896,7 @@ "CC_LUA_ENGINE_ENABLED=1", "CC_ENABLE_CHIPMUNK_INTEGRATION=1", COCOS2D_JAVASCRIPT, + "CC_ENABLE_BULLET_INTEGRATION=1", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -924,6 +925,7 @@ "CC_ENABLE_CHIPMUNK_INTEGRATION=1", COCOS2D_JAVASCRIPT, NDEBUG, + "CC_ENABLE_BULLET_INTEGRATION=1", ); GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; diff --git a/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj b/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj index 3123402c14..72d6ef8671 100644 --- a/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj +++ b/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj @@ -76,7 +76,7 @@ ProgramDatabase EnableFastChecks Disabled - WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions) + WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions) 4267;4251;4244;%(DisableSpecificWarnings) true $(IntDir)vc$(PlatformToolsetVersion).pdb @@ -141,7 +141,7 @@ xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32" MultiThreadedDLL Sync ProgramDatabase - COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions) + COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;CC_ENABLE_BULLET_INTEGRATION=1;%(PreprocessorDefinitions) 4267;4251;4244;%(DisableSpecificWarnings) true $(IntDir)vc$(PlatformToolsetVersion).pdb