wxPython configuration fixes.

* Add support for setting python site package path to PYTHON_SITE_PACKAGE_PATH.
* Move configure_file() so WXPYTHON_VERSION is already initialized before creating
  config.h (Duh!).
* Add status message to indicate the version of wxPython found.
This commit is contained in:
Wayne Stambaugh 2015-02-18 20:47:34 -05:00
parent 63d3c835cb
commit 04c55f0956
3 changed files with 16 additions and 10 deletions

View File

@ -666,6 +666,13 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
# wxWidgets found. At least the major an minor version should match. # wxWidgets found. At least the major an minor version should match.
set( _wxpy_version "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}" ) set( _wxpy_version "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}" )
set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" ) set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" )
# 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}" execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
RESULT_VARIABLE WXPYTHON_VERSION_RESULT RESULT_VARIABLE WXPYTHON_VERSION_RESULT
OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND
@ -681,11 +688,12 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
endif() endif()
if( NOT WXPYTHON_VERSION_FOUND STREQUAL "True" ) if( NOT WXPYTHON_VERSION_FOUND STREQUAL "True" )
message( FATAL_ERROR "wxPython version ${_wxpy_version} does not appear to be installed on the system." ) message( FATAL_ERROR
else() "wxPython version ${_wxpy_version} does not appear to be installed on the system." )
set( WXPYTHON_VERSION_FOUND "${_wxpy_version}"
CACHE STRING "wxPython version found." )
endif() endif()
set( WXPYTHON_VERSION ${_wxpy_version} CACHE STRING "wxPython version found." )
message( STATUS "wxPython version ${_wxpy_version} found." )
endif() endif()
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" ) #message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
@ -825,6 +833,9 @@ else()
message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" ) message( STATUS "WARNING: Doxygen not found - doxygen-docs (Source Docs) target not created" )
endif() endif()
# Generate config.h.
configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
${CMAKE_BINARY_DIR}/config.h )
#================================================ #================================================
# "make uninstall" rules # "make uninstall" rules

View File

@ -109,9 +109,4 @@ macro( perform_feature_checks )
# getc() on platforms where getc_unlocked() doesn't exist. # getc() on platforms where getc_unlocked() doesn't exist.
check_symbol_exists( getc_unlocked "stdio.h" HAVE_FGETC_NOLOCK ) check_symbol_exists( getc_unlocked "stdio.h" HAVE_FGETC_NOLOCK )
# Generate config.h.
configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
${CMAKE_BINARY_DIR}/config.h
)
endmacro( perform_feature_checks ) endmacro( perform_feature_checks )

View File

@ -72,7 +72,7 @@
/// The wxPython version found during configuration. /// The wxPython version found during configuration.
#if defined( KICAD_SCRIPTING_WXPYTHON ) #if defined( KICAD_SCRIPTING_WXPYTHON )
#define WXPYTHON_VERSION "@WXPYTHON_VERSION_FOUND@" #define WXPYTHON_VERSION "@WXPYTHON_VERSION@"
#endif #endif
/// When defined, build the GITHUB_PLUGIN for pcbnew. /// When defined, build the GITHUB_PLUGIN for pcbnew.