-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
45 lines (39 loc) · 1.56 KB
/
setup.py
File metadata and controls
45 lines (39 loc) · 1.56 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
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
import numpy
__version__ = "1.3.1"
class _CustomBuildExt(build_ext):
def build_extensions(self) -> None:
for extension in self.extensions:
assert len(extension.extra_compile_args) == 0
if self.compiler.compiler_type != "msvc":
# Specify additional flags from the default for unix-like compilers
# only. Whilst we could enable /WX for MSVC to get the equivalent of
# -Werror, this trips on a warning from within a numpy header file.
extension.extra_compile_args = [
"-std=c++11",
"-pedantic",
"-Werror",
]
super().build_extensions()
setup(
ext_modules=[
Extension(
"mt2._mt2",
["src/_mt2/main.cpp"],
define_macros=[
# Pass in the version info so we can expose it in the extension.
("VERSION_INFO", __version__),
# For reasons explained in lester_mt2_bisect_v7.h, we need to manually
# enable some inlining optimisations.
("ENABLE_INLINING", "1"),
# Copyright printing is disabled here, since we include the necessary
# citation information elsewhere.
("DISABLE_COPYRIGHT_PRINTING", "1"),
],
include_dirs=[numpy.get_include()],
language="c++",
),
],
cmdclass={"build_ext": _CustomBuildExt},
)