setup.py 1.06 KB
Newer Older
Soumith Chintala's avatar
Soumith Chintala committed
1
#!/usr/bin/env python
2
3
import os
import platform
Soumith Chintala's avatar
Soumith Chintala committed
4
5

from setuptools import setup, find_packages
6
from torch.utils.cpp_extension import BuildExtension, CppExtension
Soumith Chintala's avatar
Soumith Chintala committed
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21

def check_env_flag(name, default=''):
    return os.getenv(name, default).upper() in set(['ON', '1', 'YES', 'TRUE', 'Y'])

DEBUG = check_env_flag('DEBUG')
eca = []
ela = []
if DEBUG:
    if platform.system() == 'Windows':
        ela += ['/DEBUG:FULL']
    else:
        eca += ['-O0', '-g']
        ela += ['-O0', '-g']

Soumith Chintala's avatar
Soumith Chintala committed
22
23
setup(
    name="torchaudio",
David Pollack's avatar
David Pollack committed
24
    version="0.2",
Soumith Chintala's avatar
Soumith Chintala committed
25
26
    description="An audio package for PyTorch",
    url="https://github.com/pytorch/audio",
27
    author="Soumith Chintala, David Pollack, Sean Naren, Peter Goldsborough",
Soumith Chintala's avatar
Soumith Chintala committed
28
    author_email="soumith@pytorch.org",
Soumith Chintala's avatar
Soumith Chintala committed
29
30
    # Exclude the build files.
    packages=find_packages(exclude=["build"]),
31
32
    ext_modules=[
        CppExtension(
33
34
35
36
37
            '_torch_sox',
            ['torchaudio/torch_sox.cpp'],
            libraries=['sox'],
            extra_compile_args=eca,
            extra_link_args=ela),
Soumith Chintala's avatar
Soumith Chintala committed
38
    ],
39
    cmdclass={'build_ext': BuildExtension})