Skip to content

Commit 0e7eeef

Browse files
committed
Let Meson find NumPy headers for us
See https://mesonbuild.com/Dependencies.html#numpy.
1 parent e545bcd commit 0e7eeef

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

meson.build

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ project(
1919
'pymmcore',
2020
'cpp',
2121
version: '11.9.0.73.0.dev0',
22-
meson_version: '>=1.3.0',
22+
meson_version: '>=1.4.0',
2323
default_options: [
2424
'cpp_std=c++14',
2525
'warning_level=3',
@@ -52,14 +52,7 @@ python = import('python').find_installation(pure: false)
5252

5353
threads_dep = dependency('threads')
5454

55-
numpy_abs_incdir = run_command(
56-
python, '-c', 'import numpy; print(numpy.get_include())',
57-
check: true,
58-
).stdout().strip()
59-
# The "correct" way would be to "detect" NumPy as a dependency. Since we are
60-
# cutting corners, we need to use a relative path as if the NumPy headers are
61-
# part of this project.
62-
numpy_incdirs = include_directories(fs.relative_to(numpy_abs_incdir, '.'))
55+
numpy_dep = dependency('numpy')
6356

6457
swig = find_program('swig', native: true)
6558

src/pymmcore/meson.build

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,9 @@ python.extension_module(
5959
swig_gen_cpp_sources,
6060
dependencies: [
6161
mmcore_dep,
62+
numpy_dep,
6263
threads_dep,
6364
],
64-
include_directories: [
65-
numpy_incdirs,
66-
],
6765
install: true,
6866
subdir: 'pymmcore',
6967
)

0 commit comments

Comments
 (0)