我正在为 C++ 库编写一个扩展,以便使用 Pybind11 在 Python 中可用。该库本身依赖于其他几个 C++ 库。
我不明白的是我应该在我的分发包中包含哪些文件以及如何包含。混合了Python 打包指南 和构建 C++ 扩展中的一些代码后,我得到了以下文件
安装程序.py
from setuptools import setup, Extension
#from distutils.core import setup, Extension #used this at first, switched to setuptools. Didn't see the difference
src = ['module.cpp', /*... other cpp files */]
include = ['MyLibrary/include', /*... other header files for 3rdparty libs*/]
module = Extension(
'TestlibPy',
sources = src,
include_dirs= include,
libraries=[/* library names*/]
lib_dirs=[/*library dirs*/]
language='c++',
)
setup(
ext_modules = [module],
)
Run Code Online (Sandbox Code Playgroud)
安装程序.cfg
[metadata] …Run Code Online (Sandbox Code Playgroud)