1- # NumPy include directory - needed in all submodules
2- # The try-except is needed because when things are split across drives on Windows, there
3- # is no relative path and an exception gets raised. There may be other such cases, so add
4- # a catch-all and switch to an absolute path. Relative paths are needed when for example
5- # a virtualenv is placed inside the source tree; Meson rejects absolute paths to places
6- # inside the source tree.
7- # For cross-compilation it is often not possible to run the Python interpreter in order
8- # to retrieve numpy's include directory. It can be specified in the cross file instead:
9- #
10- # [properties]
11- # numpy-include-dir = /abspath/to/host-pythons/site-packages/numpy/core/include
12- #
13- # This uses the path as is, and avoids running the interpreter.
14- incdir_numpy = meson .get_external_property(' numpy-include-dir' , ' not-given' )
15- if incdir_numpy == ' not-given'
16- incdir_numpy = run_command (py3,
17- [
18- ' -c' ,
19- ''' import os
20- import numpy as np
21- try:
22- incdir = os.path.relpath(np.get_include())
23- except Exception:
24- incdir = np.get_include()
25- print(incdir)'''
26- ],
27- check : true
28- ).stdout().strip()
29- endif
30- numpy_dep = declare_dependency (
31- compile_args : [
32- ' -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' ,
33- # Allow NumPy's printf format specifiers in C++.
34- ' -D__STDC_FORMAT_MACROS=1' ,
35- ],
36- include_directories : include_directories (incdir_numpy),
37- dependencies : py3_dep,
38- )
39-
401# For cross-compilation it is often not possible to run the Python interpreter in order
412# to retrieve the platform-specific /dev/null. It can be specified in the cross file
423# instead:
@@ -76,7 +37,7 @@ extension_data = {
7637 ' _backend_agg.cpp' ,
7738 ' _backend_agg_wrapper.cpp' ,
7839 ),
79- ' dependencies' : [agg_dep, numpy_dep, freetype_dep, pybind11_dep],
40+ ' dependencies' : [agg_dep, freetype_dep, pybind11_dep],
8041 },
8142 ' _c_internal_utils' : {
8243 ' subdir' : ' matplotlib' ,
@@ -92,7 +53,7 @@ extension_data = {
9253 ' ft2font_wrapper.cpp' ,
9354 ),
9455 ' dependencies' : [
95- freetype_dep, pybind11_dep, numpy_dep, agg_dep.partial_dependency(includes : true ),
56+ freetype_dep, pybind11_dep, agg_dep.partial_dependency(includes : true ),
9657 ],
9758 ' cpp_args' : [
9859 ' -DFREETYPE_BUILD_TYPE="@0@"' .format(
@@ -117,7 +78,7 @@ extension_data = {
11778 ' sources' : files (
11879 ' _path_wrapper.cpp' ,
11980 ),
120- ' dependencies' : [numpy_dep, agg_dep, pybind11_dep],
81+ ' dependencies' : [agg_dep, pybind11_dep],
12182 },
12283 ' _qhull' : {
12384 ' subdir' : ' matplotlib' ,
@@ -157,16 +118,7 @@ extension_data = {
157118}
158119
159120foreach ext, kwargs : extension_data
160- # Ensure that PY_ARRAY_UNIQUE_SYMBOL is uniquely defined for each extension.
161- unique_array_api = ' -DPY_ARRAY_UNIQUE_SYMBOL=MPL_@0@_ARRAY_API' .format(ext.replace(' .' , ' _' ))
162- additions = {
163- ' c_args' : [unique_array_api] + kwargs.get(' c_args' , []),
164- ' cpp_args' : [unique_array_api] + kwargs.get(' cpp_args' , []),
165- }
166- py3.extension_module(
167- ext,
168- install : true ,
169- kwargs : kwargs + additions)
121+ py3.extension_module(ext, install : true , kwargs : kwargs)
170122endforeach
171123
172124if get_option (' macosx' ) and host_machine .system() == ' darwin'
0 commit comments