-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py.in
60 lines (49 loc) · 2.06 KB
/
setup.py.in
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
#!/usr/bin/env python
import os, subprocess, sys
from distutils.command.build_ext import build_ext
from distutils.core import Extension, setup
import numpy
macros = []
extra_args = []
include_dirs=[numpy.get_include(), '${TBB_INCLUDE_DIR}', '${Boost_INCLUDE_DIR}']
sources = []
for (dirpath, _, filenames) in os.walk('${CMAKE_CURRENT_SOURCE_DIR}/cpp'):
include_dirs.append(dirpath)
sources.extend([os.path.join(dirpath, name) for name in filenames
if name.endswith('.cc') and not name in
['CorrelationFunction.cc', 'pairing.cc']])
if '--cython' in sys.argv:
from Cython.Build import cythonize
sys.argv.remove('--cython')
def myCythonize(*args, **kwargs):
result = cythonize(*args, nthreads=4, **kwargs)
for r in result:
r.define_macros.extend(macros)
r.include_dirs.extend(include_dirs)
r.extra_compile_args.extend(extra_args)
r.extra_link_args.extend(extra_args)
r.sources.extend(sources)
return result
pyxes = []
sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')
for (dirpath, _, filenames) in os.walk('${CMAKE_CURRENT_SOURCE_DIR}/freud'):
pyxes.extend([os.path.join(dirpath, name) for name in filenames
if name.endswith('.pyx')])
modules = myCythonize(pyxes)
else:
for (dirpath, _, filenames) in os.walk('${CMAKE_CURRENT_SOURCE_DIR}/freud'):
sources.extend([os.path.join(dirpath, name) for name in filenames
if name.endswith('.cpp') or name.endswith('.c')])
modules = [Extension('freud._freud', sources=sources,
define_macros=macros, extra_compile_args=extra_args,
extra_link_args=extra_args, include_dirs=include_dirs)]
setup(name='freud',
version='0.6',
description='Glotzer group analysis software',
author='Glotzer group',
author_email='glotzerlab-admins@umich.edu',
url='',
package_dir={'': '${CMAKE_CURRENT_SOURCE_DIR}'},
packages=['freud'],
ext_modules=modules
)