我正在尝试为我的使用 numpy 的小模块制作 setup.py。要编译这个模块,我需要位于同一目录中的额外库
ls -l audiotools
total 20
-rw-rw-r-- 1 rth rth 4405 Sep 9 10:58 audiotools.c
drwxr-xr-x 6 rth rth 4096 Sep 9 11:13 libresample-0.1.3
-rw-rw-r-- 1 rth rth 741 Sep 9 11:56 setup.py
所以我需要在 setup.py 中添加一些内容,它将在 libresample-0.1.3 中调用 configure 和 make,然后将“libresample.a”添加到链接器命令中。
我试过使用 add_library,但它只需要源文件而不需要整个源目录。我该怎么做?
这行不通。
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('audiotools',parent_package,top_path)
config.add_extension('audiotools', ['audiotools.c'])
config.add_library('libresample',['libresample.a'])
return config
if __name__ == "__main__":
from numpy.distutils.core import setup
setup(
name = "audiotools",
version='0.01',
description='Python wrapper for GNU libresample-0.1.3 and reader of Wave 24bit files',
author='Ruben Tikidji-Hamburyan, Timur Pinin',
author_email='rth@nisms.krinc.ru, timpin@rambler.ru',
configuration=configuration
)
谢谢!