-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
57 lines (43 loc) · 1.74 KB
/
setup.py
File metadata and controls
57 lines (43 loc) · 1.74 KB
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
from Cython.Distutils import build_ext
from Cython.Build import cythonize
from setuptools import setup, find_packages
from setuptools.extension import Extension
import numpy
import subprocess
opencv_libs = subprocess.check_output("pkg-config --libs opencv".split()).decode('utf-8')
opencv_libs = [lib for lib in opencv_libs.split()]
opencv_libdirs = [s[2:].strip() for s in subprocess.check_output("pkg-config --libs-only-L opencv".split()).decode('utf-8').split(' ')]
opencv_headers = subprocess.check_output("pkg-config --cflags-only-I opencv".split()).decode('utf-8')
opencv_headers = [header[2:] for header in opencv_headers.split()]
def link_args(*libs, **kwargs):
_link_all = kwargs.get('link_all', True)
if _link_all:
link_args = {'extra_link_args': opencv_libs}
else:
link_args = {'library_dirs': opencv_libdirs,
'libraries': list(libs)}
return link_args
inc_dirs = [numpy.get_include()]
inc_dirs.extend(opencv_headers)
ext_modules = [
Extension('stitchup.lib.cvt', ['stitchup/lib/cvt.pyx'],
language = 'c++',
extra_compile_args = ['-std=c++11'],
include_dirs=inc_dirs,
**link_args('opencv_core', link_all=False)),
Extension('stitchup.lib.stitch', ['stitchup/lib/stitch.pyx', 'stitchup/lib/src/simplestitcher.cpp', 'stitchup/lib/src/stitcher2.cpp'],
language = 'c++',
extra_compile_args = ['-std=c++11'],
include_dirs=inc_dirs,
**link_args(link_all=True)),
]
setup(
name='stitchup',
description='Stitch multiple images into one panorama mosaic',
version='0.1.0',
author='John Stowers',
author_email='john.stowers@gmail.com',
cmdclass = {'build_ext': build_ext},
packages=['stitchup', 'stitchup.lib'],
ext_modules = ext_modules,
)