-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
84 lines (77 loc) · 3.55 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
# setup.py
# build from python setup.py build_ext --build-lib <build directory>
import os
from Cython.Build import cythonize
import numpy
try:
from setuptools import setup
from setuptools import find_packages
from setuptools import Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
from distutils.extension import find_packages
from distutils.command.build_ext import build_ext
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
ext_cynum = Extension("pylsewave.cynum",
sources=["pylsewave/cynum.pyx",
"pylsewave/cypwfdm.cpp",
"pylsewave/cypwmesh.cpp",
"pylsewave/cypwfuns.cpp"],
language='c++',
include_dirs=["pylsewave/include/", numpy.get_include()])
class build_ext_compiler_check(build_ext):
def build_extensions(self):
compiler = self.compiler.compiler_type
print('\n\ncompiler', compiler)
if 'msvc' in compiler:
print("compiling on Windows")
for extension in self.extensions:
if extension.name == "pylsewave.cynum":
extension.extra_compile_args.append('/O2')
extension.extra_compile_args.append('/openmp')
extension.extra_compile_args.append('/EHsc')
extension.extra_compile_args.append('/GA')
extension.extra_compile_args.append('/favor:INTEL64')
if 'unix' in compiler:
print("compiling on unix")
for extension in self.extensions:
if extension.name == "pylsewave.cynum":
extension.extra_compile_args.append('-O2')
extension.extra_compile_args.append('-fopenmp')
extension.extra_compile_args.append('-std=c++11')
extension.extra_link_args = ['-lgomp']
super().build_extensions()
setup(name="pylsewave",
version='1.0.2',
license="GNU GPL v3.0",
packages=find_packages(),
description='A python package for pulse wave dynamics and/or any hyperbolic system of PDEs',
author='Georgios E. Ragkousis',
author_email='[email protected]',
url = "https://giorag.bitbucket.io/pylsewave/pyw_doc.html",
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Education',
'Intended Audience :: Developers',
'Intended Audience :: Healthcare Industry',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Mathematics',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Operating System :: OS Independent'],
keywords='pdes fdm pulsewave blood-vessels',
long_description=read('README.md'),
long_description_content_type='text/markdown',
requires=['numpy', "scipy", 'matplotlib'],
install_requires=['numpy', 'scipy', 'matplotlib'],
cmdclass={ 'build_ext': build_ext_compiler_check },
ext_modules=cythonize([ext_cynum], annotate=True))