From 6e46393b6103af3eb41acb201bf68625a1757251 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 6 Oct 2023 04:14:18 -0400 Subject: [PATCH] Bump required C++ standard to c++17 According to SciPy's Toolchain Roadmap [1], C++17 core features became available in 2022. This was concluded based on minimum compiler versions in `manylinux2014` images, AIX systems, FreeBSD systems, and Windows. Note, some standard library features are not universally supported. This commit does not move much code to C++17, just a couple of minor improvements that I could easily change. [1] https://docs.scipy.org/doc/scipy/dev/toolchain.html#c-language-standards --- .../next_api_changes/development/27012-ES.rst | 7 +++ doc/devel/dependencies.rst | 14 ++--- meson.build | 2 +- src/_image_wrapper.cpp | 51 +++++++++---------- 4 files changed, 40 insertions(+), 34 deletions(-) create mode 100644 doc/api/next_api_changes/development/27012-ES.rst diff --git a/doc/api/next_api_changes/development/27012-ES.rst b/doc/api/next_api_changes/development/27012-ES.rst new file mode 100644 index 000000000000..1bec3e7d91df --- /dev/null +++ b/doc/api/next_api_changes/development/27012-ES.rst @@ -0,0 +1,7 @@ +Extensions require C++17 +~~~~~~~~~~~~~~~~~~~~~~~~ + +Matplotlib now requires a compiler that supports C++17 in order to build its extensions. +According to `SciPy's analysis +`_, this +should be available on all supported platforms. diff --git a/doc/devel/dependencies.rst b/doc/devel/dependencies.rst index 77df6e494d50..0ffdaf65696a 100644 --- a/doc/devel/dependencies.rst +++ b/doc/devel/dependencies.rst @@ -233,7 +233,7 @@ in your target environment manually: C++ compiler ------------ -Matplotlib requires a C++ compiler that supports C++11, and each platform has a +Matplotlib requires a C++ compiler that supports C++17, and each platform has a development environment that must be installed before a compiler can be installed. .. tab-set:: @@ -277,18 +277,18 @@ Xcode, VS Code or Linux package manager. Choose **one** compiler from this list: - platforms - notes * - GCC - - **4.8.1** + - **7.2** - Linux, macOS, Windows - - `gcc 4.8.1 `_, + - `gcc 7.2 `_, `GCC: Binaries `_, * - Clang (LLVM) - - **3.3** + - **5** - Linux, macOS - - `clang 3.3 `_, `LLVM `_ + - `clang 5 `_, `LLVM `_ * - MSVC++ - - **14.0** + - **16.0** - Windows - - `Visual Studio 2015 C++ `_ + - `Visual Studio 2019 C++ `_ diff --git a/meson.build b/meson.build index 1ba673948a1e..41f080b3700e 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,7 @@ project( meson_version: '>=1.1.0', default_options: [ 'b_lto=true', - 'cpp_std=c++11', + 'cpp_std=c++17', 'auto_features=disabled', # Force FreeType to avoid extra dependencies. ], ) diff --git a/src/_image_wrapper.cpp b/src/_image_wrapper.cpp index 179f8d1301f7..b18e93a50fb3 100644 --- a/src/_image_wrapper.cpp +++ b/src/_image_wrapper.cpp @@ -10,41 +10,40 @@ * */ const char* image_resample__doc__ = -"Resample input_array, blending it in-place into output_array, using an\n" -"affine transformation.\n\n" +R"""(Resample input_array, blending it in-place into output_array, using an affine transform. -"Parameters\n" -"----------\n" -"input_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8`\n" -" If 2-d, the image is grayscale. If 3-d, the image must be of size\n" -" 4 in the last dimension and represents RGBA data.\n\n" +Parameters +---------- +input_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8` + If 2-d, the image is grayscale. If 3-d, the image must be of size 4 in the last + dimension and represents RGBA data. -"output_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8`\n" -" The dtype and number of dimensions must match `input_array`.\n\n" +output_array : 2-d or 3-d NumPy array of float, double or `numpy.uint8` + The dtype and number of dimensions must match `input_array`. -"transform : matplotlib.transforms.Transform instance\n" -" The transformation from the input array to the output array.\n\n" +transform : matplotlib.transforms.Transform instance + The transformation from the input array to the output array. -"interpolation : int, default: NEAREST\n" -" The interpolation method. Must be one of the following constants\n" -" defined in this module:\n\n" +interpolation : int, default: NEAREST + The interpolation method. Must be one of the following constants defined in this + module: -" NEAREST, BILINEAR, BICUBIC, SPLINE16, SPLINE36,\n" -" HANNING, HAMMING, HERMITE, KAISER, QUADRIC, CATROM, GAUSSIAN,\n" -" BESSEL, MITCHELL, SINC, LANCZOS, BLACKMAN\n\n" + NEAREST, BILINEAR, BICUBIC, SPLINE16, SPLINE36, HANNING, HAMMING, HERMITE, KAISER, + QUADRIC, CATROM, GAUSSIAN, BESSEL, MITCHELL, SINC, LANCZOS, BLACKMAN -"resample : bool, optional\n" -" When `True`, use a full resampling method. When `False`, only\n" -" resample when the output image is larger than the input image.\n\n" +resample : bool, optional + When `True`, use a full resampling method. When `False`, only resample when the + output image is larger than the input image. -"alpha : float, default: 1\n" -" The transparency level, from 0 (transparent) to 1 (opaque).\n\n" +alpha : float, default: 1 + The transparency level, from 0 (transparent) to 1 (opaque). -"norm : bool, default: False\n" -" Whether to norm the interpolation function.\n\n" +norm : bool, default: False + Whether to norm the interpolation function. -"radius: float, default: 1\n" -" The radius of the kernel, if method is SINC, LANCZOS or BLACKMAN.\n"; +radius: float, default: 1 + The radius of the kernel, if method is SINC, LANCZOS or BLACKMAN. +)"""; static pybind11::array_t