diff --git a/Pyext/CMakeLists.txt b/Pyext/CMakeLists.txt index 790822c..83f9c0b 100644 --- a/Pyext/CMakeLists.txt +++ b/Pyext/CMakeLists.txt @@ -40,99 +40,28 @@ include_directories( ../CSim/src ) -message( STATUS " CMAKE_VERSION : ${CMAKE_VERSION}, need cmake version >= 3.12.0 to build ecflow python3 extension" ) -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - # We only support python2 extension for cmake less 3.12.0 - # cmake 3.12.0 or greater allows multiple boost python libs & hence multiple extensions to be built - # Using -DPYTHON_EXECUTABLE=/usr/local/apps/python3/3.6.5-01/bin/python3 is not suffcient as the wrong(python2) libs are found - ecbuild_find_python( VERSION 2.6 REQUIRED ) - message( STATUS " PYTHON_FOUND : ${PYTHON_FOUND}" ) - message( STATUS " PYTHONINTERP_FOUND : ${PYTHONINTERP_FOUND}" ) - message( STATUS " PYTHONLIBS_FOUND : ${PYTHONLIBS_FOUND}" ) - message( STATUS " PYTHON_VERSION_STRING : ${PYTHON_VERSION_STRING}" ) - message( STATUS " PYTHON_VERSION_MAJOR : ${PYTHON_VERSION_MAJOR}" ) - message( STATUS " PYTHON_VERSION_MINOR : ${PYTHON_VERSION_MINOR}" ) - message( STATUS " PYTHON_VERSION_PATCH : ${PYTHON_VERSION_PATCH}" ) - message( STATUS " PYTHON_CONFIG_EXECUTABLE : ${PYTHON_CONFIG_EXECUTABLE}" ) - message( STATUS " PYTHON_EXECUTABLE : ${PYTHON_EXECUTABLE}" ) - message( STATUS " PYTHON_INCLUDE_DIRS : ${PYTHON_INCLUDE_DIRS}" ) - message( STATUS " PYTHON_LIBRARIES : ${PYTHON_LIBRARIES}" ) - if (${PYTHON_VERSION_MAJOR} EQUAL 3) - ecbuild_error("Need cmake version >= 3.12.0 to build ecflow python3 extension, current cmake version is ${CMAKE_VERSION}") - endif() - find_package( Boost ${ECFLOW_BOOST_VERSION} REQUIRED COMPONENTS python ) - add_subdirectory( python2 ) -else() - # ====================================================================================== - # Attempt to build both python2 and python3 ecflow extension, depending on what is found - # this assumes cmake 3.12.0 min, which added support for boost python2 and python3 - # ====================================================================================== - find_package(Python2 COMPONENTS Interpreter Development) - message( STATUS " Python2_FOUND : ${Python2_FOUND}" ) - if (Python2_FOUND) - if ( NOT Python2_LIBRARIES ) - ecbuild_error("ecflow python extension is enabled, but python2 libraries not found") - endif() - - # ***************************************************************************************** - # Although we have found python2 it could be that *ONLY* python3 was module loaded - # Otherwise will build for python2 and test with python3 interpreter - # ***************************************************************************************** - ecbuild_find_python( VERSION 2.6 REQUIRED ) # if not included iterpreter not found ? - if ( ${PYTHON_VERSION_MAJOR} EQUAL 2) - message( STATUS " Python2_Interpreter_FOUND : ${Python2_Interpreter_FOUND}" ) - message( STATUS " Python2_EXECUTABLE : ${Python2_EXECUTABLE}" ) - message( STATUS " Python2_STDLIB : ${Python2_STDLIB} Standard platform independent installation directory" ) - message( STATUS " Python2_STDARCH : ${Python2_STDARCH} Standard platform dependent installation directory." ) - message( STATUS " Python2_Development_FOUND : ${Python2_Development_FOUND}" ) - message( STATUS " Python2_INCLUDE_DIRS : ${Python2_INCLUDE_DIRS}" ) - message( STATUS " Python2_LIBRARIES : ${Python2_LIBRARIES}" ) - message( STATUS " Python2_LIBRARY_DIRS : ${Python2_LIBRARY_DIRS}" ) - message( STATUS " Python2_VERSION : ${Python2_VERSION}" ) - message( STATUS " Python2_VERSION_MAJOR : ${Python2_VERSION_MAJOR}" ) - message( STATUS " Python2_VERSION_MINOR : ${Python2_VERSION_MINOR}" ) - message( STATUS " Python2_VERSION_PATCH : ${Python2_VERSION_PATCH}" ) - - message( STATUS " PYTHON_FOUND : ${PYTHON_FOUND}" ) - message( STATUS " PYTHONINTERP_FOUND : ${PYTHONINTERP_FOUND}" ) - message( STATUS " PYTHONLIBS_FOUND : ${PYTHONLIBS_FOUND}" ) - message( STATUS " PYTHON_VERSION_STRING : ${PYTHON_VERSION_STRING}" ) - message( STATUS " PYTHON_VERSION_MAJOR : ${PYTHON_VERSION_MAJOR}" ) - message( STATUS " PYTHON_VERSION_MINOR : ${PYTHON_VERSION_MINOR}" ) - message( STATUS " PYTHON_VERSION_PATCH : ${PYTHON_VERSION_PATCH}" ) - message( STATUS " PYTHON_CONFIG_EXECUTABLE : ${PYTHON_CONFIG_EXECUTABLE}" ) - message( STATUS " PYTHON_EXECUTABLE : ${PYTHON_EXECUTABLE}" ) - message( STATUS " PYTHON_INCLUDE_DIRS : ${PYTHON_INCLUDE_DIRS}" ) - message( STATUS " PYTHON_LIBRARIES : ${PYTHON_LIBRARIES}" ) - - find_package( Boost ${ECFLOW_BOOST_VERSION} REQUIRED COMPONENTS python ) - add_subdirectory( python2 ) - endif() - endif() - - find_package(Python3 COMPONENTS Interpreter Development) - message( STATUS " Python3_FOUND : ${Python3_FOUND}" ) - if (Python3_FOUND) - message( STATUS " Python3_Interpreter_FOUND : ${Python3_Interpreter_FOUND}" ) - message( STATUS " Python3_EXECUTABLE : ${Python3_EXECUTABLE}" ) - message( STATUS " Python3_STDLIB : ${Python3_STDLIB} Standard platform independent installation directory" ) - message( STATUS " Python3_STDARCH : ${Python3_STDARCH} Standard platform dependent installation directory." ) - message( STATUS " Python3_Development_FOUND : ${Python3_Development_FOUND}" ) - message( STATUS " Python3_INCLUDE_DIRS : ${Python3_INCLUDE_DIRS}" ) - message( STATUS " Python3_LIBRARIES : ${Python3_LIBRARIES}" ) - message( STATUS " Python3_LIBRARY_DIRS : ${Python3_LIBRARY_DIRS}" ) - message( STATUS " Python3_VERSION : ${Python3_VERSION}" ) - message( STATUS " Python3_VERSION_MAJOR : ${Python3_VERSION_MAJOR}" ) - message( STATUS " Python3_VERSION_MINOR : ${Python3_VERSION_MINOR}" ) - message( STATUS " Python3_VERSION_PATCH : ${Python3_VERSION_PATCH}" ) - - if ( NOT Python3_LIBRARIES ) - ecbuild_error("ecflow python extension is enabled, but python3 libraries not found") - endif() - - ecbuild_find_python( VERSION ${Python3_VERSION} REQUIRED ) - - find_package( Boost ${ECFLOW_BOOST_VERSION} REQUIRED COMPONENTS python3 ) - add_subdirectory( python3 ) - endif() +find_package(Python3 COMPONENTS Interpreter Development) +message( STATUS " Python3_FOUND : ${Python3_FOUND}" ) +if (Python3_FOUND) + message( STATUS " Python3_Interpreter_FOUND : ${Python3_Interpreter_FOUND}" ) + message( STATUS " Python3_EXECUTABLE : ${Python3_EXECUTABLE}" ) + message( STATUS " Python3_STDLIB : ${Python3_STDLIB} Standard platform independent installation directory" ) + message( STATUS " Python3_STDARCH : ${Python3_STDARCH} Standard platform dependent installation directory." ) + message( STATUS " Python3_Development_FOUND : ${Python3_Development_FOUND}" ) + message( STATUS " Python3_INCLUDE_DIRS : ${Python3_INCLUDE_DIRS}" ) + message( STATUS " Python3_LIBRARIES : ${Python3_LIBRARIES}" ) + message( STATUS " Python3_LIBRARY_DIRS : ${Python3_LIBRARY_DIRS}" ) + message( STATUS " Python3_VERSION : ${Python3_VERSION}" ) + message( STATUS " Python3_VERSION_MAJOR : ${Python3_VERSION_MAJOR}" ) + message( STATUS " Python3_VERSION_MINOR : ${Python3_VERSION_MINOR}" ) + message( STATUS " Python3_VERSION_PATCH : ${Python3_VERSION_PATCH}" ) + + if ( NOT Python3_LIBRARIES ) + ecbuild_error("ecflow python extension is enabled, but python3 libraries not found") + endif() + + ecbuild_find_python( VERSION ${Python3_VERSION} REQUIRED ) + + find_package( Boost ${ECFLOW_BOOST_VERSION} REQUIRED COMPONENTS python37 ) + add_subdirectory( python3 ) endif()