forked from flatironinstitute/CaImAn
-
Notifications
You must be signed in to change notification settings - Fork 1
/
_buildhelper_cython.py
47 lines (41 loc) · 1.47 KB
/
_buildhelper_cython.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
#!/usr/bin/env python
###################
# build helper for pyproject.toml to do the
# cython parts of the build.
#
# This was ported from logic originally in the
# old-stype setup.py, in order to comply with the
# new PEP-517/PEP-518 build style.
from Cython.Build import cythonize
import numpy as np
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py as _build_py
import setuptools.extension
class build_py(_build_py):
def run(self):
self.run_command("build_ext")
return super().run()
def initialize_options(self):
super().initialize_options()
if sys.platform == 'darwin':
# TODO: Verify still needed; requirement was
# added w/ OSX 10.9
# See also:
# https://github.com/pandas-dev/pandas/issues/23424
extra_compiler_args = ['-stdlib=libc++']
else:
extra_compiler_args = []
if self.distribution.ext_modules is None:
self.distribution.ext_modules = []
self.distribution.ext_modules.append(
setuptools.extension.Extension(
"caiman.source_extraction.cnmf.oasis",
sources=["caiman/source_extraction/cnmf/oasis.pyx"],
include_dirs=[np.get_include()],
language="c++",
extra_compile_args = extra_compiler_args,
extra_link_args = extra_compiler_args,
)
)