• Home
  • Raw
  • Download

Lines Matching +full:- +full:dpybind11_findpython

6 .. _build-setuptools:
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
27 :ref:`setup_helpers-copy-manually` (always works but you have to manually sync
32 .. code-block:: python
54 .. code-block:: python
73 Since pybind11 does not require NumPy when building, a light-weight replacement
76 .. code-block:: python
95 using ``pip install -e .`` and do not have local headers, you can skip the
99 .. code-block:: python
108 pip install -e .`` would be the way to use it with GCC, for example. Unlike the
117 or use Pip's ``--no-cache-dir`` option.
123 .. _setup_helpers-pep518:
126 ---------------------------------------
128 If you use `PEP 518's <https://www.python.org/dev/peps/pep-0518/>`_
137 .. code-block:: toml
139 [build-system]
141 build-backend = "setuptools.build_meta"
152 `pypa-build`_ is the recommended offical tool.
154 .. _PEP 517: https://www.python.org/dev/peps/pep-0517/
156 .. _pypa-build: https://pypa-build.readthedocs.io/en/latest/
158 .. _setup_helpers-setup_requires:
161 --------------------------
165 two-phase ``setup.py`` run, then you will need to use something like this to
169 .. code-block:: python
184 .. _setup_helpers-copy-manually:
187 -------------
204 .. code-block:: python
211 del sys.path[-1]
233 For C++ codebases that have an existing CMake-based build system, a Python
236 .. code-block:: cmake
261 -------------------
266 .. code-block:: cmake
274 will take care of all the Python-specific compiler and linker flags as well
275 as the OS- and Python-version-specific file extension. The produced target
280 Python-exclusive module. Specifying ``SHARED`` will create a more traditional
299 regular LTO if ``-flto=thin`` is not available. If
301 that will be respected instead of the built-in flag search.
308 no-op) to disable pybind11's ipo flags.
310 The ``OPT_SIZE`` flag enables size-based optimization equivalent to the
311 standard ``/Os`` or ``-Os`` compiler flags and the ``MinSizeRel`` build type,
314 into performance-critical parts and associated bindings. In this case, we can
319 a per-target level and takes precedence over the global CMake build type
326 -----------------------
333 .. code-block:: cmake
340 the ``-D<variable>=<value>`` flag. You can also manually set ``CXX_STANDARD``
341 on a target or use ``target_compile_features`` on your targets - anything that
348 .. code-block:: bash
350 cmake -DPYBIND11_PYTHON_VERSION=3.6 ..
353 cmake -DPYTHON_EXECUTABLE=/path/to/python ..
356 cmake -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") ..
360 ---------------------------------
362 For CMake-based projects that don't include the pybind11 repository internally,
366 .. code-block:: cmake
378 .. code-block:: bash
389 cmake -S . -B build
390 cmake --build build -j 2 # Build on 2 cores
391 cmake --install build
397 -- just swap out ``add_subdirectory`` for ``find_package``.
402 .. _find-python-mode:
405 ---------------
412 .. code-block:: cmake
426 algorithms from the CMake invocation, with ``-DPYBIND11_FINDPYTHON=ON``.
430 If you use FindPython2 and FindPython3 to dual-target Python, use the
451 -----------------------------------
469 …Everything for extension modules - ``pybind11::pybind11`` + ``Python::Module`` (FindPython CMake 3…
472 …Everything for embedding the Python interpreter - ``pybind11::pybind11`` + ``Python::Embed`` (Find…
475 An alternative to `INTERPROCEDURAL_OPTIMIZATION` for adding link-time optimization.
481 ``/Os`` for MSVC, ``-Os`` for other compilers. Does nothing for debug builds.
494 .. code-block:: cmake
524 .. _nopython-mode:
527 -----------------------
532 freedom to integrate into an existing system (like `Scikit-Build's
533 <https://scikit-build.readthedocs.io>`_ ``PythonExtensions``).
540 --------------------------------
549 .. code-block:: cmake
564 pybind11 is a header-only library, hence it is not necessary to link against
570 .. code-block:: bash
572 …$ c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$…
577 The ``python3 -m pybind11 --includes`` command fetches the include paths for
580 ``-I <path-to-pybind11>/include`` together with the Python includes path
581 ``python3-config --includes``.
584 use ``example.so`` instead of ``example$(python3-config --extension-suffix)``.
585 Besides, the ``--extension-suffix`` option may or may not be available, depending
590 the ``-undefined dynamic_lookup`` flag so as to ignore missing symbols when
593 .. code-block:: bash
595 …$ c++ -O3 -Wall -shared -std=c++11 -undefined dynamic_lookup $(python3 -m pybind11 --includes) exa…
599 :ref:`cmake` for a detailed example of a suitable cross-platform CMake-based
608 system-provided Python, and one that ships with a piece of commercial
630 high-level languages. It parses C++ code using LLVM/Clang technologies and
633 classes or incorporating modern meta-programming constructs.
637 [robotpy-build]_ is a is a pure python, cross platform build tool that aims to
639 cross-project dependency management. Additionally, it is able to autogenerate
640 customizable pybind11-based wrappers by parsing C++ header files.
642 .. [robotpy-build] https://robotpy-build.readthedocs.io