diff options
author | Samuel O'Brien <sam.obrien@ni.com> | 2020-08-03 12:10:53 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-10-07 15:29:19 -0500 |
commit | f54a22c60a0cbe990c9d3892f4c565d64226196b (patch) | |
tree | 6d12ddf64859fa51140e14264899de6c9f94b9b5 | |
parent | bfff8b79b950f2f1cebfd2db662a4205df5da65a (diff) | |
download | uhd-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>
-rw-r--r-- | host/python/CMakeLists.txt | 57 | ||||
-rwxr-xr-x | mpm/python/setup.py.in | 1 | ||||
-rwxr-xr-x | mpm/python/tests/CMakeLists.txt | 4 |
3 files changed, 61 insertions, 1 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 diff --git a/mpm/python/setup.py.in b/mpm/python/setup.py.in index e131f02f1..226cf0270 100755 --- a/mpm/python/setup.py.in +++ b/mpm/python/setup.py.in @@ -36,6 +36,7 @@ setup(name='usrp_mpm', 'usrp_mpm.cores', 'usrp_mpm.sys_utils', 'usrp_mpm.xports', + 'usrp_mpm.simulator', ], install_requires=[ 'mprpc', diff --git a/mpm/python/tests/CMakeLists.txt b/mpm/python/tests/CMakeLists.txt index 26dcad40a..36bff9d3a 100755 --- a/mpm/python/tests/CMakeLists.txt +++ b/mpm/python/tests/CMakeLists.txt @@ -10,5 +10,7 @@ add_test( NAME mpm_unit_tests - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run_unit_tests.py ${MPM_DEVICE} + COMMAND ${CMAKE_COMMAND} -E env + PYTHONPATH=${CMAKE_BINARY_DIR}/python + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run_unit_tests.py ${MPM_DEVICE} ) |