-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
75 lines (66 loc) · 2.2 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
#!/usr/bin/env python
from sys import platform
from pathlib import Path
import numpy as np
from setuptools import setup, Extension, find_packages
from sysconfig import get_paths
from Cython.Build import cythonize
__PATHS = get_paths()
__ROOT = Path(__PATHS["include"])
if __ROOT.name.lower() != "include":
__ROOT = __ROOT.parent # strip python subdirectory (if present)
__ROOT = __ROOT.parent
__CANTERA_LIBS = ["cantera"] # shared libraries
if platform == "win32":
__CANTERA_LIBS = [f"{lib}.lib" for lib in __CANTERA_LIBS]
__INCLUDE = __ROOT / "Library" / "include"
extra_comp_args = ["/std:c++17"]
extra_link_args = [f"/LIBPATH:{__ROOT / 'Library' / 'lib'}"]
else:
__CANTERA_LIBS = [f"-l{lib}" for lib in __CANTERA_LIBS]
__INCLUDE = __ROOT / "include"
extra_comp_args = ["-std=c++17"]
extra_link_args = []
if platform == "darwin":
extra_link_args.extend(["-framework", "Accelerate"])
extra_comp_args.append("-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION")
def readme():
with open('README.md') as f:
return f.read()
with Path("ctapp/_version.py").open() as version_file:
exec(version_file.read())
extensions = [
Extension(
"ctapp._ctapp",
[
"ctapp/_ctapp.pyx",
"ctapp/NewFlow.cpp",
"ctapp/NewFunc1.cpp"
],
include_dirs=[np.get_include(), str(__INCLUDE)],
extra_objects=__CANTERA_LIBS,
extra_compile_args=extra_comp_args,
extra_link_args=extra_link_args,
language='c++17',
),
]
setup(
name="ctapp",
version=__version__,
description='Example for compilation of custom classes against stock Cantera',
long_description=readme(),
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: MIT',
'Programming Language :: Python :: 3',
],
keywords='cantera',
url='https://github.com/ischoegl/ctapp.git',
author=__author__,
author_email='ischoegl@lsu.edu',
license='MIT',
packages=find_packages(),
install_requires=['cantera>=3.0.0b1'],
ext_modules=cythonize(extensions, compiler_directives={'language_level' : "3"}))