-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathmeson.build
More file actions
108 lines (96 loc) · 2.64 KB
/
Copy pathmeson.build
File metadata and controls
108 lines (96 loc) · 2.64 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
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(
'mkl_fft',
['c', 'cython'],
version: run_command(
find_program('python3', 'python'),
['-c', 'exec(open("mkl_fft/_version.py").read()); print(__version__)'],
check: true
).stdout().strip(),
meson_version: '>=1.8.3',
default_options: [
'buildtype=release',
]
)
py = import('python').find_installation(pure: false)
# numpy includes
np_dir = run_command(py,
['-c', 'import numpy; print(numpy.get_include())'],
check: true
).stdout().strip()
inc_np = include_directories(np_dir, 'mkl_fft/src', 'mkl_fft')
# compiler/linker
# this looks like dead code, but it isn't: removing get_compiler call
# can cause segfaults at runtime (most notably when building with Intel clang)
cc = meson.get_compiler('c')
c_args = ['-DNDEBUG']
rpath_link_args = []
if host_machine.system() == 'linux'
rpath = '$ORIGIN' / '../..' + ':' + '$ORIGIN' / '../../..'
rpath_link_args = ['-Wl,-rpath,' + rpath]
endif
mkl_dep = dependency('MKL', method: 'cmake',
modules: ['MKL::MKL'],
cmake_args: [
'-DMKL_ARCH=intel64',
'-DMKL_LINK=sdl',
],
required: true
)
# code gen
src_file_cli = files('_vendored/process_src_template.py')
gen_mklfft_c = custom_target(
'mklfft_c_generated',
output: 'mklfft.c',
input: 'mkl_fft/src/mklfft.c.src',
command: [py, src_file_cli, '@INPUT@', '-o', '@OUTPUT@'],
)
# Cython extension
py.extension_module(
'_pydfti',
sources: [
'mkl_fft/_pydfti.pyx',
gen_mklfft_c
],
include_directories: inc_np,
dependencies: [mkl_dep],
c_args: c_args + [
'-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION',
'-DPY_ARRAY_UNIQUE_SYMBOL=mkl_fft_ext'
],
link_args: rpath_link_args,
install: true,
subdir: 'mkl_fft'
)
# Python sources
py.install_sources(
[
'mkl_fft/__init__.py',
'mkl_fft/__main__.py',
'mkl_fft/_fft_utils.py',
'mkl_fft/_init_helper.py',
'mkl_fft/_mkl_fft.py',
'mkl_fft/_patch_numpy.py',
'mkl_fft/_patch_startup.py',
'mkl_fft/_version.py',
'mkl_fft/patch.py',
'mkl_fft/with_patch.py',
],
subdir: 'mkl_fft'
)
py.install_sources(
[
'mkl_fft/interfaces/__init__.py',
'mkl_fft/interfaces/_float_utils.py',
'mkl_fft/interfaces/_numpy_fft.py',
'mkl_fft/interfaces/_numpy_helper.py',
'mkl_fft/interfaces/_scipy_fft.py',
'mkl_fft/interfaces/numpy_fft.py',
'mkl_fft/interfaces/scipy_fft.py',
],
subdir: 'mkl_fft/interfaces'
)
install_subdir(
'mkl_fft/tests',
install_dir: py.get_install_dir() / 'mkl_fft',
exclude_files: ['AGENTS.md']
)