一个用于快速python c++绑定构建的小程序包。
ccimport的Python项目详细描述
ccimport公司
一个用于快速构建pythoncc++绑定的小软件包。在
支持Python3.5、3.7-3.9。在
使用
代码的限制
- 不支持带有模板参数的函数/类。如果确实需要使用模板,则需要为所有参数提供默认值。生成的代码将使用
func<>
绑定代码。在
单个文件扩展名
- 在
在函数声明名之前添加
在CODEAI_EXPORT
。对于类,编写一个静态工厂成员,该成员返回一个唯一的\u ptr,然后在其前面添加CODEAI_EXPORT_INIT
。在 - 在
使用
在ccimport.autoimport
生成扩展。在
多文件扩展名
- 在
在头文件中添加
在CODEAI_EXPORT
和/或CODEAI_EXPORT_INIT
。在 - 在
在源文件中实现函数和类。在
在 - 在
使用
在ccimport.autoimport
生成扩展。您需要将带有CODEAI_EXPORT
的所有头文件添加到sources
参数中。在
没有pybind的库
- 使用ccimport.ccimport公司相反。在
美国石油学会
- 在ccimport.自动导入在
defautoimport(sources:List[Union[str,Path]],# list of source path, may include headers with 'CODEAI_EXPORT'out_path:Union[str,Path],# output path. the name of output file must be a name # without platform library prefix and suffix such as `lib-`, '.so'.includes:Optional[List[Union[str,Path]]]=None,# include pathslibpaths:Optional[List[Union[str,Path]]]=None,# library pathslibraries:Optional[List[str]]=None,# libraries. the name of library must be a name # without platform library prefix and suffix such as `lib-`, '.so'.export_kw="CODEAI_EXPORT",# use the macro to mark a exported function.export_init_kw="CODEAI_EXPORT_INIT",# use the macro to mark a static class factory member.compile_options:Optional[List[str]]=None,# compile options.link_options:Optional[List[str]]=None,# link options.std="c++14",# c++ standard.additional_cflags:Optional[Dict[str,List[str]]]=None):# compiler to compile optionspass
- 在ccimport.ccimport公司在
- 项目
标签: