-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathsetup.py
68 lines (58 loc) · 1.93 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
"""Setup for fast-simplification."""
import builtins
from io import open as io_open
import os
import sys
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext as _build_ext
# Define macros for cython
macros = []
if os.name == "nt": # windows
extra_compile_args = ["/openmp", "/O2", "/w", "/GS"]
elif os.name == "posix": # linux org mac os
if sys.platform == "linux":
extra_compile_args = ["-std=gnu++11", "-O3", "-w"]
else: # probably mac os
extra_compile_args = ["-std=c++11", "-O3", "-w"]
else:
raise OSError("Unsupported OS %s" % os.name)
# Check if 64-bit
if sys.maxsize > 2**32:
macros.append(("IS64BITPLATFORM", None))
# for: the cc1plus: warning: command line option '-Wstrict-prototypes'
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
# prevent numpy from thinking it is still in its setup process:
try:
del builtins.__NUMPY_SETUP__
except AttributeError:
pass
import numpy
self.include_dirs.append(numpy.get_include())
def build_extensions(self):
try:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
except (AttributeError, ValueError):
pass
_build_ext.build_extensions(self)
setup(
# Build cython modules
cmdclass={"build_ext": build_ext},
ext_modules=[
Extension(
"genesis.ext.fast_simplification._simplify",
["genesis/ext/fast_simplification/_simplify.pyx"],
language="c++",
extra_compile_args=extra_compile_args,
define_macros=macros,
),
Extension(
"genesis.ext.fast_simplification._replay",
["genesis/ext/fast_simplification/_replay.pyx"],
language="c++",
extra_compile_args=extra_compile_args,
define_macros=macros,
),
],
)