初始化

This commit is contained in:
SmallMain
2022-06-25 00:23:03 +08:00
commit ef0589e8e5
2264 changed files with 617829 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
How to Use bindings-generator
==================
On Windows:
------------
* Make sure that you have installed `android-ndk-r16` or later.
* Download python2.7.3 (32bit) from (http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi).
* Add the installed path of python (e.g. C:\Python27) to windows environment variable named 'PATH'.
* Download pyyaml from http://pyyaml.org/download/pyyaml/PyYAML-3.11.win32-py2.7.exe and install it.
* Download [Cheetah-2.4.4.tar.gz](https://pypi.python.org/packages/cd/b0/c2d700252fc251e91c08639ff41a8a5203b627f4e0a2ae18a6b662ab32ea/Cheetah-2.4.4.tar.gz#md5=853917116e731afbc8c8a43c37e6ddba), extract and install it by `python setup.py`.
* Set environment variables (`NDK_ROOT`) and `PYTHON_BIN`
* Go to "cocos2d-x/tools/tojs" folder, and run "genbindings.py". The generated codes will be under "cocos\scripting\auto-generated\js-bindings".
On MAC:
----------
* The OSX 10.10 has a built-in python2.7 and if your os don't have python2.7 then use [Homebrew](http://brew.sh/) to install the python and use pip install the python dependencies.
<pre>
brew install python
</pre>
* Install python dependices by pip.
<pre>
sudo easy_install pip
sudo pip install PyYAML
sudo pip install Cheetah
</pre>
* Download NDK r16 or later from [Android Ndk](https://developer.android.com/ndk/downloads/index.html)
* Run
<pre>
export NDK_ROOT=/path/to/android-ndk-r16
./genbindings.py
</pre>
On Ubuntu Linux 12.04 64bit
------------
* Install python
<pre>
sudo apt-get install python2.7
</pre>
* Install python dependices by pip.
<pre>
sudo apt-get install python-pip
sudo pip install PyYAML
sudo pip install Cheetah
</pre>
* Download NDK r16 or later from [Android Ndk](https://developer.android.com/ndk/downloads/index.html)
* Go to "cocos2d-x/tools/tojs", Run
<pre>
export NDK_ROOT=/path/to/android-ndk-r16
./genbindings.py
</pre>

View File

@@ -0,0 +1,71 @@
[protocols]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = anysdk_framework
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = anysdk
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.9/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/%(clang_include)s
clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
cocos_headers = -I%(anysdk_appstore_dir)s
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s
# what headers to 9
headers = %(anysdk_appstore_dir)s/PluginManager.h %(anysdk_appstore_dir)s/ProtocolAnalytics.h %(anysdk_appstore_dir)s/ProtocolYAP.h %(anysdk_appstore_dir)s/ProtocolAds.h %(anysdk_appstore_dir)s/ProtocolShare.h %(anysdk_appstore_dir)s/ProtocolSocial.h %(anysdk_appstore_dir)s/ProtocolUser.h %(anysdk_appstore_dir)s/ProtocolPush.h %(anysdk_appstore_dir)s/ProtocolCrash.h %(anysdk_appstore_dir)s/ProtocolREC.h %(anysdk_appstore_dir)s/ProtocolCustom.h %(anysdk_appstore_dir)s/AgentManager.h %(anysdk_appstore_dir)s/JSBRelation.h %(anysdk_appstore_dir)s/ProtocolAdTracking.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
classes = PluginProtocol PluginFactory PluginManager ProtocolYAP ProtocolAnalytics ProtocolAds ProtocolSocial ProtocolUser ProtocolPush ProtocolREC ProtocolCrash ProtocolCustom AgentManager JSBRelation ProtocolAdTracking
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = ProtocolYAP::[setResultListener getYapListener yapForProduct],
ProtocolAnalytics::[logEvent],
ProtocolAds::[setAdsListener getAdsListener],
ProtocolShare::[setResultListener],
ProtocolSocial::[setListener getListener unlockAchievement],
ProtocolUser::[setActionListener getActionListener],
PluginProtocol::[callFuncWithParam callStringFuncWithParam callIntFuncWithParam callBoolFuncWithParam callFloatFuncWithParam],
ProtocolPush::[setActionListener getActionListener setTags delTags],
ProtocolCustom::[setResultListener getCustomListener],
ProtocolREC::[setResultListener getRECListener],
AgentManager::[getYAPPlugin getFrameworkVersion loadPlugin],
JSBRelation::[getMethodsOfJobject],
ProtocolAdTracking::[trackEvent]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# CCSet is special and we will use a hand-written constructor
abstract_classes = PluginProtocol PluginFactory ProtocolYAP ProtocolAnalytics PluginManager ProtocolAds ProtocolShare ProtocolUser ProtocolSocial ProtocolPush AgentManager ProtocolCustom ProtocolCrash ProtocolREC ProtocolAdTracking JSBRelation
persistent_classes =
classes_owned_by_cpp = PluginProtocol PluginFactory PluginManager ProtocolYAP ProtocolAnalytics ProtocolAds ProtocolSocial ProtocolUser ProtocolPush ProtocolREC ProtocolCrash ProtocolCustom AgentManager JSBRelation ProtocolAdTracking

View File

@@ -0,0 +1,74 @@
[protocols]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = anysdk_framework
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = anysdk
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.9/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/%(clang_include)s
clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
cocos_headers = -I%(anysdk_common_dir)s
replace_headers = extensions/anysdk/js-bindings/jsb_anysdk_protocols_auto.hpp::jsb_anysdk_protocols_auto.hpp
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s
# what headers to 9
headers = %(anysdk_common_dir)s/PluginManager.h %(anysdk_common_dir)s/ProtocolAnalytics.h %(anysdk_common_dir)s/ProtocolIAP.h %(anysdk_common_dir)s/ProtocolAds.h %(anysdk_common_dir)s/ProtocolShare.h %(anysdk_common_dir)s/ProtocolSocial.h %(anysdk_common_dir)s/ProtocolUser.h %(anysdk_common_dir)s/ProtocolPush.h %(anysdk_common_dir)s/ProtocolCrash.h %(anysdk_common_dir)s/ProtocolREC.h %(anysdk_common_dir)s/ProtocolCustom.h %(anysdk_common_dir)s/AgentManager.h %(anysdk_common_dir)s/JSBRelation.h %(anysdk_common_dir)s/ProtocolAdTracking.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
classes = PluginProtocol PluginFactory PluginManager ProtocolIAP ProtocolAnalytics ProtocolAds ProtocolSocial ProtocolUser ProtocolPush ProtocolREC ProtocolCrash ProtocolCustom AgentManager JSBRelation ProtocolAdTracking
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = ProtocolIAP::[setResultListener getPayListener payForProduct],
ProtocolAnalytics::[logEvent],
ProtocolAds::[setAdsListener getAdsListener],
ProtocolShare::[setResultListener],
ProtocolSocial::[setListener getListener unlockAchievement],
ProtocolUser::[setActionListener getActionListener],
PluginProtocol::[callFuncWithParam callStringFuncWithParam callIntFuncWithParam callBoolFuncWithParam callFloatFuncWithParam],
ProtocolPush::[setActionListener getActionListener setTags delTags],
ProtocolCustom::[setResultListener getCustomListener],
ProtocolREC::[setResultListener getRECListener],
AgentManager::[getIAPPlugin getFrameworkVersion loadPlugin],
JSBRelation::[getMethodsOfJobject],
ProtocolAdTracking::[trackEvent]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# CCSet is special and we will use a hand-written constructor
abstract_classes = PluginProtocol PluginFactory ProtocolIAP ProtocolAnalytics PluginManager ProtocolAds ProtocolShare ProtocolUser ProtocolSocial ProtocolPush AgentManager ProtocolCustom ProtocolCrash ProtocolREC ProtocolAdTracking JSBRelation
persistent_classes =
classes_owned_by_cpp = PluginProtocol PluginFactory PluginManager ProtocolIAP ProtocolAnalytics ProtocolAds ProtocolSocial ProtocolUser ProtocolPush ProtocolREC ProtocolCrash ProtocolCustom AgentManager JSBRelation ProtocolAdTracking

View File

@@ -0,0 +1,72 @@
[cocos2d-x]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = engine
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = jsb
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/2d/CCTTFLabelRenderer.h
replace_headers=
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = FileUtils$ SAXParser CanvasRenderingContext2D CanvasGradient Device LabelRenderer
classes_need_extend = LabelRenderer
field =
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = FileUtils::[getFileData setFilenameLookupDictionary destroyInstance getFullPathCache getContents listFilesRecursively],
SAXParser::[parse setDelegator startElement endElement textHandler],
Device::[getDeviceMotionValue],
CanvasRenderingContext2D::[setCanvasBufferUpdatedCallback set_.+],
LabelRenderer::[bindSharedBlock]
rename_functions = FileUtils::[loadFilenameLookupDictionaryFromFile=loadFilenameLookup],
CanvasRenderingContext2D::[getImageData=_getImageData]
rename_classes = SAXParser::PlistParser
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents = SAXParser
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = SAXParser Device
persistent_classes = FileUtils
classes_owned_by_cpp =

View File

@@ -0,0 +1,65 @@
[cocos2dx_audioengine]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = audioengine
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = jsb
macro_judgement = #if (USE_AUDIO > 0) && (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/audio/include/AudioEngine.h
replace_headers = AudioEngine.h::audio/include/AudioEngine.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = AudioEngine AudioProfile
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip =
field = AudioProfile::[name maxInstances minDelay]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents = AudioEngine AudioProfile
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = AudioEngine
classes_owned_by_cpp = AudioEngine

View File

@@ -0,0 +1,90 @@
[cocos2dx_dragonbones]
prefix = cocos2dx_dragonbones
target_namespace = dragonBones
android_headers =
macro_judgement = #if USE_DRAGONBONES > 0
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -I%(cocosdir)s/external/android/arm64-v8a/include/v8
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/cocos/editor-support
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
headers = %(cocosdir)s/cocos/editor-support/dragonbones-creator-support/CCDragonBonesHeaders.h
classes = DragonBonesData CCFactory CCArmatureDisplay Armature CCSlot WorldClock Animation Slot BaseFactory BaseObject TextureData CCTextureData TextureAtlasData CCTextureAtlasData AnimationState EventObject UserData Bone Transform Matrix TransformObject ArmatureData BoneData SlotData SkinData AnimationData CCArmatureCacheDisplay ArmatureCacheMgr RealTimeAttachUtil CacheModeAttachUtil AttachUtilBase BoundingBoxData RectangleBoundingBoxData PolygonBoundingBoxData EllipseBoundingBoxData
abstract_classes = DragonBonesData Armature CCSlot WorldClock Animation Slot BaseFactory BaseObject TextureData CCTextureData TextureAtlasData CCTextureAtlasData AnimationState EventObject UserData Bone Transform Matrix TransformObject ArmatureData BoneData SlotData SkinData AnimationData AttachUtilBase BoundingBoxData
skip = CCFactory::[destroyInstance loadDragonBonesData loadTextureAtlasData getRenderOrder],
BaseFactory::[getAllTextureAtlasData getAllDragonBonesData getClassTypeIndex replaceSlotDisplayList getTextureAtlasData parseTextureAtlasData],
Armature::[getReplacedTexture setReplacedTexture getBoneByDisplay getSlotByDisplay init _sortZOrder getBones getSlots getDisplay getTypeIndex getRenderOrder],
Animation::[getTypeIndex getStates setAnimations getAnimations],
Slot::[init getDisplay getRawDisplay getMeshDisplay setDisplay _updateBlendMode _updateVisible _setDisplayIndex _setDisplayList getDisplayList _setColor _setDisplayList],
AnimationState::[copyFrom getTypeIndex],
CCSlot::[_onClear getClassTypeIndex getTypeIndex],
Transform::[operator= fromMatrix add identity minus toMatrix],
Matrix::[operator= identity concat invert transformPoint transformRectangle],
WorldClock::[add remove],
ArmatureData::[setCacheFrame getCacheFrame getTypeIndex getActions getDefaultActions cacheFrames addBone addSlot addSkin addAnimation getSortedBones getSortedSlots],
BoneData::[getTypeIndex],
SlotData::[getTypeIndex],
AnimationData::[cacheFrames addBoneTimeline addSlotTimeline getSlotTimelines getBoneTimelines getConstraintTimelines getClassTypeIndex getTypeIndex],
BaseObject::[getClassTypeIndex setObjectRecycleOrDestroyCallback isInPool getAllObjects],
TextureAtlasData::[getTextures copyFrom],
DragonBonesData::[getTypeIndex],
SkinData::[getDisplays getSlotDisplays getTypeIndex],
Bone::[getTypeIndex],
EventObject::[getTypeIndex],
UserData::[getTypeIndex],
TextureData::[copyFrom],
CCTextureAtlasData::[getTypeIndex],
CCTextureData::[getTypeIndex],
CCArmatureDisplay::[render update getRenderOrder],
RealTimeAttachUtil::[syncAttachedNode],
CacheModeAttachUtil::[syncAttachedNode],
AttachUtilBase::[releaseAttachedNode],
CCArmatureCacheDisplay::[getRenderOrder]
field = Transform::[x y skew scaleX scaleY rotation],
Slot::[displayController _zOrder],
Matrix::[a b c d tx ty],
EventObject::[animationState armature name type bone slot],
AnimationState::[timeScale displayControl additiveBlending playTimes weight autoFadeOutTime fadeTotalTime name],
Animation::[timeScale],
ArmatureData::[frameRate name],
AnimationData::[name frameCount playTimes duration fadeInTime],
BoneData::[name parent],
SlotData::[name parent],
SkinData::[name],
DragonBonesData::[name],
TextureAtlasData::[name],
BoundingBoxData::[color width height],
RectangleBoundingBoxData::[color width height],
PolygonBoundingBoxData::[color x y width height],
EllipseBoundingBoxData::[color width height],
CCArmatureDisplay::[timeScale]
remove_prefix =
classes_have_no_parents = WorldClock AnimationData
base_classes_to_skip = Ref IArmatureProxy IAnimatable IMiddleware
rename_functions = CCArmatureCacheDisplay::[getArmature=armature],
CCArmatureDisplay::[getArmature=armature],
CCFactory::[getFactory=getInstance]
rename_classes =
classes_owned_by_cpp = DragonBonesData Armature CCSlot WorldClock Animation Slot BaseFactory BaseObject TextureData CCTextureData TextureAtlasData CCTextureAtlasData AnimationState EventObject Bone Transform Matrix TransformObject ArmatureData BoneData SlotData SkinData AnimationData BoundingBoxData RectangleBoundingBoxData PolygonBoundingBoxData EllipseBoundingBoxData

View File

@@ -0,0 +1,44 @@
[cocos2dx_editor_support]
prefix = cocos2dx_editor_support
target_namespace = middleware
android_headers =
macro_judgement = #if USE_MIDDLEWARE > 0
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -I%(cocosdir)s/external/android/arm64-v8a/include/v8
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/cocos/editor-support
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
headers = %(cocosdir)s/cocos/editor-support/middleware-adapter.h %(cocosdir)s/cocos/editor-support/MiddlewareManager.h
replace_headers =
classes = Texture2D MiddlewareManager
classes_need_extend =
skip = MiddlewareManager::[addTimer removeTimer getMeshBuffer]
remove_prefix =
classes_have_no_parents =
base_classes_to_skip = Ref IMiddleware
abstract_classes =
rename_functions =
rename_classes =

View File

@@ -0,0 +1,67 @@
[cocos2dx_extension]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = extension
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = jsb
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/extensions/cocos-ext.h
replace_headers = cocos-ext.h::extensions/cocos-ext.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = AssetsManagerEx Manifest EventListenerAssetsManagerEx EventAssetsManagerEx
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = ScrollView::[(g|s)etDelegate$],
.*Delegate::[*],
.*Loader.*::[*],
*::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*HSV onTouch.* onAcc.* onKey.* onRegisterTouchListener],
Manifest::[getAssets],
AssetsManagerEx::[getFailedAssets updateAssets]
rename_functions =
rename_classes = AssetsManagerEx::AssetsManager,
EventAssetsManagerEx::EventAssetsManager,
EventListenerAssetsManagerEx::EventListenerAssetsManager
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =
classes_need_extend =

View File

@@ -0,0 +1,60 @@
[cocos2dx_network]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = network
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = jsb
macro_judgement = #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/network/CCDownloader.h
# cpp_headers = network/js_network_manual.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = Downloader
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = Downloader::[createDownloadDataTask createDownloadFileTask abort setOnTaskError setOnFileTaskSuccess]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents = Downloader
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =

View File

@@ -0,0 +1,46 @@
[cocos2dx_particle]
prefix = cocos2dx_particle
target_namespace = middleware
android_headers =
macro_judgement = #if USE_PARTICLE > 0
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -I%(cocosdir)s/external/android/arm64-v8a/include/v8
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/cocos/editor-support
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
headers = %(cocosdir)s/cocos/editor-support/particle/ParticleSimulator.h
replace_headers =
classes = ParticleSimulator
classes_need_extend = ParticleSimulator
field = ParticleSimulator::[positionType emissionRate totalParticles duration emitterMode life lifeVar startSize startSizeVar endSize endSizeVar startSpin startSpinVar endSpin endSpinVar angle angleVar speed speedVar radialAccel radialAccelVar tangentialAccel tangentialAccelVar rotationIsDir startRadius startRadiusVar endRadius endRadiusVar rotatePerS rotatePerSVar aspectRatio]
skip = ParticleSimulator::[getRenderOrder]
remove_prefix =
classes_have_no_parents =
base_classes_to_skip = Ref IMiddleware
abstract_classes =
rename_functions =
rename_classes =

View File

@@ -0,0 +1,93 @@
[cocos2dx_spine]
prefix = cocos2dx_spine
target_namespace = spine
android_headers =
macro_judgement = #if USE_SPINE > 0
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -I%(cocosdir)s/external/android/arm64-v8a/include/v8
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources -I%(cocosdir)s/cocos/editor-support
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
headers = %(cocosdir)s/cocos/editor-support/spine-creator-support/spine-cocos2dx.h
replace_headers = spine-cocos2dx.h::spine-creator-support/spine-cocos2dx.h
classes = SkeletonRenderer SkeletonAnimation VertexEffectDelegate Animation TrackEntry AnimationState AnimationStateData Attachment AttachmentTimeline BoundingBoxAttachment Bone BoneData ClippingAttachment Color ColorTimeline CurveTimeline DeformTimeline DrawOrderTimeline Event EventData EventTimeline IkConstraint IkConstraintData IkConstraintTimeline MeshAttachment Polygon PathAttachment PathConstraint PathConstraintData PathConstraintMixTimeline PathConstraintPositionTimeline PathConstraintSpacingTimeline PointAttachment RegionAttachment RotateTimeline ScaleTimeline ShearTimeline Skeleton Slot Skin SkeletonBounds SkeletonData SlotData Timeline TransformConstraint TransformConstraintData TransformConstraintTimeline TranslateTimeline TwoColorTimeline VertexAttachment VertexEffect JitterVertexEffect SwirlVertexEffect SkeletonDataMgr SkeletonCacheAnimation SkeletonCacheMgr ConstraintData RealTimeAttachUtil CacheModeAttachUtil AttachUtilBase
classes_need_extend = SkeletonAnimation
skip = SkeletonRenderer::[create createWithData initWithData createWithSkeleton createWithFile getRenderOrder],
SkeletonAnimation::[createWithData onTrackEntryEvent onAnimationStateEvent],
Animation::[apply],
TrackEntry::[setListener],
AnimationState::[apply setListener],
Attachment::[getRTTI],
AttachmentTimeline::[apply getRTTI],
BoundingBoxAttachment::[getRTTI],
Bone::[worldToLocal localToWorld getRTTI],
ClippingAttachment::[getRTTI],
Color::[set add],
ColorTimeline::[apply getRTTI],
CurveTimeline::[apply getRTTI],
DeformTimeline::[apply setFrame getVertices getRTTI],
DrawOrderTimeline::[apply setFrame getDrawOrders getRTTI],
EventTimeline::[apply getRTTI],
IkConstraint::[apply getRTTI],
IkConstraintTimeline::[apply getRTTI],
MeshAttachment::[getRTTI],
PathAttachment::[getRTTI],
PathConstraint::[getRTTI],
PathConstraintMixTimeline::[apply getRTTI],
PathConstraintPositionTimeline::[apply getRTTI],
PathConstraintSpacingTimeline::[apply getRTTI],
PointAttachment::[computeWorldPosition getRTTI computeWorldRotation],
RegionAttachment::[computeWorldVertices getRTTI],
RotateTimeline::[apply getRTTI],
ScaleTimeline::[apply getRTTI],
ShearTimeline::[apply getRTTI],
Skeleton::[getBounds],
Skin::[getAttachments],
SkeletonBounds::[update aabbIntersectsSkeleton],
Timeline::[apply getRTTI],
TransformConstraint::[getRTTI],
TransformConstraintTimeline::[apply getRTTI],
TranslateTimeline::[apply getRTTI],
TwoColorTimeline::[apply getRTTI],
VertexEffect::[begin transform end],
JitterVertexEffect::[begin transform end],
SwirlVertexEffect::[begin transform end],
VertexAttachment::[computeWorldVertices getBones getRTTI],
SkeletonDataMgr::[destroyInstance hasSkeletonData setSkeletonData retainByUUID releaseByUUID],
SkeletonCacheAnimation::[render getRenderOrder],
RealTimeAttachUtil::[syncAttachedNode],
CacheModeAttachUtil::[syncAttachedNode],
AttachUtilBase::[releaseAttachedNode]
field = Color::[r g b a]
remove_prefix =
classes_have_no_parents =
base_classes_to_skip = Ref IMiddleware SpineObject HasRendererObject Updatable Constraint
abstract_classes = Animation TrackEntry AnimationState AnimationStateData Attachment AttachmentTimeline BoundingBoxAttachment Bone BoneData ClippingAttachment Color ColorTimeline CurveTimeline DeformTimeline DrawOrderTimeline Event EventData EventTimeline IkConstraint IkConstraintData IkConstraintTimeline MeshAttachment Polygon PathAttachment PathConstraint PathConstraintData PathConstraintMixTimeline PathConstraintPositionTimeline PathConstraintSpacingTimeline PointAttachment RegionAttachment RotateTimeline ScaleTimeline ShearTimeline Skeleton Slot Skin SlotData SkeletonBounds SkeletonData Timeline TransformConstraint TransformConstraintData TransformConstraintTimeline TranslateTimeline TwoColorTimeline VertexAttachment VertexEffect JitterVertexEffect SwirlVertexEffect ConstraintData AttachUtilBase
rename_functions = SkeletonAnimation::[createWithFile=create setCompleteListener=setCompleteListenerNative setTrackCompleteListener=setTrackCompleteListenerNative],
SkeletonRenderer::[createWithFile=create]
rename_classes = SkeletonRenderer::Skeleton
classes_owned_by_cpp = Animation TrackEntry AnimationState AnimationStateData Attachment AttachmentTimeline BoundingBoxAttachment Bone BoneData ClippingAttachment Color ColorTimeline CurveTimeline DeformTimeline DrawOrderTimeline Event EventData EventTimeline IkConstraint IkConstraintData IkConstraintTimeline MeshAttachment Polygon PathAttachment PathConstraint PathConstraintData PathConstraintMixTimeline PathConstraintPositionTimeline PathConstraintSpacingTimeline PointAttachment RegionAttachment RotateTimeline ScaleTimeline ShearTimeline Skeleton Slot Skin SlotData SkeletonBounds SkeletonData Timeline TransformConstraint TransformConstraintData TransformConstraintTimeline TranslateTimeline TwoColorTimeline VertexAttachment VertexEffect JitterVertexEffect SwirlVertexEffect

View File

@@ -0,0 +1,60 @@
[video]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = video
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = jsb
macro_judgement = #if (USE_VIDEO > 0) && (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/ui/videoplayer/VideoPlayer.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = VideoPlayer
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip =
rename_functions = VideoPlayer::[~VideoPlayer=destroy]
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =

View File

@@ -0,0 +1,60 @@
[webview]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = webview
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = jsb
macro_judgement = #if (USE_WEB_VIEW > 0) && (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/ui/webview/WebView.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = WebView
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip =
rename_functions = WebView::[~WebView=destroy]
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =

View File

@@ -0,0 +1,187 @@
#!/usr/bin/python
# This script is used to generate luabinding glue codes.
# Android ndk version must be ndk-r9b.
import sys
import os, os.path
import shutil
import ConfigParser
import subprocess
import re
from contextlib import contextmanager
def _check_ndk_root_env():
''' Checking the environment NDK_ROOT, which will be used for building
'''
try:
NDK_ROOT = os.environ['NDK_ROOT']
except Exception:
print "NDK_ROOT not defined. Please define NDK_ROOT in your environment."
sys.exit(1)
return NDK_ROOT
def _check_python_bin_env():
''' Checking the environment PYTHON_BIN, which will be used for building
'''
try:
PYTHON_BIN = os.environ['PYTHON_BIN']
except Exception:
print "PYTHON_BIN not defined, use current python."
PYTHON_BIN = sys.executable
return PYTHON_BIN
class CmdError(Exception):
pass
@contextmanager
def _pushd(newDir):
previousDir = os.getcwd()
os.chdir(newDir)
yield
os.chdir(previousDir)
def _run_cmd(command):
ret = subprocess.call(command, shell=True)
if ret != 0:
message = "Error running command"
raise CmdError(message)
def main():
cur_platform= '??'
llvm_path = '??'
ndk_root = _check_ndk_root_env()
# del the " in the path
ndk_root = re.sub(r"\"", "", ndk_root)
python_bin = _check_python_bin_env()
platform = sys.platform
if platform == 'win32':
cur_platform = 'windows'
elif platform == 'darwin':
cur_platform = platform
elif 'linux' in platform:
cur_platform = 'linux'
else:
print 'Your platform is not supported!'
sys.exit(1)
x86_llvm_path = ""
x64_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
if not os.path.exists(x64_llvm_path):
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm/prebuilt', '%s' % (cur_platform)))
if not os.path.exists(x86_llvm_path):
x86_llvm_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/llvm/prebuilt', '%s-%s' % (cur_platform, 'x86')))
if os.path.isdir(x64_llvm_path):
llvm_path = x64_llvm_path
elif os.path.isdir(x86_llvm_path):
llvm_path = x86_llvm_path
else:
print 'llvm toolchain not found!'
print 'path: %s or path: %s are not valid! ' % (x86_llvm_path, x64_llvm_path)
sys.exit(1)
x86_gcc_toolchain_path = ""
x64_gcc_toolchain_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/arm-linux-androideabi-4.9/prebuilt', '%s-%s' % (cur_platform, 'x86_64')))
if not os.path.exists(x64_gcc_toolchain_path):
x86_gcc_toolchain_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/arm-linux-androideabi-4.9/prebuilt', '%s' % (cur_platform)))
if not os.path.exists(x86_gcc_toolchain_path):
x86_gcc_toolchain_path = os.path.abspath(os.path.join(ndk_root, 'toolchains/arm-linux-androideabi-4.9/prebuilt', '%s-%s' % (cur_platform, 'x86')))
if os.path.isdir(x64_gcc_toolchain_path):
gcc_toolchain_path = x64_gcc_toolchain_path
elif os.path.isdir(x86_gcc_toolchain_path):
gcc_toolchain_path = x86_gcc_toolchain_path
else:
print 'gcc toolchain not found!'
print 'path: %s or path: %s are not valid! ' % (x64_gcc_toolchain_path, x86_gcc_toolchain_path)
sys.exit(1)
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
cocos_root = os.path.abspath(project_root)
jsb_root = os.path.abspath(os.path.join(project_root, 'js-bindings'))
cxx_generator_root = os.path.abspath(os.path.join(project_root, 'tools/bindings-generator'))
# save config to file
config = ConfigParser.ConfigParser()
config.set('DEFAULT', 'androidndkdir', ndk_root)
config.set('DEFAULT', 'clangllvmdir', llvm_path)
config.set('DEFAULT', 'gcc_toolchain_dir', gcc_toolchain_path)
config.set('DEFAULT', 'cocosdir', cocos_root)
config.set('DEFAULT', 'cxxgeneratordir', cxx_generator_root)
config.set('DEFAULT', 'extra_flags', '')
conf_ini_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'userconf.ini'))
print 'generating userconf.ini...'
with open(conf_ini_file, 'w') as configfile:
config.write(configfile)
# set proper environment variables
if 'linux' in platform or platform == 'darwin':
os.putenv('LD_LIBRARY_PATH', '%s/libclang' % cxx_generator_root)
print '%s/libclang' % cxx_generator_root
if platform == 'win32':
path_env = os.environ['PATH']
os.putenv('PATH', r'%s;%s\libclang;%s\tools\win32;' % (path_env, cxx_generator_root, cxx_generator_root))
try:
tojs_root = '%s/tools/tojs' % project_root
output_dir = '%s/cocos/scripting/js-bindings/auto' % project_root
cmd_args = {
'cocos2dx.ini' : ('cocos2d-x', 'jsb_cocos2dx_auto'),
'cocos2dx_webview.ini': ('webview', 'jsb_webview_auto'),
'cocos2dx_video.ini': ('video', 'jsb_video_auto'),
'cocos2dx_audioengine.ini' : ('cocos2dx_audioengine', 'jsb_cocos2dx_audioengine_auto'),
'cocos2dx_extension.ini' : ('cocos2dx_extension', 'jsb_cocos2dx_extension_auto'),
'cocos2dx_network.ini' : ('cocos2dx_network', 'jsb_cocos2dx_network_auto'),
'gfx.ini': ('gfx', 'jsb_gfx_auto'),
'renderer.ini': ('renderer', 'jsb_renderer_auto'),
'cocos2dx_spine.ini': ('cocos2dx_spine','jsb_cocos2dx_spine_auto'),
'cocos2dx_editor_support.ini': ('cocos2dx_editor_support','jsb_cocos2dx_editor_support_auto'),
'cocos2dx_dragonbones.ini': ('cocos2dx_dragonbones','jsb_cocos2dx_dragonbones_auto'),
'cocos2dx_particle.ini': ('cocos2dx_particle', 'jsb_cocos2dx_particle_auto')
}
target = 'spidermonkey'
generator_py = '%s/generator.py' % cxx_generator_root
for key in cmd_args.keys():
args = cmd_args[key]
cfg = '%s/%s' % (tojs_root, key)
print 'Generating bindings for %s...' % (key[:-4])
command = '%s %s %s -s %s -t %s -o %s -n %s' % (python_bin, generator_py, cfg, args[0], target, output_dir, args[1])
print(command)
_run_cmd(command)
print '----------------------------------------'
print 'Generating javascript bindings succeeds.'
print '----------------------------------------'
except Exception as e:
if e.__class__.__name__ == 'CmdError':
print '-------------------------------------'
print 'Generating javascript bindings fails.'
print '-------------------------------------'
sys.exit(1)
else:
raise
# -------------- main --------------
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,74 @@
[gfx]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = gfx
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = gfx
macro_judgement = #if (USE_GFX_RENDERER > 0) && (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/renderer/gfx/GFX.h
replace_headers =
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = DeviceGraphics FrameBuffer IndexBuffer Program RenderBuffer RenderTarget Texture2D Texture VertexBuffer GraphicsHandle
classes_need_extend =
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = DeviceGraphics::[clear setUniform.* setTexture setTextureArray],
IndexBuffer::[create init update getFormat getBytesPerIndex setFetchDataCallback invokeFetchDataCallback],
VertexBuffer::[create init update getFormat setFormat setFetchDataCallback invokeFetchDataCallback],
Program::[create getAttributes getUniforms isLinked setHash getHash],
FrameBuffer::[create init (g|s)et.*Buffer]
rename_functions = DeviceGraphics::[setBlendFuncSeparate=setBlendFuncSep setBlendEquationSeparate=setBlendEqSep],
Texture2D::[update=updateNative updateSubImage=updateSubImageNative]
rename_classes = DeviceGraphics::Device
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = DeviceGraphics
persistent_classes = DeviceGraphics
classes_owned_by_cpp =

