zoukankan      html  css  js  c++  java
  • cocos:C++ 导出到lua, cocos2dx_extension.ini修改

    cocos:C++ 导出到lua, cocos2dx_extension.ini修改

    [zq] //zq section, 需要和genbindings.py中的配置相同
    # the prefix to be added to the generated functions. You might or might not use this in your own
    # templates
    //前缀,生成的函数lua_zq_ZQPlistManage_getDictFromFile类似于这样,都有zq
    prefix = zq 
    
    # 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
    //namespace, 类似于cc,在lua中都是zq.ZQPlistManage这样
    target_namespace = zq
    
    // android_headers 头文件配置,保持不变就行了,androidndkdir
    // 我们在genbindings.py中config.set('DEFAULT', 'androidndkdir', ndk_root)
    // 保存到userconf.ini中
    android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/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
    android_flags = -D_SIZE_T_DEFINED_
    
    // clang 的clang_headers头文件 和 clang_flags参数
    clang_headers = -I%(clangllvmdir)s/lib/clang/%(clang_version)s/include
    clang_flags = -nostdinc -x c++ -std=c++11 -U __SSE__
    
    // cocos_headers 头文件目录 和 cocos_flags 参数, 
    // 同样这里cocosdir的也genbindings.py中保存的
    cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/external -I%(cocosdir)s/external/lua/luajit/include -I%(cocosdir)s/external/lua/tolua
    cocos_flags = -DANDROID
    
    cxxgenerator_headers =
    
    // 我们的工程头文件目录
    zq_headers = -I%(zqdir)s/libzq -I%(zqdir)s/libzq/libs
    
    # extra arguments for clang ,因为tolua是用clang生成的,所以需要配置这些参数
    // 给clang
    extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(zq_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
    
    # what headers to parse 
    // 需要导出到lua的类的头文件,这里放到了一个头文件中,这个头文件中包含了所有需要导出的
    // 类的头文件,当然也可以每个头文件单独写,空格分开
    headers = %(zqdir)s/libzq/ZQLibExt.h
    // cocos2dx_extension.ini 中的配置
    // # what headers to parse
    // headers = %(cocosdir)s/extensions/cocos-ext.h
    // #include "ExtensionMacros.h"
    // #include "GUI/CCControlExtension/CCControlExtensions.h"
    // #include "GUI/CCScrollView/CCScrollView.h"
    // #include "GUI/CCScrollView/CCTableView.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*$".
    // 导出到lua的C++类,只写需要导出的
    classes = ZQLogger ZQFileManage ZQJsonManage ZQPlistManage ZQImageManage DateUtils ZQCustomAction
    
    # 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.
    
    //需要跳过的函数,也就是不需要导出到lua中的函数
    skip =  ZQFileManage::[getDataFromFile],
            DateUtils::[date time],
            ZQCustomAction::[registerScriptListener unregisterScriptListener]
    
    
    
    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 = ZQLogger
    
    # classes that create no constructor
    # Set is special and we will use a hand-written constructor
    abstract_classes =
    
    # Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
    script_control_cpp = no
    
    
    
  • 相关阅读:
    辞职信(转贴)
    去掉控件上显示聚焦框
    静态构造函数
    用Excel 公式求 金额的差额
    2020/2/6学习总结
    2020/2/3学习总结
    2020/2/7学习总结
    2020/1/31学习总结
    2020/2/5学习总结
    2020/2/4学习总结
  • 原文地址:https://www.cnblogs.com/ZhYQ-Note/p/6215515.html
Copyright © 2011-2022 走看看