-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
executable file
·34 lines (30 loc) · 1.02 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
import os
from setuptools import setup, find_packages, Extension
setup_requires = ['setuptools', 'wheel']
FLAG_CPP = os.getenv('PSFLAG_CPP', '0') == '1'
if FLAG_CPP:
try:
from Cython.Build import cythonize
import eigency
WITH_CPP = True
setup_requires += ['cython', 'eigency']
ext_modules = cythonize(Extension(
name='pyg_spectral.propagations.prop_cppext',
sources=['pyg_spectral/propagations/prop_cppext.pyx'],
language='c++',
extra_compile_args=["-std=c++11", "-O3", "-fopenmp"],
include_dirs=[".", "module-dir-name"] + eigency.get_includes(),
optional=True,
))
except ImportError:
import warnings
warnings.warn("Cython or Eigen is not installed, continue without cpp.", category=ImportWarning, stacklevel=2)
WITH_CPP = False
ext_modules = []
else:
ext_modules = []
setup(
setup_requires=setup_requires,
packages=find_packages(),
ext_modules=ext_modules,
)