diff options
Diffstat (limited to 'host/examples')
-rw-r--r-- | host/examples/gpio.cpp | 2 | ||||
-rw-r--r-- | host/examples/init_usrp/CMakeLists.txt | 19 | ||||
-rw-r--r-- | host/examples/test_dboard_coercion.cpp | 12 | ||||
-rw-r--r-- | host/examples/test_messages.cpp | 5 | ||||
-rw-r--r-- | host/examples/tx_waveforms.cpp | 1 |
5 files changed, 28 insertions, 11 deletions
diff --git a/host/examples/gpio.cpp b/host/examples/gpio.cpp index 02c73e96b..e47b2ab27 100644 --- a/host/examples/gpio.cpp +++ b/host/examples/gpio.cpp @@ -129,7 +129,7 @@ void output_reg_values( for (int i = num_bits - 1; i >= 0; i--) std::cout << (boost::format(" %2d") % i); std::cout << std::endl; - BOOST_FOREACH(std::string &attr, attrs) + for(std::string &attr: attrs) { std::cout << (boost::format("%10s:%s") % attr % to_bit_string(uint32_t(usrp->get_gpio_attr(bank, attr)), num_bits)) diff --git a/host/examples/init_usrp/CMakeLists.txt b/host/examples/init_usrp/CMakeLists.txt index 4ce51125f..139f9b853 100644 --- a/host/examples/init_usrp/CMakeLists.txt +++ b/host/examples/init_usrp/CMakeLists.txt @@ -46,6 +46,25 @@ find_package(UHD "3.8.0" REQUIRED) #find_package(UHD 3.8.1 EXACT REQUIRED) ### Configure Compiler ######################################################## +IF(CMAKE_VERSION VERSION_LESS "3.1") + IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + SET(CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}") + ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + IF("${IS_APPLE}" STREQUAL "") + SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") + ELSE() + SET(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}") + ENDIF() + ENDIF() +ELSE() + SET(CMAKE_CXX_STANDARD 11) +ENDIF() + +IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + SET(CMAKE_EXE_LINKER_FLAGS "-lthr ${CMAKE_EXE_LINKER_FLAGS}") + SET(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") +ENDIF() + include_directories( ${Boost_INCLUDE_DIRS} ${UHD_INCLUDE_DIRS} diff --git a/host/examples/test_dboard_coercion.cpp b/host/examples/test_dboard_coercion.cpp index 81c45fcb3..0119f39cd 100644 --- a/host/examples/test_dboard_coercion.cpp +++ b/host/examples/test_dboard_coercion.cpp @@ -102,7 +102,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in std::cout << boost::format("\nTesting %s coercion...") % type << std::endl; - BOOST_FOREACH(const uhd::range_t &range, freq_ranges){ + for(const uhd::range_t &range: freq_ranges){ double freq_begin = range.start(); double freq_end = range.stop(); @@ -152,7 +152,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in bool has_sensor = (std::find(dboard_sensor_names.begin(), dboard_sensor_names.end(), "lo_locked")) != dboard_sensor_names.end(); - BOOST_FOREACH(double freq, freqs){ + for(double freq: freqs){ //Testing for successful frequency tune if(type == "TX") usrp->set_tx_freq(freq,chan); @@ -212,7 +212,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in //Testing for successful gain tune - BOOST_FOREACH(double gain, gains){ + for(double gain: gains){ if(type == "TX") usrp->set_tx_gain(gain,chan); else usrp->set_rx_gain(gain,chan); @@ -266,7 +266,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in } else{ results += "USRP did not successfully tune to the following frequencies: "; - BOOST_FOREACH(double bad_freq, bad_tune_freqs){ + for(double bad_freq: bad_tune_freqs){ if(bad_freq != *bad_tune_freqs.begin()) results += ", "; results += MHz_str(bad_freq); } @@ -282,7 +282,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in } else{ results += "LO did not lock at the following frequencies: "; - BOOST_FOREACH(double bad_freq, no_lock_freqs){ + for(double bad_freq: no_lock_freqs){ if(bad_freq != *no_lock_freqs.begin()) results += ", "; results += MHz_str(bad_freq); } @@ -298,7 +298,7 @@ std::string coercion_test(uhd::usrp::multi_usrp::sptr usrp, std::string type, in } else{ results += "USRP did not successfully set gain under the following circumstances:"; - BOOST_FOREACH(double_pair bad_pair, bad_gain_vals){ + for(double_pair bad_pair: bad_gain_vals){ double bad_freq = bad_pair.first; double bad_gain = bad_pair.second; results += str(boost::format("\nFrequency: %s, Gain: %5.2f") % MHz_str(bad_freq) % bad_gain); diff --git a/host/examples/test_messages.cpp b/host/examples/test_messages.cpp index 43b035d19..8a50e4c85 100644 --- a/host/examples/test_messages.cpp +++ b/host/examples/test_messages.cpp @@ -23,7 +23,6 @@ #include <uhd/usrp/multi_usrp.hpp> #include <boost/assign/list_of.hpp> #include <boost/program_options.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/format.hpp> #include <cstdlib> @@ -330,7 +329,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //init result counts uhd::dict<std::string, size_t> failures, successes; - BOOST_FOREACH(const std::string &key, tests.keys()){ + for(const std::string &key: tests.keys()){ failures[key] = 0; successes[key] = 0; } @@ -352,7 +351,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //print the result summary bool any_failure = false; std::cout << std::endl << "Summary:" << std::endl << std::endl; - BOOST_FOREACH(const std::string &key, tests.keys()){ + for(const std::string &key: tests.keys()){ std::cout << boost::format( "%s -> %3u successes, %3u failures" ) % key % successes[key] % failures[key] << std::endl; diff --git a/host/examples/tx_waveforms.cpp b/host/examples/tx_waveforms.cpp index b2a8f944c..d596d9ed4 100644 --- a/host/examples/tx_waveforms.cpp +++ b/host/examples/tx_waveforms.cpp @@ -23,7 +23,6 @@ #include <uhd/exception.hpp> #include <boost/program_options.hpp> #include <boost/math/special_functions/round.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/thread.hpp> #include <boost/lexical_cast.hpp> |