-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
125 lines (99 loc) · 3.81 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
from __future__ import print_function
"""
setup.py file for SWIG example
"""
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
import sys
import os
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
long_description = f.read()
print('building mumps solver interface')
##
setup_dir = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
mumps_solve_incdir = os.path.join(setup_dir, "mumps_solve")
mumps_solve_dir = ''
from distutils.core import *
from distutils import sysconfig
modules= ["mumps_solve", ]
module_path="petram.ext.mumps."
sdir = "petram/ext/mumps/"
sources = {name: [sdir + name + "_wrap.cxx"] for name in modules}
proxy_names = {name: '_'+name for name in modules}
#mumps_link_args = [libporda, mumpscommonliba, dmumpsliba, smumpsliba, cmumpsliba,
# zmumpsliba]
#include_dirs = [mumps_solve_incdir, mpichincdir, numpyincdir,
# mpi4pyincdir, mumpsincdir, mumpssrcdir]
import numpy
numpyincdir = numpy.get_include()
import mpi4py
mpi4pyincdir = mpi4py.get_include()
mumps_inc_dir = os.getenv("MUMPS_INC_DIR")
mpi_inc_dir = os.getenv("MPI_INC_DIR")
include_dirs = [mumps_solve_incdir, numpyincdir, mpi4pyincdir,
mumps_inc_dir, mpi_inc_dir]
include_dirs = [x for x in include_dirs if x.strip() != '']
#lib_list = ["pord", "parmetis", "metis5", "scalapack", "blas"]
lib_list = []
library_dirs = [os.getenv("MUMPS_SOLVE_DIR")]
#libraries = ["smumps", "dmumps", "cmumps", "zmumps", "mumps_common"]
libraries = ["mumps_solve"]
for lib in lib_list:
if eval(lib) != "":
print(lib, eval(lib))
library_dirs.append(eval(lib+ 'lnkdir'))
libraries.append(eval(lib+'lib'))
mkl = os.getenv("MKL")
ompflag = os.getenv("OMPFLAG")
print("ompflag", ompflag)
ext_modules = []
for kk, name in enumerate(modules):
extra_link_args = [ompflag]
'''
if kk == 0:
extra_link_args = mumps_link_args + [sdir + name+'.a']
else:
extra_link_args = [sdir + name+'.a']
if whole_archive != '':
extra_link_args = ['-Wl', whole_archive] + extra_link_args + [no_whole_archive]
extra_link_args = [x for x in extra_link_args if len(x) != 0]
extra_link_args = [','.join(extra_text)]
'''
if mkl != '':
extra_link_args = ['-shared-intel', mkl] + extra_link_args
#if nocompactunwind != '':
# extra_link_args.extend([nocompactunwind])
#extra_link_args = ['-fopenmp']+[x for x in extra_link_args if len(x) != 0]
#extra_link_args = [x for x in extra_link_args if len(x) != 0]
ext_modules.append(Extension(module_path+proxy_names[name],
sources=sources[name],
extra_compile_args = ['-DSWIG_TYPE_TABLE=PyMFEM'],
extra_link_args = extra_link_args,
include_dirs = include_dirs,
library_dirs = library_dirs,
libraries = libraries ))
setup (name = 'PetraM_MUMPS',
url='https://github.com/piScope/PetraM',
version = '1.1.9',
description = 'PetraM MUMPS interface',
long_description=long_description,
author = "S. Shiraiwa",
author_email='[email protected]',
license='GNUv3',
classifiers=[
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Scientific/Engineering :: Physics',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python :: 2.7',
],
keywords='MFEM physics',
packages=find_packages(),
ext_modules = ext_modules,
# py_modules = modules,
)