aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/pybind11
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/pybind11')
-rw-r--r--vcpkg/ports/pybind11/android.diff16
-rw-r--r--vcpkg/ports/pybind11/portfile.cmake26
-rw-r--r--vcpkg/ports/pybind11/usage12
-rw-r--r--vcpkg/ports/pybind11/vcpkg.json22
4 files changed, 76 insertions, 0 deletions
diff --git a/vcpkg/ports/pybind11/android.diff b/vcpkg/ports/pybind11/android.diff
new file mode 100644
index 0000000..1067ff4
--- /dev/null
+++ b/vcpkg/ports/pybind11/android.diff
@@ -0,0 +1,16 @@
+diff --git a/tools/pybind11NewTools.cmake b/tools/pybind11NewTools.cmake
+index e881ca7..c012e2d 100644
+--- a/tools/pybind11NewTools.cmake
++++ b/tools/pybind11NewTools.cmake
+@@ -248,10 +248,7 @@ if(TARGET ${_Python}::Module)
+ # files.
+ get_target_property(module_target_type ${_Python}::Module TYPE)
+ if(ANDROID AND module_target_type STREQUAL INTERFACE_LIBRARY)
+- set_property(
+- TARGET ${_Python}::Module
+- APPEND
+- PROPERTY INTERFACE_LINK_LIBRARIES "${${_Python}_LIBRARIES}")
++ target_link_libraries(${_Python}::Module INTERFACE ${${_Python}_LIBRARIES})
+ endif()
+
+ set_property(
diff --git a/vcpkg/ports/pybind11/portfile.cmake b/vcpkg/ports/pybind11/portfile.cmake
new file mode 100644
index 0000000..204b72d
--- /dev/null
+++ b/vcpkg/ports/pybind11/portfile.cmake
@@ -0,0 +1,26 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO pybind/pybind11
+ REF "v${VERSION}"
+ SHA512 c17e6d6a78c38e760864b390ac2aa7df6a94ca53acb2e8be71f0d63d611b738fa20a16946c98a93fbfcad56cb0346ebf247bbe41c6f5171c6ce68397b1e5c4db
+ HEAD_REF master
+ PATCHES
+ android.diff
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DPYBIND11_TEST=OFF
+ # Disable all Python searching, Python required only for tests
+ -DPYBIND11_NOPYTHON=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH "share/cmake/pybind11")
+vcpkg_fixup_pkgconfig()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/pybind11/usage b/vcpkg/ports/pybind11/usage
new file mode 100644
index 0000000..ad9349b
--- /dev/null
+++ b/vcpkg/ports/pybind11/usage
@@ -0,0 +1,12 @@
+pybind11 provides CMake integration:
+
+ # Easy
+ set(PYBIND11_FINDPYTHON ON)
+ find_package(pybind11 CONFIG REQUIRED)
+ pybind11_add_module(MyModule1 src1.cpp)
+
+ # Advanced
+ find_package(Python COMPONENTS Interpreter Development)
+ find_package(pybind11 CONFIG REQUIRED)
+ Python_add_library(MyModule2 src2.cpp)
+ target_link_libraries(MyModule2 PRIVATE pybind11::headers)
diff --git a/vcpkg/ports/pybind11/vcpkg.json b/vcpkg/ports/pybind11/vcpkg.json
new file mode 100644
index 0000000..67c53a6
--- /dev/null
+++ b/vcpkg/ports/pybind11/vcpkg.json
@@ -0,0 +1,22 @@
+{
+ "name": "pybind11",
+ "version": "3.0.1",
+ "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",
+ "documentation": "https://pybind11.readthedocs.io/",
+ "license": "BSD-3-Clause",
+ "dependencies": [
+ {
+ "name": "python3",
+ "default-features": false
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}