aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'host/utils/CMakeLists.txt')
-rw-r--r--host/utils/CMakeLists.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt
index 58eb842e1..834c69c19 100644
--- a/host/utils/CMakeLists.txt
+++ b/host/utils/CMakeLists.txt
@@ -157,6 +157,38 @@ 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}/share/uhd")
+
+# 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)