| 1 |
project('skfmm', 'cpp', version: '2025.06.23') |
| 2 |
|
| 3 |
py = import('python').find_installation() |
| 4 |
|
| 5 |
incdir_numpy = meson.get_external_property('numpy-include-dir', 'not-given') |
| 6 |
if incdir_numpy == 'not-given' |
| 7 |
incdir_numpy = run_command(py, |
| 8 |
[ |
| 9 |
'-c', |
| 10 |
''' |
| 11 |
import os |
| 12 |
import numpy as np |
| 13 |
try: |
| 14 |
incdir = os.path.relpath(np.get_include()) |
| 15 |
except Exception: |
| 16 |
incdir = np.get_include() |
| 17 |
print(incdir) |
| 18 |
''' |
| 19 |
], |
| 20 |
check: true |
| 21 |
).stdout().strip() |
| 22 |
endif |
| 23 |
|
| 24 |
inc_np = include_directories(incdir_numpy) |
| 25 |
np_dep = declare_dependency(include_directories: inc_np) |
| 26 |
includes = include_directories('skfmm') |
| 27 |
|
| 28 |
srcs = [ |
| 29 |
'skfmm/fmm.cpp', |
| 30 |
'skfmm/heap.cpp', |
| 31 |
'skfmm/base_marcher.cpp', |
| 32 |
'skfmm/distance_marcher.cpp', |
| 33 |
'skfmm/travel_time_marcher.cpp', |
| 34 |
'skfmm/extension_velocity_marcher.cpp', |
| 35 |
] |
| 36 |
|
| 37 |
py.install_sources( |
| 38 |
['skfmm/__init__.py', |
| 39 |
'skfmm/pfmm.py', |
| 40 |
'skfmm/heap.py'], |
| 41 |
subdir: 'skfmm', |
| 42 |
pure: false, |
| 43 |
) |
| 44 |
|
| 45 |
py.extension_module( |
| 46 |
'cfmm', |
| 47 |
srcs, |
| 48 |
install: true, |
| 49 |
subdir: 'skfmm', |
| 50 |
include_directories: [includes, inc_np], |
| 51 |
dependencies: [np_dep], |
| 52 |
) |
| 53 |
|
| 54 |
|
| 55 |
py.extension_module( |
| 56 |
'pheap', |
| 57 |
['skfmm/pheap.cpp', |
| 58 |
'skfmm/heap.cpp'], |
| 59 |
install: true, |
| 60 |
subdir: 'skfmm', |
| 61 |
include_directories: includes, |
| 62 |
) |