-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
83 lines (72 loc) · 2.95 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
82
83
from setuptools import setup, find_packages, Extension
from glob import glob
from Cython.Build import cythonize
import platform
import os
import versioneer
include_dirs = ['ffld2', 'ffld2/lib']
library_dirs = []
extra_compile_args = []
extra_link_args = []
libraries = []
sources = (['cyffld2/ffld2/HOGPyramid.cpp',
'cyffld2/ffld2/JPEGImage.cpp',
'cyffld2/ffld2/LBFGS.cpp',
'cyffld2/ffld2/Model.cpp',
'cyffld2/ffld2/Object.cpp',
'cyffld2/ffld2/Patchwork.cpp',
'cyffld2/ffld2/Rectangle.cpp',
'cyffld2/ffld2/Scene.cpp',
'cyffld2/ffld2/Mixture.cpp',
'cyffld2/ffld2/lib/ffld2.cpp',
'cyffld2/_ffld2.pyx'])
_platform = platform.platform().lower()
if 'linux' in _platform:
extra_compile_args += ['-fopenmp']
extra_link_args += ['-fopenmp']
libraries += ['xml2', 'fftw3f', 'jpeg']
elif 'darwin' in _platform:
libraries += ['xml2', 'fftw3f', 'jpeg']
elif 'windows' in _platform:
extra_compile_args += ['/openmp']
extra_link_args += ['/openmp']
if os.environ.get('CONDA_BUILD', None):
# There is a bug in visual studio 2008 whereby you can't pass non-aligned
# values, therefore, we have to turn off alignment enforcement
# for eigen on Win32. See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=83
# more more information.
if int(os.environ.get('ARCH', 32)) == 32: # Default to 32 for safety
extra_compile_args += ['/DEIGEN_DONT_ALIGN_STATICALLY=1']
extra_compile_args += ['/D_USE_MATH_DEFINES=1' , '/EHsc']
libxml_dir = os.path.join(os.environ['LIBRARY_INC'], 'libxml2')
include_dirs += [os.environ['LIBRARY_INC'], libxml_dir]
library_dirs.append(os.environ['LIBRARY_LIB'])
# This looks a bit strange but it is to match the library names
# that I have created in other recipes.
libraries += ['libxml2', 'libfftw3f-3', 'jpeg']
extensions = [Extension('cyffld2._ffld2', sources,
include_dirs=include_dirs,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
libraries=libraries,
language='c++')]
setup(name='cyffld2',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='A Cython wrapper around the FFLD2 face detection library.',
author='Patrick Snape',
author_email='[email protected]',
url='https://github.com/menpo/cyffld2',
ext_modules=cythonize(extensions, quiet=True),
package_data={'cyffld2': [
'ffld2/models/headhunter_dpm_baseline.txt',
'ffld2/*.h',
'ffld2/lib/*.h',
'ffld2/*.cpp',
'ffld2/lib/*.cpp',
'_ffld2.pyx',
'_ffld2.pxd'
]},
packages=find_packages()
)