forked from mthomure/glimpse-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcython_setup.py
executable file
·98 lines (79 loc) · 2.62 KB
/
cython_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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env python
# Copyright (c) 2011 Mick Thomure
# All rights reserved.
#
# Please see the file COPYING in this distribution for usage
# terms.
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
#### Control Flags for Compilation ####
# Optimize runtime binary. Disables output needed for debugging. Implies that
# ndebug = False.
optimize = True
# Disable the NDEBUG preprocessor define, adding (expensive) sanity checks to
# resulting binary.
debug = (not optimize)
# Enable SSE intrinsics.
sse = True
# Add output required for profiling. This generally does not affect the speed of
# the resulting binary.
profiler = False
#### Parsing of Control Flags ####
extra_compile_args = []
extra_link_args = []
define_macros = []
undef_macros = []
if optimize:
extra_compile_args += [ "-O3", "-mtune=native" ]
extra_link_args += [ ]
else:
extra_compile_args += ["-O0", "-g" ]
extra_link_args += [ "-rdynamic", "-fno-omit-frame-pointer", "-g" ]
if debug:
undef_macros += [ "NDEBUG" ]
else:
define_macros += [ ("NDEBUG", None) ]
if sse:
extra_compile_args += [ "-msse3", "-mfpmath=sse" ]
extra_link_args += [ "-msse3" ]
if profiler:
extra_compile_args += [ "-pg" ]
extra_link_args += [ "-lprofiler", "-pg" ]
#### Do Not Edit Below This Line ####
cython_backend_ext = Extension(
"glimpse.backends.cython_backend.filter",
[
"glimpse/backends/cython_backend/filter.pyx",
"glimpse/backends/cython_backend/src/array.cpp",
"glimpse/backends/cython_backend/src/bitset_array.cpp",
"glimpse/backends/cython_backend/src/filter.cpp",
"glimpse/backends/cython_backend/src/util.cpp",
],
depends = [
"glimpse/backends/cython_backend/src/array.h",
"glimpse/backends/cython_backend/src/bitset_array.h",
"glimpse/backends/cython_backend/src/filter.h",
"glimpse/backends/cython_backend/src/util.h",
],
language = "c++",
extra_compile_args = extra_compile_args,
extra_link_args = extra_link_args,
define_macros = define_macros,
undef_macros = undef_macros,
)
setup(
name = "glimpse",
version = "1.1",
description = "Library for hierarchical visual models in C++ and Python",
author = "Mick Thomure",
author_email = "[email protected]",
cmdclass = {'build_ext': build_ext},
ext_modules = [ cython_backend_ext ],
packages = [ 'glimpse', 'glimpse.backends', 'glimpse.backends.cython_backend',
'glimpse.models', 'glimpse.models.viz2', 'glimpse.models.ml',
'glimpse.pools', 'glimpse.pools.zmq_cluster', 'glimpse.pools.gearman_cluster',
'glimpse.util' ],
include_dirs = [ numpy.get_include() ],
)