Fix builds with scripting disabled

Fixes: lp:1750853
* https://bugs.launchpad.net/kicad/+bug/1750853
This commit is contained in:
Maciej Suminski 2018-02-21 17:46:46 +01:00
parent dd04bcbcbf
commit fad0452c0e
1 changed files with 25 additions and 26 deletions

View File

@ -679,6 +679,31 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
set( WXPYTHON_VERSION ${_wxpy_version} CACHE STRING "wxPython version found." ) set( WXPYTHON_VERSION ${_wxpy_version} CACHE STRING "wxPython version found." )
message( STATUS "wxPython version ${_wxpy_version} found." ) message( STATUS "wxPython version ${_wxpy_version} found." )
# Compare wxPython and wxWidgets toolkits
set( _py_cmd "import wx; print(wx.version().split(' ')[1])" )
# Add user specified Python site package path.
if( PYTHON_SITE_PACKAGE_PATH )
set( _py_cmd
"import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");${_py_cmd}" )
endif()
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
RESULT_VARIABLE WXPYTHON_TOOLKIT_RESULT
OUTPUT_VARIABLE WXPYTHON_TOOLKIT_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Check if wxWidgets toolkits match, it is a Linux-only issue
if( UNIX AND NOT APPLE AND NOT wxWidgets_TOOLKIT_FOUND STREQUAL WXPYTHON_TOOLKIT_FOUND )
message( FATAL_ERROR "\nwxWidgets and wxPython use different toolkits "
"(${wxWidgets_TOOLKIT_FOUND} vs ${WXPYTHON_TOOLKIT_FOUND}). "
"It will result in a broken build. Please either install wxPython built using "
"${wxWidgets_TOOLKIT_FOUND} or add '-DKICAD_SCRIPTING_WXPYTHON=OFF' to cmake "
"parameters to disable wxPython support." )
endif()
endif() endif()
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" ) #message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
@ -689,32 +714,6 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/scripting ) set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/scripting )
#message( STATUS "/ INC_AFTER:${INC_AFTER}" ) #message( STATUS "/ INC_AFTER:${INC_AFTER}" )
# Compare wxPython and wxWidgets toolkits
set( _py_cmd "import wx; print(wx.version().split(' ')[1])" )
# Add user specified Python site package path.
if( PYTHON_SITE_PACKAGE_PATH )
set( _py_cmd
"import sys;sys.path.insert(0, \"${PYTHON_SITE_PACKAGE_PATH}\");${_py_cmd}" )
endif()
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
RESULT_VARIABLE WXPYTHON_TOOLKIT_RESULT
OUTPUT_VARIABLE WXPYTHON_TOOLKIT_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Check if wxWidgets toolkits match, it is a Linux-only issue
if( UNIX AND NOT APPLE AND NOT wxWidgets_TOOLKIT_FOUND STREQUAL WXPYTHON_TOOLKIT_FOUND )
message( FATAL_ERROR "\nwxWidgets and wxPython use different toolkits "
"(${wxWidgets_TOOLKIT_FOUND} vs ${WXPYTHON_TOOLKIT_FOUND}). "
"It will result in a broken build. Please either install wxPython built using "
"${wxWidgets_TOOLKIT_FOUND} or add '-DKICAD_SCRIPTING_WXPYTHON=OFF' to cmake "
"parameters to disable wxPython support." )
endif()
endif() endif()
if( APPLE ) if( APPLE )