-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
111 lines (93 loc) · 2.67 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# -*- coding: utf-8 -*-
"""
Build Cython interface to CanteraPFR.
"""
import os
import sys
from numpy import get_include
from setuptools import setup
from distutils.extension import Extension
from Cython.Build import cythonize
def get_platform():
if 'linux' in sys.platform:
platform_abbr = 'Nix'
elif 'darwin' in sys.platform:
platform_abbr = 'Nix'
else:
platform_abbr = 'Win'
return platform_abbr
platform_abbr = get_platform()
absdir = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
basepath = os.path.join(absdir, 'external', platform_abbr)
if not os.path.exists(basepath):
print('Assuming default path Cantera and Sundials')
basepath = ''
install_requires = [
'numpy>=1.11.0',
'pandas>=0.23.4',
'matplotlib>=2.2.0',
'networkx>=2.1',
'cantera>=2.4.0'
]
include_dirs = [
get_include(),
os.path.join(basepath, 'include'),
os.path.join(absdir, 'CanteraPFR', 'include')
]
extra_objects = [
os.path.join(absdir, 'CanteraPFR', 'lib', 'libCanteraPFR.a'),
os.path.join(basepath, 'lib', 'libcantera.a'),
os.path.join(basepath, 'lib', 'libsundials_ida.a'),
os.path.join(basepath, 'lib', 'libsundials_nvecserial.a')
]
extra_compile_args = []
if platform_abbr == 'Nix':
extra_link_args = ['-lopenblas']
else:
extra_link_args = []
ext_modules = []
ext_modules += [
Extension(
name = 'CanteraPFR.ct_pfr',
sources = [os.path.join('CanteraPFR', 'ct_pfr.pyx')],
extra_compile_args = extra_compile_args,
extra_objects = extra_objects,
extra_link_args = extra_link_args,
language = 'c++'
)
]
ext_modules += [
Extension(
name = 'CanteraPFR.ct_aux',
sources = [os.path.join('CanteraPFR', 'ct_aux.pyx')],
)
]
ext_modules += [
Extension(
name = 'CanteraPFR.ct_graph',
sources = [os.path.join('CanteraPFR', 'ct_graph.pyx')],
)
]
ext_modules += [
Extension(
name = 'CanteraPFR.ct_test',
sources = [os.path.join('CanteraPFR', 'ct_test.pyx')],
)
]
ext_modules = cythonize(ext_modules, build_dir='build', language_level=3)
setup(
name = 'CanteraPFR',
packages = ['CanteraPFR'],
include_package_data = True,
install_requires = install_requires,
include_dirs = include_dirs,
ext_modules = ext_modules,
author = 'Walter Dal\'Maz Silva',
author_email = '[email protected]',
description = 'Plug-flow reactor models',
keywords = 'kinetics reactor chemistry cantera transport',
url = 'https://github.com/waltermateriais/CanteraPFR/',
license = 'UNLICENSE',
version = '0.1.2',
zip_safe = False
)