summaryrefslogtreecommitdiff
path: root/Modules/FindPython3.cmake
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-11-18 16:24:17 +0100
committerMarc Chevrier <marc.chevrier@gmail.com>2022-11-29 16:48:08 +0100
commit77d734aede807a038ab10520620cfbb24e84e76e (patch)
treebc20ce786a249862842c82484393d61edef2b0ca /Modules/FindPython3.cmake
parentf72c405d4ee4ad4775a10a944774b91f49726dad (diff)
downloadcmake-77d734aede807a038ab10520620cfbb24e84e76e.tar.gz
FindPython: add support for Stable ABI
Fixes: #24141
Diffstat (limited to 'Modules/FindPython3.cmake')
-rw-r--r--Modules/FindPython3.cmake66
1 files changed, 64 insertions, 2 deletions
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 837300e26d..ae086e8546 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -31,6 +31,13 @@ The following components are supported:
* ``Development.Embed``: search for artifacts for Python 3 embedding
developments.
+ .. versionadded:: 3.26
+
+ * ``Development.SABIModule``: search for artifacts for Python 3 module
+ developments using the
+ `Stable Application Binary Interface <https://docs.python.org/3/c-api/stable.html>`_.
+ This component is available only for version ``3.2`` and upper.
+
* ``NumPy``: search for NumPy include directories.
.. versionadded:: 3.14
@@ -81,6 +88,12 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`:
Python 3 library for Python module. Target defined if component
``Development.Module`` is found.
+``Python3::SABIModule``
+ .. versionadded:: 3.26
+
+ Python 3 library for Python module using the Stable Application Binary
+ Interface. Target defined if component ``Development.SABIModule`` is found.
+
``Python3::Python``
Python 3 library for Python embedding. Target defined if component
``Development.Embed`` is found.
@@ -146,6 +159,16 @@ This module will set the following variables in your project
not available, ``sysconfig.get_config_var('EXT_SUFFIX')`` or
``sysconfig.get_config_var('SOABI')`` are used.
+``Python3_SOSABI``
+ .. versionadded:: 3.26
+
+ Extension suffix for modules using the Stable Application Binary Interface.
+
+ Information computed from ``importlib.machinery.EXTENSION_SUFFIXES`` if the
+ COMPONENT ``Interpreter`` was specified. Otherwise, the extension is ``abi3``
+ except for ``Windows``, ``MSYS`` and ``CYGWIN`` for which this is an empty
+ string.
+
``Python3_Compiler_FOUND``
System has the Python 3 compiler.
``Python3_COMPILER``
@@ -168,6 +191,12 @@ This module will set the following variables in your project
System has the Python 3 development artifacts for Python module.
+``Python3_Development.SABIModule_FOUND``
+ .. versionadded:: 3.26
+
+ System has the Python 3 development artifacts for Python module using the
+ Stable Application Binary Interface.
+
``Python3_Development.Embed_FOUND``
.. versionadded:: 3.18
@@ -189,6 +218,18 @@ This module will set the following variables in your project
The Python 3 library directories.
``Python3_RUNTIME_LIBRARY_DIRS``
The Python 3 runtime library directories.
+``Python3_SABI_LIBRARIES``
+ .. versionadded:: 3.26
+
+ The Python 3 libraries for the Stable Application Binary Interface.
+``Python3_SABI_LIBRARY_DIRS``
+ .. versionadded:: 3.26
+
+ The Python 3 ``SABI`` library directories.
+``Python3_RUNTIME_SABI_LIBRARY_DIRS``
+ .. versionadded:: 3.26
+
+ The Python 3 runtime ``SABI`` library directories.
``Python3_VERSION``
Python 3 version.
``Python3_VERSION_MAJOR``
@@ -423,6 +464,13 @@ setting the following variables:
variables ``Python3_LIBRARIES``, ``Python3_LIBRARY_DIRS`` and
``Python3_RUNTIME_LIBRARY_DIRS``.
+``Python3_SABI_LIBRARY``
+ .. versionadded:: 3.26
+
+ The path to the library for Stable Application Binary Interface. It will be
+ used to compute the variables ``Python3_SABI_LIBRARIES``,
+ ``Python3_SABI_LIBRARY_DIRS`` and ``Python3_RUNTIME_SABI_LIBRARY_DIRS``.
+
``Python3_INCLUDE_DIR``
The path to the directory of the ``Python`` headers. It will be used to
compute the variable ``Python3_INCLUDE_DIRS``.
@@ -468,10 +516,11 @@ Commands
This module defines the command ``Python3_add_library`` (when
:prop_gbl:`CMAKE_ROLE` is ``PROJECT``), which has the same semantics as
:command:`add_library` and adds a dependency to target ``Python3::Python`` or,
-when library type is ``MODULE``, to target ``Python3::Module`` and takes care
+when library type is ``MODULE``, to target ``Python3::Module`` or
+``Python3::SABIModule`` (when ``USE_SABI`` option is specified) and takes care
of Python module naming rules::
- Python3_add_library (<name> [STATIC | SHARED | MODULE [WITH_SOABI]]
+ Python3_add_library (<name> [STATIC | SHARED | MODULE [USE_SABI <version>] [WITH_SOABI]]
<source1> [<source2> ...])
If the library type is not specified, ``MODULE`` is assumed.
@@ -479,6 +528,19 @@ If the library type is not specified, ``MODULE`` is assumed.
.. versionadded:: 3.17
For ``MODULE`` library type, if option ``WITH_SOABI`` is specified, the
module suffix will include the ``Python3_SOABI`` value, if any.
+
+.. versionadded:: 3.26
+ For ``MODULE`` type, if the option ``USE_SABI`` is specified, the
+ preprocessor definition ``Py_LIMITED_API`` will be specified, as ``PRIVATE``,
+ for the target ``<name>`` with the value computed from ``<version>`` argument.
+ The expected format for ``<version>`` is ``major[.minor]``, where each
+ component is a numeric value. If ``minor`` component is specified, the
+ version should be, at least, ``3.2`` which is the version where the
+ `Stable Application Binary Interface <https://docs.python.org/3/c-api/stable.html>`_
+ was introduced. Specifying only major version ``3`` is equivalent to ``3.2``.
+
+ When option ``WITH_SOABI`` is also specified, the module suffix will include
+ the ``Python3_SOSABI`` value, if any.
#]=======================================================================]