forked from libffcv/ffcv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
63 lines (52 loc) · 1.75 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from setuptools import find_packages
import subprocess
from glob import glob
from distutils.core import setup, Extension
# read the contents of your README file
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
def pkgconfig(package, kw):
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
output = subprocess.getoutput(
'pkg-config --cflags --libs {}'.format(package))
if 'not found' in output:
raise Exception(f"Could not find required package: {package}.")
for token in output.strip().split():
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
return kw
sources = ['./libffcv/libffcv.cpp']
extension_kwargs = {
'sources': sources,
'include_dirs': []
}
extension_kwargs = pkgconfig('opencv4', extension_kwargs)
extension_kwargs = pkgconfig('libturbojpeg', extension_kwargs)
extension_kwargs['libraries'].append('pthread')
libffcv = Extension('ffcv._libffcv',
**extension_kwargs)
setup(name='ffcv',
version='0.0.3rc1',
description=' FFCV: Fast Forward Computer Vision ',
author='MadryLab',
author_email='leclerc@mit.edu',
url='https://github.com/libffcv/ffcv',
license_files = ('LICENSE.txt',),
packages=find_packages(),
long_description=long_description,
long_description_content_type='text/markdown',
ext_modules=[libffcv],
install_requires=[
'terminaltables',
'pytorch_pfn_extras',
'fastargs',
'matplotlib',
'sklearn',
'imgcat',
'pandas',
'assertpy',
'tqdm',
'psutil',
'webdataset',
]
)