1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-09-18 02:09:48 +00:00
This commit is contained in:
Carles Fernandez 2019-06-10 21:41:47 +02:00
commit e8368db86f
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
42 changed files with 1022 additions and 389 deletions

View File

@ -596,113 +596,6 @@ endif()
################################################################################
# Boost - https://www.boost.org
################################################################################
if(UNIX AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") # Fedora 64-bit fix
endif()
set(Boost_ADDITIONAL_VERSIONS
"1.53.0" "1.53" "1.54.0" "1.54"
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
"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"
"1.70.0" "1.70" "1.71.0" "1.71" "1.72.0" "1.72" "1.73.0" "1.73" "1.74.0" "1.74"
"1.75.0" "1.75" "1.76.0" "1.76" "1.77.0" "1.77" "1.78.0" "1.78" "1.79.0" "1.79"
"1.80.0" "1.80" "1.81.0" "1.81" "1.82.0" "1.82" "1.83.0" "1.83" "1.84.0" "1.84"
)
set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF)
find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS atomic chrono date_time filesystem serialization system thread REQUIRED)
set_package_properties(Boost PROPERTIES
URL "https://www.boost.org"
DESCRIPTION "Portable C++ source libraries"
PURPOSE "Used widely across the source code."
TYPE REQUIRED
)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >=${GNSSSDR_BOOST_MIN_VERSION}) required.")
endif()
if(CMAKE_VERSION VERSION_LESS 3.5)
if(NOT TARGET Boost::boost)
add_library(Boost::boost SHARED IMPORTED) # Trick for CMake 2.8.12
set_target_properties(Boost::boost PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
endif()
if(NOT TARGET Boost::date_time)
add_library(Boost::date_time SHARED IMPORTED)
set_target_properties(Boost::date_time PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_DATE_TIME_LIBRARIES}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
endif()
if(NOT TARGET Boost::system)
add_library(Boost::system SHARED IMPORTED)
set_target_properties(Boost::system PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_SYSTEM_LIBRARIES}
)
endif()
if(NOT TARGET Boost::filesystem)
add_library(Boost::filesystem SHARED IMPORTED)
set_target_properties(Boost::filesystem PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_FILESYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_FILESYSTEM_LIBRARIES}
)
endif()
if(NOT TARGET Boost::thread)
add_library(Boost::thread SHARED IMPORTED)
set_target_properties(Boost::thread PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_THREAD_LIBRARIES}
IMPORTED_LOCATION ${Boost_THREAD_LIBRARIES}
)
endif()
if(NOT TARGET Boost::serialization)
add_library(Boost::serialization SHARED IMPORTED)
set_target_properties(Boost::serialization PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SERIALIZATION_LIBRARIES}
IMPORTED_LOCATION ${Boost_SERIALIZATION_LIBRARIES}
)
endif()
if(NOT TARGET Boost::chrono)
add_library(Boost::chrono SHARED IMPORTED)
set_target_properties(Boost::chrono PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_CHRONO_LIBRARIES}
IMPORTED_LOCATION ${Boost_CHRONO_LIBRARIES}
)
endif()
if(NOT TARGET Boost::atomic)
add_library(Boost::atomic SHARED IMPORTED)
set_target_properties(Boost::atomic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_ATOMIC_LIBRARIES}
IMPORTED_LOCATION ${Boost_ATOMIC_LIBRARIES}
)
endif()
endif()
# Fix for Boost Asio < 1.70 when using Clang in macOS
if(${Boost_VERSION} VERSION_LESS 107000)
# Check if we have std::string_view
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <string_view>
int main()
{ std::string_view sv; }"
has_string_view
)
endif()
################################################################################
# GNU Radio - https://gnuradio.org
################################################################################
@ -859,6 +752,150 @@ endif()
################################################################################
# Dectect availability of std::filesystem
################################################################################
set(FILESYSTEM_FOUND FALSE)
if(NOT (GNURADIO_VERSION VERSION_LESS 3.8))
# Check if we have std::filesystem
if(NOT (CMAKE_VERSION VERSION_LESS 3.8))
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
if(ENABLE_UNIT_TESTING_EXTRA OFF) # Workaround for GPSTk
find_package(FILESYSTEM)
set_package_properties(FILESYSTEM PROPERTIES
URL "https://en.cppreference.com/w/cpp/filesystem"
DESCRIPTION "Provides facilities for performing operations on file systems and their components"
PURPOSE "Work with paths, regular files, and directories."
TYPE OPTIONAL
)
if(${FILESYSTEM_FOUND})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
endif()
endif()
endif()
################################################################################
# Boost - https://www.boost.org
################################################################################
if(UNIX AND EXISTS "/usr/lib64")
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") # Fedora 64-bit fix
endif()
set(Boost_ADDITIONAL_VERSIONS
"1.53.0" "1.53" "1.54.0" "1.54"
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
"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"
"1.70.0" "1.70" "1.71.0" "1.71" "1.72.0" "1.72" "1.73.0" "1.73" "1.74.0" "1.74"
"1.75.0" "1.75" "1.76.0" "1.76" "1.77.0" "1.77" "1.78.0" "1.78" "1.79.0" "1.79"
"1.80.0" "1.80" "1.81.0" "1.81" "1.82.0" "1.82" "1.83.0" "1.83" "1.84.0" "1.84"
)
set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS OFF)
set(BOOST_COMPONENTS atomic chrono date_time serialization system thread)
if(NOT ${FILESYSTEM_FOUND})
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem)
endif()
find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
set_package_properties(Boost PROPERTIES
URL "https://www.boost.org"
DESCRIPTION "Portable C++ source libraries"
PURPOSE "Used widely across the source code."
TYPE REQUIRED
)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Fatal error: Boost (version >=${GNSSSDR_BOOST_MIN_VERSION}) required.")
endif()
if(CMAKE_VERSION VERSION_LESS 3.5)
if(NOT TARGET Boost::boost)
add_library(Boost::boost SHARED IMPORTED) # Trick for CMake 2.8.12
set_target_properties(Boost::boost PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
endif()
if(NOT TARGET Boost::date_time)
add_library(Boost::date_time SHARED IMPORTED)
set_target_properties(Boost::date_time PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_DATE_TIME_LIBRARIES}
IMPORTED_LOCATION ${Boost_DATE_TIME_LIBRARIES}
)
endif()
if(NOT TARGET Boost::system)
add_library(Boost::system SHARED IMPORTED)
set_target_properties(Boost::system PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_SYSTEM_LIBRARIES}
)
endif()
if(NOT TARGET Boost::thread)
add_library(Boost::thread SHARED IMPORTED)
set_target_properties(Boost::thread PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_THREAD_LIBRARIES}
IMPORTED_LOCATION ${Boost_THREAD_LIBRARIES}
)
endif()
if(NOT TARGET Boost::serialization)
add_library(Boost::serialization SHARED IMPORTED)
set_target_properties(Boost::serialization PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_SERIALIZATION_LIBRARIES}
IMPORTED_LOCATION ${Boost_SERIALIZATION_LIBRARIES}
)
endif()
if(NOT TARGET Boost::chrono)
add_library(Boost::chrono SHARED IMPORTED)
set_target_properties(Boost::chrono PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_CHRONO_LIBRARIES}
IMPORTED_LOCATION ${Boost_CHRONO_LIBRARIES}
)
endif()
if(NOT TARGET Boost::atomic)
add_library(Boost::atomic SHARED IMPORTED)
set_target_properties(Boost::atomic PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_ATOMIC_LIBRARIES}
IMPORTED_LOCATION ${Boost_ATOMIC_LIBRARIES}
)
endif()
if(NOT ${FILESYSTEM_FOUND})
if(NOT TARGET Boost::filesystem)
add_library(Boost::filesystem SHARED IMPORTED)
set_target_properties(Boost::filesystem PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES ${Boost_FILESYSTEM_LIBRARIES}
IMPORTED_LOCATION ${Boost_FILESYSTEM_LIBRARIES}
)
endif()
endif()
endif()
# Fix for Boost Asio < 1.70 when using Clang in macOS
if(${Boost_VERSION} VERSION_LESS 107000)
# Check if we have std::string_view
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <string_view>
int main()
{ std::string_view sv; }"
has_string_view
)
endif()
################################################################################
# VOLK - Vector-Optimized Library of Kernels
################################################################################

