forked from xulabs/aitom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
91 lines (77 loc) · 3.68 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
84
85
86
87
88
89
90
91
#!/usr/bin/env python
import os
import platform
# from distutils.core import setup
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
from Cython.Build import cythonize
from codecs import open
import numpy as N
# Make sure to use gcc compiler instead of x86_64-conda_cos6-linux-gnu-cc or x86_64-linux-gnu-gcc
os.environ["CC"] = "gcc"
os.environ["CXX"] = "gcc"
compile_extra_args = ['-std=c++11']
link_extra_args = []
if platform.system() == "Darwin":
compile_extra_args = ['-std=c++11', "-mmacosx-version-min=10.9"]
link_extra_args = ["-stdlib=libc++", "-mmacosx-version-min=10.9"]
import os
script_dir = os.path.dirname(os.path.realpath(__file__))
cpp_core = Extension('aitom.tomominer.core.core',
sources=[
'aitom/tomominer/core/cython/wrap_core.cpp',
'aitom/tomominer/core/cython/core.pyx',
'aitom/tomominer/core/src/affine_transform.cpp',
'aitom/tomominer/core/src/align.cpp',
'aitom/tomominer/core/src/arma_extend.cpp',
'aitom/tomominer/core/src/dilate.cpp',
'aitom/tomominer/core/src/fft.cpp',
'aitom/tomominer/core/src/geometry.cpp',
'aitom/tomominer/core/src/interpolation.cpp',
'aitom/tomominer/core/src/io.cpp',
'aitom/tomominer/core/src/legendre.cpp',
'aitom/tomominer/core/src/rotate.cpp',
'aitom/tomominer/core/src/sht.cpp',
'aitom/tomominer/core/src/wigner.cpp',
'aitom/tomominer/core/src/segmentation/watershed/watershed_segmentation.cpp'],
libraries=['m', 'fftw3', 'armadillo', 'blas', 'lapack'],
include_dirs=[N.get_include(), '/usr/include',
'/usr/local/include', 'aitom/tomominer/core/src/', os.path.join(script_dir, 'ext', 'include')], # use script_dir/ext/include to include header files that cannot be installed without root privilege
library_dirs=[os.path.join(script_dir, 'ext', 'lib')], # use script_dir/ext/lib to include library files that cannot be installed without root privilege
extra_compile_args=compile_extra_args,
extra_link_args=link_extra_args,
language='c++')
def get_packages(root_dir='aitom', exclude_dir_roots=['aitom/tomominer/core/src', 'aitom/tomominer/core/cython']):
# def get_packages(root_dir='aitom', exclude_dir_roots=['aitom/tomominer/core']):
pkg = []
for (root, dirs, files) in os.walk(root_dir):
exclude = False
for d in exclude_dir_roots:
if root.startswith(d):
exclude = True
if exclude:
continue
pkg.append(root.replace('/', '.'))
return pkg
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(name='aitom',
version='0.0.1',
author='Xu Lab (CMU) and collaborators',
author_email='[email protected]',
description='AI software for tomogram analysis',
install_requires=[requirements],
license='GPLv3',
url='https://github.com/xulabs/aitom',
platforms=['x86_64'],
ext_modules=cythonize(cpp_core),
packages=get_packages(),
package_dir={'aitom': 'aitom',
'aitom.tomominer.core': 'aitom/tomominer/core/', },
cmdclass={'build_ext': build_ext, },
entry_points={
'console_scripts': [
'picking = aitom.bin.picking:main',
]}
)