generated from microsoft/python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
53 lines (47 loc) · 1.64 KB
/
build.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
48
49
50
51
52
53
# setup.py
from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize
import numpy as np
import os
extensions = [
Extension(
"src.wavekit.value_change",
sources=["src/wavekit/value_change.pyx", ],
include_dirs=[np.get_include()],
extra_compile_args=["-fpic","-O3", "-march=native"],
extra_link_args=["-O3", "-march=native"],
language="c++",
#define_macros=[('CYTHON_TRACE', '1')] # open profiling
)
]
if VERDI_HOME := os.environ.get('VERDI_HOME'):
npi_include_dir = os.path.join(VERDI_HOME,'share/NPI/inc')
npi_library_dir = os.path.join(VERDI_HOME,'share/NPI/lib/LINUX64')
extensions.append(
Extension(
"src.wavekit.npi_fsdb_reader",
sources=["src/wavekit/npi_fsdb_reader.pyx", ],
include_dirs=[np.get_include(), npi_include_dir],
library_dirs=[npi_library_dir],
libraries=["NPI", "rt"],
extra_compile_args=["-fpic","-O3", "-march=native"],
extra_link_args=["-O3", "-march=native",f"-Wl,-rpath,{npi_library_dir}"],
language="c++",
#define_macros=[('CYTHON_TRACE', '1')] # open profiling
)
)
setup(
ext_modules=cythonize(extensions,
compiler_directives={
"language_level": 3,
"embedsignature": True,
"boundscheck": False,
"wraparound": False,
"cdivision": True,
"nonecheck": False,
#'profile': True, # open profiling
#'linetrace': True
}
),
script_args=['build_ext','--inplace'],
)