diff --git a/CMakeLists.txt b/CMakeLists.txt index eb4985fddc..563f65a66b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -767,17 +767,21 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) endif() endif() - if( NOT APPLE ) - set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" - CACHE PATH "Python module install path." - ) - else() + if( APPLE ) # relative path for python in bundle set( PYTHON_LIB_DIR "python/site-packages" ) # install into bundle Frameworks folder set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}" CACHE PATH "Python module install path." ) + elseif( VCPKG_TOOLCHAIN ) + set( PYTHON_DEST "${CMAKE_INSTALL_PREFIX}/lib/python3/Lib/site-packages" + CACHE PATH "Python module install path." + ) + else() + set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" + CACHE PATH "Python module install path." + ) endif() mark_as_advanced( PYTHON_DEST ) message( STATUS "Python module install path: ${PYTHON_DEST}" ) diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 1a270688f5..b25c10110c 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -215,7 +215,7 @@ PGM_BASE* PgmOrNull() static bool scriptingSetup() { -#if defined( __WINDOWS__ ) +#if defined( __WINDOWS__ ) && !defined( _MSC_VER ) // If our python.exe (in kicad/bin) exists, force our kicad python environment wxString kipython = FindKicadFile( "python.exe" ); diff --git a/pcbnew/swig/python_scripting.cpp b/pcbnew/swig/python_scripting.cpp index 1b9adb8fff..5dd4340b17 100644 --- a/pcbnew/swig/python_scripting.cpp +++ b/pcbnew/swig/python_scripting.cpp @@ -165,12 +165,12 @@ bool pcbnewInitPythonScripting( const char * aUserScriptingPath ) // Under vcpkg/msvc, we need to explicitly set the python home // or else it'll start consuming system python registry keys and the like instead // We are going to follow the "unix" layout for the msvc/vcpkg distributions so exes in /root/bin - // And the python lib in /root/share/python3(/Lib,/DLLs) + // And the python lib in /root/lib/python3(/Lib,/DLLs) wxFileName pyHome; pyHome.Assign( Pgm().GetExecutablePath() ); pyHome.AppendDir( wxT("..") ); - pyHome.AppendDir( wxT("share") ); + pyHome.AppendDir( wxT("lib") ); pyHome.AppendDir( wxT("python3") ); pyHome.Normalize();