View File

@@ -0,0 +1,89 @@
[renderer]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = renderer
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = renderer
macro_judgement = #if (USE_GFX_RENDERER > 0) && (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
android_headers =
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -I%(cocosdir)s/external/android/arm64-v8a/include/v8
clang_headers =
clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__
cocos_headers = -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/math -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/source
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/renderer/renderer/Renderer.h %(cocosdir)s/cocos/renderer/scene/scene-bindings.h
replace_headers =
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = ForwardRenderer BaseRenderer Camera Light Scene View ProgramLib EffectBase Effect NodeProxy Assembler RenderFlow CustomAssembler MaskAssembler RenderDataList AssemblerBase TiledMapAssembler NodeMemPool MemPool EffectVariant AssemblerSprite SimpleSprite2D SlicedSprite2D MeshAssembler SimpleSprite3D SlicedSprite3D Particle3DAssembler
classes_need_extend = Assembler CustomAssembler MaskAssembler AssemblerBase TiledMapAssembler AssemblerSprite SimpleSprite2D SlicedSprite2D MeshAssembler SimpleSprite3D SlicedSprite3D Particle3DAssembler
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = RenderFlow::[calculateWorldMatrix insertNodeLevel visit calculateLocalMatrix removeNodeLevel getRenderScene getModelBatcher calculateLevelWorldMatrix getDevice getInstance],
AssemblerBase::[handle postHandle enableDirty getDirty getUseModel getCustomWorldMatrix setCustomWorldMatrix clearCustomWorldMatirx],
Assembler::[getIACount updateOpacity isOpacityAlwaysDirty isIgnoreWorldMatrix fillBuffers beforeFillBuffers getVertexFormat getEffect],
CustomAssembler::[getIACount getIA adjustIA updateIARange getEffect],
RenderDataList::[getRenderData getMeshCount],
BaseRenderer::[registerStage],
Camera::[getColor getRect extractView screenToWorld worldToScreen setNode getNode worldMatrixToScreen],
Light::[extractView setNode],
View::[getForward getPosition],
Scene::[getModel removeModel addModel removeModels],
Effect::[getPasses init],
EffectBase::[setProperty],
EffectVariant::[getHash getPasses],
NodeProxy::[render updateLocalMatrix updateWorldMatrix getChildren setCullingMask disaleUpdateWorldMatrix getAssembler getChildByName visit setOpacity getRealOpacity getDirty getOpacity enableUpdateWorldMatrix updateRealOpacity getCullingMask getID getParent getChildByID set3DNode setLocalZOrder getName getChildrenCount addChild removeAllChildren getRotation setParent getWorldRT getWorldMatrix getWorldPosition isDirty getScale getPosition removeChild getRenderOrder resetGlobalRenderOrder getWorldRotation],
MemPool::[getCommonPool getCommonUnit getCommonList],
NodeMemPool::[getUnit getNodePool getInstance],
AssemblerSprite::[fillBuffers calculateWorldVertices generateWorldVertices],
SimpleSprite2D::[generateWorldVertices],
SlicedSprite2D::[generateWorldVertices],
SimpleSprite3D::[generateWorldVertices],
SlicedSprite3D::[generateWorldVertices],
ProgramLib::[switchProgram getKey getValueFromDefineList]
rename_classes = BaseRenderer::Base,
Effect::EffectNative
rename_functions =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip = Ref Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = EffectBase
persistent_classes =
classes_owned_by_cpp =