-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
47 lines (39 loc) · 1.1 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
43
44
45
46
47
import platform
import os
from os.path import join
from setuptools import Extension, setup
import numpy as np
source_files = [
"polyagamma/_polyagamma.c",
"src/pgm_random.c",
"src/pgm_alternate.c",
"src/pgm_devroye.c",
"src/pgm_common.c",
"src/pgm_saddle.c",
"src/pgm_density.c",
]
macros = [('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')]
if os.getenv("BUILD_WITH_COVERAGE", None):
macros.append(('CYTHON_TRACE_NOGIL', 1))
if platform.system() == 'Windows':
compile_args = ['/O2']
else:
compile_args = ['-O2', '-std=c99']
# https://numpy.org/devdocs/reference/random/examples/cython/setup.py.html
npy_include_path = np.get_include()
lib_dirs = [
join(npy_include_path, '..', '..', 'random', 'lib'),
join(npy_include_path, '..', 'lib')
]
extensions = [
Extension(
"polyagamma._polyagamma",
sources=source_files,
include_dirs=[npy_include_path, "./include"],
library_dirs=lib_dirs,
libraries=['npyrandom', 'npymath'],
define_macros=macros,
extra_compile_args=compile_args,
),
]
setup(ext_modules=extensions)