forked from cvondrick/pyvision
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
81 lines (72 loc) · 2.9 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# immediately below is stupid hackery for setuptools to work with Cython
import distutils.extension
from distutils.extension import Extension as _Extension
from setuptools import setup
distutils.extension.Extension = _Extension
Extension = _Extension
from Cython.Distutils import build_ext
# end stupid hackery
# these lines will cause html annotation files to be generated
from Cython.Compiler.Main import default_options as pyrex_default_options
pyrex_default_options['annotate'] = True
import os
import numpy
print "building ffmpeg/_extract.o"
os.system("g++ -Wno-deprecated-declarations -D__STDC_CONSTANT_MACROS -c -O3 "
"-fPIC vision/ffmpeg/_extract.c -o vision/ffmpeg/_extract.o")
print "building liblinear"
os.system("make -C vision/liblinear")
root = os.getcwd() + "/vision/"
ext_modules = [
Extension("vision.annotations", ["vision/annotations.pyx",
"vision/annotations.pxd"]),
Extension("vision.features", ["vision/features.pyx"]),
Extension("vision.model", ["vision/model.pyx"]),
Extension("vision.convolution", ["vision/convolution.pyx"]),
Extension("vision.track.standard", ["vision/track/standard.pyx"]),
Extension("vision.alearn.linear", ["vision/alearn/linear.pyx"]),
Extension("vision.alearn.marginals", ["vision/alearn/marginals.pyx"]),
Extension("vision.track.dp", ["vision/track/dp.pyx",
"vision/track/dp.pxd"]),
Extension("vision.track.pairwise", ["vision/track/pairwise.pyx"]),
Extension("vision.svm", ["vision/svm.pyx"],
extra_objects = [root + "liblinear/linear.o",
root + "liblinear/tron.o",
root + "liblinear/blas/blas.a"],
language = "c++"),
Extension("vision.ffmpeg.extract",
sources = ["vision/ffmpeg/extract.pyx"],
include_dirs = [root + "ffmpeg/"],
library_dirs = [root + "ffmpeg/"],
libraries = ["avformat", "avcodec", "avutil", "swscale"],
extra_objects = [root + "ffmpeg/_extract.o"],
language = "c++")
]
for e in ext_modules:
e.pyrex_directives = {
"boundscheck": False,
"cdivision": True,
"infer_types": True,
"embedsignature": True}
# e.include_dirs.append(".")
e.extra_compile_args = ["-w"]
e.include_dirs.append(numpy.get_include())
print ext_modules
setup(
name = "pyvision",
author = "Carl Vondrick",
author_email = "[email protected]",
description = "A concise computer vision toolkit",
license = "MIT",
version = "0.2.5",
classifiers = ["Development Status :: 1 - Planning",
"Intended Audience :: Developers"],
packages = ["vision",
"vision.track",
"vision.ffmpeg",
"vision.alearn",
"vision.reporting"],
cmdclass = {"build_ext": build_ext},
ext_modules = ext_modules,
#ext_package = "vision"
)