1.. _compiling: 2 3Build systems 4############# 5 6.. _build-setuptools: 7 8Building with setuptools 9======================== 10 11For projects on PyPI, building with setuptools is the way to go. Sylvain Corlay 12has kindly provided an example project which shows how to set up everything, 13including automatic generation of documentation using Sphinx. Please refer to 14the [python_example]_ repository. 15 16.. [python_example] https://github.com/pybind/python_example 17 18A helper file is provided with pybind11 that can simplify usage with setuptools. 19 20To use pybind11 inside your ``setup.py``, you have to have some system to 21ensure that ``pybind11`` is installed when you build your package. There are 22four possible ways to do this, and pybind11 supports all four: You can ask all 23users to install pybind11 beforehand (bad), you can use 24:ref:`setup_helpers-pep518` (good, but very new and requires Pip 10), 25:ref:`setup_helpers-setup_requires` (discouraged by Python packagers now that 26PEP 518 is available, but it still works everywhere), or you can 27:ref:`setup_helpers-copy-manually` (always works but you have to manually sync 28your copy to get updates). 29 30An example of a ``setup.py`` using pybind11's helpers: 31 32.. code-block:: python 33 34 from glob import glob 35 from setuptools import setup 36 from pybind11.setup_helpers import Pybind11Extension 37 38 ext_modules = [ 39 Pybind11Extension( 40 "python_example", 41 sorted(glob("src/*.cpp")), # Sort source files for reproducibility 42 ), 43 ] 44 45 setup( 46 ..., 47 ext_modules=ext_modules 48 ) 49 50If you want to do an automatic search for the highest supported C++ standard, 51that is supported via a ``build_ext`` command override; it will only affect 52``Pybind11Extensions``: 53 54.. code-block:: python 55 56 from glob import glob 57 from setuptools import setup 58 from pybind11.setup_helpers import Pybind11Extension, build_ext 59 60 ext_modules = [ 61 Pybind11Extension( 62 "python_example", 63 sorted(glob("src/*.cpp")), 64 ), 65 ] 66 67 setup( 68 ..., 69 cmdclass={"build_ext": build_ext}, 70 ext_modules=ext_modules 71 ) 72 73If you have single-file extension modules that are directly stored in the 74Python source tree (``foo.cpp`` in the same directory as where a ``foo.py`` 75would be located), you can also generate ``Pybind11Extensions`` using 76``setup_helpers.intree_extensions``: ``intree_extensions(["path/to/foo.cpp", 77...])`` returns a list of ``Pybind11Extensions`` which can be passed to 78``ext_modules``, possibly after further customizing their attributes 79(``libraries``, ``include_dirs``, etc.). By doing so, a ``foo.*.so`` extension 80module will be generated and made available upon installation. 81 82``intree_extension`` will automatically detect if you are using a ``src``-style 83layout (as long as no namespace packages are involved), but you can also 84explicitly pass ``package_dir`` to it (as in ``setuptools.setup``). 85 86Since pybind11 does not require NumPy when building, a light-weight replacement 87for NumPy's parallel compilation distutils tool is included. Use it like this: 88 89.. code-block:: python 90 91 from pybind11.setup_helpers import ParallelCompile 92 93 # Optional multithreaded build 94 ParallelCompile("NPY_NUM_BUILD_JOBS").install() 95 96 setup(...) 97 98The argument is the name of an environment variable to control the number of 99threads, such as ``NPY_NUM_BUILD_JOBS`` (as used by NumPy), though you can set 100something different if you want; ``CMAKE_BUILD_PARALLEL_LEVEL`` is another choice 101a user might expect. You can also pass ``default=N`` to set the default number 102of threads (0 will take the number of threads available) and ``max=N``, the 103maximum number of threads; if you have a large extension you may want set this 104to a memory dependent number. 105 106If you are developing rapidly and have a lot of C++ files, you may want to 107avoid rebuilding files that have not changed. For simple cases were you are 108using ``pip install -e .`` and do not have local headers, you can skip the 109rebuild if an object file is newer than its source (headers are not checked!) 110with the following: 111 112.. code-block:: python 113 114 from pybind11.setup_helpers import ParallelCompile, naive_recompile 115 116 SmartCompile("NPY_NUM_BUILD_JOBS", needs_recompile=naive_recompile).install() 117 118 119If you have a more complex build, you can implement a smarter function and pass 120it to ``needs_recompile``, or you can use [Ccache]_ instead. ``CXX="cache g++" 121pip install -e .`` would be the way to use it with GCC, for example. Unlike the 122simple solution, this even works even when not compiling in editable mode, but 123it does require Ccache to be installed. 124 125Keep in mind that Pip will not even attempt to rebuild if it thinks it has 126already built a copy of your code, which it deduces from the version number. 127One way to avoid this is to use [setuptools_scm]_, which will generate a 128version number that includes the number of commits since your last tag and a 129hash for a dirty directory. Another way to force a rebuild is purge your cache 130or use Pip's ``--no-cache-dir`` option. 131 132.. [Ccache] https://ccache.dev 133 134.. [setuptools_scm] https://github.com/pypa/setuptools_scm 135 136.. _setup_helpers-pep518: 137 138PEP 518 requirements (Pip 10+ required) 139--------------------------------------- 140 141If you use `PEP 518's <https://www.python.org/dev/peps/pep-0518/>`_ 142``pyproject.toml`` file, you can ensure that ``pybind11`` is available during 143the compilation of your project. When this file exists, Pip will make a new 144virtual environment, download just the packages listed here in ``requires=``, 145and build a wheel (binary Python package). It will then throw away the 146environment, and install your wheel. 147 148Your ``pyproject.toml`` file will likely look something like this: 149 150.. code-block:: toml 151 152 [build-system] 153 requires = ["setuptools>=42", "wheel", "pybind11~=2.6.1"] 154 build-backend = "setuptools.build_meta" 155 156.. note:: 157 158 The main drawback to this method is that a `PEP 517`_ compliant build tool, 159 such as Pip 10+, is required for this approach to work; older versions of 160 Pip completely ignore this file. If you distribute binaries (called wheels 161 in Python) using something like `cibuildwheel`_, remember that ``setup.py`` 162 and ``pyproject.toml`` are not even contained in the wheel, so this high 163 Pip requirement is only for source builds, and will not affect users of 164 your binary wheels. If you are building SDists and wheels, then 165 `pypa-build`_ is the recommended official tool. 166 167.. _PEP 517: https://www.python.org/dev/peps/pep-0517/ 168.. _cibuildwheel: https://cibuildwheel.readthedocs.io 169.. _pypa-build: https://pypa-build.readthedocs.io/en/latest/ 170 171.. _setup_helpers-setup_requires: 172 173Classic ``setup_requires`` 174-------------------------- 175 176If you want to support old versions of Pip with the classic 177``setup_requires=["pybind11"]`` keyword argument to setup, which triggers a 178two-phase ``setup.py`` run, then you will need to use something like this to 179ensure the first pass works (which has not yet installed the ``setup_requires`` 180packages, since it can't install something it does not know about): 181 182.. code-block:: python 183 184 try: 185 from pybind11.setup_helpers import Pybind11Extension 186 except ImportError: 187 from setuptools import Extension as Pybind11Extension 188 189 190It doesn't matter that the Extension class is not the enhanced subclass for the 191first pass run; and the second pass will have the ``setup_requires`` 192requirements. 193 194This is obviously more of a hack than the PEP 518 method, but it supports 195ancient versions of Pip. 196 197.. _setup_helpers-copy-manually: 198 199Copy manually 200------------- 201 202You can also copy ``setup_helpers.py`` directly to your project; it was 203designed to be usable standalone, like the old example ``setup.py``. You can 204set ``include_pybind11=False`` to skip including the pybind11 package headers, 205so you can use it with git submodules and a specific git version. If you use 206this, you will need to import from a local file in ``setup.py`` and ensure the 207helper file is part of your MANIFEST. 208 209 210Closely related, if you include pybind11 as a subproject, you can run the 211``setup_helpers.py`` inplace. If loaded correctly, this should even pick up 212the correct include for pybind11, though you can turn it off as shown above if 213you want to input it manually. 214 215Suggested usage if you have pybind11 as a submodule in ``extern/pybind11``: 216 217.. code-block:: python 218 219 DIR = os.path.abspath(os.path.dirname(__file__)) 220 221 sys.path.append(os.path.join(DIR, "extern", "pybind11")) 222 from pybind11.setup_helpers import Pybind11Extension # noqa: E402 223 224 del sys.path[-1] 225 226 227.. versionchanged:: 2.6 228 229 Added ``setup_helpers`` file. 230 231Building with cppimport 232======================== 233 234[cppimport]_ is a small Python import hook that determines whether there is a C++ 235source file whose name matches the requested module. If there is, the file is 236compiled as a Python extension using pybind11 and placed in the same folder as 237the C++ source file. Python is then able to find the module and load it. 238 239.. [cppimport] https://github.com/tbenthompson/cppimport 240 241.. _cmake: 242 243Building with CMake 244=================== 245 246For C++ codebases that have an existing CMake-based build system, a Python 247extension module can be created with just a few lines of code: 248 249.. code-block:: cmake 250 251 cmake_minimum_required(VERSION 3.4...3.18) 252 project(example LANGUAGES CXX) 253 254 add_subdirectory(pybind11) 255 pybind11_add_module(example example.cpp) 256 257This assumes that the pybind11 repository is located in a subdirectory named 258:file:`pybind11` and that the code is located in a file named :file:`example.cpp`. 259The CMake command ``add_subdirectory`` will import the pybind11 project which 260provides the ``pybind11_add_module`` function. It will take care of all the 261details needed to build a Python extension module on any platform. 262 263A working sample project, including a way to invoke CMake from :file:`setup.py` for 264PyPI integration, can be found in the [cmake_example]_ repository. 265 266.. [cmake_example] https://github.com/pybind/cmake_example 267 268.. versionchanged:: 2.6 269 CMake 3.4+ is required. 270 271Further information can be found at :doc:`cmake/index`. 272 273pybind11_add_module 274------------------- 275 276To ease the creation of Python extension modules, pybind11 provides a CMake 277function with the following signature: 278 279.. code-block:: cmake 280 281 pybind11_add_module(<name> [MODULE | SHARED] [EXCLUDE_FROM_ALL] 282 [NO_EXTRAS] [THIN_LTO] [OPT_SIZE] source1 [source2 ...]) 283 284This function behaves very much like CMake's builtin ``add_library`` (in fact, 285it's a wrapper function around that command). It will add a library target 286called ``<name>`` to be built from the listed source files. In addition, it 287will take care of all the Python-specific compiler and linker flags as well 288as the OS- and Python-version-specific file extension. The produced target 289``<name>`` can be further manipulated with regular CMake commands. 290 291``MODULE`` or ``SHARED`` may be given to specify the type of library. If no 292type is given, ``MODULE`` is used by default which ensures the creation of a 293Python-exclusive module. Specifying ``SHARED`` will create a more traditional 294dynamic library which can also be linked from elsewhere. ``EXCLUDE_FROM_ALL`` 295removes this target from the default build (see CMake docs for details). 296 297Since pybind11 is a template library, ``pybind11_add_module`` adds compiler 298flags to ensure high quality code generation without bloat arising from long 299symbol names and duplication of code in different translation units. It 300sets default visibility to *hidden*, which is required for some pybind11 301features and functionality when attempting to load multiple pybind11 modules 302compiled under different pybind11 versions. It also adds additional flags 303enabling LTO (Link Time Optimization) and strip unneeded symbols. See the 304:ref:`FAQ entry <faq:symhidden>` for a more detailed explanation. These 305latter optimizations are never applied in ``Debug`` mode. If ``NO_EXTRAS`` is 306given, they will always be disabled, even in ``Release`` mode. However, this 307will result in code bloat and is generally not recommended. 308 309As stated above, LTO is enabled by default. Some newer compilers also support 310different flavors of LTO such as `ThinLTO`_. Setting ``THIN_LTO`` will cause 311the function to prefer this flavor if available. The function falls back to 312regular LTO if ``-flto=thin`` is not available. If 313``CMAKE_INTERPROCEDURAL_OPTIMIZATION`` is set (either ``ON`` or ``OFF``), then 314that will be respected instead of the built-in flag search. 315 316.. note:: 317 318 If you want to set the property form on targets or the 319 ``CMAKE_INTERPROCEDURAL_OPTIMIZATION_<CONFIG>`` versions of this, you should 320 still use ``set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)`` (otherwise a 321 no-op) to disable pybind11's ipo flags. 322 323The ``OPT_SIZE`` flag enables size-based optimization equivalent to the 324standard ``/Os`` or ``-Os`` compiler flags and the ``MinSizeRel`` build type, 325which avoid optimizations that that can substantially increase the size of the 326resulting binary. This flag is particularly useful in projects that are split 327into performance-critical parts and associated bindings. In this case, we can 328compile the project in release mode (and hence, optimize performance globally), 329and specify ``OPT_SIZE`` for the binding target, where size might be the main 330concern as performance is often less critical here. A ~25% size reduction has 331been observed in practice. This flag only changes the optimization behavior at 332a per-target level and takes precedence over the global CMake build type 333(``Release``, ``RelWithDebInfo``) except for ``Debug`` builds, where 334optimizations remain disabled. 335 336.. _ThinLTO: http://clang.llvm.org/docs/ThinLTO.html 337 338Configuration variables 339----------------------- 340 341By default, pybind11 will compile modules with the compiler default or the 342minimum standard required by pybind11, whichever is higher. You can set the 343standard explicitly with 344`CMAKE_CXX_STANDARD <https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_STANDARD.html>`_: 345 346.. code-block:: cmake 347 348 set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ version selection") # or 11, 14, 17, 20 349 set(CMAKE_CXX_STANDARD_REQUIRED ON) # optional, ensure standard is supported 350 set(CMAKE_CXX_EXTENSIONS OFF) # optional, keep compiler extensionsn off 351 352The variables can also be set when calling CMake from the command line using 353the ``-D<variable>=<value>`` flag. You can also manually set ``CXX_STANDARD`` 354on a target or use ``target_compile_features`` on your targets - anything that 355CMake supports. 356 357Classic Python support: The target Python version can be selected by setting 358``PYBIND11_PYTHON_VERSION`` or an exact Python installation can be specified 359with ``PYTHON_EXECUTABLE``. For example: 360 361.. code-block:: bash 362 363 cmake -DPYBIND11_PYTHON_VERSION=3.6 .. 364 365 # Another method: 366 cmake -DPYTHON_EXECUTABLE=/path/to/python .. 367 368 # This often is a good way to get the current Python, works in environments: 369 cmake -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") .. 370 371 372find_package vs. add_subdirectory 373--------------------------------- 374 375For CMake-based projects that don't include the pybind11 repository internally, 376an external installation can be detected through ``find_package(pybind11)``. 377See the `Config file`_ docstring for details of relevant CMake variables. 378 379.. code-block:: cmake 380 381 cmake_minimum_required(VERSION 3.4...3.18) 382 project(example LANGUAGES CXX) 383 384 find_package(pybind11 REQUIRED) 385 pybind11_add_module(example example.cpp) 386 387Note that ``find_package(pybind11)`` will only work correctly if pybind11 388has been correctly installed on the system, e. g. after downloading or cloning 389the pybind11 repository : 390 391.. code-block:: bash 392 393 # Classic CMake 394 cd pybind11 395 mkdir build 396 cd build 397 cmake .. 398 make install 399 400 # CMake 3.15+ 401 cd pybind11 402 cmake -S . -B build 403 cmake --build build -j 2 # Build on 2 cores 404 cmake --install build 405 406Once detected, the aforementioned ``pybind11_add_module`` can be employed as 407before. The function usage and configuration variables are identical no matter 408if pybind11 is added as a subdirectory or found as an installed package. You 409can refer to the same [cmake_example]_ repository for a full sample project 410-- just swap out ``add_subdirectory`` for ``find_package``. 411 412.. _Config file: https://github.com/pybind/pybind11/blob/master/tools/pybind11Config.cmake.in 413 414 415.. _find-python-mode: 416 417FindPython mode 418--------------- 419 420CMake 3.12+ (3.15+ recommended, 3.18.2+ ideal) added a new module called 421FindPython that had a highly improved search algorithm and modern targets 422and tools. If you use FindPython, pybind11 will detect this and use the 423existing targets instead: 424 425.. code-block:: cmake 426 427 cmake_minimum_required(VERSION 3.15...3.19) 428 project(example LANGUAGES CXX) 429 430 find_package(Python COMPONENTS Interpreter Development REQUIRED) 431 find_package(pybind11 CONFIG REQUIRED) 432 # or add_subdirectory(pybind11) 433 434 pybind11_add_module(example example.cpp) 435 436You can also use the targets (as listed below) with FindPython. If you define 437``PYBIND11_FINDPYTHON``, pybind11 will perform the FindPython step for you 438(mostly useful when building pybind11's own tests, or as a way to change search 439algorithms from the CMake invocation, with ``-DPYBIND11_FINDPYTHON=ON``. 440 441.. warning:: 442 443 If you use FindPython2 and FindPython3 to dual-target Python, use the 444 individual targets listed below, and avoid targets that directly include 445 Python parts. 446 447There are `many ways to hint or force a discovery of a specific Python 448installation <https://cmake.org/cmake/help/latest/module/FindPython.html>`_), 449setting ``Python_ROOT_DIR`` may be the most common one (though with 450virtualenv/venv support, and Conda support, this tends to find the correct 451Python version more often than the old system did). 452 453.. warning:: 454 455 When the Python libraries (i.e. ``libpythonXX.a`` and ``libpythonXX.so`` 456 on Unix) are not available, as is the case on a manylinux image, the 457 ``Development`` component will not be resolved by ``FindPython``. When not 458 using the embedding functionality, CMake 3.18+ allows you to specify 459 ``Development.Module`` instead of ``Development`` to resolve this issue. 460 461.. versionadded:: 2.6 462 463Advanced: interface library targets 464----------------------------------- 465 466Pybind11 supports modern CMake usage patterns with a set of interface targets, 467available in all modes. The targets provided are: 468 469 ``pybind11::headers`` 470 Just the pybind11 headers and minimum compile requirements 471 472 ``pybind11::python2_no_register`` 473 Quiets the warning/error when mixing C++14 or higher and Python 2 474 475 ``pybind11::pybind11`` 476 Python headers + ``pybind11::headers`` + ``pybind11::python2_no_register`` (Python 2 only) 477 478 ``pybind11::python_link_helper`` 479 Just the "linking" part of pybind11:module 480 481 ``pybind11::module`` 482 Everything for extension modules - ``pybind11::pybind11`` + ``Python::Module`` (FindPython CMake 3.15+) or ``pybind11::python_link_helper`` 483 484 ``pybind11::embed`` 485 Everything for embedding the Python interpreter - ``pybind11::pybind11`` + ``Python::Embed`` (FindPython) or Python libs 486 487 ``pybind11::lto`` / ``pybind11::thin_lto`` 488 An alternative to `INTERPROCEDURAL_OPTIMIZATION` for adding link-time optimization. 489 490 ``pybind11::windows_extras`` 491 ``/bigobj`` and ``/mp`` for MSVC. 492 493 ``pybind11::opt_size`` 494 ``/Os`` for MSVC, ``-Os`` for other compilers. Does nothing for debug builds. 495 496Two helper functions are also provided: 497 498 ``pybind11_strip(target)`` 499 Strips a target (uses ``CMAKE_STRIP`` after the target is built) 500 501 ``pybind11_extension(target)`` 502 Sets the correct extension (with SOABI) for a target. 503 504You can use these targets to build complex applications. For example, the 505``add_python_module`` function is identical to: 506 507.. code-block:: cmake 508 509 cmake_minimum_required(VERSION 3.4) 510 project(example LANGUAGES CXX) 511 512 find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11) 513 514 add_library(example MODULE main.cpp) 515 516 target_link_libraries(example PRIVATE pybind11::module pybind11::lto pybind11::windows_extras) 517 518 pybind11_extension(example) 519 pybind11_strip(example) 520 521 set_target_properties(example PROPERTIES CXX_VISIBILITY_PRESET "hidden" 522 CUDA_VISIBILITY_PRESET "hidden") 523 524Instead of setting properties, you can set ``CMAKE_*`` variables to initialize these correctly. 525 526.. warning:: 527 528 Since pybind11 is a metatemplate library, it is crucial that certain 529 compiler flags are provided to ensure high quality code generation. In 530 contrast to the ``pybind11_add_module()`` command, the CMake interface 531 provides a *composable* set of targets to ensure that you retain flexibility. 532 It can be especially important to provide or set these properties; the 533 :ref:`FAQ <faq:symhidden>` contains an explanation on why these are needed. 534 535.. versionadded:: 2.6 536 537.. _nopython-mode: 538 539Advanced: NOPYTHON mode 540----------------------- 541 542If you want complete control, you can set ``PYBIND11_NOPYTHON`` to completely 543disable Python integration (this also happens if you run ``FindPython2`` and 544``FindPython3`` without running ``FindPython``). This gives you complete 545freedom to integrate into an existing system (like `Scikit-Build's 546<https://scikit-build.readthedocs.io>`_ ``PythonExtensions``). 547``pybind11_add_module`` and ``pybind11_extension`` will be unavailable, and the 548targets will be missing any Python specific behavior. 549 550.. versionadded:: 2.6 551 552Embedding the Python interpreter 553-------------------------------- 554 555In addition to extension modules, pybind11 also supports embedding Python into 556a C++ executable or library. In CMake, simply link with the ``pybind11::embed`` 557target. It provides everything needed to get the interpreter running. The Python 558headers and libraries are attached to the target. Unlike ``pybind11::module``, 559there is no need to manually set any additional properties here. For more 560information about usage in C++, see :doc:`/advanced/embedding`. 561 562.. code-block:: cmake 563 564 cmake_minimum_required(VERSION 3.4...3.18) 565 project(example LANGUAGES CXX) 566 567 find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11) 568 569 add_executable(example main.cpp) 570 target_link_libraries(example PRIVATE pybind11::embed) 571 572.. _building_manually: 573 574Building manually 575================= 576 577pybind11 is a header-only library, hence it is not necessary to link against 578any special libraries and there are no intermediate (magic) translation steps. 579 580On Linux, you can compile an example such as the one given in 581:ref:`simple_example` using the following command: 582 583.. code-block:: bash 584 585 $ c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$(python3-config --extension-suffix) 586 587The flags given here assume that you're using Python 3. For Python 2, just 588change the executable appropriately (to ``python`` or ``python2``). 589 590The ``python3 -m pybind11 --includes`` command fetches the include paths for 591both pybind11 and Python headers. This assumes that pybind11 has been installed 592using ``pip`` or ``conda``. If it hasn't, you can also manually specify 593``-I <path-to-pybind11>/include`` together with the Python includes path 594``python3-config --includes``. 595 596Note that Python 2.7 modules don't use a special suffix, so you should simply 597use ``example.so`` instead of ``example$(python3-config --extension-suffix)``. 598Besides, the ``--extension-suffix`` option may or may not be available, depending 599on the distribution; in the latter case, the module extension can be manually 600set to ``.so``. 601 602On macOS: the build command is almost the same but it also requires passing 603the ``-undefined dynamic_lookup`` flag so as to ignore missing symbols when 604building the module: 605 606.. code-block:: bash 607 608 $ c++ -O3 -Wall -shared -std=c++11 -undefined dynamic_lookup $(python3 -m pybind11 --includes) example.cpp -o example$(python3-config --extension-suffix) 609 610In general, it is advisable to include several additional build parameters 611that can considerably reduce the size of the created binary. Refer to section 612:ref:`cmake` for a detailed example of a suitable cross-platform CMake-based 613build system that works on all platforms including Windows. 614 615.. note:: 616 617 On Linux and macOS, it's better to (intentionally) not link against 618 ``libpython``. The symbols will be resolved when the extension library 619 is loaded into a Python binary. This is preferable because you might 620 have several different installations of a given Python version (e.g. the 621 system-provided Python, and one that ships with a piece of commercial 622 software). In this way, the plugin will work with both versions, instead 623 of possibly importing a second Python library into a process that already 624 contains one (which will lead to a segfault). 625 626 627Building with Bazel 628=================== 629 630You can build with the Bazel build system using the `pybind11_bazel 631<https://github.com/pybind/pybind11_bazel>`_ repository. 632 633Generating binding code automatically 634===================================== 635 636The ``Binder`` project is a tool for automatic generation of pybind11 binding 637code by introspecting existing C++ codebases using LLVM/Clang. See the 638[binder]_ documentation for details. 639 640.. [binder] http://cppbinder.readthedocs.io/en/latest/about.html 641 642[AutoWIG]_ is a Python library that wraps automatically compiled libraries into 643high-level languages. It parses C++ code using LLVM/Clang technologies and 644generates the wrappers using the Mako templating engine. The approach is automatic, 645extensible, and applies to very complex C++ libraries, composed of thousands of 646classes or incorporating modern meta-programming constructs. 647 648.. [AutoWIG] https://github.com/StatisKit/AutoWIG 649 650[robotpy-build]_ is a is a pure python, cross platform build tool that aims to 651simplify creation of python wheels for pybind11 projects, and provide 652cross-project dependency management. Additionally, it is able to autogenerate 653customizable pybind11-based wrappers by parsing C++ header files. 654 655.. [robotpy-build] https://robotpy-build.readthedocs.io 656