View File

@ -166,6 +166,20 @@ gr_module(WAVELET gnuradio-wavelet gnuradio/wavelet/api.h gnuradio-wavelet)
list(REMOVE_DUPLICATES GNURADIO_ALL_INCLUDE_DIRS)
list(REMOVE_DUPLICATES GNURADIO_ALL_LIBRARIES)
if(NOT PC_GNURADIO_RUNTIME_VERSION)
list(GET GNURADIO_BLOCKS_LIBRARIES 0 FIRST_DIR)
get_filename_component(GNURADIO_BLOCKS_DIR ${FIRST_DIR} DIRECTORY)
if(EXISTS ${GNURADIO_BLOCKS_DIR}/cmake/gnuradio/GnuradioConfigVersion.cmake)
set(PACKAGE_FIND_VERSION_MAJOR 3)
set(PACKAGE_FIND_VERSION_MINOR 7)
set(PACKAGE_FIND_VERSION_PATCH 4)
include(${GNURADIO_BLOCKS_DIR}/cmake/gnuradio/GnuradioConfigVersion.cmake)
endif()
if(PACKAGE_VERSION)
set(PC_GNURADIO_RUNTIME_VERSION ${PACKAGE_VERSION})
endif()
endif()
# Trick to find out that GNU Radio is >= 3.7.4 if pkgconfig is not present
if(NOT PC_GNURADIO_RUNTIME_VERSION)
find_file(GNURADIO_VERSION_GREATER_THAN_373

View File

@ -28,6 +28,13 @@ source_group(Headers FILES ${PVT_GR_BLOCKS_HEADERS})
add_library(pvt_gr_blocks ${PVT_GR_BLOCKS_SOURCES} ${PVT_GR_BLOCKS_HEADERS})
if(${FILESYSTEM_FOUND})
target_compile_definitions(pvt_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(pvt_gr_blocks PRIVATE std::filesystem)
else()
target_link_libraries(pvt_gr_blocks PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(pvt_gr_blocks
PUBLIC
algorithms_libs_rtklib
@ -40,8 +47,6 @@ target_link_libraries(pvt_gr_blocks
algorithms_libs
Gflags::gflags
Glog::glog
Boost::filesystem
Boost::system
Boost::serialization
)

View File

@ -66,10 +66,8 @@
#include <boost/bind/bind.hpp> // for bind_t, bind
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/exception.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/nvp.hpp> // for nvp, make_nvp
#include <boost/system/error_code.hpp> // for error_code
#include <glog/logging.h> // for LOG
#include <gnuradio/io_signature.h> // for io_signature
#include <pmt/pmt_sugar.h> // for mp
@ -83,6 +81,19 @@
#include <stdexcept> // for length_error
#include <sys/ipc.h> // for IPC_CREAT
#include <sys/msg.h> // for msgctl
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
namespace fs = std::filesystem;
namespace errorlib = std;
#else
#include <boost/filesystem/path.hpp>
#include <boost/system/error_code.hpp> // for error_code
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
#if OLD_BOOST
#include <boost/math/common_factor_rt.hpp>
namespace bc = boost::math;
@ -140,7 +151,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
dump_ls_pvt_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
dump_ls_pvt_filename = dump_path + fs::path::preferred_separator + d_dump_filename;
dump_ls_pvt_filename.append(".dat");
// create directory
if (!gnss_sdr_create_directory(dump_path))
@ -305,24 +316,24 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
if (d_xml_storage)
{
xml_base_path = conf_.xml_output_path;
boost::filesystem::path full_path(boost::filesystem::current_path());
const boost::filesystem::path p(xml_base_path);
if (!boost::filesystem::exists(p))
fs::path full_path(fs::current_path());
const fs::path p(xml_base_path);
if (!fs::exists(p))
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(xml_base_path))
for (auto& folder : fs::path(xml_base_path))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
if (!boost::filesystem::create_directory(new_folder, ec))
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
xml_base_path = full_path.string();
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
}
else
@ -334,7 +345,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
std::cout << "XML files will be stored at " << xml_base_path << std::endl;
}
xml_base_path = xml_base_path + boost::filesystem::path::preferred_separator;
xml_base_path = xml_base_path + fs::path::preferred_separator;
}
d_rx_time = 0.0;

View File

@ -61,6 +61,13 @@ source_group(Headers FILES ${PVT_LIB_HEADERS})
add_library(pvt_libs ${PVT_LIB_SOURCES} ${PVT_LIB_HEADERS})
if(${FILESYSTEM_FOUND})
target_compile_definitions(pvt_libs PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(pvt_libs PRIVATE std::filesystem)
else()
target_link_libraries(pvt_libs PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(pvt_libs
PUBLIC
Armadillo::armadillo
@ -70,8 +77,6 @@ target_link_libraries(pvt_libs
core_system_parameters
PRIVATE
algorithms_libs
Boost::filesystem
Boost::system
Gflags::gflags
Glog::glog
Matio::matio

View File

@ -33,10 +33,15 @@
#include "geojson_printer.h"
#include "pvt_solution.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
#endif
#include <glog/logging.h>
#include <cstdio> // for remove
#include <ctime> // for tm
@ -45,29 +50,36 @@
#include <iostream> // for cout, cerr
#include <sstream> // for stringstream
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path)
{
first_pos = true;
geojson_base_path = base_path;
boost::filesystem::path full_path(boost::filesystem::current_path());
const boost::filesystem::path p(geojson_base_path);
if (!boost::filesystem::exists(p))
fs::path full_path(fs::current_path());
const fs::path p(geojson_base_path);
if (!fs::exists(p))
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(geojson_base_path))
for (auto& folder : fs::path(geojson_base_path))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
if (!boost::filesystem::create_directory(new_folder, ec))
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
geojson_base_path = full_path.string();
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
}
else
@ -79,7 +91,7 @@ GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path)
std::cout << "GeoJSON files will be stored at " << geojson_base_path << std::endl;
}
geojson_base_path = geojson_base_path + boost::filesystem::path::preferred_separator;
geojson_base_path = geojson_base_path + fs::path::preferred_separator;
}

View File

@ -33,10 +33,15 @@
#include "gpx_printer.h"
#include "rtklib_solver.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
#endif
#include <glog/logging.h>
#include <cstdio> // for remove
#include <ctime> // for tm
@ -45,30 +50,38 @@
#include <iostream> // for cout, cerr
#include <sstream> // for stringstream
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
Gpx_Printer::Gpx_Printer(const std::string& base_path)
{
positions_printed = false;
indent = " ";
gpx_base_path = base_path;
boost::filesystem::path full_path(boost::filesystem::current_path());
const boost::filesystem::path p(gpx_base_path);
if (!boost::filesystem::exists(p))
fs::path full_path(fs::current_path());
const fs::path p(gpx_base_path);
if (!fs::exists(p))
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(gpx_base_path))
for (auto& folder : fs::path(gpx_base_path))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
if (!boost::filesystem::create_directory(new_folder, ec))
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
gpx_base_path = full_path.string();
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
}
else
@ -80,7 +93,7 @@ Gpx_Printer::Gpx_Printer(const std::string& base_path)
std::cout << "GPX files will be stored at " << gpx_base_path << std::endl;
}
gpx_base_path = gpx_base_path + boost::filesystem::path::preferred_separator;
gpx_base_path = gpx_base_path + fs::path::preferred_separator;
}

View File

