diff --git a/CMakeLists.txt b/CMakeLists.txt index da6f04331..2b10ef346 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -568,9 +568,6 @@ if(NOT VOLK_GNSSSDR_FOUND) # Find Python required modules ############################### include(SetupPython) # sets PYTHON_EXECUTABLE and search for required modules - GNSSSDR_PYTHON_CHECK_MODULE("python >= ${GNSSSDR_PYTHON_MIN_VERSION}" sys "sys.version.split()[0] >= '${GNSSSDR_PYTHON_MIN_VERSION}'" PYTHON_MIN_VER_FOUND) - GNSSSDR_PYTHON_CHECK_MODULE("mako >= ${GNSSSDR_MAKO_MIN_VERSION}" mako "mako.__version__ >= '${GNSSSDR_MAKO_MIN_VERSION}'" MAKO_FOUND) - GNSSSDR_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND) if(NOT PYTHON_MIN_VER_FOUND) message(FATAL_ERROR "Python ${GNSSSDR_PYTHON_MIN_VERSION} or greater required to build VOLK_GNSSSDR") diff --git a/cmake/Modules/SetupPython.cmake b/cmake/Modules/SetupPython.cmake index 01fc9a512..b643364b8 100644 --- a/cmake/Modules/SetupPython.cmake +++ b/cmake/Modules/SetupPython.cmake @@ -16,46 +16,6 @@ # along with GNSS-SDR. If not, see . -######################################################################## -# Setup the python interpreter: -# This allows the user to specify a specific interpreter, -# or finds the interpreter via the built-in cmake module. -######################################################################## - -if (PYTHON_EXECUTABLE) - message(STATUS "User set python executable ${PYTHON_EXECUTABLE}") - string(FIND "${PYTHON_EXECUTABLE}" "python3" IS_PYTHON3) - if(IS_PYTHON3 EQUAL -1) - find_package(PythonInterp ${GNSSSDR_PYTHON_MIN_VERSION} REQUIRED) - else(IS_PYTHON3 EQUAL -1) - find_package(PythonInterp ${GNSSSDR_PYTHON3_MIN_VERSION} REQUIRED) - endif(IS_PYTHON3 EQUAL -1) -else (PYTHON_EXECUTABLE) - message(STATUS "PYTHON_EXECUTABLE not set - using default python2") - message(STATUS "Use -DPYTHON_EXECUTABLE=/path/to/python3 to build for python3.") - find_package(PythonInterp ${GNSSSDR_PYTHON_MIN_VERSION}) - if(NOT PYTHONINTERP_FOUND) - message(STATUS "python2 not found - trying with python3") - find_package(PythonInterp ${GNSSSDR_PYTHON3_MIN_VERSION} REQUIRED) - endif(NOT PYTHONINTERP_FOUND) -endif (PYTHON_EXECUTABLE) - -if (${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3) - set(PYTHON3 TRUE) -endif () - -find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT) - -if (CMAKE_CROSSCOMPILING) - set(QA_PYTHON_EXECUTABLE "/usr/bin/python") -else (CMAKE_CROSSCOMPILING) - set(QA_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE}) -endif(CMAKE_CROSSCOMPILING) - -#make the path to the executable appear in the cmake gui -set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") -set(QA_PYTHON_EXECUTABLE ${QA_PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter for QA tests") - ######################################################################## # Check for the existence of a python module: # - desc a string description of the check @@ -90,3 +50,72 @@ except: pass #########################################" "${have}") endmacro(GNSSSDR_PYTHON_CHECK_MODULE) + + +######################################################################## +# Setup the python interpreter: +# This allows the user to specify a specific interpreter, +# or finds the interpreter via the built-in cmake module. +######################################################################## + +if(CMAKE_VERSION VERSION_LESS 3.12) + if(PYTHON_EXECUTABLE) + message(STATUS "User set python executable ${PYTHON_EXECUTABLE}") + string(FIND "${PYTHON_EXECUTABLE}" "python3" IS_PYTHON3) + if(IS_PYTHON3 EQUAL -1) + find_package(PythonInterp ${GNSSSDR_PYTHON_MIN_VERSION} REQUIRED) + else(IS_PYTHON3 EQUAL -1) + find_package(PythonInterp ${GNSSSDR_PYTHON3_MIN_VERSION} REQUIRED) + endif(IS_PYTHON3 EQUAL -1) + GNSSSDR_PYTHON_CHECK_MODULE("python >= ${GNSSSDR_PYTHON_MIN_VERSION}" sys "sys.version.split()[0] >= '${GNSSSDR_PYTHON_MIN_VERSION}'" PYTHON_MIN_VER_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("mako >= ${GNSSSDR_MAKO_MIN_VERSION}" mako "mako.__version__ >= '${GNSSSDR_MAKO_MIN_VERSION}'" MAKO_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND) + else(PYTHON_EXECUTABLE) + message(STATUS "PYTHON_EXECUTABLE not set - trying by default python2") + message(STATUS "Use -DPYTHON_EXECUTABLE=/path/to/python3 to build for python3.") + find_package(PythonInterp ${GNSSSDR_PYTHON_MIN_VERSION}) + if(NOT PYTHONINTERP_FOUND) + message(STATUS "python2 not found - trying with python3") + find_package(PythonInterp ${GNSSSDR_PYTHON3_MIN_VERSION} REQUIRED) + endif(NOT PYTHONINTERP_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("python >= ${GNSSSDR_PYTHON_MIN_VERSION}" sys "sys.version.split()[0] >= '${GNSSSDR_PYTHON_MIN_VERSION}'" PYTHON_MIN_VER_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("mako >= ${GNSSSDR_MAKO_MIN_VERSION}" mako "mako.__version__ >= '${GNSSSDR_MAKO_MIN_VERSION}'" MAKO_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND) + endif(PYTHON_EXECUTABLE) + find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT) +else(CMAKE_VERSION VERSION_LESS 3.12) + find_package (Python3 COMPONENTS Interpreter Development) + if(Python3_FOUND) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + set(PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR}) + GNSSSDR_PYTHON_CHECK_MODULE("python >= ${GNSSSDR_PYTHON_MIN_VERSION}" sys "sys.version.split()[0] >= '${GNSSSDR_PYTHON_MIN_VERSION}'" PYTHON_MIN_VER_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("mako >= ${GNSSSDR_MAKO_MIN_VERSION}" mako "mako.__version__ >= '${GNSSSDR_MAKO_MIN_VERSION}'" MAKO_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND) + endif(Python3_FOUND) + if(NOT Python3_FOUND OR NOT MAKO_FOUND OR NOT SIX_FOUND) + find_package(Python2 COMPONENTS Interpreter Development) + if(Python2_FOUND) + set(PYTHON_EXECUTABLE ${Python2_EXECUTABLE}) + set(PYTHON_VERSION_MAJOR ${Python2_VERSION_MAJOR}) + GNSSSDR_PYTHON_CHECK_MODULE("python >= ${GNSSSDR_PYTHON_MIN_VERSION}" sys "sys.version.split()[0] >= '${GNSSSDR_PYTHON_MIN_VERSION}'" PYTHON_MIN_VER_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("mako >= ${GNSSSDR_MAKO_MIN_VERSION}" mako "mako.__version__ >= '${GNSSSDR_MAKO_MIN_VERSION}'" MAKO_FOUND) + GNSSSDR_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND) + endif(Python2_FOUND) + endif(NOT Python3_FOUND OR NOT MAKO_FOUND OR NOT SIX_FOUND) +endif(CMAKE_VERSION VERSION_LESS 3.12) + +if(${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3) + set(PYTHON3 TRUE) +endif(${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3) + + +if(CMAKE_CROSSCOMPILING) + set(QA_PYTHON_EXECUTABLE "/usr/bin/python") +else(CMAKE_CROSSCOMPILING) + set(QA_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE}) +endif(CMAKE_CROSSCOMPILING) + + +#make the path to the executable appear in the cmake gui +set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") +set(QA_PYTHON_EXECUTABLE ${QA_PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter for QA tests") diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake index 074b7003e..56eb75d47 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkBoost.cmake @@ -61,6 +61,8 @@ set(Boost_ADDITIONAL_VERSIONS "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" + "1.70.0" "1.70" "1.71.0" "1.71" "1.72.0" "1.72" "1.73.0" "1.73" "1.74.0" "1.74" + "1.75.0" "1.75" "1.76.0" "1.76" "1.77.0" "1.77" "1.78.0" "1.78" "1.79.0" "1.79" ) # Boost 1.52 disabled, see https://svn.boost.org/trac/boost/ticket/7669 diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake index 9f29d2de7..cc68e91c4 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake @@ -27,24 +27,37 @@ set(__INCLUDED_VOLK_PYTHON_CMAKE TRUE) ######################################################################## set(VOLK_PYTHON_MIN_VERSION "2.7") set(VOLK_PYTHON3_MIN_VERSION "3.4") -if (PYTHON_EXECUTABLE) - message(STATUS "User set python executable ${PYTHON_EXECUTABLE}") - find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION} REQUIRED) -else (PYTHON_EXECUTABLE) - message(STATUS "PYTHON_EXECUTABLE not set - using default python2") - message(STATUS "Use -DPYTHON_EXECUTABLE=/path/to/python3 to build for python3.") - find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION}) - if(NOT PYTHONINTERP_FOUND) - message(STATUS "python2 not found - using python3") - find_package(PythonInterp ${VOLK_PYTHON3_MIN_VERSION} REQUIRED) - endif(NOT PYTHONINTERP_FOUND) -endif (PYTHON_EXECUTABLE) + +if(CMAKE_VERSION VERSION_LESS 3.12) + if(PYTHON_EXECUTABLE) + message(STATUS "User set python executable ${PYTHON_EXECUTABLE}") + find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION} REQUIRED) + else(PYTHON_EXECUTABLE) + message(STATUS "PYTHON_EXECUTABLE not set - using default python2") + message(STATUS "Use -DPYTHON_EXECUTABLE=/path/to/python3 to build for python3.") + find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION}) + if(NOT PYTHONINTERP_FOUND) + message(STATUS "python2 not found - using python3") + find_package(PythonInterp ${VOLK_PYTHON3_MIN_VERSION} REQUIRED) + endif(NOT PYTHONINTERP_FOUND) + endif(PYTHON_EXECUTABLE) + find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT) +else(CMAKE_VERSION VERSION_LESS 3.12) + if(PYTHON_EXECUTABLE) + message(STATUS "User set python executable ${PYTHON_EXECUTABLE}") + find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION} REQUIRED) + else(PYTHON_EXECUTABLE) + find_package (Python COMPONENTS Interpreter Development) + set(PYTHON_VERSION_MAJOR ${Python_VERSION_MAJOR}) + set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) + endif(PYTHON_EXECUTABLE) +endif(CMAKE_VERSION VERSION_LESS 3.12) if (${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3) set(PYTHON3 TRUE) endif () -find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT) + ######################################################################## # Check for the existence of a python module: