pybind11/2.12.0

Seamless operability between C++11 and Python
Recipe info
2024-03-28

Available packages
Header Only

Install
Add the following line to your conanfile.txt:
[requires]
pybind11/2.12.0

Using pybind11

Note

If you are a new Conan user, we recommend reading the how to consume packages tutorial.

If you need additional assistance, please ask a question in the Conan Center Index repository.

Simplest use case consuming this recipe and assuming CMake as your local build tool:

[requires]
pybind11/2.12.0
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout
from conan import ConanFile
from conan.tools.cmake import cmake_layout


class ExampleRecipe(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeDeps", "CMakeToolchain"

    def requirements(self):
        self.requires("pybind11/2.12.0")

    def layout(self):
        cmake_layout(self)

Now, you can run this Conan command to locally install (and build if necessary) this recipe and its dependencies (if any):

$ conan install conanfile.txt --build=missing

Useful information to take into account to consume this library:


These are the main declared targets:

  • CMake package name(s): pybind11
  • CMake target name(s): pybind11_all_do_not_use
  • pybind11_ => pybind11::pybind11
    
  • pkg-config file name(s): pybind11.pc
  • pybind11_ => pybind11-pybind11_.pc
    

A simple use case using the CMake file name and the global target:

# ...
find_package(pybind11 REQUIRED)
# ...
target_link_libraries(YOUR_TARGET pybind11_all_do_not_use)

These are all the available headers. Some of these ones might be non-public; make sure of it by visiting the pybind11 homepage listed above:

#include "pybind11/attr.h"
#include "pybind11/buffer_info.h"
#include "pybind11/cast.h"
#include "pybind11/chrono.h"
#include "pybind11/common.h"
#include "pybind11/complex.h"
#include "pybind11/detail/class.h"
#include "pybind11/detail/common.h"
#include "pybind11/detail/descr.h"
#include "pybind11/detail/init.h"
#include "pybind11/detail/internals.h"
#include "pybind11/detail/type_caster_base.h"
#include "pybind11/detail/typeid.h"
#include "pybind11/eigen.h"
#include "pybind11/eigen/common.h"
#include "pybind11/eigen/matrix.h"
#include "pybind11/eigen/tensor.h"
#include "pybind11/embed.h"
#include "pybind11/eval.h"
#include "pybind11/functional.h"
#include "pybind11/gil.h"
#include "pybind11/gil_safe_call_once.h"
#include "pybind11/iostream.h"
#include "pybind11/numpy.h"
#include "pybind11/operators.h"
#include "pybind11/options.h"
#include "pybind11/pybind11.h"
#include "pybind11/pytypes.h"
#include "pybind11/stl.h"
#include "pybind11/stl/filesystem.h"
#include "pybind11/stl_bind.h"
#include "pybind11/type_caster_pyobject_ptr.h"
#include "pybind11/typing.h"