-
Notifications
You must be signed in to change notification settings - Fork 1
/
meson.build
94 lines (85 loc) · 1.83 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
project(
'igakit',
'c', 'fortran',
version: '0.1.0',
license: 'BSD-2-Clause',
license_files: ['LICENSE.rst'],
meson_version: '>=1.1.0',
)
fs = import('fs')
py = import('python').find_installation(pure: false)
py_dep = py.dependency()
incdir_numpy = run_command(py,
['-c', 'import numpy; print(numpy.get_include())'],
check : true,
).stdout().strip()
incdir_f2py = run_command(py,
['-c', 'import numpy.f2py; print(numpy.f2py.get_include())'],
check : true,
).stdout().strip()
np_dep = declare_dependency(
# include_directories: [incdir_numpy, incdir_f2py],
compile_args: [f'-I@incdir_numpy@', f'-I@incdir_f2py@'],
)
f2py = [
py, '-m', 'numpy.f2py',
'--build-dir', '@OUTDIR@',
'@INPUT@',
]
fc = meson.get_compiler('fortran')
cc = meson.get_compiler('c')
add_project_arguments(
fc.get_supported_arguments(
#'-Wno-unused-dummy-argument',
),
language : 'fortran',
)
add_project_arguments(
cc.get_supported_arguments(
'-Wno-misleading-indentation',
),
language : 'c',
)
ext_name = 'igalib'
ext_fort_srcs = ['igakit' / ext_name + '.f90']
ext_f2py_srcs = custom_target(
command: [f2py],
input: ['igakit' / ext_name + '.pyf'],
output: [
ext_name + 'module.c',
ext_name + '-f2pywrappers2.f90',
],
)
py.extension_module(
ext_name, [ext_fort_srcs, ext_f2py_srcs],
incdir_f2py / 'fortranobject.c',
dependencies : [py_dep, np_dep],
subdir: 'igakit',
install : true
)
package = {
'igakit': [
'__init__.py',
'cad.py',
'io.py',
'nurbs.py',
'plot_mpl.py',
'plot_myv.py',
'plot_nul.py',
'plot.py',
'transform.py',
]
}
foreach pkg, src : package
srcdir = ''
subdir = join_paths(pkg.split('.'))
sources = []
foreach fn : src
sources += srcdir / subdir / fn
endforeach
py.install_sources(
sources,
pure: false,
subdir: subdir,
)
endforeach