Cleanup cmake python dependency handling to catch errors
* Changed the KICAD_SCRIPTING flag to be a global disable, so it will disable all other scripting flags when set to OFF * Added version testing with the wxPython flags to ensure the proper version is found for the flags provided
This commit is contained in:
parent
2f23aa9556
commit
42e14b5a4e
|
@ -100,28 +100,39 @@ option( KICAD_BUILD_QA_TESTS
|
||||||
"Build software Quality assurance unit tests (default ON)"
|
"Build software Quality assurance unit tests (default ON)"
|
||||||
ON )
|
ON )
|
||||||
|
|
||||||
|
option( BUILD_GITHUB_PLUGIN
|
||||||
|
"Build the GITHUB_PLUGIN for pcbnew."
|
||||||
|
ON )
|
||||||
|
|
||||||
|
option( KICAD_SPICE
|
||||||
|
"Build KiCad with internal Spice simulator."
|
||||||
|
ON )
|
||||||
|
|
||||||
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
||||||
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
||||||
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
||||||
# when not defined by user, the default is python.exe under Windows and python2 for others
|
# when not defined by user, the default is python.exe under Windows and python2 for others
|
||||||
# python binary file should be in exec path.
|
# python binary file should be in exec path.
|
||||||
|
|
||||||
# KICAD_SCRIPTING_MODULES requires KICAD_SCRIPTING enable it here if KICAD_SCRIPTING_MODULES is ON
|
# KICAD_SCRIPTING controls the entire python scripting system. If it is off, no other scripting
|
||||||
if ( KICAD_SCRIPTING_MODULES AND NOT KICAD_SCRIPTING )
|
# functions are available.
|
||||||
message(STATUS "Changing KICAD_SCRIPTING to ON as needed by KICAD_SCRIPTING_MODULES")
|
if ( NOT KICAD_SCRIPTING )
|
||||||
set ( KICAD_SCRIPTING ON )
|
message( STATUS "KICAD_SCRIPTING is OFF: Disabling all python scripting support" )
|
||||||
|
set( KICAD_SCRIPTING_MODULES OFF )
|
||||||
|
set( KICAD_SCRIPTING_ACTION_MENU OFF )
|
||||||
|
set( KICAD_SCRIPTING_PYTHON3 OFF )
|
||||||
|
set( KICAD_SCRIPTING_WXPYTHON OFF )
|
||||||
|
set( KICAD_SCRIPTING_WXPYTHON_PHOENIX OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# same with KICAD_SCRIPTING_ACTION_MENUS
|
# KICAD_SCRIPTING_WXPYTHON_PHOENIX requires enabling the KICAD_SCRIPTING_WXPYTHON flag
|
||||||
if ( KICAD_SCRIPTING_ACTION_MENU AND NOT KICAD_SCRIPTING )
|
# so that the wxWidgets library is properly versioned
|
||||||
message(STATUS "Changing KICAD_SCRIPTING to ON as needed by KICAD_SCRIPTING_ACTION_MENU")
|
if ( KICAD_SCRIPTING AND NOT KICAD_SCRIPTING_WXPYTHON AND KICAD_SCRIPTING_WXPYTHON_PHOENIX )
|
||||||
set ( KICAD_SCRIPTING ON )
|
message( STATUS
|
||||||
|
"KICAD_SCRIPTING_WXPYTHON_PHOENIX has been requested, setting KICAD_SCRIPTING_WXPYTHON to ON")
|
||||||
|
set( KICAD_SCRIPTING_WXPYTHON ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
|
|
||||||
|
|
||||||
option( KICAD_SPICE "Build KiCad with internal Spice simulator." ON )
|
|
||||||
|
|
||||||
# Global setting: exports are explicit
|
# Global setting: exports are explicit
|
||||||
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
|
set( CMAKE_CXX_VISIBILITY_PRESET "hidden" )
|
||||||
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
|
set( CMAKE_VISIBILITY_INLINES_HIDDEN ON )
|
||||||
|
@ -627,8 +638,9 @@ set( INC_AFTER
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#
|
||||||
# Find Python and other scripting resources
|
# Find Python and other scripting resources
|
||||||
|
#
|
||||||
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||||
|
|
||||||
# SWIG 3.0 or later require for C++11 support.
|
# SWIG 3.0 or later require for C++11 support.
|
||||||
|
@ -686,19 +698,36 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
|
||||||
find_package( PythonLibs 2.6 REQUIRED )
|
find_package( PythonLibs 2.6 REQUIRED )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( KICAD_SCRIPTING_WXPYTHON )
|
|
||||||
find_package( wxPython REQUIRED )
|
|
||||||
message( STATUS "Found ${WXPYTHON_FLAVOR} "
|
|
||||||
"${WXPYTHON_VERSION}/${WXPYTHON_TOOLKIT} "
|
|
||||||
"(wxWidgets ${WXPYTHON_WXVERSION})" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Infrequently needed headers go at end of search paths, append to INC_AFTER which
|
# Infrequently needed headers go at end of search paths, append to INC_AFTER which
|
||||||
# although is used for all components, should be a harmless hit for something like eeschema
|
# although is used for all components, should be a harmless hit for something like eeschema
|
||||||
# so long as unused search paths are at the end like this.
|
# so long as unused search paths are at the end like this.
|
||||||
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 )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Find the wxPython installation if requested
|
||||||
|
if( KICAD_SCRIPTING_WXPYTHON )
|
||||||
|
find_package( wxPython REQUIRED )
|
||||||
|
|
||||||
|
if( KICAD_SCRIPTING_WXPYTHON_PHOENIX AND WXPYTHON_VERSION VERSION_LESS 4.0.0 )
|
||||||
|
message( FATAL_ERROR
|
||||||
|
"Unable to find wxPython Phoenix,"
|
||||||
|
" instead found wxPython Classic ${WXPYTHON_VERSION}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# The test VERSION_GREATER_EQUAL is only available in cmake >3.7, so use the max possible
|
||||||
|
# version for the 3.0 line as the basis of the comparison
|
||||||
|
if( NOT KICAD_SCRIPTING_WXPYTHON_PHOENIX AND WXPYTHON_VERSION VERSION_GREATER 3.9.999 )
|
||||||
|
message( FATAL_ERROR
|
||||||
|
"Unable to find wxPython Classic,"
|
||||||
|
" instead found wxPython Phoenix ${WXPYTHON_VERSION}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message( STATUS "Found ${WXPYTHON_FLAVOR} "
|
||||||
|
"${WXPYTHON_VERSION}/${WXPYTHON_TOOLKIT} "
|
||||||
|
"(wxWidgets ${WXPYTHON_WXVERSION})" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Find wxWidgets library, required
|
# Find wxWidgets library, required
|
||||||
#
|
#
|
||||||
|
|
|
@ -138,35 +138,40 @@ these options and their default values.
|
||||||
## Scripting Support ## {#scripting_opt}
|
## Scripting Support ## {#scripting_opt}
|
||||||
|
|
||||||
The KICAD_SCRIPTING option is used to enable building the Python scripting support into Pcbnew.
|
The KICAD_SCRIPTING option is used to enable building the Python scripting support into Pcbnew.
|
||||||
This options is enabled by default.
|
This options is enabled by default, and will disable all other KICAD_SCRIPTING_* options when
|
||||||
|
it is disabled.
|
||||||
|
|
||||||
|
## Python 3 Scripting Support ## {#python3}
|
||||||
|
|
||||||
|
The KICAD_SCRIPTING_PYTHON3 option is used to enable using Python 3 for the scripting support
|
||||||
|
instead of Python 2. This option is disabled by default and only is relevant if
|
||||||
|
[KICAD_SCRIPTING](#scripting_opt) is enabled.
|
||||||
|
|
||||||
## Scripting Module Support ## {#scripting_mod_opt}
|
## Scripting Module Support ## {#scripting_mod_opt}
|
||||||
|
|
||||||
The KICAD_SCRIPTING_MODULES option is used to enable building and installing the Python modules
|
The KICAD_SCRIPTING_MODULES option is used to enable building and installing the Python modules
|
||||||
supplied by KiCad. This option is enabled by default and it will enable
|
supplied by KiCad. This option is enabled by default, but will be disabled if
|
||||||
[KICAD_SCRIPTING](#scripting_opt) if disabled.
|
[KICAD_SCRIPTING](#scripting_opt) is disabled.
|
||||||
|
|
||||||
## Python 3 Scripting Support ## {#python3}
|
|
||||||
|
|
||||||
The KICAD_SCRIPTING_PYTHON3 option is used to enable building of the Python 3 interface instead
|
|
||||||
of Python 2. This option is disabled by default.
|
|
||||||
|
|
||||||
## wxPython Scripting Support ## {#wxpython_opt}
|
## wxPython Scripting Support ## {#wxpython_opt}
|
||||||
|
|
||||||
The KICAD_SCRIPTING_WXPYTHON option is used to enable building the wxPython interface into
|
The KICAD_SCRIPTING_WXPYTHON option is used to enable building the wxPython interface into
|
||||||
Pcbnew including the wxPython console. This option is enabled by default.
|
Pcbnew including the wxPython console. This option is enabled by default, but will be disabled if
|
||||||
|
[KICAD_SCRIPTING](#scripting_opt) is disabled.
|
||||||
|
|
||||||
## wxPython Phoenix Scripting Support ## {#wxpython_phoenix}
|
## wxPython Phoenix Scripting Support ## {#wxpython_phoenix}
|
||||||
|
|
||||||
The KICAD_SCRIPTING_WXPYTHON_PHOENIX option is used to enable building the wxPython interface with
|
The KICAD_SCRIPTING_WXPYTHON_PHOENIX option is used to enable building the wxPython interface with
|
||||||
the new Phoenix binding instead of the legacy one. This option is disabled by default.
|
the new Phoenix binding instead of the legacy one. This option is disabled by default, and
|
||||||
|
enabling it requires [KICAD_SCRIPTING](#scripting_opt) to be enabled.
|
||||||
|
|
||||||
## Python Scripting Action Menu Support ## {#python_action_menu_opt}
|
## Python Scripting Action Menu Support ## {#python_action_menu_opt}
|
||||||
|
|
||||||
The KICAD_SCRIPTING_ACTION_MENU option allows Python scripts to be added directly to the Pcbnew
|
The KICAD_SCRIPTING_ACTION_MENU option allows Python scripts to be added directly to the Pcbnew
|
||||||
menu. This option is enabled by default and will enable [KICAD_SCRIPTING](#scripting_opt) if
|
menu. This option is enabled by default, but will be disabled if
|
||||||
disabled. Please note that this option is highly experimental and can cause Pcbnew to crash
|
[KICAD_SCRIPTING](#scripting_opt) is disabled. Please note that this option is highly
|
||||||
if Python scripts create an invalid object state within Pcbnew.
|
experimental and can cause Pcbnew to crash if Python scripts create an invalid object state
|
||||||
|
within Pcbnew.
|
||||||
|
|
||||||
## GitHub Plugin ## {#github_opt}
|
## GitHub Plugin ## {#github_opt}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue