Fix the install location for vcpkg built python modules

This commit is contained in:
Marek Roszko 2021-01-06 23:32:56 -05:00
parent 318d7ab67b
commit 84dd78e01d
3 changed files with 12 additions and 8 deletions

View File

@ -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}" )

View File

@ -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" );

View File

@ -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();