diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-05-01 14:31:11 -0700 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-05-05 08:04:50 -0500 |
commit | 6a488d32ebd128b0f320863723a6877113bde6dd (patch) | |
tree | 81a3bcb6d7d76d86c4406b62bc8ad17ac0b18f5d /host/utils/CMakeLists.txt | |
parent | 24527b39103b756581287f8e9e6082673645b1cd (diff) | |
download | uhd-6a488d32ebd128b0f320863723a6877113bde6dd.tar.gz uhd-6a488d32ebd128b0f320863723a6877113bde6dd.tar.bz2 uhd-6a488d32ebd128b0f320863723a6877113bde6dd.zip |
python: Move the rfnoc image builder module under the uhd module
Note: This commit changes nothing to the way the image builder is being
called. One can still run
rfnoc_image_builder [...]
as before. The difference is in the Python guts:
Where previously one had to do
import rfnoc
now the incantation becomes:
from uhd import imgbuilder
(Note that the submodule uhd.rfnoc already exists for wrapping the RFNoC
API into Python, hence the renaming from rfnoc to imgbuilder).
This is done for a variety of reasons:
- Now, there is only one and exactly one Python module for UHD that
contains all the things, as opposed to before where there were two.
- The rfnoc and uhd modules were installed in different ways (setuptools
vs. CMake); that is now harmonized. This also removes a lot of CMake
plumbing.
- It is not common to import the rfnoc module for anyone other than
rfnoc_image_builder
Diffstat (limited to 'host/utils/CMakeLists.txt')
-rw-r--r-- | host/utils/CMakeLists.txt | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index 958bffb97..08ace6a0c 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -26,6 +26,18 @@ foreach(util_source ${util_runtime_sources}) UHD_INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT utilities) endforeach(util_source) +set(CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR}") +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/rfnoc_image_builder.py" + "${CMAKE_CURRENT_BINARY_DIR}/rfnoc_image_builder" +) +UHD_INSTALL(PROGRAMS + ${CMAKE_CURRENT_BINARY_DIR}/rfnoc_image_builder + RENAME rfnoc_image_builder + DESTINATION ${RUNTIME_DIR} + COMPONENT utilities +) + ######################################################################## # Utilities that get installed into the share path ######################################################################## @@ -105,6 +117,7 @@ UHD_INSTALL(PROGRAMS DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities ) + if(LINUX) UHD_INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/uhd_images_downloader.py @@ -158,38 +171,6 @@ if(ENABLE_USRP2) endif(ENABLE_USRP2) ######################################################################## -# Python rfnoc package -######################################################################## -set(RFNOC_PKG_FILES "") -add_subdirectory(rfnoc) - -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(CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${PKG_DATA_DIR}") - -# construct site-package folder from install prefix -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c - "from __future__ import print_function; from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE RFNOC_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE -) - -configure_file(${SETUP_PY_IN} ${SETUP_PY}) -# rfnoc_image_builder uses RFNOC_PACKAGE_DIR to find python package location -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/rfnoc_image_builder" "${CMAKE_CURRENT_BINARY_DIR}/bin/rfnoc_image_builder") - -add_custom_command(OUTPUT ${OUTPUT} - COMMENT "build rfnoc package" - COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" -DBINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}" -P ${CMAKE_CURRENT_SOURCE_DIR}/copy_python_module.cmake - COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q build - COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} - DEPENDS ${RFNOC_PKG_FILES}) -add_custom_target(rfnoc ALL DEPENDS ${OUTPUT}) - -get_filename_component(SETUP_FOLDER ${SETUP_PY} DIRECTORY) -install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --force --prefix ${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${SETUP_FOLDER})") - -######################################################################## # Other files that are not utilities or executables ######################################################################## if(WIN32) |