mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Patch pybind11 to use debug python libraries on windows
This commit is contained in:
parent
3ca9e2d2b6
commit
2bde19bde2
@ -108,17 +108,12 @@
|
|||||||
# define HAVE_SNPRINTF 1
|
# define HAVE_SNPRINTF 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Include Python header, disable linking to pythonX_d.lib on Windows in debug mode
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)
|
# if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)
|
||||||
# define HAVE_ROUND 1
|
# define HAVE_ROUND 1
|
||||||
# endif
|
# endif
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable: 4510 4610 4512 4005)
|
# pragma warning(disable: 4510 4610 4512 4005)
|
||||||
# if defined(_DEBUG) && !defined(Py_DEBUG)
|
|
||||||
# define PYBIND11_DEBUG_MARKER
|
|
||||||
# undef _DEBUG
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
@ -196,6 +196,11 @@ if(CMAKE_HOST_WIN32)
|
|||||||
PYTHON_LIBRARY
|
PYTHON_LIBRARY
|
||||||
NAMES "python${PYTHON_LIBRARY_SUFFIX}"
|
NAMES "python${PYTHON_LIBRARY_SUFFIX}"
|
||||||
NO_SYSTEM_ENVIRONMENT_PATH)
|
NO_SYSTEM_ENVIRONMENT_PATH)
|
||||||
|
|
||||||
|
find_library(PYTHON_DEBUG_LIBRARY
|
||||||
|
NAMES python${PYTHON_LIBRARY_SUFFIX}_d
|
||||||
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# if we are in MSYS & MINGW, and we didn't find windows python lib, look for system python lib
|
# if we are in MSYS & MINGW, and we didn't find windows python lib, look for system python lib
|
||||||
@ -241,7 +246,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
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
|
# 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
|
# cache entries because they are meant to specify the location of a single
|
||||||
@ -254,6 +259,10 @@ if(NOT PYTHON_DEBUG_LIBRARY)
|
|||||||
endif()
|
endif()
|
||||||
set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
|
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_LIBRARY}"
|
find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARY}"
|
||||||
"${PYTHON_EXECUTABLE}${PYTHON_VERSION_STRING}")
|
"${PYTHON_EXECUTABLE}${PYTHON_VERSION_STRING}")
|
||||||
|
|
||||||
|
12
thirdparty/pybind11/tools/pybind11Tools.cmake
vendored
12
thirdparty/pybind11/tools/pybind11Tools.cmake
vendored
@ -120,8 +120,11 @@ set_property(
|
|||||||
TARGET pybind11::module
|
TARGET pybind11::module
|
||||||
APPEND
|
APPEND
|
||||||
PROPERTY
|
PROPERTY
|
||||||
INTERFACE_LINK_LIBRARIES pybind11::python_link_helper
|
INTERFACE_LINK_LIBRARIES pybind11::python_link_helper)
|
||||||
"$<$<OR:$<PLATFORM_ID:Windows>,$<PLATFORM_ID:Cygwin>>:$<BUILD_INTERFACE:${PYTHON_LIBRARIES}>>")
|
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(pybind11::module INTERFACE ${PYTHON_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PYTHON_VERSION VERSION_LESS 3)
|
if(PYTHON_VERSION VERSION_LESS 3)
|
||||||
set_property(
|
set_property(
|
||||||
@ -130,10 +133,13 @@ if(PYTHON_VERSION VERSION_LESS 3)
|
|||||||
PROPERTY INTERFACE_LINK_LIBRARIES pybind11::python2_no_register)
|
PROPERTY INTERFACE_LINK_LIBRARIES pybind11::python2_no_register)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# KiCad Workaround, this ends tying release libraries into debug builds which doesn't end well
|
||||||
set_property(
|
set_property(
|
||||||
TARGET pybind11::embed
|
TARGET pybind11::embed
|
||||||
APPEND
|
APPEND
|
||||||
PROPERTY INTERFACE_LINK_LIBRARIES pybind11::pybind11 $<BUILD_INTERFACE:${PYTHON_LIBRARIES}>)
|
PROPERTY INTERFACE_LINK_LIBRARIES pybind11::pybind11)
|
||||||
|
|
||||||
|
target_link_libraries(pybind11::embed INTERFACE ${PYTHON_LIBRARIES})
|
||||||
|
|
||||||
function(pybind11_extension name)
|
function(pybind11_extension name)
|
||||||
# The prefix and extension are provided by FindPythonLibsNew.cmake
|
# The prefix and extension are provided by FindPythonLibsNew.cmake
|
||||||
|
Loading…
x
Reference in New Issue
Block a user