diff options
-rw-r--r-- | volk/CMakeLists.txt | 14 | ||||
-rw-r--r-- | volk/apps/volk_profile.cc | 37 |
2 files changed, 31 insertions, 20 deletions
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 << "\ |