2

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

そのため、configure を呼び出して libresample-0.1.3 を作成し、リンカー コマンドに「libresample.a」を追加する setup.py に何かを追加する必要があります。

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
        )

ありがとう!

4

2 に答える 2