Fix vcpkg python build compatibility
This commit is contained in:
parent
3fcd0860c1
commit
82ecb0f77b
|
@ -108,7 +108,7 @@ if(NOT PYTHON_EXECUTABLE)
|
|||
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} )
|
||||
list( APPEND _Python_PPATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3" )
|
||||
else()
|
||||
list( APPEND _Python_PPATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath] )
|
||||
endif()
|
||||
|
|
|
@ -41,7 +41,16 @@ if( PYTHON_SITE_PACKAGE_PATH )
|
|||
endif()
|
||||
endif()
|
||||
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_site_path}${_py_cmd}"
|
||||
if( VCPKG_TOOLCHAIN )
|
||||
# python 3.8+ requires us to use python to add additiona load directories (PATH no longer supported)
|
||||
# vcpkg does not copy all the dlls into the python folder so we need this for development
|
||||
# as the wxpython modules need the wxwidgets library DLLs to load
|
||||
set( _py_dll "import os;os.add_dll_directory(\"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin\");os.add_dll_directory(\"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin\");" )
|
||||
else()
|
||||
set( _py_dll "" )
|
||||
endif()
|
||||
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_dll}${_py_site_path}${_py_cmd}"
|
||||
RESULT_VARIABLE _WXPYTHON_VERSION_RESULT
|
||||
OUTPUT_VARIABLE _WXPYTHON_VERSION_FOUND
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
|
@ -70,8 +79,9 @@ list( GET _WXPYTHON_VERSION_LIST 2 WXPYTHON_FLAVOR )
|
|||
# Determine wxWidgets version used by wxPython/Phoenix
|
||||
if( WXPYTHON_FLAVOR MATCHES "phoenix" )
|
||||
# 4.0.1;gtk3;(phoenix) does not contain wxWidgets version, request it explicitly
|
||||
|
||||
set( _py_cmd "import wx;print(wx.wxWidgets_version.split(' ')[1])")
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_site_path}${_py_cmd}"
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_dll}${_py_site_path}${_py_cmd}"
|
||||
RESULT_VARIABLE WXPYTHON_WXVERSION_RESULT
|
||||
OUTPUT_VARIABLE WXPYTHON_WXVERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
|
|
Loading…
Reference in New Issue