-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
51 lines (45 loc) · 1.23 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
import platform
import sys
from Cython.Build import cythonize
from setuptools import Extension, setup
machine = platform.machine().lower()
x86 = ("x86_64", "amd64", "i386", "x86", "i686")
if sys.platform.startswith("linux"):
if machine in x86:
cflags = ["-std=c++14", "-O2", "-mavx"]
else:
cflags = ["-std=c++14", "-O2"]
elif sys.platform == "win32":
if machine in x86:
cflags = ["/std:c++14", "/O2", "/arch:AVX"]
else:
cflags = ["/std:c++14", "/O2"]
elif sys.platform == "darwin":
if machine in x86:
cflags = ["-std=c++14", "-O2", "-mavx"]
else:
cflags = ["-std=c++14", "-O2"]
else:
cflags = []
cy_extensions = [
Extension(
"cppcontainers.cppcontainers",
["cppcontainers/cppcontainers.pyx"],
include_dirs=["include"],
extra_compile_args=cflags,
language="c++",
),
]
compiler_directives = {
"boundscheck": False,
"wraparound": False,
"initializedcheck": False,
"annotation_typing": True,
"warn.undeclared": True,
"warn.unused": True,
"warn.unused_arg": True,
"warn.unused_result": True,
}
setup(
ext_modules=cythonize(cy_extensions, language_level=3, compiler_directives=compiler_directives),
)