-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
40 lines (32 loc) · 1008 Bytes
/
Copy pathsetup.py
File metadata and controls
40 lines (32 loc) · 1008 Bytes
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
from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup
class BuildExt(build_ext):
def build_extensions(self):
compiler_type = self.compiler.compiler_type
opts = []
link_opts = []
if compiler_type == "msvc":
opts = ["/O2", "/openmp", "/arch:AVX2", "/wd4244", "/wd4267", "/wd4018"]
else:
opts = ["-O3", "-march=native", "-fopenmp"]
link_opts = ["-fopenmp"]
for ext in self.extensions:
ext.extra_compile_args.extend(opts)
ext.extra_link_args.extend(link_opts)
build_ext.build_extensions(self)
ext_modules = [
Pybind11Extension(
"gbrs.core",
["python/bindings.cpp"],
include_dirs=["inst/include", "third_party/eigen"],
cxx_std=17,
),
]
setup(
name="pygbrs",
packages=["gbrs"],
package_dir={"": "python"},
ext_modules=ext_modules,
cmdclass={"build_ext": BuildExt},
zip_safe=False,
)