@ -33,17 +33,34 @@
#include "kml_printer.h"
#include "rtklib_solver.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
#endif
#include <glog/logging.h>
#include <cstdio> // for remove
#include <cstdlib> // for mkstemp
#include <cstring> // for strncpy
#include <ctime> // for tm
#include <exception> // for exception
#include <iostream> // for cout, cerr
#include <sstream>
#include <string>
#include <sys/stat.h> // for S_IXUSR | S_IRWXG | S_IRWXO
#include <sys/types.h> //for mode_t
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
Kml_Printer::Kml_Printer(const std::string& base_path)
@ -51,24 +68,24 @@ Kml_Printer::Kml_Printer(const std::string& base_path)
positions_printed = false;
indent = " ";
kml_base_path = base_path;
boost::filesystem::path full_path(boost::filesystem::current_path());
const boost::filesystem::path p(kml_base_path);
if (!boost::filesystem::exists(p))
fs::path full_path(fs::current_path());
const fs::path p(kml_base_path);
if (!fs::exists(p))
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(kml_base_path))
for (auto& folder : fs::path(kml_base_path))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
if (!boost::filesystem::create_directory(new_folder, ec))
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
kml_base_path = full_path.string();
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
}
else
@ -80,13 +97,22 @@ Kml_Printer::Kml_Printer(const std::string& base_path)
std::cout << "KML files will be stored at " << kml_base_path << std::endl;
}
kml_base_path = kml_base_path + boost::filesystem::path::preferred_separator;
kml_base_path = kml_base_path + fs::path::preferred_separator;
boost::filesystem::path tmp_base_path = boost::filesystem::temp_directory_path();
boost::filesystem::path tmp_filename = boost::filesystem::unique_path();
boost::filesystem::path tmp_file = tmp_base_path / tmp_filename;
char tmp_filename_[] = "/tmp/file.XXXXXX";
mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
int fd = mkstemp(tmp_filename_);
if (fd == -1)
{
std::cerr << "Error in KML printer: failed to create temporary file" << std::endl;
}
else
{
close(fd);
}
fs::path tmp_filename = fs::path(tmp_filename_);
tmp_file_str = tmp_file.string();
tmp_file_str = tmp_filename.string();
point_id = 0;
}

View File

@ -36,10 +36,15 @@
#include "nmea_printer.h"
#include "rtklib_solution.h"
#include "rtklib_solver.h"
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
#endif
#include <glog/logging.h>
#include <cstdint>
#include <exception>
@ -47,6 +52,14 @@
#include <iostream> // for cout, cerr
#include <termios.h>
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, bool flag_nmea_tty_port, std::string nmea_dump_devname, const std::string& base_path)
{
@ -54,24 +67,24 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
d_flag_nmea_output_file = flag_nmea_output_file;
if (d_flag_nmea_output_file == true)
{
boost::filesystem::path full_path(boost::filesystem::current_path());
const boost::filesystem::path p(nmea_base_path);
if (!boost::filesystem::exists(p))
fs::path full_path(fs::current_path());
const fs::path p(nmea_base_path);
if (!fs::exists(p))
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(nmea_base_path))
for (auto& folder : fs::path(nmea_base_path))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
if (!boost::filesystem::create_directory(new_folder, ec))
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
nmea_base_path = full_path.string();
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
}
else
@ -84,7 +97,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
std::cout << "NMEA files will be stored at " << nmea_base_path << std::endl;
}
nmea_base_path = nmea_base_path + boost::filesystem::path::preferred_separator;
nmea_base_path = nmea_base_path + fs::path::preferred_separator;
nmea_filename = nmea_base_path + filename;

View File

@ -53,9 +53,15 @@
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/date_time/time_zone_base.hpp>
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
#endif
#include <glog/logging.h>
#include <algorithm> // for min and max
#include <cmath> // for floor
@ -69,28 +75,36 @@
#include <utility>
#include <vector>
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path)
{
std::string base_rinex_path = base_path;
boost::filesystem::path full_path(boost::filesystem::current_path());
const boost::filesystem::path p(base_rinex_path);
if (!boost::filesystem::exists(p))
fs::path full_path(fs::current_path());
const fs::path p(base_rinex_path);
if (!fs::exists(p))
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(base_rinex_path))
for (auto& folder : fs::path(base_rinex_path))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
if (!boost::filesystem::create_directory(new_folder, ec))
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
base_rinex_path = full_path.string();
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
}
else
@ -102,13 +116,13 @@ Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path)
std::cout << "RINEX files will be stored at " << base_rinex_path << std::endl;
}
navfilename = base_rinex_path + boost::filesystem::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GPS_NAV");
obsfilename = base_rinex_path + boost::filesystem::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_OBS");
sbsfilename = base_rinex_path + boost::filesystem::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_SBAS");
navGalfilename = base_rinex_path + boost::filesystem::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GAL_NAV");
navMixfilename = base_rinex_path + boost::filesystem::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_MIXED_NAV");
navGlofilename = base_rinex_path + boost::filesystem::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GLO_NAV");
navBdsfilename = base_rinex_path + boost::filesystem::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_BDS_NAV");
navfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GPS_NAV");
obsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_OBS");
sbsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_SBAS");
navGalfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GAL_NAV");
navMixfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_MIXED_NAV");
navGlofilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_GLO_NAV");
navBdsfilename = base_rinex_path + fs::path::preferred_separator + Rinex_Printer::createFilename("RINEX_FILE_TYPE_BDS_NAV");
Rinex_Printer::navFile.open(navfilename, std::ios::out | std::ios::in | std::ios::app);
Rinex_Printer::obsFile.open(obsfilename, std::ios::out | std::ios::in | std::ios::app);

View File

@ -39,11 +39,16 @@
#include "gps_cnav_ephemeris.h"
#include "gps_ephemeris.h"
#include "rtcm.h"
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_codes
#endif
#include <glog/logging.h>
#include <cstdio> // for remove
#include <ctime> // for tm
@ -53,6 +58,14 @@
#include <termios.h> // for tcgetattr
#include <unistd.h> // for close, write
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string& rtcm_dump_devname, bool time_tag_name, const std::string& base_path)
{
@ -62,24 +75,24 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
rtcm_base_path = base_path;
if (d_rtcm_file_dump)
{
boost::filesystem::path full_path(boost::filesystem::current_path());
const boost::filesystem::path p(rtcm_base_path);
if (!boost::filesystem::exists(p))
fs::path full_path(fs::current_path());
const fs::path p(rtcm_base_path);
if (!fs::exists(p))
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(rtcm_base_path))
for (auto& folder : fs::path(rtcm_base_path))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
if (!boost::filesystem::create_directory(new_folder, ec))
if (!fs::create_directory(new_folder, ec))
{
std::cout << "Could not create the " << new_folder << " folder." << std::endl;
rtcm_base_path = full_path.string();
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
}
else
@ -91,7 +104,7 @@ Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump
std::cout << "RTCM binary file will be stored at " << rtcm_base_path << std::endl;
}
rtcm_base_path = rtcm_base_path + boost::filesystem::path::preferred_separator;
rtcm_base_path = rtcm_base_path + fs::path::preferred_separator;
}
if (time_tag_name)

View File

