diff options
author | Paul David <paul.david@ettus.com> | 2017-05-02 14:10:05 -0400 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-06-20 19:02:32 -0500 |
commit | e74cf7635ba3360b5b7002a2f7317941f65ffa16 (patch) | |
tree | 46b63039f31c5aedf26773b4b626b2a7932999db /host/python/CMakeLists.txt | |
parent | 22e24497a510c174e6de7718ad918a423d1973dd (diff) | |
download | uhd-e74cf7635ba3360b5b7002a2f7317941f65ffa16.tar.gz uhd-e74cf7635ba3360b5b7002a2f7317941f65ffa16.tar.bz2 uhd-e74cf7635ba3360b5b7002a2f7317941f65ffa16.zip |
python: Separating exposed Python data structures
- Separating exposed Python data structures into logical sections
- Exposes all of the multi_usrp API
- Adds a layer of Python for documentation and adding helper methods
- Adds improvements and fixes to the MultiUSRP object
- Includes additional exposed data structures (like time_spec_t, etc.)
- Add code to release the Python GIL during long C++ calls
Diffstat (limited to 'host/python/CMakeLists.txt')
-rw-r--r-- | host/python/CMakeLists.txt | 75 |
1 files changed, 29 insertions, 46 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index f4effa1c4..a650529fa 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -1,30 +1,19 @@ # -# Copyright 2017 Ettus Research LLC +# Copyright 2017-2018 Ettus Research, a National Instruments Company # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later # ######################################################################## # This file included, use CMake directory variables ######################################################################## - PYTHON_CHECK_MODULE( - "virtualenv" - "sys" "hasattr(sys, 'real_prefix')" - HAVE_PYTHON_VIRTUALENV - ) + "virtualenv" + "sys" "hasattr(sys, 'real_prefix')" + HAVE_PYTHON_VIRTUALENV +) + # Get include dirs INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) EXECUTE_PROCESS( @@ -32,7 +21,7 @@ EXECUTE_PROCESS( "from __future__ import print_function\ntry:\n import numpy\n import os\n inc_path = numpy.get_include()\n if os.path.exists(os.path.join(inc_path, 'numpy', 'arrayobject.h')):\n print(inc_path, end='')\nexcept:\n pass" OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR) -# Build libpyuhd.so +# Build pyuhd library ADD_LIBRARY(pyuhd SHARED pyuhd.cpp) TARGET_INCLUDE_DIRECTORIES(pyuhd PUBLIC ${PYTHON_NUMPY_INCLUDE_DIR} @@ -42,7 +31,7 @@ TARGET_LINK_LIBRARIES(pyuhd ${BOOST_PYTHON_LIBRARY} ${Boost_LIBRARIES} ${PYTHON_ # Copy pyuhd library to the staging directory SET(PYUHD_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}pyuhd${CMAKE_SHARED_LIBRARY_SUFFIX}) ADD_CUSTOM_COMMAND(TARGET pyuhd - POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libpyuhd.so ${CMAKE_CURRENT_BINARY_DIR}/uhd/libpyuhd.so) + POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:pyuhd> ${CMAKE_CURRENT_BINARY_DIR}/uhd/${PYUHD_LIBRARY_NAME}) SET(PYUHD_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py @@ -51,33 +40,27 @@ SET(PYUHD_FILES ${CMAKE_CURRENT_SOURCE_DIR}/filters.py ) -SET(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") -SET(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") -SET(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") +SET(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") +SET(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") +SET(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") - SET(PYUHD_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py - ${CMAKE_CURRENT_SOURCE_DIR}/pyuhd.py - ) - SET(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") - SET(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") - SET(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") +CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY}) - CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY}) +ADD_CUSTOM_COMMAND(OUTPUT ${TIMESTAMP_FILE} + COMMAND ${CMAKE_COMMAND} -E copy ${PYUHD_FILES} ${CMAKE_CURRENT_BINARY_DIR}/uhd + COMMAND ${PYTHON} ${SETUP_PY} -q build + COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_FILE} + DEPENDS ${PYUHD_FILES}) - ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT} - COMMAND ${CMAKE_COMMAND} -E copy ${PYUHD_FILES} ${CMAKE_CURRENT_BINARY_DIR}/uhd - COMMAND ${PYTHON} ${SETUP_PY} -q build - COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} - DEPENDS ${PYUHD_FILES}) - ADD_CUSTOM_TARGET(target ALL DEPENDS ${OUTPUT} pyuhd) - IF(HAVE_PYTHON_VIRTUALENV) - INSTALL(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} -q install --force)") - ELSE() - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c - "from distutils import sysconfig; print sysconfig.get_python_lib(plat_specific=True, prefix='')" - OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE - ) - INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build/lib/uhd DESTINATION ${CMAKE_INSTALL_PREFIX}/${UHD_PYTHON_DIR}) - ENDIF() +ADD_CUSTOM_TARGET(pyuhd_library ALL DEPENDS ${TIMESTAMP_FILE} pyuhd) +IF(HAVE_PYTHON_VIRTUALENV) + INSTALL(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} -q install --force)") +ELSE() + EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c + "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix=''))" + OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE + ) + MESSAGE(STATUS "Utilizing the python install directory: ${CMAKE_INSTALL_PREFIX}/${UHD_PYTHON_DIR}") + INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/uhd DESTINATION ${CMAKE_INSTALL_PREFIX}/${UHD_PYTHON_DIR}) +ENDIF() |