-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
131 lines (108 loc) · 4.84 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import sys
import os
import os.path
import subprocess
import re
from setuptools import setup
from setuptools.command.install_lib import install_lib
from setuptools.command.install import install
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
import setuptools.command.bdist_egg
import sys
import distutils.spawn
import numpy as np
from Cython.Build import cythonize
#from numpy.distutils.core import setup as numpy_setup, Extension as numpy_Extension
extra_compile_args = {
"msvc": ["/openmp"],
#"unix": ["-O0", "-g", "-Wno-uninitialized","-std=c11","-fstack-protector-all"), # Replace the line below with this line to enable debugging of the compiled extension
"unix": ["-fopenmp","-O5","-Wno-uninitialized","-std=c11","-fstack-protector-all"],
"mingw32": [ "-fopenmp","-O5","-std=c11","-fstack-protector-all" ],
"clang": ["-fopenmp","-O5","-Wno-uninitialized"],
}
extra_include_dirs = {
"msvc": [".", np.get_include() ],
"unix": [".", np.get_include() ],
"clang": [".", np.get_include() ],
}
extra_libraries = {
"msvc": [],
"unix": ["gomp",],
"clang": [],
}
extra_link_args = {
"msvc": [],
"clang": ["-fopenmp=libomp"],
"unix": [ "-fopenmp","-std=c11" ],
"mingw32": [ "-fopenmp","-std=c11" ],
"clang": [".", np.get_include(),"-fopenmp=libomp"],
}
if os.name=="posix":
# Check for obsolete gcc, try to use Red Hat Sofware Collections
# if necessary
gccversioninfo = subprocess.check_output("gcc --version",shell="True")
gccver = gccversioninfo.split()[2]
gccsubvers=gccver.decode('utf-8').split(".")
if int(gccsubvers[0]) <= 4 and int(gccsubvers[1]) < 9:
# old version with C11 atomics
if os.path.exists("/opt/rh/devtoolset-7/root/bin/gcc"):
os.environ["CC"]="/opt/rh/devtoolset-7/root/bin/gcc"
pass
pass
pass
class build_ext_compile_args(build_ext):
def build_extensions(self):
compiler=self.compiler.compiler_type
for ext in self.extensions:
if compiler in extra_compile_args:
ext.extra_compile_args=extra_compile_args[compiler]
ext.extra_link_args=extra_link_args[compiler]
ext.include_dirs.extend(list(extra_include_dirs[compiler]))
ext.libraries.extend(list(extra_libraries[compiler]))
pass
else:
# use unix parameters as default
ext.extra_compile_args=extra_compile_args["unix"]
ext.extra_link_args=extra_link_args["unix"]
ext.include_dirs.extend(list(extra_include_dirs["unix"]))
ext.libraries.extend(extra_libraries["unix"])
pass
pass
build_ext.build_extensions(self)
pass
pass
spatialnde_package_files = [ "pt_steps/*" ]
# NOTE: MSVC 2008 must remove "m" from libraries
ext_modules=cythonize([ Extension("spatialnde.imageprojection",["spatialnde/imageprojection.pyx"],
libraries=[ ],
include_dirs=[np.get_include()]),
Extension("spatialnde.imageorthographic",["spatialnde/imageorthographic.pyx"],
libraries=[ ],
include_dirs=[np.get_include()]),
Extension("spatialnde.geometry_accel",["spatialnde/geometry_accel.pyx"],
libraries=[ ],
include_dirs=[np.get_include()]),
Extension("spatialnde.cadpart.polygonalsurface_texcoordparameterization_accel",["spatialnde/cadpart/polygonalsurface_texcoordparameterization_accel.pyx"],
libraries=[ ],
include_dirs=[np.get_include()]),
Extension("spatialnde.cadpart.polygonalsurface_accel",["spatialnde/cadpart/polygonalsurface_accel.pyx"],
libraries=[ ],
include_dirs=[np.get_include()])])
setup(name="spatialnde",
description="spatialnde",
author="Stephen D. Holland",
url="http://thermal.cnde.iastate.edu/spatialnde",
ext_modules=ext_modules,
zip_safe=False,
packages=["spatialnde",
"spatialnde.cadpart",
"spatialnde.cadpart.loaders",
"spatialnde.exporters",
"spatialnde.dataguzzler",
"spatialnde.opencascade"],
scripts=["scripts/fiducialname","scripts/spatialnde_calib_image"],
cmdclass = {"build_ext": build_ext_compile_args},
package_data={"spatialnde": spatialnde_package_files},
entry_points={"limatix.processtrak.step_url_search_path": [ "limatix.share.pt_steps = spatialnde:getstepurlpath" ]}
)