diff --git a/thirdparty/pybind11/include/pybind11/detail/common.h b/thirdparty/pybind11/include/pybind11/detail/common.h index c26df990d6..0aad78d01e 100644 --- a/thirdparty/pybind11/include/pybind11/detail/common.h +++ b/thirdparty/pybind11/include/pybind11/detail/common.h @@ -210,23 +210,10 @@ # define HAVE_SNPRINTF 1 #endif -/// Include Python header, disable linking to pythonX_d.lib on Windows in debug mode #if defined(_MSC_VER) PYBIND11_WARNING_PUSH PYBIND11_WARNING_DISABLE_MSVC(4505) -// C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only) -# if defined(_DEBUG) && !defined(Py_DEBUG) -// Workaround for a VS 2022 issue. -// NOTE: This workaround knowingly violates the Python.h include order requirement: -// https://docs.python.org/3/c-api/intro.html#include-files -// See https://github.com/pybind/pybind11/pull/3497 for full context. -# include -# if _MSVC_STL_VERSION >= 143 -# include -# endif -# define PYBIND11_DEBUG_MARKER -# undef _DEBUG -# endif +PYBIND11_WARNING_DISABLE_MSVC(4510 4610 4512 4005) #endif // https://en.cppreference.com/w/c/chrono/localtime diff --git a/thirdparty/pybind11/tools/FindPythonLibsNew.cmake b/thirdparty/pybind11/tools/FindPythonLibsNew.cmake index ce558d4ece..b221186cda 100644 --- a/thirdparty/pybind11/tools/FindPythonLibsNew.cmake +++ b/thirdparty/pybind11/tools/FindPythonLibsNew.cmake @@ -218,6 +218,21 @@ elseif(CMAKE_HOST_WIN32) if(NOT EXISTS "${PYTHON_LIBRARY}") get_filename_component(_PYTHON_ROOT ${PYTHON_INCLUDE_DIR} DIRECTORY) set(PYTHON_LIBRARY "${_PYTHON_ROOT}/libs/python${PYTHON_LIBRARY_SUFFIX}.lib") + elseif(DEFINED VCPKG_TOOLCHAIN AND NOT EXISTS "${PYTHON_LIBRARY}") + set(PYTHON_LIBRARY "${PYTHON_PREFIX}/../../lib/python${PYTHON_LIBRARY_SUFFIX}.lib") + endif() + + if(DEFINED VCPKG_TOOLCHAIN) + unset(PYTHON_LIBRARY) + find_library( + PYTHON_LIBRARY + NAMES "python${PYTHON_LIBRARY_SUFFIX}" + NO_SYSTEM_ENVIRONMENT_PATH) + + find_library(PYTHON_DEBUG_LIBRARY + NAMES python${PYTHON_LIBRARY_SUFFIX}_d + NO_SYSTEM_ENVIRONMENT_PATH + ) endif() # if we are in MSYS & MINGW, and we didn't find windows python lib, look for system python lib @@ -263,7 +278,7 @@ else() endif() endif() -mark_as_advanced(PYTHON_LIBRARY PYTHON_INCLUDE_DIR) +mark_as_advanced(PYTHON_DEBUG_LIBRARY PYTHON_LIBRARY PYTHON_INCLUDE_DIR) # We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the # cache entries because they are meant to specify the location of a single @@ -276,6 +291,10 @@ if(NOT PYTHON_DEBUG_LIBRARY) endif() set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") +set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}") +set(PYTHON_LIBRARY_RELEASE, "${PYTHON_LIBRARY}") +select_library_configurations(PYTHON) + find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARIES}" "${PYTHON_EXECUTABLE}${PYTHON_VERSION_STRING}")