-
Notifications
You must be signed in to change notification settings - Fork 13
/
meson.build
108 lines (89 loc) · 2.95 KB
/
meson.build
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
project('stripy', 'c')
name = 'stripy'
add_languages('fortran')
platform = host_machine.system()
if platform == 'windows'
add_project_link_arguments('-static', language: ['fortran', 'c'])
elif platform == 'darwin'
add_project_link_arguments('-Wl,-rpath, "@loader_path"', language: ['fortran', 'c'])
else
add_project_link_arguments('-Wl,-rpath,"$ORIGIN"', language: ['fortran', 'c'])
endif
py_mod = import('python')
py = py_mod.find_installation(pure: false)
py_dep = py.dependency()
incdir_numpy = run_command(py,
['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'],
check : true
).stdout().strip()
incdir_f2py = run_command(py,
['-c', 'import os; os.chdir(".."); import numpy.f2py; print(numpy.f2py.get_include())'],
check : true
).stdout().strip()
inc_np = include_directories(incdir_numpy, incdir_f2py)
install_subdir(name, install_dir: py.get_install_dir() / name, strip_directory: true)
tripack_source = custom_target('_tripackmodule.c',
input : ['src/tripack.pyf'], # .f so no F90 wrappers
output : ['_tripackmodule.c', '_tripack-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@']
)
stripack_source = custom_target('_stripackmodule.c',
input : ['src/stripack.pyf'], # .f so no F90 wrappers
output : ['_stripackmodule.c', '_stripack-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@']
)
srfpack_source = custom_target('_srfpackmodule.c',
input : ['src/srfpack.pyf'], # .f so no F90 wrappers
output : ['_srfpackmodule.c'],
command : [py, '-m', 'numpy.f2py', '@INPUT@']
)
ssrfpack_source = custom_target('_ssrfpackmodule.c',
input : ['src/ssrfpack.pyf'], # .f so no F90 wrappers
output : ['_ssrfpackmodule.c', '_ssrfpack-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@']
)
fortran_source = custom_target('_fortranmodule.c',
input : ['src/stripyf.pyf'], # .f so no F90 wrappers
output : ['_fortranmodule.c', '_fortran-f2pywrappers.f'],
command : [py, '-m', 'numpy.f2py', '@INPUT@']
)
py.extension_module('_tripack',
['src/tripack.f90', tripack_source],
incdir_f2py / 'fortranobject.c',
subdir: 'stripy',
include_directories: inc_np,
dependencies: py_dep,
install: true,
)
py.extension_module('_stripack',
['src/stripack.f90', stripack_source],
incdir_f2py / 'fortranobject.c',
subdir: 'stripy',
include_directories: inc_np,
dependencies: py_dep,
install: true,
)
py.extension_module('_srfpack',
['src/srfpack.f', srfpack_source],
incdir_f2py / 'fortranobject.c',
subdir: 'stripy',
include_directories: inc_np,
dependencies: py_dep,
install: true,
)
py.extension_module('_ssrfpack',
['src/ssrfpack.f', ssrfpack_source],
incdir_f2py / 'fortranobject.c',
subdir: 'stripy',
include_directories: inc_np,
dependencies: py_dep,
install: true,
)
py.extension_module('_fortran',
['src/stripyf.f90', fortran_source],
incdir_f2py / 'fortranobject.c',
subdir: 'stripy',
include_directories: inc_np,
dependencies: py_dep,
install: true,
)