diff options
-rw-r--r-- | cmake/Modules/GrBoost.cmake | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_random_pdu.cc | 7 | ||||
-rw-r--r-- | volk/CMakeLists.txt | 14 | ||||
-rw-r--r-- | volk/apps/volk_profile.cc | 37 |
4 files changed, 37 insertions, 23 deletions
diff --git a/cmake/Modules/GrBoost.cmake b/cmake/Modules/GrBoost.cmake index 38cb027f8..01378df66 100644 --- a/cmake/Modules/GrBoost.cmake +++ b/cmake/Modules/GrBoost.cmake @@ -39,6 +39,8 @@ if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") if(MSVC) + set(BOOST_REQUIRED_COMPONENTS ${BOOST_REQUIRED_COMPONENTS} chrono) + if (NOT DEFINED BOOST_ALL_DYN_LINK) set(BOOST_ALL_DYN_LINK TRUE) endif() diff --git a/gnuradio-core/src/lib/general/gr_random_pdu.cc b/gnuradio-core/src/lib/general/gr_random_pdu.cc index 9f692c72b..6d8c13614 100644 --- a/gnuradio-core/src/lib/general/gr_random_pdu.cc +++ b/gnuradio-core/src/lib/general/gr_random_pdu.cc @@ -34,6 +34,7 @@ #include <stdexcept> #include <string.h> #include <iostream> +#include <vector> // public constructor that returns a shared_ptr @@ -68,13 +69,13 @@ void gr_random_pdu::output_random(){ int len = rvar(); // fill it with random bytes - unsigned char vec[len]; + std::vector<unsigned char> vec; for(int i=0; i<len; i++){ - vec[i] = (unsigned char) bvar(); + vec.push_back((unsigned char) bvar()); } // send the vector - pmt::pmt_t vecpmt( pmt::pmt_make_blob( vec, len ) ); + pmt::pmt_t vecpmt( pmt::pmt_make_blob( &vec[0], len ) ); pmt::pmt_t pdu( pmt::pmt_cons( pmt::PMT_NIL, vecpmt ) ); message_port_pub( pmt::mp("pdus"), pdu ); diff --git a/volk/CMakeLists.txt b/volk/CMakeLists.txt index 9519505eb..99f705256 100644 --- a/volk/CMakeLists.txt +++ b/volk/CMakeLists.txt @@ -62,6 +62,18 @@ if(NOT CHEETAH_FOUND) message(FATAL_ERROR "Cheetah templates required to build VOLK") endif() +if(MSVC) + if (NOT DEFINED BOOST_ALL_DYN_LINK) + set(BOOST_ALL_DYN_LINK TRUE) + endif() + set(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking") + if(BOOST_ALL_DYN_LINK) + add_definitions(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc + else(BOOST_ALL_DYN_LINK) + unset(BOOST_REQUIRED_COMPONENTS) #empty components list for static link + endif(BOOST_ALL_DYN_LINK) +endif(MSVC) + set(Boost_ADDITIONAL_VERSIONS "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" @@ -71,7 +83,7 @@ set(Boost_ADDITIONAL_VERSIONS "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" ) -find_package(Boost COMPONENTS unit_test_framework) +find_package(Boost COMPONENTS unit_test_framework filesystem system) if(NOT Boost_FOUND) message(FATAL_ERROR "VOLK Requires boost to build") diff --git a/volk/apps/volk_profile.cc b/volk/apps/volk_profile.cc index 648f4d878..e0919a278 100644 --- a/volk/apps/volk_profile.cc +++ b/volk/apps/volk_profile.cc @@ -1,15 +1,19 @@ #include "qa_utils.h" -extern "C" { + #include <volk/volk.h> #include <volk/volk_prefs.h> -} + +#include <ciso646> #include <vector> #include <boost/foreach.hpp> +#include <boost/filesystem.hpp> #include <iostream> #include <fstream> #include <sys/stat.h> #include <sys/types.h> +namespace fs = boost::filesystem; + int main(int argc, char *argv[]) { std::vector<std::string> results; @@ -123,25 +127,20 @@ int main(int argc, char *argv[]) { VOLK_PROFILE(volk_32f_s32f_multiply_32f_a, 1e-4, 1.0, 204600, 10000, &results); VOLK_PROFILE(volk_32f_s32f_multiply_32f_u, 1e-4, 0, 204600, 1000, &results); - - char path[256]; + char path[1024]; get_config_path(path); - std::string config_path(path); - std::ofstream config; - std::cout << "filename: " << config_path << std::endl; - config.open(config_path.c_str()); + const fs::path config_path(path); + + if (not fs::exists(config_path.branch_path())) + { + std::cout << "Creating " << config_path.branch_path() << "..." << std::endl; + fs::create_directories(config_path.branch_path()); + } + + std::cout << "Writing " << config_path << "..." << std::endl; + std::ofstream config(config_path.string().c_str()); if(!config.is_open()) { //either we don't have write access or we don't have the dir yet - std::string dir(getenv("HOME")); - dir += "/.volk"; - if(mkdir(dir.c_str(), 0777) == -1) { - std::cout << "Error creating directory " << dir << std::endl; - return -1; - } - config.open(config_path.c_str()); - if(!config.is_open()) { - std::cout << "Error opening file " << config_path << std::endl; - return -1; - } + std::cout << "Error opening file " << config_path << std::endl; } config << "\ |