diff --git a/.clang-format b/.clang-format index c8cd017d2..57c1b1d78 100644 --- a/.clang-format +++ b/.clang-format @@ -53,7 +53,7 @@ IncludeBlocks: Merge IncludeCategories: - Regex: '^.*.h"' Priority: 1 - - Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gpstk|gsl|gtest|pmt|uhd|volk)/' + - Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gnsstk|gsl|gtest|pmt|uhd|volk)/' Priority: 2 - Regex: '^.*(armadillo|iio|matio|pugixml)' Priority: 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7379fa1e2..106465e95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,6 +113,14 @@ endif() option(ENABLE_OWN_GNSSTK "Force to download, build and link gnsstk for system tests, even if it is already installed" OFF) +if(NOT ENABLE_OWN_GNSSTK) + option(ENABLE_OWN_GPSTK "Force to download, build and link gnsstk for system tests, even if it is already installed" OFF) + if(ENABLE_OWN_GPSTK) + message(STATUS "WARNING: Option ENABLE_OWN_GPSTK is deprecated, please use ENABLE_OWN_GNSSTK") + set(ENABLE_OWN_GNSSTK ON) + endif() +endif() + option(ENABLE_INSTALL_TESTS "Install QA code system-wide" OFF) if(ENABLE_FPGA) set(ENABLE_INSTALL_TESTS ON) @@ -663,7 +671,7 @@ endif() if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND (LOG4CPP_READY_FOR_CXX17 OR GNURADIO_USES_SPDLOG)) # Check if we have std::filesystem if(NOT (CMAKE_VERSION VERSION_LESS 3.8)) - #if(NOT GPSTK_FOUND OR NOT (GPSTK_FOUND AND GPSTK_OLDER_THAN_8)) # Fix for GPSTk < 8.0.0 + if(NOT GNSSTK_FOUND OR NOT (GNSSTK_FOUND AND GNSSTK_OLDER_THAN_8)) # Fix for GNSSTk < 8.0.0 find_package(FILESYSTEM COMPONENTS Final Experimental) set_package_properties(FILESYSTEM PROPERTIES URL "https://en.cppreference.com/w/cpp/filesystem" @@ -671,7 +679,7 @@ if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND (LOG4CPP_READY_FOR_CXX17 OR GNURA PURPOSE "Work with paths, regular files, and directories." TYPE OPTIONAL ) - #endif() + endif() if(FILESYSTEM_FOUND) set(CMAKE_CXX_STANDARD 17) # if(CMAKE_VERSION VERSION_GREATER 3.13) diff --git a/cmake/Modules/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake index 48c4bcdc3..ba0accb6e 100644 --- a/cmake/Modules/FindGNSSTK.cmake +++ b/cmake/Modules/FindGNSSTK.cmake @@ -31,14 +31,27 @@ if(DEFINED ENV{GNSSTK_ROOT}) ) endif() +unset(GNSSTK_INCLUDE_DIR CACHE) +set(GNSSTK_USES_GPSTK_NAMESPACE FALSE) find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp PATHS ${GNSSTK_ROOT_USER_DEFINED}/include /usr/include /usr/local/include /opt/local/include ) - -set(GNSSTK_NAMES gnsstk libgnsstk) +set(GNSSTK_NAMES ${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_SHARED_LIBRARY_SUFFIX}) +if(NOT GNSSTK_INCLUDE_DIR) + find_path(GNSSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp + PATHS ${GNSSTK_ROOT_USER_DEFINED}/include + /usr/include + /usr/local/include + /opt/local/include + ) + if(GNSSTK_INCLUDE_DIR) + set(GNSSTK_NAMES gpstk ${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(GNSSTK_USES_GPSTK_NAMESPACE TRUE) + endif() +endif() include(GNUInstallDirs) @@ -61,6 +74,10 @@ if(GNSSTK_FOUND) unset(PACKAGE_VERSION) if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) + else() + if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake) + include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake) + endif() endif() if(PACKAGE_VERSION) set(GNSSTK_VERSION ${PACKAGE_VERSION}) @@ -70,30 +87,40 @@ endif() if(GNSSTK_FOUND AND GNSSTK_VERSION) set_package_properties(GNSSTK PROPERTIES - DESCRIPTION "Library and suite of applications for satellite navigation (found: v${GNSSTK_VERSION})" + DESCRIPTION "The GNSSTk C++ Library (found: v${GNSSTK_VERSION})" ) else() set_package_properties(GNSSTK PROPERTIES - DESCRIPTION "Library and suite of applications for satellite navigation" + DESCRIPTION "The GNSSTk C++ Library" ) endif() -#if(GNSSTK_FOUND AND NOT EXISTS ${GNSSTK_INCLUDE_DIR}/gnsstk/SatelliteSystem.hpp) -# set(GNSSTK_OLDER_THAN_8 TRUE) -#endif() +if(GNSSTK_FOUND AND GNSSTK_USES_GPSTK_NAMESPACE AND NOT EXISTS ${GNSSTK_INCLUDE_DIR}/gpstk/SatelliteSystem.hpp) + set(GNSSTK_OLDER_THAN_8 TRUE) +endif() set_package_properties(GNSSTK PROPERTIES URL "https://github.com/SGL-UT/gnsstk/" + TYPE OPTIONAL ) if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk) add_library(Gnsstk::gnsstk SHARED IMPORTED) - set_target_properties(Gnsstk::gnsstk PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GNSSTK_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" - INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" - ) + if(GNSSTK_USES_GPSTK_NAMESPACE) + set_target_properties(Gnsstk::gnsstk PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GNSSTK_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gpstk" + INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" + ) + else() + set_target_properties(Gnsstk::gnsstk PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GNSSTK_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" + INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" + ) + endif() endif() -mark_as_advanced(GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR) +mark_as_advanced(GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR GNSSTK_USES_GPSTK_NAMESPACE GNSSTK_OLDER_THAN_8) diff --git a/cmake/Modules/FindGPSTK.cmake b/cmake/Modules/FindGPSTK.cmake deleted file mode 100644 index 5ea1beb54..000000000 --- a/cmake/Modules/FindGPSTK.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -# This file is part of GNSS-SDR. -# -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es -# SPDX-License-Identifier: BSD-3-Clause - -# - Find gpstk library -# Find the native gpstk includes and library -# This module defines -# GPSTK_INCLUDE_DIR, where to find Rinex3ObsBase.hpp, etc. -# GPSTK_FOUND, If false, do not try to use GPSTK. -# GPSTK_LIBRARY, where to find the GPSTK library. -# -# Provides the following imported target: -# Gpstk::gpstk -# - -if(NOT COMMAND feature_summary) - include(FeatureSummary) -endif() - -if(NOT GPSTK_ROOT) - set(GPSTK_ROOT_USER_DEFINED /usr/local) -else() - set(GPSTK_ROOT_USER_DEFINED ${GPSTK_ROOT}) -endif() -if(DEFINED ENV{GPSTK_ROOT}) - set(GPSTK_ROOT_USER_DEFINED - ${GPSTK_ROOT_USER_DEFINED} - $ENV{GPSTK_ROOT} - ) -endif() - -find_path(GPSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp - PATHS ${GPSTK_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include -) - -set(GPSTK_NAMES gpstk libgpstk) - -include(GNUInstallDirs) - -find_library(GPSTK_LIBRARY NAMES ${GPSTK_NAMES} - PATHS ${GPSTK_ROOT_USER_DEFINED}/lib - ${GPSTK_ROOT_USER_DEFINED}/${CMAKE_INSTALL_LIBDIR} - /usr/local/lib - /usr/${CMAKE_INSTALL_LIBDIR} - /usr/local/${CMAKE_INSTALL_LIBDIR} - /opt/local/lib -) - -# handle the QUIET and REQUIRED arguments and set GPSTK_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GPSTK DEFAULT_MSG GPSTK_LIBRARY GPSTK_INCLUDE_DIR) - -if(GPSTK_FOUND) - set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION}) - unset(PACKAGE_VERSION) - if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake) - include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake) - endif() - if(PACKAGE_VERSION) - set(GPSTK_VERSION ${PACKAGE_VERSION}) - endif() - set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION}) -endif() - -if(GPSTK_FOUND AND GPSTK_VERSION) - set_package_properties(GPSTK PROPERTIES - DESCRIPTION "Library and suite of applications for satellite navigation (found: v${GPSTK_VERSION})" - ) -else() - set_package_properties(GPSTK PROPERTIES - DESCRIPTION "Library and suite of applications for satellite navigation" - ) -endif() - -if(GPSTK_FOUND AND NOT EXISTS ${GPSTK_INCLUDE_DIR}/gpstk/SatelliteSystem.hpp) - set(GPSTK_OLDER_THAN_8 TRUE) -endif() - -set_package_properties(GPSTK PROPERTIES - URL "https://github.com/SGL-UT/gnsstk" -) - -if(GPSTK_FOUND AND NOT ENABLE_OWN_GPSTK AND NOT TARGET Gpstk::gpstk) - add_library(Gpstk::gpstk SHARED IMPORTED) - set_target_properties(Gpstk::gpstk PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GPSTK_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GPSTK_INCLUDE_DIR};${GPSTK_INCLUDE_DIR}/gpstk" - INTERFACE_LINK_LIBRARIES "${GPSTK_LIBRARY}" - ) -endif() - -mark_as_advanced(GPSTK_LIBRARY GPSTK_INCLUDE_DIR) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index be0d63cb7..31dfb3ca7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -35,6 +35,13 @@ All notable changes to GNSS-SDR will be documented in this file. **not** applied to the computed PVT solution. In the Galileo E6B-only receiver, HAS messages are decoded and reported. +### Improvements in Maintainability: + +- The now archived [GPSTk toolkit](https://github.com/SGL-UT/GPSTk), used in + some optional tests and applications, has been replaced by the new + [GNSSTk](https://github.com/SGL-UT/gnsstk) C++ Library. Compatibility with the + former GPSTk toolkit is maintained. + ### Improvements in Portability: - Improved detection of the BLAS library under macOS / Macports (the `lapack` diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 238e9074d..9c0e34762 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -555,9 +555,12 @@ if(ENABLE_UNIT_TESTING) endif() if(ENABLE_UNIT_TESTING_EXTRA) target_link_libraries(run_tests PRIVATE Gnsstk::gnsstk) - #if(GNSSTK_OLDER_THAN_8) - # target_compile_definitions(run_tests PRIVATE -DOLD_GPSTK=1) - #endif() + if(GNSSTK_OLDER_THAN_8) + target_compile_definitions(run_tests PRIVATE -DOLD_GPSTK=1) + endif() + if(GNSSTK_USES_GPSTK_NAMESPACE) + target_compile_definitions(run_tests PRIVATE -DGNSSTK_USES_GPSTK_NAMESPACE=1) + endif() endif() if(ENABLE_STRIP) set_target_properties(run_tests PROPERTIES LINK_FLAGS "-s") diff --git a/src/tests/data/gpstk_static.patch b/src/tests/data/gpstk_static.patch deleted file mode 100644 index bfddec0e2..000000000 --- a/src/tests/data/gpstk_static.patch +++ /dev/null @@ -1,31 +0,0 @@ -SPDX-License-Identifier: GPL-3.0-or-later -SPDX-FileCopyrightText: 2020 Carles Fernandez-Prades ---- CMakeLists.txt 2022-04-05 23:24:04.000000000 +0200 -+++ CMakeLists.txt 2022-04-05 23:29:02.000000000 +0200 -@@ -77,7 +77,16 @@ - - - include( BuildSetup.cmake ) -- -+set(STADYN "STATIC") -+if(POLICY CMP0063) -+ cmake_policy(SET CMP0063 NEW) -+ set(CMAKE_CXX_VISIBILITY_PRESET hidden) -+ set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) -+else() -+ if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) -+ add_definitions(-fvisibility=hidden) -+ endif() -+endif() - #============================================================ - # Core Library Target Files - #============================================================ -@@ -161,7 +170,7 @@ - add_library( gpstk ${STADYN} ${GPSTK_SRC_FILES} ${GPSTK_INC_FILES} ) - - # GPSTk library install target --install( TARGETS gpstk DESTINATION "${CMAKE_INSTALL_LIBDIR}" EXPORT "${EXPORT_TARGETS_FILENAME}" ) -+install( TARGETS gpstk DESTINATION lib EXPORT "${EXPORT_TARGETS_FILENAME}" ) - - # GPSTk header file install target (whether it is version dependent changes based on user flag) - install( FILES ${GPSTK_INC_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 493941408..704005402 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -57,11 +57,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -70,6 +65,20 @@ #include #include #include +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#include +#include +#include +#include +namespace gnsstk = gpstk; +#else +#include +#include +#include +#include +#include +#endif #if HAS_GENERIC_LAMBDA #else @@ -1556,17 +1565,17 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S // Open and read reference RINEX observables file try { - gpstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); + gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); r_ref.exceptions(std::ios::failbit); - gpstk::Rinex3ObsData r_ref_data; - gpstk::Rinex3ObsHeader r_ref_header; + gnsstk::Rinex3ObsData r_ref_data; + gnsstk::Rinex3ObsHeader r_ref_header; - gpstk::RinexDatum dataobj; + gnsstk::RinexDatum dataobj; r_ref >> r_ref_header; std::vector first_row; - gpstk::SatID prn; + gnsstk::SatID prn; for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++) { first_row.push_back(true); @@ -1582,28 +1591,28 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S { case 'G': #if OLD_GPSTK - prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); + prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS); #else - prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); + prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS); #endif break; case 'E': #if OLD_GPSTK - prn = gpstk::SatID(myprn, gpstk::SatID::systemGalileo); + prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGalileo); #else - prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::Galileo); + prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::Galileo); #endif break; default: #if OLD_GPSTK - prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); + prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS); #else - prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); + prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS); #endif } - gpstk::CommonTime time = r_ref_data.time; - double sow(static_cast(time).sow); + gnsstk::CommonTime time = r_ref_data.time; + double sow(static_cast(time).sow); auto pointer = r_ref_data.obs.find(prn); if (pointer == r_ref_data.obs.end()) @@ -1680,12 +1689,12 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S } } // end while } // End of 'try' block - catch (const gpstk::FFStreamError& e) + catch (const gnsstk::FFStreamError& e) { std::cout << e; return false; } - catch (const gpstk::Exception& e) + catch (const gnsstk::Exception& e) { std::cout << e; return false; diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc index 9e40ab53c..74e397d2e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc @@ -56,11 +56,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -71,6 +66,21 @@ #include #include +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#include +#include +#include +#include +namespace gnsstk = gpstk; +#else +#include +#include +#include +#include +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -1648,17 +1658,17 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn // Open and read reference RINEX observables file try { - gpstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); + gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); r_ref.exceptions(std::ios::failbit); - gpstk::Rinex3ObsData r_ref_data; - gpstk::Rinex3ObsHeader r_ref_header; + gnsstk::Rinex3ObsData r_ref_data; + gnsstk::Rinex3ObsHeader r_ref_header; - gpstk::RinexDatum dataobj; + gnsstk::RinexDatum dataobj; r_ref >> r_ref_header; std::vector first_row; - gpstk::SatID prn; + gnsstk::SatID prn; for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++) { first_row.push_back(true); @@ -1674,28 +1684,28 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn { case 'G': #if OLD_GPSTK - prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); + prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS); #else - prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); + prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS); #endif break; case 'E': #if OLD_GPSTK - prn = gpstk::SatID(myprn, gpstk::SatID::systemGalileo); + prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGalileo); #else - prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::Galileo); + prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::Galileo); #endif break; default: #if OLD_GPSTK - prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); + prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS); #else - prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); + prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS); #endif } - gpstk::CommonTime time = r_ref_data.time; - double sow(static_cast(time).sow); + gnsstk::CommonTime time = r_ref_data.time; + double sow(static_cast(time).sow); auto pointer = r_ref_data.obs.find(prn); if (pointer == r_ref_data.obs.end()) @@ -1773,12 +1783,12 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn } // end while } // End of 'try' block - catch (const gpstk::FFStreamError& e) + catch (const gnsstk::FFStreamError& e) { std::cout << e; return false; } - catch (const gpstk::Exception& e) + catch (const gnsstk::Exception& e) { std::cout << e; return false; diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 5ba60ae5c..0071bf3dc 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -10,8 +10,13 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND find_package(GNSSTK QUIET) if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) include(GNUInstallDirs) - set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + if(GNSSTK_USES_GPSTK_NAMESPACE) + set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + else() + set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + endif() endif() if(USE_CMAKE_TARGET_SOURCES) @@ -54,17 +59,35 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERSION}) add_dependencies(obsdiff matio-${GNSSSDR_MATIO_LOCAL_VERSION}) endif() + if(GNSSTK_USES_GPSTK_NAMESPACE) + target_compile_definitions(obsdiff PUBLIC -DGNSSTK_USES_GPSTK_NAMESPACE=1) + endif() + if(GNSSTK_OLDER_THAN_8) + target_compile_definitions(obsdiff PUBLIC -DOLD_GPSTK=1) + endif() if(NOT TARGET Gnsstk::gnsstk) - file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIR}/gnsstk) - add_library(Gnsstk::gnsstk STATIC IMPORTED) - add_dependencies(Gnsstk::gnsstk gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) - set_target_properties(Gnsstk::gnsstk PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GNSSTK_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" - INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" - ) + if(GNSSTK_USES_GPSTK_NAMESPACE) + file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIR}/gpstk) + add_library(Gnsstk::gnsstk STATIC IMPORTED) + add_dependencies(Gnsstk::gnsstk gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) + set_target_properties(Gnsstk::gnsstk PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GNSSTK_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gpstk" + INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" + ) + else() + file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIR}/gnsstk) + add_library(Gnsstk::gnsstk STATIC IMPORTED) + add_dependencies(Gnsstk::gnsstk gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) + set_target_properties(Gnsstk::gnsstk PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GNSSTK_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" + INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" + ) + endif() endif() target_link_libraries(obsdiff diff --git a/src/utils/rinex-tools/README.md b/src/utils/rinex-tools/README.md index 1bb198834..58a1bd259 100644 --- a/src/utils/rinex-tools/README.md +++ b/src/utils/rinex-tools/README.md @@ -23,8 +23,8 @@ Requirements: - [Gflags](https://github.com/gflags/gflags): A C++ library that implements command-line flags processing. If not found in your system, the latest version will be downloaded, built and linked for you at building time. -- [GPSTK](https://github.com/SGL-UT/GPSTk): The GPS Toolkit, used for RINEX - files reading. If not found in your system, the latest version will be +- [GNSSTK](https://github.com/SGL-UT/gnsstk): The GNSSTk C++ Library, used for + RINEX files reading. If not found in your system, the latest version will be downloaded, built and linked for you at building time. - [Matio](https://github.com/tbeu/matio): A MATLAB MAT File I/O Library, version >= 1.5.3. If it is not found, or an older version is found, CMake will diff --git a/src/utils/rinex-tools/obsdiff.cc b/src/utils/rinex-tools/obsdiff.cc index cc03ae660..c44817551 100644 --- a/src/utils/rinex-tools/obsdiff.cc +++ b/src/utils/rinex-tools/obsdiff.cc @@ -21,6 +21,34 @@ #include "gnuplot_i.h" #include "obsdiff_flags.h" #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace gnsstk = gpstk; +#else // Classes for handling observations RINEX files (data) #include #include @@ -49,16 +77,7 @@ // Class defining GPS system constants #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#endif #if GFLAGS_OLD_NAMESPACE namespace gflags @@ -111,15 +130,27 @@ std::map ReadRinexObs(const std::string& rinex_file, char system switch (system) { case 'G': - prn.system = gnsstk::SatelliteSystem::GPS; +#if OLD_GPSTK + prn.system = gpstk::SatID::systemGPS; +#else + prn.system = gpstk::SatelliteSystem::GPS; +#endif PRN_set = available_gps_prn; break; case 'E': - prn.system = gnsstk::SatelliteSystem::Galileo; +#if OLD_GPSTK + prn.system = gpstk::SatID::systemGalileo; +#else + prn.system = gpstk::SatelliteSystem::Galileo; +#endif PRN_set = available_galileo_prn; break; default: - prn.system = gnsstk::SatelliteSystem::GPS; +#if OLD_GPSTK + prn.system = gpstk::SatID::systemGPS; +#else + prn.system = gpstk::SatelliteSystem::GPS; +#endif PRN_set = available_gps_prn; } @@ -1239,12 +1270,19 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: // pointer to the tropospheric model to be applied try { - gnsstk::Matrix invMC; +#if OLD_GPSTK + std::vector Syss; +#endif + gpstk::Matrix invMC; int iret; // Call RAIMCompute +#if OLD_GPSTK + iret = raimSolver.RAIMCompute(rod.time, prnVec, Syss, rangeVec, invMC, + &bcestore, tropModelPtr); +#else iret = raimSolver.RAIMCompute(rod.time, prnVec, rangeVec, invMC, &bcestore, tropModelPtr); - +#endif switch (iret) { /// @return Return values: diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index fa0dd40c3..d788109c7 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -8,8 +8,13 @@ find_package(GNSSTK QUIET) if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) include(GNUInstallDirs) - set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + if(GNSSTK_USES_GPSTK_NAMESPACE) + set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + else() + set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + endif() endif() @@ -79,11 +84,25 @@ if(Boost_FOUND) core_system_parameters ) - target_include_directories(rinex2assist - PRIVATE - ${GNSSTK_INCLUDE_DIR}/gnsstk - ${GNSSTK_INCLUDE_DIR} - ) + if(GNSSTK_USES_GPSTK_NAMESPACE) + target_compile_definitions(rinex2assist PUBLIC -DGNSSTK_USES_GPSTK_NAMESPACE=1) + target_include_directories(rinex2assist + PRIVATE + ${GNSSTK_INCLUDE_DIR}/gpstk + ${GNSSTK_INCLUDE_DIR} + ) + else() + target_include_directories(rinex2assist + PRIVATE + ${GNSSTK_INCLUDE_DIR}/gnsstk + ${GNSSTK_INCLUDE_DIR} + ) + endif() + if(GNSSTK_VERSION) + if(GNSSTK_VERSION VERSION_LESS "9.0.0") + target_compile_definitions(rinex2assist PUBLIC -DGNSSTK_OLDER_THAN_9=1) + endif() + endif() if(NOT UNCOMPRESS_EXECUTABLE-NOTFOUND) target_compile_definitions(rinex2assist PRIVATE -DUNCOMPRESS_EXECUTABLE="${UNCOMPRESS_EXECUTABLE}") diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index 0e16560cf..b394abfa0 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -28,14 +28,23 @@ #include #include #include +#include // for size_t +#include +#include +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#include +#include +#include +#include +namespace gnsstk = gpstk; +#else #include #include #include #include #include -#include // for size_t -#include -#include +#endif #if GFLAGS_OLD_NAMESPACE namespace gflags @@ -178,12 +187,17 @@ int main(int argc, char** argv) gps_utc_model.valid = (hdr.valid > 2147483648) ? true : false; gps_utc_model.A1 = hdr.mapTimeCorr["GPUT"].A0; gps_utc_model.A0 = hdr.mapTimeCorr["GPUT"].A1; +#if GNSSTK_OLDER_THAN_9 + gps_utc_model.tot = hdr.mapTimeCorr["GPUT"].refSOW; + gps_utc_model.WN_T = hdr.mapTimeCorr["GPUT"].refWeek; +#else if (hdr.mapTimeCorr["GPUT"].refTime != gnsstk::CommonTime::BEGINNING_OF_TIME) { gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GPUT"].refTime); gps_utc_model.tot = gws.getSOW(); gps_utc_model.WN_T = gws.getWeek(); } +#endif gps_utc_model.DeltaT_LS = hdr.leapSeconds; gps_utc_model.WN_LSF = hdr.leapWeek; gps_utc_model.DN = hdr.leapDay; @@ -205,12 +219,17 @@ int main(int argc, char** argv) gal_utc_model.A0 = hdr.mapTimeCorr["GAUT"].A0; gal_utc_model.A1 = hdr.mapTimeCorr["GAUT"].A1; gal_utc_model.Delta_tLS = hdr.leapSeconds; +#if GNSSTK_OLDER_THAN_9 + gal_utc_model.tot = hdr.mapTimeCorr["GAUT"].refSOW; + gal_utc_model.WNot = hdr.mapTimeCorr["GAUT"].refWeek; +#else if (hdr.mapTimeCorr["GAUT"].refTime != gnsstk::CommonTime::BEGINNING_OF_TIME) { gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GAUT"].refTime); gal_utc_model.tot = gws.getSOW(); gal_utc_model.WNot = gws.getWeek(); } +#endif gal_utc_model.WN_LSF = hdr.leapWeek; gal_utc_model.DN = hdr.leapDay; gal_utc_model.Delta_tLSF = hdr.leapDelta;