From 9a3eff67adfc0258888535f52d7ff9825cd8b8b3 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Thu, 1 Jun 2023 18:04:06 +0200 Subject: [PATCH] cmake API documentation improvements --- docs/api_cmake.rst | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/docs/api_cmake.rst b/docs/api_cmake.rst index 4e57ec36..359908b6 100644 --- a/docs/api_cmake.rst +++ b/docs/api_cmake.rst @@ -33,7 +33,7 @@ The high-level interface consists of just one CMake command: nanobind_build_library( my_ext # Target name - NB_STATIC STABLE_API LTO # Optional flags (see below) + NB_STATIC STABLE_ABI LTO # Optional flags (see below) my_ext.h # Source code files below my_ext.cpp) @@ -45,14 +45,16 @@ The high-level interface consists of just one CMake command: - Perform a `stable ABI `_ build, making it possible to use a compiled extension across Python minor versions. - Only Python >= 3.12 is supported. The flag is ignored on older - Python versions. - * - ``NB_SHARED`` - - Compile the core nanobind library as a shared library (the default). + The flag is ignored on Python versions older than < 3.12. * - ``NB_STATIC`` - Compile the core nanobind library as a static library. This - simplifies redistribution but unnecessarily increases the binary - storage footprint when a project contains many Python extensions. + simplifies redistribution but can increase the combined binary + storage footprint when a project contains many Python extensions + (this is the default). + * - ``NB_SHARED`` + - The opposite of ``NB_STATIC``: compile the core nanobind library + as a shared library for use in projects that consist of multiple + extensions. * - ``PROTECT_STACK`` - Don't remove stack smashing-related protections. * - ``LTO`` @@ -219,7 +221,7 @@ is equivalent to nanobind_link_options(my_ext) # Statically link against libstdc++/libgcc when targeting musllinux - nanobind_musl_static_libcpp(${name}) + nanobind_musl_static_libcpp(my_ext) The various commands are described below: @@ -234,7 +236,7 @@ The various commands are described below: :widths: 10 50 * - ``-static`` - - Perform a static library build (shared is the default). + - Perform a static library build (without this suffix, a shared build is used) * - ``-abi3`` - Perform a stable ABI build targeting Python v3.12+. @@ -278,16 +280,6 @@ The various commands are described below: nanobind_strip(my_target) -.. cmake:command:: nanobind_strip - - This function strips unused and debug symbols in ``Release`` and - ``MinSizeRel`` builds on Linux and macOS. It expects a single target as - argument, as in - - .. code-block:: cmake - - nanobind_strip(my_target) - .. cmake:command:: nanobind_disable_stack_protector The stack protector affects the binary size of bindings negatively (+8% @@ -344,3 +336,10 @@ The various commands are described below: ``-static-libgcc`` to ``gcc`` when the environment variable ``AUDITWHEEL_PLAT`` contains the string ``musllinux``, which indicates a cibuildwheel build targeting that platform. + + The function expects a single target as argument, as in + + .. code-block:: cmake + + nanobind_musl_static_libcpp(my_target) +