[python3, pybind11] Move Py_DEBUG to python, and use python from vcpkg (#37758)

Alternative to #36585
Fixes #22743
Fixes #34338
Fixes #34678

---------

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: Cheney-Wang <850426846@qq.com>
Co-authored-by: Osyotr <8740768+Osyotr@users.noreply.github.com>
This commit is contained in:
Osyotr 2024-05-08 00:34:31 +03:00 committed by GitHub
parent 267a287924
commit e338d66dcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 30 additions and 22 deletions

View File

@ -1,12 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d93203..031088a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -196,6 +196,7 @@ if(NOT TARGET pybind11_headers)
target_compile_features(pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
cxx_right_angle_brackets)
+ target_compile_definitions (pybind11_headers INTERFACE $<$<CONFIG:Debug>:Py_DEBUG>)
if(NOT "${PYBIND11_INTERNALS_VERSION}" STREQUAL "")
target_compile_definitions(
pybind11_headers INTERFACE "PYBIND11_INTERNALS_VERSION=${PYBIND11_INTERNALS_VERSION}")

View File

@ -4,8 +4,6 @@ vcpkg_from_github(
REF "v${VERSION}"
SHA512 c20247a4dccec310307174a26a79f9a98dd7ae7c84a48ad61c61589b02ef74caac26c2945de602cbe38b0bea65fc9985f1cc37f9e2322cae2f824dee98d602f1
HEAD_REF master
PATCHES
fix-debug-link.patch
)
vcpkg_cmake_configure(

View File

@ -1,11 +1,13 @@
{
"name": "pybind11",
"version": "2.12.0",
"port-version": 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",
"license": "BSD-3-Clause",
"supports": "!(arm & windows)",
"dependencies": [
"python3",
{
"name": "vcpkg-cmake",
"host": true

View File

@ -64,15 +64,18 @@ if(_PythonFinder_WantLibs)
)
endif()
# These are duplicated as normal variables to nullify FindPython's checksum verifications.
set(_@PythonFinder_PREFIX@_INCLUDE_DIR "${_@PythonFinder_PREFIX@_INCLUDE_DIR}")
set(_@PythonFinder_PREFIX@_LIBRARY_RELEASE "${_@PythonFinder_PREFIX@_LIBRARY_RELEASE}")
set(_@PythonFinder_PREFIX@_LIBRARY_DEBUG "${_@PythonFinder_PREFIX@_LIBRARY_DEBUG}")
_find_package(${ARGS})
if(@VCPKG_LIBRARY_LINKAGE@ STREQUAL static)
include(CMakeFindDependencyMacro)
# Python for Windows embeds the zlib module into the core, so we have to link against it.
# This is a separate extension module on Unix-like platforms.
if(WIN32)
find_dependency(ZLIB)
find_package(ZLIB)
if(TARGET @PythonFinder_PREFIX@::Python)
set_property(TARGET @PythonFinder_PREFIX@::Python APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
endif()
@ -85,8 +88,8 @@ if(_PythonFinder_WantLibs)
endif()
if(APPLE)
find_dependency(Iconv)
find_dependency(Intl)
find_package(Iconv)
find_package(Intl)
if(TARGET @PythonFinder_PREFIX@::Python)
get_target_property(_PYTHON_INTERFACE_LIBS @PythonFinder_PREFIX@::Python INTERFACE_LINK_LIBRARIES)
if(NOT _PYTHON_INTERFACE_LIBS)
@ -122,5 +125,12 @@ else()
_find_package(${ARGS})
endif()
if(TARGET @PythonFinder_PREFIX@::Python)
target_compile_definitions(@PythonFinder_PREFIX@::Python INTERFACE "$<$<CONFIG:Debug>:Py_DEBUG>")
endif()
if(TARGET @PythonFinder_PREFIX@::Module)
target_compile_definitions(@PythonFinder_PREFIX@::Module INTERFACE "$<$<CONFIG:Debug>:Py_DEBUG>")
endif()
unset(_PythonFinder_WantInterp)
unset(_PythonFinder_WantLibs)

View File

@ -1,7 +1,7 @@
{
"name": "python3",
"version": "3.11.8",
"port-version": 1,
"port-version": 2,
"description": "The Python programming language",
"homepage": "https://github.com/python/cpython",
"license": "Python-2.0",

View File

@ -7054,7 +7054,7 @@
},
"pybind11": {
"baseline": "2.12.0",
"port-version": 0
"port-version": 1
},
"pystring": {
"baseline": "1.1.4",
@ -7066,7 +7066,7 @@
},
"python3": {
"baseline": "3.11.8",
"port-version": 1
"port-version": 2
},
"qca": {
"baseline": "2.3.7",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4eaa1bf96bcc566f9c14e249c51eb6bf6f6da98a",
"version": "2.12.0",
"port-version": 1
},
{
"git-tree": "fdb8e4d4c69b8a217e5cfc387ec750d4143738cc",
"version": "2.12.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "24bb8d2b3db0a12a7ca7f04061f632f0e94abcc2",
"version": "3.11.8",
"port-version": 2
},
{
"git-tree": "fe70d9080f1c1254ec0495eb74f1d0a5c4b747f7",
"version": "3.11.8",