-
Notifications
You must be signed in to change notification settings - Fork 14
/
setup.py
executable file
·125 lines (107 loc) · 3.67 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
import re
import sys
from os.path import join
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
from Cython.Build import cythonize
import numpy
LINUX = sys.platform == "linux"
WINDOWS = sys.platform == "win32"
# Avoid a gcc warning below:
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# for C/ObjC but not for C++
class BuildExt(build_ext):
def build_extensions(self):
if LINUX:
if "-Wstrict-prototypes" in self.compiler.compiler_so:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
super().build_extensions()
ckdtree = join("jakteristics", "ckdtree")
ckdtree_src = [
join(ckdtree, "ckdtree", "src", x)
for x in [
"query.cxx",
"build.cxx",
"query_pairs.cxx",
"count_neighbors.cxx",
"query_ball_point.cxx",
"query_ball_tree.cxx",
"sparse_distances.cxx",
]
]
ckdtree_src.append(join(ckdtree, "ckdtree.pyx"))
ckdtree_includes = [
numpy.get_include(),
join(ckdtree, "ckdtree", "src"),
join(ckdtree, "_lib"),
]
extra_compile_args = ["-fopenmp"]
extra_link_args = ["-fopenmp"]
if WINDOWS:
extra_compile_args = ["/openmp"]
extra_link_args = ["/openmp"]
ext_modules = [
Extension(
"jakteristics.extension",
sources=[
"jakteristics/extension.pyx",
join(ckdtree, "ckdtree", "src", "query_ball_point.cxx"),
],
include_dirs=ckdtree_includes,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
define_macros=[("NPY_NO_DEPRECATED_API", "1")],
),
Extension(
"jakteristics.utils",
sources=["jakteristics/utils.pyx"],
include_dirs=[numpy.get_include()],
define_macros=[("NPY_NO_DEPRECATED_API", "1")],
),
Extension(
"jakteristics.ckdtree.ckdtree",
sources=ckdtree_src,
include_dirs=ckdtree_includes,
define_macros=[("NPY_NO_DEPRECATED_API", "1")],
),
]
ext_modules = cythonize(ext_modules, language_level=3)
cmdclass = {"build_ext": BuildExt}
with open("README.rst") as readme_file:
readme = readme_file.read()
with open("HISTORY.rst") as history_file:
history = history_file.read().replace(".. :changelog:", "")
requirements = [line for line in open("requirements.txt").read().split("\n") if line]
about = open(join("jakteristics", "__about__.py")).read()
version = re.search(r"__version__ ?= ?['\"](.+)['\"]", about).group(1)
setup(
name="jakteristics",
version=version,
description="Point cloud geometric properties from python.",
long_description=readme + "\n\n" + history,
author="David Caron",
author_email="[email protected]",
url="https://github.com/jakarto3d/jakteristics",
packages=["jakteristics"],
package_dir={"jakteristics": "jakteristics"},
package_data={"": ["*.pyx", "*.pxd", "*.h", "*.cpp"]},
python_requires=">=3.7",
install_requires=requirements,
tests_require=["pytest"],
license="BSD",
zip_safe=False,
keywords="jakteristics",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
test_suite="tests",
cmdclass=cmdclass,
ext_modules=ext_modules,
entry_points={"console_scripts": ["jakteristics = jakteristics.__main__:app"]},
)