Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·88 lines (78 loc) · 1.98 KB
/
Copy pathsetup.py
File metadata and controls
executable file
·88 lines (78 loc) · 1.98 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python
import os
import numpy
from Cython.Build import cythonize
from Cython.Distutils import build_ext
from setuptools import Extension, setup
# Give user option to specify local compiler name
if "CC" not in os.environ:
os.environ["CC"] = "gcc"
print("Compiler set to: " + os.environ["CC"])
extension_params = {
"extra_compile_args": [
"-fopenmp",
"-O3",
"-march=native",
],
"extra_link_args": ["-fopenmp"],
"include_dirs": [numpy.get_include()],
"define_macros": [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
}
directives = {
"language_level": "3str",
"embedsignature": True,
"boundscheck": False,
"wraparound": False,
"initializedcheck": False,
"cdivision": True,
"binding": True,
}
extensions = []
# detrended kriging
extensions += [
Extension(
"smrf.spatial.dk.detrended_kriging",
sources=[
os.path.join("smrf/spatial/dk", source_file)
for source_file in [
"detrended_kriging.pyx",
"krige.c",
"lusolv.c",
"array.c",
]
],
**extension_params,
),
]
# envphys core c functions
extensions += [
Extension(
"smrf.envphys.core.envphys_c",
sources=[
os.path.join("smrf/envphys/core", val)
for val in ["envphys_c.pyx", "topotherm.c", "dewpt.c", "iwbt.c"]
],
**extension_params,
),
Extension(
"smrf.envphys.solar.toposplit",
sources=["smrf/envphys/solar/toposplit.pyx"],
**extension_params,
),
Extension(
"smrf.utils.wind.wind_c",
sources=[
os.path.join("smrf/utils/wind", val)
for val in ["wind_c.pyx", "breshen.c", "calc_wind.c"]
],
**extension_params,
),
]
setup(
cmdclass={"build_ext": build_ext},
ext_modules=cythonize(
extensions,
compiler_directives=directives,
annotate=False,
),
)