From 1ec3d05438d4c1edf62a330f65fcfe1d86e791b2 Mon Sep 17 00:00:00 2001 From: Yury Bura Date: Mon, 10 Jul 2023 19:52:11 +0200 Subject: [PATCH] [pybind11] update to v2.10.4 (#32194) * [pybind11] update to v2.10.4, clean-up redundant dependency, add usage --- ports/pybind11/portfile.cmake | 14 +++-------- ports/pybind11/usage | 23 +++++++++++++++++ ports/pybind11/vcpkg.json | 3 +-- ports/shiva/find_python_and_no_copy_dll.patch | 25 +++++++++++++++++++ ports/shiva/no_copy_dll.patch | 13 ---------- ports/shiva/portfile.cmake | 17 ++++++------- ports/shiva/vcpkg.json | 5 +++- scripts/ci.baseline.txt | 2 -- versions/baseline.json | 4 +-- versions/p-/pybind11.json | 5 ++++ versions/s-/shiva.json | 5 ++++ 11 files changed, 77 insertions(+), 39 deletions(-) create mode 100644 ports/pybind11/usage create mode 100644 ports/shiva/find_python_and_no_copy_dll.patch delete mode 100644 ports/shiva/no_copy_dll.patch diff --git a/ports/pybind11/portfile.cmake b/ports/pybind11/portfile.cmake index 515669e1c9cbb1..26fe2fbb98d8c4 100644 --- a/ports/pybind11/portfile.cmake +++ b/ports/pybind11/portfile.cmake @@ -2,7 +2,7 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO pybind/pybind11 REF "v${VERSION}" - SHA512 3894400f04cd08e2dbb14b3d696339f0364434f1d6f8bb057338ac88157ec7491b2df1e1e46ebd5abccdcd5775c5e9238de6404f0db87f64f5a1802db3a5b18c + SHA512 7970defbb6d057a44468ed707c80bfa6ef8c9578528fbc084b03aeea20a52dbd681581f82d55ff90af11ee89693379bd79e2ab6603239ba05b0aa8da29dd93c7 HEAD_REF master ) @@ -10,11 +10,8 @@ vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS -DPYBIND11_TEST=OFF - -DPYBIND11_FINDPYTHON=ON - 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_cmake_install() @@ -23,8 +20,5 @@ vcpkg_fixup_pkgconfig() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/") -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(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/pybind11/usage b/ports/pybind11/usage new file mode 100644 index 00000000000000..39f9166e15a75b --- /dev/null +++ b/ports/pybind11/usage @@ -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 \ No newline at end of file diff --git a/ports/pybind11/vcpkg.json b/ports/pybind11/vcpkg.json index 4edd356aad82ab..7c2ed06ea40281 100644 --- a/ports/pybind11/vcpkg.json +++ b/ports/pybind11/vcpkg.json @@ -1,12 +1,11 @@ { "name": "pybind11", - "version": "2.10.3", + "version": "2.10.4", "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": [ - "python3", { "name": "vcpkg-cmake", "host": true diff --git a/ports/shiva/find_python_and_no_copy_dll.patch b/ports/shiva/find_python_and_no_copy_dll.patch new file mode 100644 index 00000000000000..31f447daa890ef --- /dev/null +++ b/ports/shiva/find_python_and_no_copy_dll.patch @@ -0,0 +1,25 @@ +diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt +index eef14ee..30130ba 100644 +--- a/modules/python/CMakeLists.txt ++++ b/modules/python/CMakeLists.txt +@@ -1,10 +1,10 @@ + include(CMakeSources.cmake) + set(MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + ++find_package(Python COMPONENTS Interpreter Development) + find_package(pybind11 CONFIG REQUIRED) + +- +-if (WIN32) ++if (FALSE) + ## We need pyton dll + file(GLOB PYTHON_DLL ${PYTHON_LIBRARIES}/../*.dll) + +@@ -19,6 +19,6 @@ endif () + + CREATE_MODULE(shiva::pyscripting "${MODULE_SOURCES}" ${MODULE_PATH} "python") + +-target_link_libraries(pyscripting INTERFACE shiva::ecs shiva::input pybind11::embed pybind11::module) ++target_link_libraries(pyscripting INTERFACE shiva::ecs shiva::input pybind11::embed pybind11::module Python::Module) + + AUTO_TARGETS_MODULE_INSTALL(pyscripting) diff --git a/ports/shiva/no_copy_dll.patch b/ports/shiva/no_copy_dll.patch deleted file mode 100644 index add7f22a494d0c..00000000000000 --- a/ports/shiva/no_copy_dll.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt -index eef14ee87..d52a147d8 100644 ---- a/modules/python/CMakeLists.txt -+++ b/modules/python/CMakeLists.txt -@@ -4,7 +4,7 @@ set(MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) - find_package(pybind11 CONFIG REQUIRED) - - --if (WIN32) -+if (WIN32 AND FALSE) - ## We need pyton dll - file(GLOB PYTHON_DLL ${PYTHON_LIBRARIES}/../*.dll) - diff --git a/ports/shiva/portfile.cmake b/ports/shiva/portfile.cmake index 884a8de108656c..d0367006645c78 100644 --- a/ports/shiva/portfile.cmake +++ b/ports/shiva/portfile.cmake @@ -1,10 +1,10 @@ vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO Milerius/shiva - REF 1.0 - SHA512 d1ce33e89b17fa8f82e21b51dfa1308e38c617fea52c34a20b7b6c8643318280df24c043238ddd73ba2dbc139c5b5de1c2cb3add1f5629a54694c78b415d73d1 - HEAD_REF master - PATCHES no_copy_dll.patch + OUT_SOURCE_PATH SOURCE_PATH + REPO Milerius/shiva + REF ${VERSION} + SHA512 d1ce33e89b17fa8f82e21b51dfa1308e38c617fea52c34a20b7b6c8643318280df24c043238ddd73ba2dbc139c5b5de1c2cb3add1f5629a54694c78b415d73d1 + HEAD_REF master + PATCHES find_python_and_no_copy_dll.patch ) find_library(PYTHON_RELEASE NAMES python310 PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH) @@ -23,8 +23,7 @@ vcpkg_cmake_configure( ) vcpkg_cmake_install() -vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/shiva") +vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug" "${CURRENT_PACKAGES_DIR}/lib") -file(COPY "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/shiva") -file(RENAME "${CURRENT_PACKAGES_DIR}/share/shiva/LICENSE" "${CURRENT_PACKAGES_DIR}/share/shiva/copyright") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/shiva/vcpkg.json b/ports/shiva/vcpkg.json index 447297bd066507..65107debfdee91 100644 --- a/ports/shiva/vcpkg.json +++ b/ports/shiva/vcpkg.json @@ -1,9 +1,11 @@ { "name": "shiva", "version": "1.0", - "port-version": 5, + "port-version": 6, "description": "Modern C++ Game Engine", "homepage": "https://github.com/Milerius/shiva", + "license": "MIT", + "supports": "!(static & windows)", "dependencies": [ "boost-dll", "boost-filesystem", @@ -16,6 +18,7 @@ }, "nlohmann-json", "pybind11", + "python3", "sol2", "spdlog", { diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 5b653a921dfb99..b60c182d883ef9 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1378,8 +1378,6 @@ septag-sx:x64-uwp=fail sfml:arm-neon-android=fail sfml:arm64-android=fail sfml:x64-android=fail -shiva:x64-windows-static=fail -shiva:x64-windows-static-md=fail shiva-sfml:x64-linux=fail shiva-sfml:x64-osx=fail shiva-sfml:arm64-osx=fail diff --git a/versions/baseline.json b/versions/baseline.json index 7df385aef41250..ecf1151f508f65 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6545,7 +6545,7 @@ "port-version": 0 }, "pybind11": { - "baseline": "2.10.3", + "baseline": "2.10.4", "port-version": 0 }, "pystring": { @@ -7506,7 +7506,7 @@ }, "shiva": { "baseline": "1.0", - "port-version": 5 + "port-version": 6 }, "shiva-sfml": { "baseline": "1.0", diff --git a/versions/p-/pybind11.json b/versions/p-/pybind11.json index 361969cb3fac77..38d08b94d2d2e8 100644 --- a/versions/p-/pybind11.json +++ b/versions/p-/pybind11.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ed50c1b3263ecefd48d008f522bf966c9e4347d1", + "version": "2.10.4", + "port-version": 0 + }, { "git-tree": "a3b13210bfd5f8dcbab60336dd54f0ed7230c5c3", "version": "2.10.3", diff --git a/versions/s-/shiva.json b/versions/s-/shiva.json index 81d1b1b42cb50a..25094698859e7c 100644 --- a/versions/s-/shiva.json +++ b/versions/s-/shiva.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1f99562a0a906db852e4ff3a7caf03ad4c4fbcab", + "version": "1.0", + "port-version": 6 + }, { "git-tree": "821cf61c76079cfd5c7a635dc36e01c0f33c38f5", "version": "1.0",