-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO pybind/pybind11 | ||
REF v2.10.1 | ||
SHA512 040f109ec870516acdaebc5133ccbba9e3ed7ff93214a66997cf4b8366c209322f3c902c283040826c7e585c3ea2259caf62d90d0b475bfa33d21e459dd54df1 | ||
REF "v${VERSION}" | ||
SHA512 497c25b33b09a9c42f67131ab82e35d689e8ce089dd7639be997305ff9a6d502447b79c824508c455d559e61f0186335b54dd2771d903a7c1621833930622d1a | ||
HEAD_REF master | ||
) | ||
|
||
vcpkg_configure_cmake( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PREFER_NINJA | ||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
OPTIONS | ||
-DPYBIND11_TEST=OFF | ||
-DPYBIND11_NOPYTHON=ON # This is a header only library, no need to search for a python interpreter at dependency build time. Only causes problems | ||
OPTIONS_RELEASE | ||
-DPYTHON_IS_DEBUG=OFF | ||
OPTIONS_DEBUG | ||
-DPYTHON_IS_DEBUG=ON | ||
# Disable all Python searching, Python required only for tests | ||
-DPYBIND11_NOPYTHON=ON | ||
) | ||
|
||
vcpkg_install_cmake() | ||
vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/${PORT}) | ||
|
||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/) | ||
vcpkg_cmake_install() | ||
vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/pybind11") | ||
vcpkg_fixup_pkgconfig() | ||
|
||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/pybind11/pybind11Tools.cmake" | ||
[=[find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED ${_pybind11_quiet})]=] | ||
[=[find_package(PythonLibs ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED ${_pybind11_quiet})]=]) # CMake's PythonLibs works better with vcpkg | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/") | ||
|
||
vcpkg_install_copyright(FILE_LIST ${SOURCE_PATH}/LICENSE) | ||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
pybind11 provides CMake targets. There are two modes provided; classic, which is built on the old Python | ||
discovery packages in CMake, or the new FindPython mode, which uses FindPython | ||
from 3.12+ forward (3.15+ _highly_ recommended). | ||
|
||
New FindPython mode: | ||
|
||
find_package(Python COMPONENTS Interpreter Development) | ||
find_package(pybind11 CONFIG) | ||
|
||
# pybind11 method: | ||
pybind11_add_module(MyModule1 src1.cpp) | ||
|
||
# Python method: | ||
Python_add_library(MyModule2 src2.cpp) | ||
target_link_libraries(MyModule2 pybind11::headers) | ||
set_target_properties(MyModule2 PROPERTIES | ||
INTERPROCEDURAL_OPTIMIZATION ON | ||
CXX_VISIBILITY_PRESET ON | ||
VISIBILITY_INLINES_HIDDEN ON | ||
) | ||
|
||
For more information see here: | ||
https://pybind11.readthedocs.io/en/latest/compiling.html#building-with-cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
{ | ||
"name": "pybind11", | ||
"version-semver": "2.10.1", | ||
"port-version": 1, | ||
"description": "lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.", | ||
"homepage": "https://pybind11.readthedocs.io" | ||
"version": "2.13.6", | ||
"description": "pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code", | ||
"homepage": "https://github.com/pybind/pybind11", | ||
"license": "BSD-3-Clause", | ||
"supports": "!(arm & windows)", | ||
"dependencies": [ | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
}, | ||
{ | ||
"name": "vcpkg-cmake-config", | ||
"host": true | ||
} | ||
] | ||
} |