@ -66,6 +66,13 @@ source_group(Headers FILES ${ACQ_GR_BLOCKS_HEADERS})
add_library(acquisition_gr_blocks ${ACQ_GR_BLOCKS_SOURCES} ${ACQ_GR_BLOCKS_HEADERS})
if(${FILESYSTEM_FOUND})
target_compile_definitions(acquisition_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(acquisition_gr_blocks PRIVATE std::filesystem)
else()
target_link_libraries(acquisition_gr_blocks PRIVATE Boost::filesystem)
endif()
target_link_libraries(acquisition_gr_blocks
PUBLIC
Gnuradio::runtime
@ -76,7 +83,6 @@ target_link_libraries(acquisition_gr_blocks
core_system_parameters
${OPT_LIBRARIES}
PRIVATE
Boost::filesystem
Gflags::gflags
Glog::glog
Matio::matio

View File

@ -39,7 +39,11 @@
#include "gnss_frequencies.h"
#include "gnss_sdr_create_directory.h"
#include "gnss_synchro.h"
#if HAS_STD_FILESYSTEM
#include <filesystem>
#else
#include <boost/filesystem/path.hpp>
#endif
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -53,6 +57,12 @@
#include <iostream>
#include <map>
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
#else
namespace fs = boost::filesystem;
#endif
pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_)
{
@ -184,7 +194,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
d_dump_filename = dump_path + fs::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{

View File

@ -34,7 +34,11 @@
#include "GPS_L1_CA.h"
#include "gnss_sdr_create_directory.h"
#include "gps_sdr_signal_processing.h"
#if HAS_STD_FILESYSTEM
#include <filesystem>
#else
#include <boost/filesystem/path.hpp>
#endif
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -43,6 +47,12 @@
#include <algorithm> // std::rotate, std::fill_n
#include <sstream>
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
#else
namespace fs = boost::filesystem;
#endif
pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(const Acq_Conf &conf_)
{
@ -107,7 +117,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
{
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
d_dump_filename = dump_path + fs::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{

View File

@ -88,6 +88,13 @@ source_group(Headers FILES ${GNSS_SPLIBS_HEADERS})
add_library(algorithms_libs ${GNSS_SPLIBS_SOURCES} ${GNSS_SPLIBS_HEADERS})
if(${FILESYSTEM_FOUND})
target_compile_definitions(algorithms_libs PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(algorithms_libs PRIVATE std::filesystem)
else()
target_link_libraries(algorithms_libs PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(algorithms_libs
PUBLIC
Armadillo::armadillo
@ -100,7 +107,6 @@ target_link_libraries(algorithms_libs
core_system_parameters
Volk::volk ${ORC_LIBRARIES}
Volkgnsssdr::volkgnsssdr
Boost::filesystem
Glog::glog
)
@ -133,11 +139,16 @@ source_group(Headers FILES gnss_sdr_flags.h)
add_library(gnss_sdr_flags gnss_sdr_flags.cc gnss_sdr_flags.h)
if(${FILESYSTEM_FOUND})
target_compile_definitions(gnss_sdr_flags PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(gnss_sdr_flags PRIVATE std::filesystem)
else()
target_link_libraries(gnss_sdr_flags PRIVATE Boost::filesystem)
endif()
target_link_libraries(gnss_sdr_flags
PUBLIC
Gflags::gflags
PRIVATE
Boost::filesystem
)
if(${GFLAGS_GREATER_20})

View File

@ -29,35 +29,46 @@
*/
#include "gnss_sdr_create_directory.h"
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/filesystem/path_traits.hpp> // for filesystem
#include <boost/system/error_code.hpp> // for error_code
#include <exception> // for exception
#include <fstream> // for ofstream
#endif
#include <exception> // for exception
#include <fstream> // for ofstream
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
bool gnss_sdr_create_directory(const std::string& foldername)
{
std::string new_folder;
for (auto& folder : boost::filesystem::path(foldername))
for (auto& folder : fs::path(foldername))
{
new_folder += folder.string();
boost::system::error_code ec;
if (!boost::filesystem::exists(new_folder))
errorlib::error_code ec;
if (!fs::exists(new_folder))
{
try
if (!fs::create_directory(new_folder, ec))
{
if (!boost::filesystem::create_directory(new_folder, ec))
{
return false;
}
return false;
}
catch (std::exception& e)
if (static_cast<bool>(ec))
{
return false;
}
}
new_folder += boost::filesystem::path::preferred_separator;
new_folder += fs::path::preferred_separator;
}
// Check if we have writing permissions
@ -67,19 +78,16 @@ bool gnss_sdr_create_directory(const std::string& foldername)
if (os_test_file.is_open())
{
boost::system::error_code ec;
errorlib::error_code ec;
os_test_file.close();
try
{
boost::filesystem::remove(test_file, ec);
}
catch (std::exception& e)
fs::remove(test_file, ec);
if (static_cast<bool>(ec))
{
return false;
}
return true;
}
os_test_file.close();
return false;
}

View File

@ -30,11 +30,22 @@
#include "gnss_sdr_flags.h"
#if HAS_STD_FILESYSTEM
#include <filesystem>
#else
#include <boost/filesystem/operations.hpp> // for exists
#endif
#include <cstdint>
#include <iostream>
#include <string>
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
#else
namespace fs = boost::filesystem;
#endif
DEFINE_string(c, "-", "Path to the configuration file (if set, overrides --config_file).");
DEFINE_string(config_file, std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"),
@ -69,7 +80,7 @@ DEFINE_double(pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter,
static bool ValidateC(const char* flagname, const std::string& value)
{
if (boost::filesystem::exists(value) or value == "-")
if (fs::exists(value) or value == "-")
{ // value is ok
return true;
}
@ -80,7 +91,7 @@ static bool ValidateC(const char* flagname, const std::string& value)
static bool ValidateConfigFile(const char* flagname, const std::string& value)
{
if (boost::filesystem::exists(value) or value == std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"))
if (fs::exists(value) or value == std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"))
{ // value is ok
return true;
}
@ -91,7 +102,7 @@ static bool ValidateConfigFile(const char* flagname, const std::string& value)
static bool ValidateS(const char* flagname, const std::string& value)
{
if (boost::filesystem::exists(value) or value == "-")
if (fs::exists(value) or value == "-")
{ // value is ok
return true;
}
@ -102,7 +113,7 @@ static bool ValidateS(const char* flagname, const std::string& value)
static bool ValidateSignalSource(const char* flagname, const std::string& value)
{
if (boost::filesystem::exists(value) or value == "-")
if (fs::exists(value) or value == "-")
{ // value is ok
return true;
}

View File

@ -27,6 +27,20 @@ enable_language(CXX)
enable_language(C)
enable_testing()
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # allows this to be a sub-project
set(PROJECT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) # allows this to be a sub-project
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) # location for custom "Modules"
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif()
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
# Set compiler flags
set(GNSSSDR_CLANG_MIN_VERSION "3.4.0")
set(GNSSSDR_APPLECLANG_MIN_VERSION "500")
@ -63,26 +77,12 @@ endif()
set(CMAKE_CXX_EXTENSIONS OFF)
# Check if we have std::filesystem
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()
if(CMAKE_VERSION VERSION_LESS 3.8)
set(has_std_filesystem FALSE)
set(FILESYSTEM_FOUND FALSE)
else()
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0"))
set(CMAKE_REQUIRED_LIBRARIES -lstdc++fs)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_REQUIRED_LIBRARIES -lc++)
endif()
endif()
include(CheckCXXSymbolExists)
check_cxx_symbol_exists(std::filesystem::path::preferred_separator filesystem has_std_filesystem)
find_package(FILESYSTEM)
endif()
set(USE_CXX17 FALSE)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1")
if(CMAKE_VERSION VERSION_LESS "3.1")
@ -94,10 +94,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")
set(CMAKE_CXX_STANDARD 14)
else()
if(${has_std_filesystem})
if(${FILESYSTEM_FOUND})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(USE_CXX17 TRUE)
else()
set(CMAKE_CXX_STANDARD 14)
endif()
@ -115,10 +114,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CLANG_VERSION VERSION_LESS "1000")
set(CMAKE_CXX_STANDARD 14)
else()
if(${has_std_filesystem})
if(${FILESYSTEM_FOUND})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(USE_CXX17 TRUE)
else()
set(CMAKE_CXX_STANDARD 14)
endif()
@ -126,17 +124,18 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0")
set(CMAKE_CXX_STANDARD 11)
if(CMAKE_VERSION VERSION_LESS "3.1")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11")
else()
set(CMAKE_CXX_STANDARD 11)
endif()
else()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0.0")
set(CMAKE_CXX_STANDARD 14)
else()
if(${has_std_filesystem})
if(${FILESYSTEM_FOUND})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT WIN32)
set(USE_CXX17 TRUE)
endif()
else()
set(CMAKE_CXX_STANDARD 14)
endif()
@ -155,19 +154,8 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif()
option(ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without shared libraries)" OFF)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # allows this to be a sub-project
set(PROJECT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) # allows this to be a sub-project
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) # location for custom "Modules"
include(VolkBuildTypes)
# select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
@ -254,7 +242,7 @@ if(MSVC)
unset(BOOST_REQUIRED_COMPONENTS) # empty components list for static link
endif()
endif()
if(${USE_CXX17})
if(${FILESYSTEM_FOUND})
set(Boost_LIBRARIES "")
set(Boost_INCLUDE_DIRS "")
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH})

View File

@ -35,22 +35,6 @@ include_directories(
)
set(CXX_REQUIRED_LINK "")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CXX_REQUIRED_LINK "c++")
else()
if(${USE_CXX17} AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0"))
set(CXX_REQUIRED_LINK "stdc++fs")
endif()
endif()
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0"))
if(${USE_CXX17})
set(CXX_REQUIRED_LINK "stdc++fs")
endif()
endif()
if(ORC_FOUND)
set(orc_lib ${ORC_LIBRARIES})
else()
@ -74,14 +58,15 @@ add_executable(volk_gnsssdr_profile
${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc
)
if(${USE_CXX17})
if(${FILESYSTEM_FOUND})
add_definitions(-DHAS_STD_FILESYSTEM=1)
target_link_libraries(volk_gnsssdr_profile PRIVATE std::filesystem)
endif()
if(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr_profile ${CXX_REQUIRED_LINK} volk_gnsssdr_static ${Boost_LIBRARIES} ${orc_lib})
target_link_libraries(volk_gnsssdr_profile PUBLIC volk_gnsssdr_static ${Boost_LIBRARIES} ${orc_lib})
else()
target_link_libraries(volk_gnsssdr_profile ${CXX_REQUIRED_LINK} volk_gnsssdr ${Boost_LIBRARIES} ${orc_lib})
target_link_libraries(volk_gnsssdr_profile PUBLIC volk_gnsssdr ${Boost_LIBRARIES} ${orc_lib})
add_dependencies(volk_gnsssdr_profile volk_gnsssdr)
endif()
@ -103,10 +88,12 @@ install(
# MAKE volk_gnsssdr-config-info
add_executable(volk_gnsssdr-config-info volk_gnsssdr-config-info.cc ${CMAKE_CURRENT_SOURCE_DIR}/volk_gnsssdr_option_helpers.cc)
if(ENABLE_STATIC_LIBS)
target_link_libraries(volk_gnsssdr-config-info ${CXX_REQUIRED_LINK} volk_gnsssdr_static ${orc_lib})
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr_static ${orc_lib})
else()
target_link_libraries(volk_gnsssdr-config-info ${CXX_REQUIRED_LINK} volk_gnsssdr ${orc_lib})
target_link_libraries(volk_gnsssdr-config-info volk_gnsssdr ${orc_lib})
add_dependencies(volk_gnsssdr-config-info volk_gnsssdr)
endif()

View File

@ -0,0 +1,255 @@
# Copyright (C) 2019 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
# Original Source: https://github.com/vector-of-bool/CMakeCM
# Modified by C. Fernandez-Prades.
#[=======================================================================[.rst:
FindFILESYSTEM
##############
This module supports the C++17 standard library's filesystem utilities. Use the
:imp-target:`std::filesystem` imported target to
Options
*******
The ``COMPONENTS`` argument to this module supports the following values:
.. find-component:: Experimental
:name: fs.Experimental
Allows the module to find the "experimental" Filesystem TS version of the
Filesystem library. This is the library that should be used with the
``std::experimental::filesystem`` namespace.
.. find-component:: Final
:name: fs.Final
Finds the final C++17 standard version of the filesystem library.
If no components are provided, behaves as if the
:find-component:`fs.Final` component was specified.
If both :find-component:`fs.Experimental` and :find-component:`fs.Final` are
provided, first looks for ``Final``, and falls back to ``Experimental`` in case
of failure. If ``Final`` is found, :imp-target:`std::filesystem` and all
:ref:`variables <fs.variables>` will refer to the ``Final`` version.
Imported Targets
****************
.. imp-target:: std::filesystem
The ``std::filesystem`` imported target is defined when any requested
version of the C++ filesystem library has been found, whether it is
*Experimental* or *Final*.
If no version of the filesystem library is available, this target will not
be defined.
.. note::
This target has ``cxx_std_17`` as an ``INTERFACE``
:ref:`compile language standard feature <req-lang-standards>`. Linking
to this target will automatically enable C++17 if no later standard
version is already required on the linking target.
.. _fs.variables:
Variables
*********
.. variable:: CXX_FILESYSTEM_IS_EXPERIMENTAL
Set to ``TRUE`` when the :find-component:`fs.Experimental` version of C++
filesystem library was found, otherwise ``FALSE``.
.. variable:: CXX_FILESYSTEM_HAVE_FS
Set to ``TRUE`` when a filesystem header was found.
.. variable:: CXX_FILESYSTEM_HEADER
Set to either ``filesystem`` or ``experimental/filesystem`` depending on
whether :find-component:`fs.Final` or :find-component:`fs.Experimental` was
found.
.. variable:: CXX_FILESYSTEM_NAMESPACE
Set to either ``std::filesystem`` or ``std::experimental::filesystem``
depending on whether :find-component:`fs.Final` or
:find-component:`fs.Experimental` was found.
Examples
********
Using `find_package(FILESYSTEM)` with no component arguments:
.. code-block:: cmake
find_package(FILESYSTEM REQUIRED)
add_executable(my-program main.cpp)
target_link_libraries(my-program PRIVATE std::filesystem)
#]=======================================================================]
if(TARGET std::filesystem)
# This module has already been processed. Don't do it again.
return()
endif()
include(CMakePushCheckState)
include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)
cmake_push_check_state()
set(CMAKE_REQUIRED_QUIET ${FILESYSTEM_FIND_QUIETLY})
# All of our tests require C++17 or later
set(CMAKE_CXX_STANDARD 17)
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "9.0.0"))
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
endif()
if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.99"))
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
endif()
# Normalize and check the component list we were given
set(want_components ${FILESYSTEM_FIND_COMPONENTS})
if(FILESYSTEM_FIND_COMPONENTS STREQUAL "")
set(want_components Final)
endif()
# Warn on any unrecognized components
set(extra_components ${want_components})
list(REMOVE_ITEM extra_components Final Experimental)
foreach(component IN LISTS extra_components)
message(WARNING "Extraneous find_package component for FILESYSTEM: ${component}")
endforeach()
# Detect which of Experimental and Final we should look for
set(find_experimental TRUE)
set(find_final TRUE)
if(NOT "Final" IN_LIST want_components)
set(find_final FALSE)
endif()
if(NOT "Experimental" IN_LIST want_components)
set(find_experimental FALSE)
endif()
if(find_final)
check_include_file_cxx("filesystem" _CXX_FILESYSTEM_HAVE_HEADER)
mark_as_advanced(_CXX_FILESYSTEM_HAVE_HEADER)
if(_CXX_FILESYSTEM_HAVE_HEADER)
# We found the non-experimental header. Don't bother looking for the
# experimental one.
set(find_experimental FALSE)
endif()
else()
set(_CXX_FILESYSTEM_HAVE_HEADER FALSE)
endif()
if(find_experimental)
check_include_file_cxx("experimental/filesystem" _CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
mark_as_advanced(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
else()
set(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER FALSE)
endif()
if(_CXX_FILESYSTEM_HAVE_HEADER)
set(_have_fs TRUE)
set(_fs_header filesystem)
set(_fs_namespace std::filesystem)
elseif(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
set(_have_fs TRUE)
set(_fs_header experimental/filesystem)
set(_fs_namespace std::experimental::filesystem)
else()
set(_have_fs FALSE)
endif()
set(CXX_FILESYSTEM_HAVE_FS ${_have_fs} CACHE BOOL "TRUE if we have the C++ filesystem headers")
set(CXX_FILESYSTEM_HEADER ${_fs_header} CACHE STRING "The header that should be included to obtain the filesystem APIs")
set(CXX_FILESYSTEM_NAMESPACE ${_fs_namespace} CACHE STRING "The C++ namespace that contains the filesystem APIs")
set(_found FALSE)
if(CXX_FILESYSTEM_HAVE_FS)
# We have some filesystem library available. Do link checks
string(CONFIGURE [[
#include <@CXX_FILESYSTEM_HEADER@>
int main() {
auto cwd = @CXX_FILESYSTEM_NAMESPACE@::current_path();
return static_cast<int>(cwd.string().size());
}
]] code @ONLY)
# Try to compile a simple filesystem program without any linker flags
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
if(NOT CXX_FILESYSTEM_NO_LINK_NEEDED)
set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
# Add the libstdc++ flag
set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lstdc++fs)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_STDCPPFS_NEEDED)
set(can_link ${CXX_FILESYSTEM_STDCPPFS_NEEDED})
if(NOT CXX_FILESYSTEM_STDCPPFS_NEEDED)
# Try the libc++ flag
set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lc++fs)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_CPPFS_NEEDED)
set(can_link ${CXX_FILESYSTEM_CPPFS_NEEDED})
endif()
endif()
if(can_link)
add_library(std::filesystem INTERFACE IMPORTED)
target_compile_features(std::filesystem INTERFACE cxx_std_17)
set(_found TRUE)
if(CXX_FILESYSTEM_NO_LINK_NEEDED)
# Nothing to add...
elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED)
target_link_libraries(std::filesystem INTERFACE -lstdc++fs)
elseif(CXX_FILESYSTEM_CPPFS_NEEDED)
target_link_libraries(std::filesystem INTERFACE -lc++fs)
endif()
endif()
endif()
if(NOT ${_found})
set(CMAKE_CXX_STANDARD 11)
endif()
cmake_pop_check_state()
set(FILESYSTEM_FOUND ${_found} CACHE BOOL "TRUE if we can compile and link a program using std::filesystem" FORCE)
if(FILESYSTEM_FIND_REQUIRED AND NOT FILESYSTEM_FOUND)
message(FATAL_ERROR "Cannot compile a simple program using std::filesystem")
endif()

View File

@ -28,6 +28,13 @@ source_group(Headers FILES ${OBS_GR_BLOCKS_HEADERS})
add_library(obs_gr_blocks ${OBS_GR_BLOCKS_SOURCES} ${OBS_GR_BLOCKS_HEADERS})
if(${FILESYSTEM_FOUND})
target_compile_definitions(obs_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(obs_gr_blocks PRIVATE std::filesystem)
else()
target_link_libraries(obs_gr_blocks PRIVATE Boost::filesystem)
endif()
target_include_directories(obs_gr_blocks
PUBLIC
${CMAKE_SOURCE_DIR}/src/algorithms/libs
@ -42,7 +49,6 @@ target_link_libraries(obs_gr_blocks
core_system_parameters
Gflags::gflags
Glog::glog
Boost::filesystem
Matio::matio
)

View File

@ -35,7 +35,6 @@
#include "gnss_circular_deque.h"
#include "gnss_sdr_create_directory.h"
#include "gnss_synchro.h"
#include <boost/filesystem/path.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -46,6 +45,13 @@
#include <limits> // for numeric_limits
#include <utility> // for move
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem/path.hpp>
namespace fs = boost::filesystem;
#endif
hybrid_observables_gs_sptr hybrid_observables_gs_make(unsigned int nchannels_in, unsigned int nchannels_out, bool dump, bool dump_mat, std::string dump_filename)
{
@ -125,7 +131,7 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename.append(".dat");
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
d_dump_filename = dump_path + fs::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{

View File

@ -80,6 +80,13 @@ add_library(tracking_gr_blocks
${TRACKING_GR_BLOCKS_HEADERS}
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(tracking_gr_blocks PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(tracking_gr_blocks PRIVATE std::filesystem)
else()
target_link_libraries(tracking_gr_blocks PRIVATE Boost::filesystem)
endif()
target_link_libraries(tracking_gr_blocks
PUBLIC
Boost::boost

View File

@ -54,7 +54,6 @@
#include "gps_sdr_signal_processing.h"
#include "lock_detectors.h"
#include "tracking_discriminators.h"
#include <boost/filesystem/path.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h> // for io_signature
#include <gnuradio/thread/thread.h> // for scoped_lock
@ -67,6 +66,14 @@
#include <iostream> // for cout, cerr
#include <map>
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem/path.hpp>
namespace fs = boost::filesystem;
#endif
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_)
{
@ -497,7 +504,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
d_dump_filename = dump_path + fs::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{

View File

@ -46,7 +46,6 @@
#include "gnss_synchro.h"
#include "lock_detectors.h"
#include "tracking_discriminators.h"
#include <boost/filesystem/path.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -60,6 +59,15 @@
#include <iostream>
#include <map>
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem/path.hpp>
namespace fs = boost::filesystem;
#endif
dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(const Dll_Pll_Conf_Fpga &conf_)
{
return dll_pll_veml_tracking_fpga_sptr(new dll_pll_veml_tracking_fpga(conf_));
@ -413,7 +421,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
d_dump_filename = d_dump_filename.substr(0, d_dump_filename.find_last_of('.'));
}
d_dump_filename = dump_path + boost::filesystem::path::preferred_separator + d_dump_filename;
d_dump_filename = dump_path + fs::path::preferred_separator + d_dump_filename;
// create directory
if (!gnss_sdr_create_directory(dump_path))
{

View File

@ -19,10 +19,15 @@
add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
if(${FILESYSTEM_FOUND})
target_compile_definitions(gnss-sdr PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(gnss-sdr PRIVATE std::filesystem)
else()
target_link_libraries(gnss-sdr PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(gnss-sdr
PUBLIC
Boost::filesystem
Boost::system
Gflags::gflags
Glog::glog
Threads::Threads

View File

@ -45,23 +45,35 @@
#include "gps_acq_assist.h"
#include <boost/exception/diagnostic_information.hpp> // for diagnostic_informatio
#include <boost/exception/exception.hpp> // for exception
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/system/error_code.hpp> // for error_code
#include <boost/thread/exceptions.hpp> // for thread_resource_error
#include <gflags/gflags.h> // for ShutDownCommandLineFlags
#include <glog/logging.h> // for FLAGS_log_dir
#include <chrono> // for time_point
#include <exception> // for exception
#include <iostream> // for operator<<, endl
#include <memory> // for unique_ptr
#include <string> // for string
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
#else
#include <boost/filesystem/operations.hpp> // for create_directories, exists
#include <boost/filesystem/path.hpp> // for path, operator<<
#include <boost/system/error_code.hpp> // for error_code
#endif
#include <gflags/gflags.h> // for ShutDownCommandLineFlags
#include <glog/logging.h> // for FLAGS_log_dir
#include <chrono> // for time_point
#include <exception> // for exception
#include <iostream> // for operator<<, endl
#include <memory> // for unique_ptr
#include <string> // for string
#if CUDA_GPU_ACCEL
// For the CUDA runtime routines (prefixed with "cuda_")
#include <cuda_runtime.h>
#endif
#if HAS_STD_FILESYSTEM
namespace fs = std::filesystem;
namespace errorlib = std;
#else
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
/*
* Concurrent queues that communicates the Telemetry Decoder
@ -103,22 +115,22 @@ int main(int argc, char** argv)
if (FLAGS_log_dir.empty())
{
std::cout << "Logging will be written at "
<< boost::filesystem::temp_directory_path()
<< fs::temp_directory_path()
<< std::endl
<< "Use gnss-sdr --log_dir=/path/to/log to change that."
<< std::endl;
}
else
{
const boost::filesystem::path p(FLAGS_log_dir);
if (!boost::filesystem::exists(p))
const fs::path p(FLAGS_log_dir);
if (!fs::exists(p))
{
std::cout << "The path "
<< FLAGS_log_dir
<< " does not exist, attempting to create it."
<< std::endl;
boost::system::error_code ec;
if (!boost::filesystem::create_directory(p, ec))
errorlib::error_code ec;
if (!fs::create_directory(p, ec))
{
std::cerr << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
google::ShutDownCommandLineFlags();

View File

@ -237,7 +237,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK)
message(STATUS " GPSTk v${GNSSSDR_GPSTK_LOCAL_VERSION} will be automatically downloaded and built when doing 'make'.")
if("${TOOLCHAIN_ARG}" STREQUAL "")
set(TOOLCHAIN_ARG "-DCMAKE_CXX_FLAGS=\"-Wno-deprecated\"")
set(TOOLCHAIN_ARG "-DCMAKE_CXX_FLAGS=-Wno-deprecated")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
endif()
include(GNUInstallDirs)
@ -354,11 +354,15 @@ include_directories(${LIST_INCLUDE_DIRS})
################################################################################
if(ENABLE_UNIT_TESTING)
add_executable(run_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cc)
if(${FILESYSTEM_FOUND})
target_compile_definitions(run_tests PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(run_tests PRIVATE std::filesystem)
else()
target_link_libraries(run_tests PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(run_tests
PUBLIC
Boost::filesystem
Boost::system
Boost::thread
Armadillo::armadillo
Gflags::gflags
@ -441,11 +445,15 @@ if(ENABLE_FPGA)
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE std::filesystem)
else()
target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga
PUBLIC
Armadillo::armadillo
Boost::filesystem
Boost::system
Boost::thread
Gflags::gflags
Glog::glog
@ -482,6 +490,12 @@ function(add_system_test executable)
execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${SYSTEM_TEST_SOURCES})
endif()
add_executable(${executable} ${SYSTEM_TEST_SOURCES})
if(${FILESYSTEM_FOUND})
target_compile_definitions(${executable} PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(${executable} PRIVATE std::filesystem)
else()
target_link_libraries(${executable} PRIVATE Boost::filesystem Boost::system)
endif()
target_include_directories(${executable} PUBLIC ${OPT_INCLUDES_} ${CMAKE_SOURCES_DIR}/src/algorithms/libs)
target_link_libraries(${executable} PUBLIC ${OPT_LIBS_} algorithms_libs)
@ -521,7 +535,7 @@ if(ENABLE_SYSTEM_TESTING)
add_definitions(-DHOST_SYSTEM="${HOST_SYSTEM}")
#### TTFF
set(OPT_LIBS_ Boost::filesystem Boost::system Boost::thread Boost::date_time
set(OPT_LIBS_ Boost::thread Boost::date_time
Threads::Threads Gflags::gflags Glog::glog
Gnuradio::runtime GTest::GTest GTest::Main
Gnuradio::blocks Gnuradio::filter
@ -532,7 +546,7 @@ if(ENABLE_SYSTEM_TESTING)
if(ENABLE_SYSTEM_TESTING_EXTRA)
#### POSITION_TEST
set(OPT_LIBS_ Boost::filesystem Boost::system Boost::thread
set(OPT_LIBS_ Boost::thread
Threads::Threads Gflags::gflags Glog::glog
GTest::GTest GTest::Main Gnuradio::runtime
Gnuradio::blocks Gnuradio::filter
@ -569,11 +583,14 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_flowgraph_test.cc
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(flowgraph_test PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(flowgraph_test PRIVATE std::filesystem)
else()
target_link_libraries(flowgraph_test PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(flowgraph_test
PUBLIC
Boost::filesystem
Boost::system
Boost::thread
Gflags::gflags
Glog::glog
@ -615,11 +632,14 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/adapter/adapter_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_block_factory_test.cc
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(gnss_block_test PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(gnss_block_test PRIVATE std::filesystem)
else()
target_link_libraries(gnss_block_test PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(gnss_block_test
PUBLIC
Boost::filesystem
Boost::system
Boost::thread
Gflags::gflags
Glog::glog
@ -659,11 +679,14 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(gnuradio_block_test PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(gnuradio_block_test PRIVATE std::filesystem)
else()
target_link_libraries(gnuradio_block_test PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(gnuradio_block_test
PUBLIC
Boost::filesystem
Boost::system
Boost::thread
Gflags::gflags
Glog::glog
@ -715,11 +738,14 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(acq_test PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(acq_test PRIVATE std::filesystem)
else()
target_link_libraries(acq_test PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(acq_test
PUBLIC
Boost::filesystem
Boost::system
Boost::thread
Gflags::gflags
Glog::glog
@ -756,11 +782,15 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(trk_test PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(trk_test PRIVATE std::filesystem)
else()
target_link_libraries(trk_test PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(trk_test
PUBLIC
Boost::filesystem
Boost::system
Boost::thread
Gflags::gflags
Glog::glog
@ -793,11 +823,15 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA)
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_message_factory_test.cc
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_thread_test.cc
)
if(${FILESYSTEM_FOUND})
target_compile_definitions(control_thread_test PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(control_thread_test PRIVATE std::filesystem)
else()
target_link_libraries(control_thread_test PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(control_thread_test
PUBLIC
Boost::filesystem
Boost::system
Boost::thread
Gflags::gflags
Glog::glog

View File

@ -48,7 +48,6 @@
#include "test_flags.h"
#include "tracking_tests_flags.h" //acquisition resampler
#include <armadillo>
#include <boost/filesystem.hpp>
#include <glog/logging.h>
#include <gtest/gtest.h>
#include <matio.h>
@ -59,6 +58,14 @@
#include <numeric>
#include <thread>
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// For GPS NAVIGATION (L1)
Concurrent_Queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
Concurrent_Map<Gps_Acq_Assist> global_gps_acq_assist_map;
@ -843,8 +850,8 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu)
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string& gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);

View File

@ -31,13 +31,19 @@
#include "gnuplot_i.h"
#include "test_flags.h"
#include <boost/filesystem.hpp>
#include <gnuradio/fft/fft.h>
#include <algorithm>
#include <chrono>
#include <functional>
#include <random>
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
DEFINE_int32(fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test");
DEFINE_bool(plot_fft_length_test, false, "Plots results of FFTLengthTest with gnuplot");
@ -110,8 +116,8 @@ TEST(FFTLengthTest, MeasureExecutionTime)
{
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string& gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);

View File

@ -47,7 +47,6 @@
#include "test_flags.h"
#include "tracking_true_obs_reader.h"
#include "true_observables_reader.h"
#include <boost/filesystem.hpp>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/interleaved_char_to_complex.h>
#include <gnuradio/blocks/skiphead.h>
@ -55,6 +54,17 @@
#include <thread>
#include <utility>
#if HAS_STD_FILESYSTEM
#include <filesystem>
#include <system_error>
namespace fs = std::filesystem;
namespace errorlib = std;
#else
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
namespace fs = boost::filesystem;
namespace errorlib = boost::system;
#endif
DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test.");
DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used.");
@ -692,8 +702,8 @@ void AcquisitionPerformanceTest::plot_results()
{
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string& gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
@ -782,12 +792,12 @@ TEST_F(AcquisitionPerformanceTest, ROC)
{
Tracking_True_Obs_Reader true_trk_data;
if (boost::filesystem::exists(path_str))
if (fs::exists(path_str))
{
boost::filesystem::remove_all(path_str);
fs::remove_all(path_str);
}
boost::system::error_code ec;
ASSERT_TRUE(boost::filesystem::create_directory(path_str, ec)) << "Could not create the " << path_str << " folder.";
errorlib::error_code ec;
ASSERT_TRUE(fs::create_directory(path_str, ec)) << "Could not create the " << path_str << " folder.";
unsigned int cn0_index = 0;
for (double it : cn0_vector)

View File

@ -41,7 +41,6 @@
#include "gnuplot_i.h"
#include "in_memory_configuration.h"
#include "test_flags.h"
#include <boost/filesystem.hpp>
#include <boost/make_shared.hpp>
#include <glog/logging.h>
#include <gnuradio/analog/sig_source_waveform.h>
@ -52,12 +51,20 @@
#include <gtest/gtest.h>
#include <chrono>
#include <utility>
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class BeidouB1iPcpsAcquisitionTest_msg_rx;
@ -200,8 +207,8 @@ void BeidouB1iPcpsAcquisitionTest::plot_grid()
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string &gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
@ -229,9 +236,9 @@ void BeidouB1iPcpsAcquisitionTest::plot_grid()
}
}
std::string data_str = "./tmp-acq-bds-b1i";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
}
@ -290,11 +297,11 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ValidationOfResults)
if (FLAGS_plot_acq_grid == true)
{
std::string data_str = "./tmp-acq-bds-b1i";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
boost::filesystem::create_directory(data_str);
fs::create_directory(data_str);
}
std::shared_ptr<BeidouB1iPcpsAcquisition> acquisition = std::make_shared<BeidouB1iPcpsAcquisition>(config.get(), "Acquisition_B1", 1, 0);

View File

@ -33,15 +33,14 @@
#include "Beidou_B3I.h"
#include "acquisition_dump_reader.h"
#include "beidou_b3i_pcps_acquisition.h"
#include "gnss_block_factory.h"
#include "gnss_block_interface.h"
#include "gnss_sdr_valve.h"
#include "gnss_synchro.h"
#include "gnuplot_i.h"
#include "beidou_b3i_pcps_acquisition.h"
#include "in_memory_configuration.h"
#include "test_flags.h"
#include <boost/filesystem.hpp>
#include <boost/make_shared.hpp>
#include <glog/logging.h>
#include <gnuradio/analog/sig_source_waveform.h>
@ -52,12 +51,20 @@
#include <gtest/gtest.h>
#include <chrono>
#include <utility>
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class BeidouB3iPcpsAcquisitionTest_msg_rx;
@ -199,8 +206,8 @@ void BeidouB3iPcpsAcquisitionTest::plot_grid()
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string &gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
@ -228,9 +235,9 @@ void BeidouB3iPcpsAcquisitionTest::plot_grid()
}
}
std::string data_str = "./tmp-acq-bds-b3i";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
}
@ -289,11 +296,11 @@ TEST_F(BeidouB3iPcpsAcquisitionTest, ValidationOfResults)
if (FLAGS_plot_acq_grid == true)
{
std::string data_str = "./tmp-acq-bds-b3i";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
boost::filesystem::create_directory(data_str);
fs::create_directory(data_str);
}
std::shared_ptr<BeidouB3iPcpsAcquisition> acquisition = std::make_shared<BeidouB3iPcpsAcquisition>(config.get(), "Acquisition_B3", 1, 0);

View File

@ -52,12 +52,21 @@
#include <gtest/gtest.h>
#include <chrono>
#include <utility>
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx;
@ -199,8 +208,8 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string& gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
@ -228,9 +237,9 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
}
}
std::string data_str = "./tmp-acq-gal1";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
}
@ -283,11 +292,11 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
if (FLAGS_plot_acq_grid == true)
{
std::string data_str = "./tmp-acq-gal1";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
boost::filesystem::create_directory(data_str);
fs::create_directory(data_str);
}
double expected_delay_samples = 2920; //18250;

View File

@ -41,7 +41,6 @@
#include "gps_l1_ca_pcps_acquisition.h"
#include "in_memory_configuration.h"
#include "test_flags.h"
#include <boost/filesystem.hpp>
#include <boost/make_shared.hpp>
#include <glog/logging.h>
#include <gnuradio/analog/sig_source_waveform.h>
@ -52,12 +51,21 @@
#include <gtest/gtest.h>
#include <chrono>
#include <utility>
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL1CaPcpsAcquisitionTest_msg_rx;
@ -200,8 +208,8 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string &gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
@ -229,9 +237,9 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
}
}
std::string data_str = "./tmp-acq-gps1";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
}
@ -290,11 +298,11 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
if (FLAGS_plot_acq_grid == true)
{
std::string data_str = "./tmp-acq-gps1";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
boost::filesystem::create_directory(data_str);
fs::create_directory(data_str);
}
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 0);

View File

@ -41,7 +41,6 @@
#include "gps_l2_m_pcps_acquisition.h"
#include "in_memory_configuration.h"
#include "test_flags.h"
#include <boost/filesystem.hpp>
#include <boost/make_shared.hpp>
#include <gnuradio/analog/sig_source_waveform.h>
#include <gnuradio/blocks/char_to_short.h>
@ -53,12 +52,21 @@
#include <gtest/gtest.h>
#include <chrono>
#include <utility>
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL2MPcpsAcquisitionTest_msg_rx;
@ -203,8 +211,8 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string &gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
@ -232,9 +240,9 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
}
}
std::string data_str = "./tmp-acq-gps2";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
}
@ -289,11 +297,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
if (FLAGS_plot_acq_grid == true)
{
std::string data_str = "./tmp-acq-gps2";
if (boost::filesystem::exists(data_str))
if (fs::exists(data_str))
{
boost::filesystem::remove_all(data_str);
fs::remove_all(data_str);
}
boost::filesystem::create_directory(data_str);
fs::create_directory(data_str);
}
init();

View File

@ -41,7 +41,6 @@
#include "tracking_tests_flags.h"
#include "tracking_true_obs_reader.h"
#include <armadillo>
#include <boost/filesystem.hpp>
#include <gnuradio/analog/sig_source_waveform.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/interleaved_char_to_complex.h>
@ -54,12 +53,21 @@
#include <unistd.h>
#include <utility>
#include <vector>
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class GpsL1CADllPllTrackingTest_msg_rx;
@ -807,8 +815,8 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
{
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string& gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
auto decimate = static_cast<unsigned int>(FLAGS_plot_decimate);

View File

@ -41,7 +41,6 @@
#include "tracking_interface.h"
#include "tracking_true_obs_reader.h"
#include <armadillo>
#include <boost/filesystem.hpp>
#include <gnuradio/analog/sig_source_waveform.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/interleaved_char_to_complex.h>
@ -53,12 +52,21 @@
#include <unistd.h>
#include <utility>
#include <vector>
#ifdef GR_GREATER_38
#include <gnuradio/analog/sig_source.h>
#else
#include <gnuradio/analog/sig_source_c.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
DEFINE_bool(plot_gps_l1_kf_tracking_test, false, "Plots results of GpsL1CAKfTrackingTest with gnuplot");
@ -525,8 +533,8 @@ TEST_F(GpsL1CAKfTrackingTest, ValidationOfResults)
{
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string& gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);

View File

@ -55,7 +55,6 @@
#include "tracking_tests_flags.h"
#include "tracking_true_obs_reader.h"
#include <armadillo>
#include <boost/filesystem.hpp>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/head.h>
#include <gnuradio/blocks/interleaved_char_to_complex.h>
@ -69,12 +68,21 @@
#include <cstdint>
#include <utility>
#include <vector>
#ifdef GR_GREATER_38
#include <gnuradio/filter/fir_filter_blk.h>
#else
#include <gnuradio/filter/fir_filter_ccf.h>
#endif
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
// ######## GNURADIO TRACKING BLOCK MESSAGE RECEVER #########
class TrackingPullInTest_msg_rx;
@ -965,8 +973,8 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
{
try
{
boost::filesystem::path p(gnuplot_executable);
boost::filesystem::path dir = p.parent_path();
fs::path p(gnuplot_executable);
fs::path dir = p.parent_path();
const std::string& gnuplot_path = dir.native();
Gnuplot::set_GNUPlotPath(gnuplot_path);
auto decimate = static_cast<unsigned int>(FLAGS_plot_decimate);

View File

@ -56,6 +56,13 @@ endif()
add_executable(front-end-cal ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
if(${FILESYSTEM_FOUND})
target_compile_definitions(front-end-cal PRIVATE -DHAS_STD_FILESYSTEM=1)
target_link_libraries(front-end-cal PRIVATE std::filesystem)
else()
target_link_libraries(front-end-cal PRIVATE Boost::filesystem Boost::system)
endif()
target_link_libraries(front-end-cal
PUBLIC
Volkgnsssdr::volkgnsssdr ${ORC_LIBRARIES}
@ -64,7 +71,6 @@ target_link_libraries(front-end-cal
front_end_cal_lib
gnss_sdr_flags
PRIVATE
Boost::filesystem
Gflags::gflags
Glog::glog
)

View File

@ -51,7 +51,6 @@
#include <boost/any.hpp> // for bad_any_cast
#include <boost/bind.hpp>
#include <boost/exception/exception.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <gflags/gflags.h>
#include <glog/logging.h>
@ -83,6 +82,14 @@
#include <utility>
#include <vector>
#if HAS_STD_FILESYSTEM
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
#endif
DECLARE_string(log_dir);
Concurrent_Map<Gps_Ephemeris> global_gps_ephemeris_map;
@ -284,14 +291,14 @@ int main(int argc, char** argv)
}
else
{
const boost::filesystem::path p(FLAGS_log_dir);
if (!boost::filesystem::exists(p))
const fs::path p(FLAGS_log_dir);
if (!fs::exists(p))
{
std::cout << "The path "
<< FLAGS_log_dir
<< " does not exist, attempting to create it"
<< std::endl;
boost::filesystem::create_directory(p);
fs::create_directory(p);
}
std::cout << "Logging with be done at "
<< FLAGS_log_dir << std::endl;

View File

@ -55,8 +55,8 @@ find_program(UNCOMPRESS_EXECUTABLE uncompress
)
if(Boost_FOUND)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
add_executable(rinex2assist ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
target_link_libraries(rinex2assist