diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index a039f61e6..c4b2c30e5 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -31,6 +31,10 @@ */ #include "file_signal_source.h" +#include +#include +#include +#include #include #include #include @@ -52,9 +56,18 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { - std::string default_filename = "../data/my_capture.dat"; + + char* userHomePath; + userHomePath = getenv ("HOME"); + if (userHomePath == NULL) + { + struct passwd *pw = getpwuid(getuid()); + userHomePath = pw->pw_dir; + } + std::string hmpath(userHomePath); + std::string default_filename = hmpath + "/.gnss-sdr/data/my_capture.dat"; std::string default_item_type = "short"; - std::string default_dump_filename = "../data/my_capture_dump.dat"; + std::string default_dump_filename = hmpath + "/.gnss-sdr/data/my_capture.dat"; samples_ = configuration->property(role + ".samples", 0); sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0); @@ -100,19 +113,33 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, } catch (const std::exception &e) { + std::string default_conf_file; + std::string text_; + if (filename_.compare(default_filename) == 0) + { + default_conf_file = hmpath + "/.gnss-sdr/" + GNSS_SDR_VERSION + "/conf/gnss-sdr.conf"; + text_ = "Please modify the configuration example at " + default_conf_file; + + } + else + { + default_conf_file = "conf/gnss-sdr.conf"; + text_ = "Please modify the configuration at " + + default_conf_file +" (the default configuration file)"; + } + std::cerr << "The receiver was configured to work with a file signal source " << std::endl << "but the specified file is unreachable by GNSS-SDR." << std::endl - << "Please modify the configuration at " - << "conf/gnss-sdr.conf (the default configuration file)" + << text_ << std::endl << "and point SignalSource.filename to a valid file," << std::endl << "or specify your own receiver and source with the flag" << std::endl - <<"gnss-sdr --config_file=my_GNSS_SDR_configuration.conf" + <<"gnss-sdr --config_file=/path/to/my_GNSS_SDR_configuration.conf" << std::endl; LOG(INFO) << "file_signal_source: Unable to open the samples file " << filename_.c_str() << ", exiting the program."; diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index f5cbe5bc1..3ffa8ec3d 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -51,8 +51,13 @@ if(OS_IS_MACOSX) endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif(OS_IS_MACOSX) + add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) +add_custom_command(TARGET gnss-sdr POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ + ${CMAKE_SOURCE_DIR}/install/$) + target_link_libraries(gnss-sdr ${MAC_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} @@ -70,8 +75,12 @@ target_link_libraries(gnss-sdr ${MAC_LIBRARIES} install(TARGETS gnss-sdr - DESTINATION ${CMAKE_SOURCE_DIR}/install + RUNTIME DESTINATION bin + COMPONENT "gnss-sdr" ) - +install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf DESTINATION $ENV{HOME}/.gnss-sdr + FILES_MATCHING PATTERN "*.conf" + ) +install(DIRECTORY DESTINATION $ENV{HOME}/.gnss-sdr/data/) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 26cd78a98..cb90955c8 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -151,6 +151,10 @@ add_definitions(-DTEST_PATH="${CMAKE_SOURCE_DIR}/src/tests/") add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc) +add_custom_command(TARGET run_tests POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ + ${CMAKE_SOURCE_DIR}/install/$) + target_link_libraries(run_tests ${CLANG_FLAGS} ${Boost_LIBRARIES} ${GFLAGS_LIBS} @@ -171,12 +175,11 @@ target_link_libraries(run_tests ${CLANG_FLAGS} ${GNSS_SDR_TEST_OPTIONAL_LIBS} ) -install(TARGETS run_tests DESTINATION ${CMAKE_SOURCE_DIR}/install) ######################################################### # Adding Tests to Ctest ######################################################### - +# ToDo #set(CMAKE_CTEST_COMMAND ctest -V) #add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) @@ -185,6 +188,7 @@ add_executable(control_thread_test EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc ${CMAKE_CURRENT_SOURCE_DIR}/control_thread/control_message_factory_test.cc ) + target_link_libraries(control_thread_test ${Boost_LIBRARIES} ${GFLAGS_LIBS} ${GLOG_LIBRARIES} diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index 5a4b1ae17..98396bfd3 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -56,6 +56,11 @@ if(ENABLE_RTLSDR) add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) add_executable(front-end-cal ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) + + add_custom_command(TARGET front-end-cal POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ + ${CMAKE_SOURCE_DIR}/install/$) + target_link_libraries(front-end-cal ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} @@ -69,7 +74,8 @@ if(ENABLE_RTLSDR) ) install(TARGETS front-end-cal - DESTINATION ${CMAKE_SOURCE_DIR}/install + RUNTIME DESTINATION bin + COMPONENT "front-end-cal" ) endif(ENABLE_RTLSDR)