-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (74 loc) · 2.76 KB
/
setup.py
File metadata and controls
79 lines (74 loc) · 2.76 KB
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
import os
import sys
from Cython.Build import cythonize
from setuptools import Extension, setup
project_root = os.path.dirname(os.path.abspath(__file__))
gf2_dir = os.path.join(project_root, "src/scloop/utils/linear_algebra_gf2")
gf2toolkit_srcs = os.path.join(gf2_dir, "GF2toolkit/srcs")
sanity_dir = os.path.join(project_root, "src/scloop/utils/denoise")
is_windows = sys.platform.startswith("win")
if is_windows:
base_link_args = ["-static"]
openmp_compile = ["-fopenmp"]
openmp_link = ["-static", "-fopenmp"]
else:
base_link_args = []
openmp_compile = ["-fopenmp"]
openmp_link = ["-fopenmp"]
extensions = [
Extension(
"scloop.data.ripser_lib",
sources=["./src/scloop/data/ripser_lib.pyx", "./src/scloop/data/ripser.cpp"],
language="c++",
include_dirs=["./src/scloop/data"],
extra_link_args=base_link_args,
),
Extension(
"scloop.utils.linear_algebra_gf2.m4ri_lib",
sources=["./src/scloop/utils/linear_algebra_gf2/m4ri_lib.pyx"],
include_dirs=[os.path.join(gf2_dir, "include")],
extra_objects=[os.path.join(gf2_dir, "libm4ri.a")],
extra_compile_args=openmp_compile,
extra_link_args=openmp_link,
),
# Extension(
# "scloop.utils.linear_algebra_gf2.gf2toolkit_lib",
# sources=[
# "./src/scloop/utils/linear_algebra_gf2/gf2toolkit_lib.pyx",
# "./src/scloop/utils/linear_algebra_gf2/gf2toolkit_wrapper.cpp",
# ],
# include_dirs=[
# gf2_dir,
# gf2toolkit_srcs,
# os.path.join(gf2_dir, "include"),
# os.path.join(gf2_dir, "GF2toolkit/submodules/m4ri"),
# ],
# extra_objects=[
# os.path.join(gf2_dir, "libGF2toolkit.a"),
# os.path.join(gf2_dir, "libm4ri.a"),
# ],
# language="c++",
# extra_compile_args=["-std=c++11", "-O3", "-fopenmp"],
# extra_link_args=["-fopenmp"],
# ),
Extension(
"scloop.utils.denoise.Sanity",
sources=["./src/scloop/utils/denoise/Sanity.pyx"],
include_dirs=[sanity_dir],
extra_objects=[os.path.join(sanity_dir, "libSanity.a")],
language="c++",
extra_compile_args=["-std=c++11", "-O3"] + openmp_compile,
extra_link_args=openmp_link,
),
Extension(
"scloop.utils.distance_metrics.frechet",
sources=[
"./src/scloop/utils/distance_metrics/frechet.pyx",
"./src/scloop/utils/distance_metrics/discrete-frechet-distance/Frechet.cpp",
],
include_dirs=["./src/scloop/utils/distance_metrics/discrete-frechet-distance"],
language="c++",
extra_link_args=base_link_args,
),
]
setup(ext_modules=cythonize(extensions, compiler_directives={"language_level": "3"}))