diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-04-11 09:10:53 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-05-24 14:17:13 -0700 |
commit | f83faf28b3424ba60c3bdc40d408011c9c619c8a (patch) | |
tree | 9f3750f097feabe8c9493b8b5b9cc99bab3e7bd2 /host/CMakeLists.txt | |
parent | 6563c53743617215a18542db7d7050a04a0d409d (diff) | |
download | uhd-f83faf28b3424ba60c3bdc40d408011c9c619c8a.tar.gz uhd-f83faf28b3424ba60c3bdc40d408011c9c619c8a.tar.bz2 uhd-f83faf28b3424ba60c3bdc40d408011c9c619c8a.zip |
cmake: Remove ENABLE_PYTHON3 flag and simplify Python detection
- Makes use of more modern find_package(Python2/3) if available
- Moves almost all Python-related code to UHDPython.cmake
- ENABLE_PYTHON3 is no longer necessary
Diffstat (limited to 'host/CMakeLists.txt')
-rw-r--r-- | host/CMakeLists.txt | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 2d2e465d1..916138ee9 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -6,11 +6,6 @@ # ######################################################################## -#if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) -# message(FATAL_ERROR "Prevented in-tree built. This is bad practice.") -#endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - -######################################################################## # Project setup ######################################################################## # NOTE! If you change the version in the following line, also change @@ -38,6 +33,7 @@ set(MSVC_MIN_VERSION_READABLE "14.0") # This Python version gets used for Python API (if requested) as well as # all the build-time Python scripts set(PYTHON_MIN_VERSION "2.7") +set(PYTHON3_MIN_VERSION "3.5") # Other deps set(BOOST_MIN_VERSION "1.58") set(NUMPY_MIN_VERSION "1.7") @@ -279,15 +275,6 @@ if(WIN32) endif(WIN32) ######################################################################## -# Choose a version of Python -######################################################################## -option(ENABLE_PYTHON3 "Enable Python 3. Default is Python 2" OFF) -set(PYBIND11_PYTHON_VERSION 2.7) -if(${ENABLE_PYTHON3}) - set(PYBIND11_PYTHON_VERSION 3) -endif() - -######################################################################## # Setup Boost ######################################################################## message(STATUS "") @@ -327,7 +314,6 @@ set(Boost_ADDITIONAL_VERSIONS "1.64" "1.65" "1.66" "1.67" "1.68" "1.69" ) -#Python API requirements message(STATUS "Looking for optional Boost components...") find_package(Boost ${BOOST_MIN_VERSION} OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS}) @@ -352,18 +338,11 @@ include(UHDLog) ######################################################################## # Check Python Modules ######################################################################## -find_package(PythonInterp ${PYBIND11_PYTHON_VERSION}) -find_package(PythonLibs ${PYBIND11_PYTHON_VERSION}) include(UHDPython) -set(PYTHON_VERSION "platform.python_version() >= '2.7' and platform.python_version() < '3.0'") -if(${ENABLE_PYTHON3}) - set(PYTHON_VERSION "platform.python_version() >= '3.0'") -endif() - PYTHON_CHECK_MODULE( - "Python version ${PYBIND11_PYTHON_VERSION} or greater" - "platform" ${PYTHON_VERSION} + "Python version ${PYTHON_MIN_VERSION} or greater" + "platform" "platform.python_version() >= '${PYTHON_MIN_VERSION}'" HAVE_PYTHON_PLAT_MIN_VERSION ) @@ -385,8 +364,6 @@ PYTHON_CHECK_MODULE( HAVE_PYTHON_MODULE_NUMPY ) -set(PYTHON_ADDITIONAL_VERSIONS 2.7 3.4 3.5) - ######################################################################## # Create Uninstall Target ######################################################################## @@ -415,9 +392,9 @@ UHD_INSTALL(FILES LIBUHD_REGISTER_COMPONENT("LibUHD" ENABLE_LIBUHD ON "Boost_FOUND;HAVE_PYTHON_PLAT_MIN_VERSION;HAVE_PYTHON_MODULE_MAKO" OFF ON) LIBUHD_REGISTER_COMPONENT("LibUHD - C API" ENABLE_C_API ON "ENABLE_LIBUHD" OFF OFF) if(WIN32) - LIBUHD_REGISTER_COMPONENT("LibUHD - Python API" ENABLE_PYTHON_API OFF "ENABLE_LIBUHD;HAVE_PYTHON_MODULE_NUMPY;PythonLibs_FOUND" OFF OFF) + LIBUHD_REGISTER_COMPONENT("LibUHD - Python API" ENABLE_PYTHON_API OFF "ENABLE_LIBUHD;HAVE_PYTHON_MODULE_NUMPY;HAVE_PYTHON_LIBS" OFF OFF) else() - LIBUHD_REGISTER_COMPONENT("LibUHD - Python API" ENABLE_PYTHON_API ON "ENABLE_LIBUHD;HAVE_PYTHON_MODULE_NUMPY;PythonLibs_FOUND" OFF OFF) + LIBUHD_REGISTER_COMPONENT("LibUHD - Python API" ENABLE_PYTHON_API ON "ENABLE_LIBUHD;HAVE_PYTHON_MODULE_NUMPY;HAVE_PYTHON_LIBS" OFF OFF) endif(WIN32) LIBUHD_REGISTER_COMPONENT("Examples" ENABLE_EXAMPLES ON "ENABLE_LIBUHD" OFF OFF) LIBUHD_REGISTER_COMPONENT("Utils" ENABLE_UTILS ON "ENABLE_LIBUHD" OFF OFF) |