File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# NumPy include directory
2- np_dep = dependency (' numpy' )
3- numpy_nodepr_api = [' -DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION' ]
2+ numpy_nodepr_api = [' -DNPY_NO_DEPRECATED_API=NPY_1_22_API_VERSION' ]
3+ np_dep = dependency (' numpy' , required : false )
4+ if not np_dep.found()
5+ # For cross-compilation it is often not possible to run the Python interpreter
6+ # in order to retrieve numpy's include directory. It can be specified in the
7+ # cross file instead:
8+ # [properties]
9+ # numpy-include-dir = /abspath/to/host-pythons/site-packages/numpy/core/include
10+ #
11+ # This uses the path as is, and avoids running the interpreter.
12+ incdir_numpy = meson .get_external_property(' numpy-include-dir' , ' not-given' )
13+ if incdir_numpy == ' not-given'
14+ incdir_numpy = run_command (py,
15+ [
16+ ' -c' ,
17+ ''' import os
18+ import numpy as np
19+ try:
20+ incdir = os.path.relpath(np.get_include())
21+ except Exception:
22+ incdir = np.get_include()
23+ print(incdir)
24+ '''
25+ ],
26+ check : true
27+ ).stdout().strip()
28+ endif
29+ inc_np = include_directories (incdir_numpy)
30+ np_dep = declare_dependency (include_directories : inc_np)
31+ endif
432
533# Deal with M_PI & friends; add `use_math_defines` to c_args or cpp_args
634# Cython doesn't always get this right itself (see, e.g., gh-16800), so
You can’t perform that action at this time.
0 commit comments