Merge pull request #12606 from natural-law/v3.7-release

Optimize the implementation of framework-compile tools & simulator project.
This commit is contained in:
子龙山人 2015-07-01 09:32:43 +08:00
commit d65900ea3d
9 changed files with 42 additions and 141 deletions

0
cocos/scripting/js-bindings/proj.android/Android.mk Executable file → Normal file
View File

View File

@ -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 \

View File

@ -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":{

View File

@ -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__

View File

@ -90,9 +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 +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

View File

@ -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/",

View File

@ -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
@ -14,3 +14,4 @@ else
endif
COCOS_SIMULATOR_BUILD := 1
USE_ARM_MODE := 1

View File

@ -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;

View File

@ -76,7 +76,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
@ -141,7 +141,7 @@ xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PreprocessorDefinitions>COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>