-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
42 lines (35 loc) · 1.21 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
#!/usr/bin/env python3
"""
Build the Cython demonstrations of low-level access to NumPy random
Usage: python setup.py build_ext -i
"""
import numpy as np
from distutils.core import setup
from Cython.Build import cythonize
from setuptools.extension import Extension
from os.path import join, dirname
import cython_gsl
path = dirname(__file__)
defs = [('NPY_NO_DEPRECATED_API', 0)]
extensions = []
GWEButils = Extension("GWEButils_cFunc",
sources=[join(path, 'GWEButils_cFunc.pyx')],
include_dirs=[np.get_include()],
define_macros=defs)
extensions.append(GWEButils)
useGSL = True
try:
GWEButils_gsl = Extension("GWEButils_cFunc_gsl",
sources=[join(path, 'GWEButils_cFunc_gsl.pyx')],
include_dirs=[np.get_include(), cython_gsl.get_include()],
define_macros=defs, libraries=cython_gsl.get_libraries(),
library_dirs=[cython_gsl.get_library_dir()])
extensions.append(GWEButils_gsl)
except:
useGSL = False
setup(
ext_modules=cythonize(extensions, compiler_directives={"language_level" : "3"}),
)
if not useGSL:
print('Warning: GSL is not installed in the system!')
print('Numpy is used for scientific computation instead ... The speed is slower than GSL')