-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
66 lines (52 loc) · 2.62 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
if __name__ == "__main__":
from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration
from numpy.distutils.core import Extension
import numpy
import os
from Cython.Build import cythonize
#---------------------------------------------------------------
"""
Building and install CHAPSim_post
"""
def create_cython_ext(folder,**other_args):
sources = [os.path.join(folder,file) for file in os.listdir(folder) \
if os.path.splitext(file)[-1] == '.pyx']
names = [os.path.splitext(source)[0].replace('/','.')\
for source in sources]
include_dirs = [numpy.get_include()]
if 'include_dirs' in other_args:
other_args['include_dirs'] += include_dirs
else:
other_args['include_dirs'] = include_dirs
ext_list = []
for name, source in zip(names,sources):
ext_list.append(Extension(name=name,
sources=[source],
**other_args))
return ext_list
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
cy_parallel = create_cython_ext("CHAPSim_post/_libs",
extra_compile_args = ["-fopenmp","-O3"],
extra_link_args = ["-fopenmp","-O3"])
cy_parallel_legacy = create_cython_ext("CHAPSim_post/legacy/_libs",
extra_compile_args = ["-fopenmp","-O3"],
extra_link_args = ["-fopenmp","-O3"])
ext_list = cythonize(cy_parallel+cy_parallel_legacy,
compiler_directives={'language_level':3})
config = Configuration(package_name='CHAPSim_post',
description="Package containing post-processing routines for the CHAPSim DNS Solver",
package_path="CHAPSim_post",
ext_modules = ext_list)
config.add_subpackage(subpackage_name='post',
subpackage_path="CHAPSim_post/post")
config.add_subpackage(subpackage_name="utils",
subpackage_path="CHAPSim_post/utils")
config.add_subpackage(subpackage_name="dtypes",
subpackage_path="CHAPSim_post/dtypes")
config.add_subpackage(subpackage_name="POD",
subpackage_path="CHAPSim_post/POD")
config.add_subpackage(subpackage_name='legacy',
subpackage_path="CHAPSim_post/legacy")
setup(**config.todict())