From 1868b15f558ca9b6e6f3e96f8a773789fa5a5468 Mon Sep 17 00:00:00 2001 From: Denis Arnaud Date: Tue, 15 Jan 2019 10:50:31 +0100 Subject: [PATCH] [Config] Now finds out automatically the right Boost.Python library version; and Python 3.4 is the new minimum required version --- CMakeLists.txt | 2 +- config/FindPythonLibsWrapper.cmake | 2 +- config/project_config_embeddable.cmake | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23b1fb7..8735b44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ packaging_set_other_options (TBZ2 "TBZ2;TGZ") ## Dependencies ## ######################################## # -get_external_libs (git "python 2.6" "boost 1.41" "mysql 5.0" "soci 3.0" +get_external_libs (git "python 3.4" "boost 1.41" "mysql 5.0" "soci 3.0" "zeromq 2.0" readline curses "doxygen 1.4" "gcov 4.6.3" "lcov 1.9" "stdair 1.00.0" "airrac 1.00.0" "rmol 1.00.0" "sevmgr 1.00.0") diff --git a/config/FindPythonLibsWrapper.cmake b/config/FindPythonLibsWrapper.cmake index 7b4736d..ceb57e3 100644 --- a/config/FindPythonLibsWrapper.cmake +++ b/config/FindPythonLibsWrapper.cmake @@ -22,7 +22,7 @@ if ("${PYTHON_LIBRARIES}" MATCHES "libpython[1-9.]*.a") # Set up the versions we know about, in the order we will search. Always add # the user supplied additional versions to the front. set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS} - 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + 3.7 3.6 3.5 3.4 2.8 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) foreach (_CURRENT_VERSION ${_Python_VERSIONS}) string (REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) diff --git a/config/project_config_embeddable.cmake b/config/project_config_embeddable.cmake index cfbbcf8..b59c284 100644 --- a/config/project_config_embeddable.cmake +++ b/config/project_config_embeddable.cmake @@ -497,11 +497,19 @@ macro (get_python) # does not seem to provide that version variable. get_filename_component (PYTHONLIBS_LIB_FILENAME ${PYTHON_LIBRARIES} NAME) string (REGEX REPLACE "^libpython([0-9]+.[0-9]+).*$" "\\1" - PYTHONLIBS_VERSION "${PYTHONLIBS_LIB_FILENAME}") - message (STATUS "Found PythonLibs ${PYTHONLIBS_VERSION}") + PYTHONLIBS_VERSION "${PYTHONLIBS_LIB_FILENAME}") + + if (${PYTHONLIBS_VERSION_STRING} MATCHES "([0-9]).([0-9]).([0-9])") + set (PY_MAJOR_VERSION "${CMAKE_MATCH_1}") + set (PY_MINOR_VERSION "${CMAKE_MATCH_2}") + set (PY_PATCH_VERSION "${CMAKE_MATCH_3}") + endif (${PYTHONLIBS_VERSION_STRING} MATCHES "([0-9]).([0-9]).([0-9])") + + message (STATUS "Found PythonLibs ${PYTHONLIBS_VERSION} (${PYTHONLIBS_VERSION_STRING} / ${PY_MAJOR_VERSION}.${PY_MINOR_VERSION}.${PY_PATCH_VERSION})") # Set the Python installation directory - set (INSTALL_PY_LIB_DIR ${INSTALL_LIB_DIR}/python${PYTHONLIBS_VERSION}/site-packages/py${PROJECT_NAME} + set (INSTALL_PY_LIB_DIR + ${INSTALL_LIB_DIR}/python${PYTHONLIBS_VERSION}/site-packages/py${PROJECT_NAME} CACHE PATH "Installation directory for Python libraries") # Update the list of include directories for the project @@ -518,7 +526,9 @@ endmacro (get_python) # ~~~~~~~~~~ ICU ~~~~~~~~~ macro (get_icu) - # cmake_policy(SET CMP0074 NEW) + if (${CMAKE_VERSION} VERSION_GREATER 3.12) + cmake_policy (SET CMP0074 NEW) + endif (${CMAKE_VERSION} VERSION_GREATER 3.12) unset (_required_version) if (${ARGC} GREATER 0) set (_required_version ${ARGV0}) @@ -601,12 +611,13 @@ macro (get_boost) # Note: ${Boost_DATE_TIME_LIBRARY} and ${Boost_PROGRAM_OPTIONS_LIBRARY} # are already set by ${SOCIMYSQL_LIBRARIES} and/or ${SOCI_LIBRARIES}. # + set (python_component_name "python${PY_MAJOR_VERSION}${PY_MINOR_VERSION}") set (Boost_USE_STATIC_LIBS OFF) set (Boost_USE_MULTITHREADED ON) set (Boost_USE_STATIC_RUNTIME OFF) set (BOOST_REQUIRED_COMPONENTS_FOR_LIB date_time random iostreams serialization filesystem system - locale python27 python34 regex) + locale ${python_component_name} regex) set (BOOST_REQUIRED_COMPONENTS_FOR_BIN program_options) set (BOOST_REQUIRED_COMPONENTS_FOR_TST unit_test_framework) set (BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS_FOR_LIB} @@ -2535,6 +2546,7 @@ macro (display_python) message (STATUS) message (STATUS "* Python:") message (STATUS " - PYTHONLIBS_VERSION ............ : ${PYTHONLIBS_VERSION}") + message (STATUS " - PY_{MAJOR,MINOR,PATCH}_VERSION : ${PY_MAJOR_VERSION}.${PY_MINOR_VERSION}.${PY_PATCH_VERSION}") message (STATUS " - PYTHON_LIBRARIES .............. : ${PYTHON_LIBRARIES}") message (STATUS " - PYTHON_INCLUDE_PATH ........... : ${PYTHON_INCLUDE_PATH}") message (STATUS " - PYTHON_INCLUDE_DIRS ........... : ${PYTHON_INCLUDE_DIRS}")