aboutsummaryrefslogtreecommitdiffstats
path: root/host/python/CMakeLists.txt
diff options
context:
space:
mode:
authorSamuel O'Brien <sam.obrien@ni.com>2020-08-03 12:10:53 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-10-07 15:29:19 -0500
commitf54a22c60a0cbe990c9d3892f4c565d64226196b (patch)
tree6d12ddf64859fa51140e14264899de6c9f94b9b5 /host/python/CMakeLists.txt
parentbfff8b79b950f2f1cebfd2db662a4205df5da65a (diff)
downloaduhd-f54a22c60a0cbe990c9d3892f4c565d64226196b.tar.gz
uhd-f54a22c60a0cbe990c9d3892f4c565d64226196b.tar.bz2
uhd-f54a22c60a0cbe990c9d3892f4c565d64226196b.zip
sim: Embed MPM into libpyuhd
When ENABLE_SIM and ENABLE_PYTHON_API are set, this commit embeds MPM (Built with -DMPM_DEVICE=sim) into the pyuhd package. Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
Diffstat (limited to 'host/python/CMakeLists.txt')
-rw-r--r--host/python/CMakeLists.txt57
1 files changed, 57 insertions, 0 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt
index dfe049b87..a8d974936 100644
--- a/host/python/CMakeLists.txt
+++ b/host/python/CMakeLists.txt
@@ -84,6 +84,63 @@ set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} NATIVE_CURRENT_BINARY_DIR)
configure_file(${SETUP_PY_IN} ${SETUP_PY})
+if(ENABLE_SIM)
+ set(MPM_DEVICE "sim")
+ add_subdirectory(${CMAKE_SOURCE_DIR}/../mpm/python simulator)
+ # simulator/usrp_mpm needs to be copied to usrp_mpm because setuptools only detects import packages in the working directory
+ add_custom_target(copy_mpm_packages ALL DEPENDS usrp_mpm)
+ add_custom_command(TARGET copy_mpm_packages
+ PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/dboard_manager
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/periph_manager
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/simulator
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/sys_utils
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/xports
+
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/dboard_manager/base.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/dboard_manager/__init__.py
+ ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/dboard_manager
+
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/periph_manager/base.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/periph_manager/common.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/periph_manager/sim.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/periph_manager/__init__.py
+ ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/periph_manager
+
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/simulator
+ ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/simulator
+
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/sys_utils
+ ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/sys_utils
+
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/xports/xportmgr_udp.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/xports/__init__.py
+ ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/xports
+
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/discovery.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/eeprom.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/ethdispatch.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/gpsd_iface.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/mpmlog.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/mpmtypes.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/mpmutils.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/prefs.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/rpc_server.py
+ ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/__init__.py
+ ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm)
+ # Move usrp_hwd.py into usrp_mpm so that it is included in the package
+ configure_file(${CMAKE_SOURCE_DIR}/../mpm/python/usrp_hwd.py
+ ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/usrp_hwd.py COPYONLY)
+ set(PYUHD_FILES ${PYUHD_FILES} copy_mpm_packages)
+endif(ENABLE_SIM)
+
add_custom_command(OUTPUT ${TIMESTAMP_FILE}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/uhd ${CMAKE_CURRENT_BINARY_DIR}/uhd
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q build