-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
62 lines (56 loc) · 1.67 KB
/
setup.py
File metadata and controls
62 lines (56 loc) · 1.67 KB
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
from setuptools import setup, Extension
import numpy
from os.path import exists
from ctypes.util import find_library
useMtg = exists("./mrarbgrad_src/ext/mtg/")
_sources = \
[
'./mrarbgrad_src/ext/utility/global.cpp',
'./mrarbgrad_src/ext/utility/v3.cpp',
'./mrarbgrad_src/ext/mag/Mag.cpp',
'./mrarbgrad_src/ext/main.cpp',
'./mrarbgrad_src/ext/mtg/mtg_functions.cpp',
'./mrarbgrad_src/ext/mtg/spline.cpp'
]
if not useMtg:
_sources.remove('./mrarbgrad_src/ext/mtg/mtg_functions.cpp')
_sources.remove('./mrarbgrad_src/ext/mtg/spline.cpp')
modExt = Extension\
(
"mrarbgrad.ext",
sources = _sources,
include_dirs = ["./mrarbgrad_src/ext/", numpy.get_include()],
define_macros = [("USE_MTG", None)] if useMtg else None,
language = 'c++'
)
_packages = \
[
"mrarbgrad",
"mrarbgrad.trajfunc",
"mrarbgrad.ext",
"mrarbgrad.ext.traj",
"mrarbgrad.ext.mag",
"mrarbgrad.ext.mtg",
"mrarbgrad.ext.utility",
]
if not useMtg:
_packages.remove("mrarbgrad.ext.mtg")
_package_dir = \
{
"mrarbgrad":"./mrarbgrad_src/",
"mrarbgrad.trajfunc":"./mrarbgrad_src/trajfunc/",
"mrarbgrad.ext":"./mrarbgrad_src/ext/",
"mrarbgrad.ext.traj":"./mrarbgrad_src/ext/traj/",
"mrarbgrad.ext.mag":"./mrarbgrad_src/ext/mag/",
"mrarbgrad.ext.mtg":"./mrarbgrad_src/ext/mtg/",
"mrarbgrad.ext.utility":"./mrarbgrad_src/ext/utility/"
}
setup\
(
name = 'mrarbgrad',
# install_requires = ["numpy", "matplotlib"], # pip will automatically upgrade numpy if it see this, which might corrupt the environment
ext_modules = [modExt],
packages = _packages,
package_dir = _package_dir,
include_package_data = True
)