diff options
Diffstat (limited to 'host/examples/rfnoc-example/cmake')
-rwxr-xr-x | host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in | 69 | ||||
-rw-r--r-- | host/examples/rfnoc-example/cmake/cmake_uninstall.cmake.in | 32 |
2 files changed, 101 insertions, 0 deletions
diff --git a/host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in b/host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in new file mode 100755 index 000000000..d1256cf97 --- /dev/null +++ b/host/examples/rfnoc-example/cmake/Modules/run_testbench.sh.in @@ -0,0 +1,69 @@ +#!@BASH@ + +if [[ ! $# -eq 4 ]]; then + echo "Usage: $0 uhd_fpga_dir test_device makefile_dir test_target" + echo "" + echo "Arguments:" + echo "- uhd_fpga_dir: Path to fpga repository (without usrp3/top)" + echo "- test_device: Device used for testing (e.g. x300, n3xx, e320)" + echo "- makefile_dir: Path to the directory with the testbench Makefile" + echo "- test_target: Test target (xsim, vsim)" + exit 0 +fi + +uhd_fpga_dir=$1 +uhd_fpga_dir_top=$uhd_fpga_dir/usrp3/top +test_device=$2 +test_target=$4 +makefile_dir=$3 +# Clear $# and pos args so setupenv.sh doesn't freak out +shift +shift +shift +shift + +# Need to convert device types to directory names +device_dir=$test_device +if [ $device_dir == "x310" ]; then + device_dir=x300 +fi +if [ $device_dir == "n300" ]; then + device_dir=n3xx +fi +if [ $device_dir == "n310" ]; then + device_dir=n3xx +fi +if [ $device_dir == "n320" ]; then + device_dir=n3xx +fi +if [ $device_dir == "e310" ]; then + device_dir=e31x +fi + +# Now check the paths are valid +if [ ! -r $uhd_fpga_dir_top/Makefile.common ]; then + echo "ERROR! '${uhd_fpga_dir_top}' is not a valid top-level FPGA directory." + exit 1 +fi +device_dir=$uhd_fpga_dir_top/$device_dir +if [ ! -r $device_dir/setupenv.sh ]; then + echo "ERROR! '${test_device}' is not a valid USRP device." + exit 1 +fi +echo "Using device directory: $device_dir" +if [ ! -r $makefile_dir/Makefile ]; then + echo "ERROR! '${makefile_dir}' does not point to an RFNoC block." + exit 1 +fi +# Check the Makefile actually contains a testbench target +if ! grep -q viv_simulator.mak $makefile_dir/Makefile; then + echo "ERROR! '${makefile_dir}/Makefile' does not contain a test target!." + exit 1 +fi + +# Load environment +echo "Loading environment from: '$device_dir/setupenv.sh'" +source $device_dir/setupenv.sh + +# And, go +make -C $makefile_dir $test_target UHD_FPGA_DIR=$uhd_fpga_dir || exit 1 diff --git a/host/examples/rfnoc-example/cmake/cmake_uninstall.cmake.in b/host/examples/rfnoc-example/cmake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..9ae1ae4bd --- /dev/null +++ b/host/examples/rfnoc-example/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,32 @@ +# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F + +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) |