CMake: refactor boost.python search
- improve description of Python dependencies - refactor search per python-version-style - report on features and found boost modules the standard way
This commit is contained in:
parent
6f1f08f728
commit
81db2bad5f
@ -124,24 +124,22 @@ set_package_properties(
|
|||||||
PythonLibs PROPERTIES
|
PythonLibs PROPERTIES
|
||||||
DESCRIPTION "C interface libraries for the Python 3 interpreter."
|
DESCRIPTION "C interface libraries for the Python 3 interpreter."
|
||||||
URL "http://python.org"
|
URL "http://python.org"
|
||||||
PURPOSE "Python 3 is used for some Calamares job modules."
|
PURPOSE "Python 3 is used for Python job modules."
|
||||||
)
|
)
|
||||||
|
|
||||||
if ( PYTHONLIBS_FOUND )
|
if ( PYTHONLIBS_FOUND )
|
||||||
include( BoostPython3 )
|
include( BoostPython3 )
|
||||||
find_boost_python3( 1.54.0 ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND )
|
find_boost_python3( 1.54.0 ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND )
|
||||||
set_package_properties(
|
set_package_properties(
|
||||||
CALAMARES_BOOST_PYTHON3 PROPERTIES
|
Boost PROPERTIES
|
||||||
DESCRIPTION "A C++ library which enables seamless interoperability between C++ and Python 3."
|
PURPOSE "Boost.Python is used for Python job modules."
|
||||||
URL "http://www.boost.org"
|
|
||||||
PURPOSE "Boost.Python is used for interfacing with Calamares job modules written in Python 3."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package( PythonQt )
|
find_package( PythonQt )
|
||||||
set_package_properties( PythonQt PROPERTIES
|
set_package_properties( PythonQt PROPERTIES
|
||||||
DESCRIPTION "A Python embedding solution for Qt applications."
|
DESCRIPTION "A Python embedding solution for Qt applications."
|
||||||
URL "http://pythonqt.sourceforge.net"
|
URL "http://pythonqt.sourceforge.net"
|
||||||
PURPOSE "PythonQt is used for the Python modules API."
|
PURPOSE "PythonQt is used for Python view modules."
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -241,8 +239,8 @@ if( mksquashfs_PROGRAM )
|
|||||||
set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ )
|
set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ )
|
||||||
set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs )
|
set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs )
|
||||||
if( EXISTS ${src_fs} )
|
if( EXISTS ${src_fs} )
|
||||||
# Collect directories needed for a minimal binary distro,
|
|
||||||
# based on the build host. If /lib64 exists, assume it is needed.
|
# based on the build host. If /lib64 exists, assume it is needed.
|
||||||
|
# Collect directories needed for a minimal binary distro,
|
||||||
# Note that the last path component is added to the root, so
|
# Note that the last path component is added to the root, so
|
||||||
# if you add /usr/sbin here, it will be put into /sbin_1.
|
# if you add /usr/sbin here, it will be put into /sbin_1.
|
||||||
# Add such paths to /etc/profile under ${src_fs}.
|
# Add such paths to /etc/profile under ${src_fs}.
|
||||||
@ -275,20 +273,12 @@ set_package_properties( mksquashfs PROPERTIES
|
|||||||
# add_subdirectory( thirdparty )
|
# add_subdirectory( thirdparty )
|
||||||
add_subdirectory( src )
|
add_subdirectory( src )
|
||||||
|
|
||||||
|
add_feature_info(Python ${WITH_PYTHON} "Python job modules")
|
||||||
|
add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules")
|
||||||
|
add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration")
|
||||||
|
|
||||||
feature_summary(WHAT ALL)
|
feature_summary(WHAT ALL)
|
||||||
|
|
||||||
if( NOT WITH_PYTHON )
|
|
||||||
message( "-- WARNING: Building Calamares without Python support. Legacy Python job modules will not work.\n" )
|
|
||||||
endif()
|
|
||||||
if( NOT WITH_PYTHONQT )
|
|
||||||
message( "-- WARNING: Building Calamares without PythonQt support. Python modules will not work.\n" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if( NOT INSTALL_CONFIG )
|
|
||||||
message( "-- WARNING: Configuration files will not be installed.\n" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add all targets to the build-tree export set
|
# Add all targets to the build-tree export set
|
||||||
set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" )
|
set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" )
|
||||||
set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
|
set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
|
||||||
|
@ -20,38 +20,50 @@
|
|||||||
# "python-$dotsuffix", where suffix is based on the `python_version` argument.
|
# "python-$dotsuffix", where suffix is based on the `python_version` argument.
|
||||||
# One can supply a custom component name by setting the
|
# One can supply a custom component name by setting the
|
||||||
# `CALAMARES_BOOST_PYTHON3_COMPONENT` variable at CMake time.
|
# `CALAMARES_BOOST_PYTHON3_COMPONENT` variable at CMake time.
|
||||||
|
|
||||||
set( CALAMARES_BOOST_PYTHON3_COMPONENT python3 CACHE STRING
|
set( CALAMARES_BOOST_PYTHON3_COMPONENT python3 CACHE STRING
|
||||||
"Name of the Boost.Python component. If Boost.Python is installed as
|
"Name of the Boost.Python component. If Boost.Python is installed as
|
||||||
libboost_python-foo.so then this variable should be set to 'python-foo'."
|
libboost_python-foo.so then this variable should be set to 'python-foo'."
|
||||||
)
|
)
|
||||||
|
|
||||||
macro( find_boost_python3 boost_version python_version found_var )
|
include(FindPackageHandleStandardArgs)
|
||||||
set( ${found_var} OFF )
|
|
||||||
|
|
||||||
# turns "3.4.123abc" into "34"
|
macro( _find_boost_python3_int boost_version componentname found_var )
|
||||||
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1\\2" _fbp_python_short_version ${python_version} )
|
foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} ${componentname} )
|
||||||
|
|
||||||
foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} python-py${_fbp_python_short_version} )
|
|
||||||
find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} )
|
find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} )
|
||||||
string( TOUPPER ${_fbp_name} _fbp_uc_name )
|
string( TOUPPER ${_fbp_name} _fbp_uc_name )
|
||||||
if( Boost_${_fbp_uc_name}_FOUND )
|
if( Boost_${_fbp_uc_name}_FOUND )
|
||||||
set( ${found_var} ON )
|
set( ${found_var} ${_fbp_uc_name} )
|
||||||
break()
|
break()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
if (NOT ${found_var})
|
macro( find_boost_python3 boost_version python_version found_var )
|
||||||
|
set( ${found_var} OFF )
|
||||||
|
set( _fbp_found OFF )
|
||||||
|
|
||||||
|
# turns "3.4.123abc" into "34"
|
||||||
|
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1\\2" _fbp_python_short_version ${python_version} )
|
||||||
|
_find_boost_python3_int( ${boost_version} python-py${_fbp_python_short_version} _fbp_found )
|
||||||
|
|
||||||
|
if (NOT _fbp_found)
|
||||||
# The following loop changes the searched name for Gentoo based distributions
|
# The following loop changes the searched name for Gentoo based distributions
|
||||||
# turns "3.4.123abc" into "3.4"
|
# turns "3.4.123abc" into "3.4"
|
||||||
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1.\\2" _fbp_python_short_version ${python_version} )
|
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1.\\2" _fbp_python_short_version ${python_version} )
|
||||||
foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} python-${_fbp_python_short_version} )
|
_find_boost_python3_int( ${boost_version} python-${_fbp_python_short_version} _fbp_found )
|
||||||
find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} )
|
|
||||||
string( TOUPPER ${_fbp_name} _fbp_uc_name )
|
|
||||||
if( Boost_${_fbp_uc_name}_FOUND )
|
|
||||||
set( ${found_var} ON )
|
|
||||||
break()
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set( ${found_var} ${_fbp_found} )
|
||||||
|
|
||||||
|
# This is superfluous, but allows proper reporting in the features list
|
||||||
|
if ( _fbp_found )
|
||||||
|
find_package( Boost ${boost_version} COMPONENTS ${_fbp_found} )
|
||||||
|
else()
|
||||||
|
find_package( Boost ${boost_version} COMPONENTS Python )
|
||||||
|
endif()
|
||||||
|
set_package_properties(
|
||||||
|
Boost PROPERTIES
|
||||||
|
DESCRIPTION "A C++ library which enables seamless interoperability between C++ and Python 3."
|
||||||
|
URL "http://www.boost.org"
|
||||||
|
)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
Loading…
Reference in New Issue
Block a user