forked from phasorpy/phasorpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
53 lines (45 loc) · 1.36 KB
/
setup.py
File metadata and controls
53 lines (45 loc) · 1.36 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
46
47
48
49
50
51
52
53
"""PhasorPy package Setuptools script."""
# project metadata are defined in pyproject.toml
import os
import sys
import numpy
from setuptools import Extension, setup
DEBUG = bool(os.environ.get('PHASORPY_DEBUG', False))
print()
print(f'Building with numpy-{numpy.__version__}')
print()
if sys.platform == 'win32':
extra_compile_args = ['/openmp']
extra_link_args: list[str] = []
if DEBUG:
extra_compile_args += [
'/Zi',
'/Od',
'/DCYTHON_TRACE=1',
# '/DCYTHON_TRACE_NOGIL=1', # too slow
]
extra_link_args += ['-debug:full']
elif sys.platform == 'darwin':
# OpenMP not available in Xcode
# https://mac.r-project.org/openmp/
extra_compile_args = [] # ['-Xclang', '-fopenmp']
extra_link_args = [] # ['-lomp']
else:
extra_compile_args = ['-fopenmp']
extra_link_args = ['-fopenmp']
ext_modules = [
Extension(
'phasorpy._phasorpy',
['src/phasorpy/_phasorpy.pyx'],
include_dirs=[numpy.get_include()],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
define_macros=[
# ('CYTHON_TRACE_NOGIL', '1'),
# ('CYTHON_LIMITED_API', '1'),
# ('Py_LIMITED_API', '1'),
('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION'),
],
)
]
setup(ext_modules=ext_modules)