Fix Python integration to build with vcpkg
* Add vcpkg support to find Oython using CMake * Fix pid_t conflict with python * Fix COMPILER conflict with python
This commit is contained in:
parent
00058f79d1
commit
7656663a2f
|
@ -107,6 +107,8 @@ if(NOT PYTHON_EXECUTABLE)
|
|||
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.2" )
|
||||
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.1" )
|
||||
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.0" )
|
||||
elseif(VCPKG_TOOLCHAIN)
|
||||
list( APPEND _Python_PPATHS ${PYTHON_ROOT_DIR} )
|
||||
else()
|
||||
list( APPEND _Python_PPATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath] )
|
||||
endif()
|
||||
|
|
|
@ -91,13 +91,20 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
|||
if(WIN32)
|
||||
if(MINGW)
|
||||
find_library(PYTHON_DEBUG_LIBRARY
|
||||
NAMES python{$_CURRENT_VERSION}_d
|
||||
NAMES python${_CURRENT_VERSION}_d
|
||||
PATHS
|
||||
"${PYTHON_ROOT_DIR}"
|
||||
"c:/python${_CURRENT_VERSION}"
|
||||
"c:/python${_CURRENT_VERSION_NO_DOTS}"
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
elseif(VCPKG_TOOLCHAIN)
|
||||
find_library(PYTHON_DEBUG_LIBRARY
|
||||
NAMES python${_CURRENT_VERSION_NO_DOTS}_d
|
||||
PATHS
|
||||
"${PYTHON_ROOT_DIR}"
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
else()
|
||||
find_library(PYTHON_DEBUG_LIBRARY
|
||||
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
|
||||
|
@ -121,6 +128,16 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
|||
${_CURRENT_VERSION_NO_DOTS}
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
elseif(VCPKG_TOOLCHAIN)
|
||||
find_library(PYTHON_LIBRARY
|
||||
NAMES python${_CURRENT_VERSION_NO_DOTS}
|
||||
PATHS
|
||||
"${PYTHON_ROOT_DIR}"
|
||||
PATH_SUFFIXES
|
||||
${_CURRENT_VERSION}
|
||||
${_CURRENT_VERSION_NO_DOTS}
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
else()
|
||||
find_library(PYTHON_LIBRARY
|
||||
NAMES
|
||||
|
@ -174,6 +191,17 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
|||
python${_CURRENT_VERSION}
|
||||
python${_CURRENT_VERSION_NOT_DOTS}
|
||||
)
|
||||
elseif(VCPKG_TOOLCHAIN)
|
||||
find_path(PYTHON_INCLUDE_DIR
|
||||
NAMES Python.h
|
||||
PATHS
|
||||
"${PYTHON_ROOT_DIR}"
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
python${_CURRENT_VERSION}
|
||||
python${_CURRENT_VERSION_NOT_DOTS}
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
else()
|
||||
find_path(PYTHON_INCLUDE_DIR
|
||||
NAMES Python.h
|
||||
|
|
|
@ -29,6 +29,11 @@
|
|||
|
||||
#include <base_units.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
// This gets leaked by python headers on MSVC only and will cause chaos
|
||||
#undef COMPILER
|
||||
#endif
|
||||
|
||||
#define TR_OP_BINARY_MASK 0x200
|
||||
#define TR_OP_UNARY_MASK 0x100
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
#undef _XOPEN_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
#undef pid_t // wxWidgets defines this, python typedefs, result is a conflict
|
||||
#endif
|
||||
|
||||
#undef HAVE_CLOCK_GETTIME // macro is defined in Python.h and causes redefine warning
|
||||
#include <Python.h>
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
|
Loading…
Reference in New Issue