-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
60 lines (46 loc) · 1.64 KB
/
build.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
# distutils: define_macros=NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
import subprocess
import shlex
from setuptools import Extension
from Cython.Build import cythonize
import numpy as np
def pkg_config(pkg_name, command):
return subprocess.check_output(["pkg-config", command, pkg_name]).decode(
"utf8"
)
def build(setup_kwargs):
"""Needed for the poetry building interface."""
# extra_compile_args = pkg_config("opencv", '--cflags')
# extra_link_args = pkg_config("opencv", '--libs')
# extra_compile_args = shlex.split(extra_compile_args)
# extra_link_args = shlex.split(extra_link_args)
extra_compile_args = ['-DDISABLE_OPENCV',
'-DDISABLE_CUDA',
'-DUSE_OPENMP',
'-DUSE_MEX']
extra_link_args = []
extensions = [
Extension(
"fastms._solver",
sources=[
"fastms/_solver.pyx",
"src/libfastms/util/has_cuda.cpp",
# "src/libfastms/util/image.cpp",
"src/libfastms/solver/solver_host.cpp",
"src/libfastms/solver/solver_base.cpp"
],
include_dirs=[np.get_include(), "src/libfastms"],
language="c++",
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
),
]
# extensions = cythonize(extensions)
extensions = cythonize(extensions,
compiler_directives={'language_level': "3"})
setup_kwargs.update(
{
"ext_modules": extensions,
"include_dirs": [np.get_include()],
}
)