diff --git a/CMakeModules/FindPythonInterp.cmake b/CMakeModules/FindPythonInterp.cmake index 0fb7e8a816..8f40bf9f28 100644 --- a/CMakeModules/FindPythonInterp.cmake +++ b/CMakeModules/FindPythonInterp.cmake @@ -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() diff --git a/CMakeModules/FindPythonLibs.cmake b/CMakeModules/FindPythonLibs.cmake index 48bc46f151..c23508ffe8 100644 --- a/CMakeModules/FindPythonLibs.cmake +++ b/CMakeModules/FindPythonLibs.cmake @@ -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 diff --git a/include/libeval_compiler/libeval_compiler.h b/include/libeval_compiler/libeval_compiler.h index 9fd6cfb258..95b3a698a2 100644 --- a/include/libeval_compiler/libeval_compiler.h +++ b/include/libeval_compiler/libeval_compiler.h @@ -29,6 +29,11 @@ #include +#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 diff --git a/pcbnew/swig/python_scripting.h b/pcbnew/swig/python_scripting.h index ce26b30515..a9f8a7e1c2 100644 --- a/pcbnew/swig/python_scripting.h +++ b/pcbnew/swig/python_scripting.h @@ -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 #undef HAVE_CLOCK_GETTIME