From 932bab1eae69a96679eea7e20c2b602c4a9a52b9 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 9 Mar 2020 14:43:10 -0700 Subject: python: Arrange file in Python module into uhd/ subdirectory This adds the host/python/uhd subdirectory, which will add all files that go into the actual Python module once installed. Before, all Python files were directly in host/python and got sorted into their appropriate destination folders during configuration and installation. This change doesn't change anything (Python modules will look the same as they do now), except that it makes the source tree a tad neater, but more importantly, it creates a consistent directory structure when adding submodules to the uhd module. Apart from the PyBind11-generated shared object file (which gets generated during build time), the uhd/ subdirectory in host/python exactly resembles the Python module once installed, so it's more obvious where to add new submodules and files. --- host/python/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'host/python/CMakeLists.txt') diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index 9c5503881..a4929b977 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -65,12 +65,12 @@ endif(WIN32) add_custom_command(TARGET pyuhd POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}/uhd/$) -set(PYUHD_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py - ${CMAKE_CURRENT_SOURCE_DIR}/types.py - ${CMAKE_CURRENT_SOURCE_DIR}/usrp.py - ${CMAKE_CURRENT_SOURCE_DIR}/filters.py - ${CMAKE_CURRENT_SOURCE_DIR}/rfnoc.py +# List of Python files that are part of the module but don't get +# generated during build time. +# Note: When adding Python files into uhd/, they don't get added to the +# dependency list until CMake is re-run. +file(GLOB_RECURSE PYUHD_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/uhd/*.py ) set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") @@ -81,7 +81,7 @@ file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} NATIVE_CURRENT_BINARY_DIR) 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 ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/uhd ${CMAKE_CURRENT_BINARY_DIR}/uhd COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q build COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_FILE} DEPENDS ${PYUHD_FILES}) -- cgit v1.2.3