From 79f88bd1429b254f2a96b5dfa910d97c9bbc1ee3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Nov 2014 23:26:31 +0100 Subject: [PATCH] Changes in the building system --- .../signal_source/adapters/CMakeLists.txt | 2 + .../adapters/file_signal_source.cc | 60 +++++++++---------- .../adapters/nsr_file_signal_source.cc | 28 +++------ src/core/receiver/CMakeLists.txt | 2 + src/core/receiver/control_thread.cc | 4 +- src/core/receiver/gnss_block_factory.cc | 2 - src/main/CMakeLists.txt | 7 ++- 7 files changed, 45 insertions(+), 60 deletions(-) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 6027298a9..40734ad64 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -127,6 +127,8 @@ if(ARCH_64BITS) add_definitions(-DARCH_64BITS=1) endif(ARCH_64BITS) +add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}") + file(GLOB SIGNAL_SOURCE_ADAPTER_HEADERS "*.h") add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES} ${SIGNAL_SOURCE_ADAPTER_HEADERS}) source_group(Headers FILES ${SIGNAL_SOURCE_ADAPTER_HEADERS}) diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index bb419224a..5676d3ec4 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -31,9 +31,6 @@ */ #include "file_signal_source.h" -#include -#include -#include #include #include #include @@ -56,18 +53,9 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { - - 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_filename = "./example_capture.dat"; std::string default_item_type = "short"; - std::string default_dump_filename = hmpath + "/.gnss-sdr/data/my_capture.dat"; + std::string default_dump_filename = "./my_capture.dat"; samples_ = configuration->property(role + ".samples", 0); sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0); @@ -113,32 +101,38 @@ 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/conf/gnss-sdr.conf"; - text_ = "Please modify the configuration taking the example at " + default_conf_file; - + std::cerr + << "The configuration file has not been found." + << std::endl + << "Please create a configuration file based on the examples at the 'conf/' folder " + << std::endl + << "and then generate your own GNSS Software Defined Receiver by doing:" + << std::endl + << "$ gnss-sdr --config_file=/path/to/my_GNSS_SDR_configuration.conf" + << std::endl; } else { - text_ = "Please modify your 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 your configuration file" + << std::endl + << "and point SignalSource.filename to a valid raw data file. Then:" + << std::endl + << "$ gnss-sdr --config_file=/path/to/my_GNSS_SDR_configuration.conf" + << std::endl + << "Examples of configuration files available at:" + << std::endl + << GNSSSDR_INSTALL_DIR "/gnss-sdr/conf/" + << std::endl; + } - 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 - << text_ - << std::endl - << "and point SignalSource.filename to a valid file," - << std::endl - << "and specify your own receiver with the flag" - << std::endl - << "$ 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."; throw(e); diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc index ff5acbe44..5f19514d0 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -31,9 +31,6 @@ */ #include "nsr_file_signal_source.h" -#include -#include -#include #include #include #include @@ -56,15 +53,6 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) { - - 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 = "../data/my_capture.dat"; std::string default_item_type = "byte"; std::string default_dump_filename = "../data/my_capture_dump.dat"; @@ -99,24 +87,22 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, } catch (const std::exception &e) { - std::string default_conf_file; - std::string text_; - default_conf_file = hmpath + "/.gnss-sdr/conf/gnss-sdr_GPS_L1_nsr.conf"; - text_ = "Please modify the configuration taking the example at " + default_conf_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 - << text_ + << "Please modify your configuration file" << std::endl - << "and point SignalSource.filename to a valid file," - << std::endl - << "and specify your own receiver and source with the flag" + << "and point SignalSource.filename to a valid raw data file. Then:" << std::endl << "$ gnss-sdr --config_file=/path/to/my_GNSS_SDR_configuration.conf" + << std::endl + << "Examples of configuration files available at:" + << std::endl + << GNSSSDR_INSTALL_DIR "/gnss-sdr/conf/" << std::endl; + LOG(WARNING) << "file_signal_source: Unable to open the samples file " << filename_.c_str() << ", exiting the program."; throw(e); diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 4f4c0200a..35279a0d1 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -85,6 +85,8 @@ else(OPENCL_FOUND) add_definitions(-DOPENCL_BLOCKS=0) endif(OPENCL_FOUND) +add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}") + file(GLOB GNSS_RECEIVER_HEADERS "*.h") file(GLOB GNSS_RECEIVER_INTERFACE_HEADERS "../interfaces/*.h") add_library(gnss_rx ${GNSS_RECEIVER_SOURCES} ${GNSS_RECEIVER_HEADERS} ${GNSS_RECEIVER_INTERFACE_HEADERS}) diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index de7f18e40..db6c8e5e9 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -90,8 +90,8 @@ extern concurrent_queue global_galileo_almanac_queue; using google::LogMessage; -DEFINE_string(config_file, "../conf/gnss-sdr.conf", - "Path to the file containing the configuration parameters"); +DEFINE_string(config_file, std::string(GNSSSDR_INSTALL_DIR "/etc/gnss-sdr/conf/default.conf"), + "File containing the configuration parameters"); ControlThread::ControlThread() { diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 656e00d2f..5e57b5cb9 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -367,7 +367,6 @@ std::unique_ptr GNSSBlockFactory::GetBlock( catch (const std::exception &e) { std::cout << "GNSS-SDR program ended." << std::endl; - LOG(ERROR) << implementation << ": Source file not found"; exit(1); } } @@ -383,7 +382,6 @@ std::unique_ptr GNSSBlockFactory::GetBlock( catch (const std::exception &e) { std::cout << "GNSS-SDR program ended." << std::endl; - LOG(ERROR) << implementation << ": Source file not found"; exit(1); } } diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 3ffa8ec3d..8335d554d 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -79,8 +79,11 @@ install(TARGETS gnss-sdr COMPONENT "gnss-sdr" ) -install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf DESTINATION $ENV{HOME}/.gnss-sdr +install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf DESTINATION etc/gnss-sdr FILES_MATCHING PATTERN "*.conf" ) -install(DIRECTORY DESTINATION $ENV{HOME}/.gnss-sdr/data/) +install(DIRECTORY DESTINATION etc/gnss-sdr/data/) +install(FILES ${CMAKE_SOURCE_DIR}/conf/gnss-sdr.conf DESTINATION etc/gnss-sdr/conf + RENAME default.conf) +