Skip to content

Commit

Permalink
CMakeLists: compare wxWidgets and wxPython toolkits
Browse files Browse the repository at this point in the history
Having wxWidgets and wxPython build using different toolkits leads
to an unusable build. KiCad executables are linked against wxWidgets
shared libraries, which will be in conflict with wxPython ones that
are loaded at runtime. We cannot easily solve it, so at least warn
the users about expected problems.

More information:
https://forum.kicad.info/t/9493
https://bugs.launchpad.net/kicad/+bug/1746753
  • Loading branch information
msuminsk committed Feb 20, 2018
1 parent cd81254 commit 792e901
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,30 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )

#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
)

if( 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()

if( APPLE )
Expand Down

0 comments on commit 792e901

Please sign in to comment.