1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-11 18:50:37 +00:00

Allow backward compatibility with GPSTK

This commit is contained in:
Carles Fernandez 2022-07-05 13:46:58 +02:00
parent dc027e95ff
commit 109112be63
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
14 changed files with 261 additions and 228 deletions

View File

@ -53,7 +53,7 @@ IncludeBlocks: Merge
IncludeCategories: IncludeCategories:
- Regex: '^.*.h"' - Regex: '^.*.h"'
Priority: 1 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 Priority: 2
- Regex: '^.*(armadillo|iio|matio|pugixml)' - Regex: '^.*(armadillo|iio|matio|pugixml)'
Priority: 2 Priority: 2

View File

@ -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) 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) option(ENABLE_INSTALL_TESTS "Install QA code system-wide" OFF)
if(ENABLE_FPGA) if(ENABLE_FPGA)
set(ENABLE_INSTALL_TESTS ON) 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)) if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND (LOG4CPP_READY_FOR_CXX17 OR GNURADIO_USES_SPDLOG))
# Check if we have std::filesystem # Check if we have std::filesystem
if(NOT (CMAKE_VERSION VERSION_LESS 3.8)) 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) find_package(FILESYSTEM COMPONENTS Final Experimental)
set_package_properties(FILESYSTEM PROPERTIES set_package_properties(FILESYSTEM PROPERTIES
URL "https://en.cppreference.com/w/cpp/filesystem" 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." PURPOSE "Work with paths, regular files, and directories."
TYPE OPTIONAL TYPE OPTIONAL
) )
#endif() endif()
if(FILESYSTEM_FOUND) if(FILESYSTEM_FOUND)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
# if(CMAKE_VERSION VERSION_GREATER 3.13) # if(CMAKE_VERSION VERSION_GREATER 3.13)

View File

@ -31,14 +31,27 @@ if(DEFINED ENV{GNSSTK_ROOT})
) )
endif() endif()
unset(GNSSTK_INCLUDE_DIR CACHE)
set(GNSSTK_USES_GPSTK_NAMESPACE FALSE)
find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp
PATHS ${GNSSTK_ROOT_USER_DEFINED}/include PATHS ${GNSSTK_ROOT_USER_DEFINED}/include
/usr/include /usr/include
/usr/local/include /usr/local/include
/opt/local/include /opt/local/include
) )
set(GNSSTK_NAMES ${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_SHARED_LIBRARY_SUFFIX})
set(GNSSTK_NAMES gnsstk libgnsstk) 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) include(GNUInstallDirs)
@ -61,6 +74,10 @@ if(GNSSTK_FOUND)
unset(PACKAGE_VERSION) unset(PACKAGE_VERSION)
if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake)
include(${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() endif()
if(PACKAGE_VERSION) if(PACKAGE_VERSION)
set(GNSSTK_VERSION ${PACKAGE_VERSION}) set(GNSSTK_VERSION ${PACKAGE_VERSION})
@ -70,30 +87,40 @@ endif()
if(GNSSTK_FOUND AND GNSSTK_VERSION) if(GNSSTK_FOUND AND GNSSTK_VERSION)
set_package_properties(GNSSTK PROPERTIES 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() else()
set_package_properties(GNSSTK PROPERTIES set_package_properties(GNSSTK PROPERTIES
DESCRIPTION "Library and suite of applications for satellite navigation" DESCRIPTION "The GNSSTk C++ Library"
) )
endif() endif()
#if(GNSSTK_FOUND AND NOT EXISTS ${GNSSTK_INCLUDE_DIR}/gnsstk/SatelliteSystem.hpp) if(GNSSTK_FOUND AND GNSSTK_USES_GPSTK_NAMESPACE AND NOT EXISTS ${GNSSTK_INCLUDE_DIR}/gpstk/SatelliteSystem.hpp)
# set(GNSSTK_OLDER_THAN_8 TRUE) set(GNSSTK_OLDER_THAN_8 TRUE)
#endif() endif()
set_package_properties(GNSSTK PROPERTIES set_package_properties(GNSSTK PROPERTIES
URL "https://github.com/SGL-UT/gnsstk/" URL "https://github.com/SGL-UT/gnsstk/"
TYPE OPTIONAL
) )
if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk) if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk)
add_library(Gnsstk::gnsstk SHARED IMPORTED) add_library(Gnsstk::gnsstk SHARED IMPORTED)
set_target_properties(Gnsstk::gnsstk PROPERTIES if(GNSSTK_USES_GPSTK_NAMESPACE)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" set_target_properties(Gnsstk::gnsstk PROPERTIES
IMPORTED_LOCATION "${GNSSTK_LIBRARY}" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" IMPORTED_LOCATION "${GNSSTK_LIBRARY}"
INTERFACE_LINK_LIBRARIES "${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() 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)

View File

@ -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)

View File

@ -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 **not** applied to the computed PVT solution. In the Galileo E6B-only
receiver, HAS messages are decoded and reported. 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: ### Improvements in Portability:
- Improved detection of the BLAS library under macOS / Macports (the `lapack` - Improved detection of the BLAS library under macOS / Macports (the `lapack`

View File

@ -555,9 +555,12 @@ if(ENABLE_UNIT_TESTING)
endif() endif()
if(ENABLE_UNIT_TESTING_EXTRA) if(ENABLE_UNIT_TESTING_EXTRA)
target_link_libraries(run_tests PRIVATE Gnsstk::gnsstk) target_link_libraries(run_tests PRIVATE Gnsstk::gnsstk)
#if(GNSSTK_OLDER_THAN_8) if(GNSSTK_OLDER_THAN_8)
# target_compile_definitions(run_tests PRIVATE -DOLD_GPSTK=1) target_compile_definitions(run_tests PRIVATE -DOLD_GPSTK=1)
#endif() endif()
if(GNSSTK_USES_GPSTK_NAMESPACE)
target_compile_definitions(run_tests PRIVATE -DGNSSTK_USES_GPSTK_NAMESPACE=1)
endif()
endif() endif()
if(ENABLE_STRIP) if(ENABLE_STRIP)
set_target_properties(run_tests PROPERTIES LINK_FLAGS "-s") set_target_properties(run_tests PROPERTIES LINK_FLAGS "-s")

View File

@ -1,31 +0,0 @@
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-FileCopyrightText: 2020 Carles Fernandez-Prades <carles.fernandez@cttc.es>
--- 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} )

View File

@ -57,11 +57,6 @@
#include <gnuradio/blocks/null_sink.h> #include <gnuradio/blocks/null_sink.h>
#include <gnuradio/filter/firdes.h> #include <gnuradio/filter/firdes.h>
#include <gnuradio/top_block.h> #include <gnuradio/top_block.h>
#include <gpstk/Rinex3ObsBase.hpp>
#include <gpstk/Rinex3ObsData.hpp>
#include <gpstk/Rinex3ObsHeader.hpp>
#include <gpstk/Rinex3ObsStream.hpp>
#include <gpstk/RinexUtilities.hpp>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <matio.h> #include <matio.h>
#include <pmt/pmt.h> #include <pmt/pmt.h>
@ -70,6 +65,20 @@
#include <exception> #include <exception>
#include <unistd.h> #include <unistd.h>
#include <utility> #include <utility>
#if GNSSTK_USES_GPSTK_NAMESPACE
#include <gpstk/Rinex3ObsBase.hpp>
#include <gpstk/Rinex3ObsData.hpp>
#include <gpstk/Rinex3ObsHeader.hpp>
#include <gpstk/Rinex3ObsStream.hpp>
#include <gpstk/RinexUtilities.hpp>
namespace gnsstk = gpstk;
#else
#include <gnsstk/Rinex3ObsBase.hpp>
#include <gnsstk/Rinex3ObsData.hpp>
#include <gnsstk/Rinex3ObsHeader.hpp>
#include <gnsstk/Rinex3ObsStream.hpp>
#include <gnsstk/RinexUtilities.hpp>
#endif
#if HAS_GENERIC_LAMBDA #if HAS_GENERIC_LAMBDA
#else #else
@ -1556,17 +1565,17 @@ bool HybridObservablesTest::ReadRinexObs(std::vector<arma::mat>* obs_vec, Gnss_S
// Open and read reference RINEX observables file // Open and read reference RINEX observables file
try try
{ {
gpstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs);
r_ref.exceptions(std::ios::failbit); r_ref.exceptions(std::ios::failbit);
gpstk::Rinex3ObsData r_ref_data; gnsstk::Rinex3ObsData r_ref_data;
gpstk::Rinex3ObsHeader r_ref_header; gnsstk::Rinex3ObsHeader r_ref_header;
gpstk::RinexDatum dataobj; gnsstk::RinexDatum dataobj;
r_ref >> r_ref_header; r_ref >> r_ref_header;
std::vector<bool> first_row; std::vector<bool> first_row;
gpstk::SatID prn; gnsstk::SatID prn;
for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++) for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++)
{ {
first_row.push_back(true); first_row.push_back(true);
@ -1582,28 +1591,28 @@ bool HybridObservablesTest::ReadRinexObs(std::vector<arma::mat>* obs_vec, Gnss_S
{ {
case 'G': case 'G':
#if OLD_GPSTK #if OLD_GPSTK
prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS);
#else #else
prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS);
#endif #endif
break; break;
case 'E': case 'E':
#if OLD_GPSTK #if OLD_GPSTK
prn = gpstk::SatID(myprn, gpstk::SatID::systemGalileo); prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGalileo);
#else #else
prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::Galileo); prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::Galileo);
#endif #endif
break; break;
default: default:
#if OLD_GPSTK #if OLD_GPSTK
prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS);
#else #else
prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS);
#endif #endif
} }
gpstk::CommonTime time = r_ref_data.time; gnsstk::CommonTime time = r_ref_data.time;
double sow(static_cast<gpstk::GPSWeekSecond>(time).sow); double sow(static_cast<gnsstk::GPSWeekSecond>(time).sow);
auto pointer = r_ref_data.obs.find(prn); auto pointer = r_ref_data.obs.find(prn);
if (pointer == r_ref_data.obs.end()) if (pointer == r_ref_data.obs.end())
@ -1680,12 +1689,12 @@ bool HybridObservablesTest::ReadRinexObs(std::vector<arma::mat>* obs_vec, Gnss_S
} }
} // end while } // end while
} // End of 'try' block } // End of 'try' block
catch (const gpstk::FFStreamError& e) catch (const gnsstk::FFStreamError& e)
{ {
std::cout << e; std::cout << e;
return false; return false;
} }
catch (const gpstk::Exception& e) catch (const gnsstk::Exception& e)
{ {
std::cout << e; std::cout << e;
return false; return false;

View File

@ -56,11 +56,6 @@
#include <gnuradio/blocks/null_sink.h> #include <gnuradio/blocks/null_sink.h>
#include <gnuradio/filter/firdes.h> #include <gnuradio/filter/firdes.h>
#include <gnuradio/top_block.h> #include <gnuradio/top_block.h>
#include <gpstk/Rinex3ObsBase.hpp>
#include <gpstk/Rinex3ObsData.hpp>
#include <gpstk/Rinex3ObsHeader.hpp>
#include <gpstk/Rinex3ObsStream.hpp>
#include <gpstk/RinexUtilities.hpp>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <matio.h> #include <matio.h>
#include <pmt/pmt.h> #include <pmt/pmt.h>
@ -71,6 +66,21 @@
#include <unistd.h> #include <unistd.h>
#include <utility> #include <utility>
#if GNSSTK_USES_GPSTK_NAMESPACE
#include <gpstk/Rinex3ObsBase.hpp>
#include <gpstk/Rinex3ObsData.hpp>
#include <gpstk/Rinex3ObsHeader.hpp>
#include <gpstk/Rinex3ObsStream.hpp>
#include <gpstk/RinexUtilities.hpp>
namespace gnsstk = gpstk;
#else
#include <gnsstk/Rinex3ObsBase.hpp>
#include <gnsstk/Rinex3ObsData.hpp>
#include <gnsstk/Rinex3ObsHeader.hpp>
#include <gnsstk/Rinex3ObsStream.hpp>
#include <gnsstk/RinexUtilities.hpp>
#endif
#if HAS_GENERIC_LAMBDA #if HAS_GENERIC_LAMBDA
#else #else
#include <boost/bind/bind.hpp> #include <boost/bind/bind.hpp>
@ -1648,17 +1658,17 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector<arma::mat>* obs_vec, Gn
// Open and read reference RINEX observables file // Open and read reference RINEX observables file
try try
{ {
gpstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs);
r_ref.exceptions(std::ios::failbit); r_ref.exceptions(std::ios::failbit);
gpstk::Rinex3ObsData r_ref_data; gnsstk::Rinex3ObsData r_ref_data;
gpstk::Rinex3ObsHeader r_ref_header; gnsstk::Rinex3ObsHeader r_ref_header;
gpstk::RinexDatum dataobj; gnsstk::RinexDatum dataobj;
r_ref >> r_ref_header; r_ref >> r_ref_header;
std::vector<bool> first_row; std::vector<bool> first_row;
gpstk::SatID prn; gnsstk::SatID prn;
for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++) for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++)
{ {
first_row.push_back(true); first_row.push_back(true);
@ -1674,28 +1684,28 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector<arma::mat>* obs_vec, Gn
{ {
case 'G': case 'G':
#if OLD_GPSTK #if OLD_GPSTK
prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS);
#else #else
prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS);
#endif #endif
break; break;
case 'E': case 'E':
#if OLD_GPSTK #if OLD_GPSTK
prn = gpstk::SatID(myprn, gpstk::SatID::systemGalileo); prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGalileo);
#else #else
prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::Galileo); prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::Galileo);
#endif #endif
break; break;
default: default:
#if OLD_GPSTK #if OLD_GPSTK
prn = gpstk::SatID(myprn, gpstk::SatID::systemGPS); prn = gnsstk::SatID(myprn, gnsstk::SatID::systemGPS);
#else #else
prn = gpstk::SatID(myprn, gpstk::SatelliteSystem::GPS); prn = gnsstk::SatID(myprn, gnsstk::SatelliteSystem::GPS);
#endif #endif
} }
gpstk::CommonTime time = r_ref_data.time; gnsstk::CommonTime time = r_ref_data.time;
double sow(static_cast<gpstk::GPSWeekSecond>(time).sow); double sow(static_cast<gnsstk::GPSWeekSecond>(time).sow);
auto pointer = r_ref_data.obs.find(prn); auto pointer = r_ref_data.obs.find(prn);
if (pointer == r_ref_data.obs.end()) if (pointer == r_ref_data.obs.end())
@ -1773,12 +1783,12 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector<arma::mat>* obs_vec, Gn
} // end while } // end while
} // End of 'try' block } // End of 'try' block
catch (const gpstk::FFStreamError& e) catch (const gnsstk::FFStreamError& e)
{ {
std::cout << e; std::cout << e;
return false; return false;
} }
catch (const gpstk::Exception& e) catch (const gnsstk::Exception& e)
{ {
std::cout << e; std::cout << e;
return false; return false;

View File

@ -10,8 +10,13 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND
find_package(GNSSTK QUIET) find_package(GNSSTK QUIET)
if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK)
include(GNUInstallDirs) include(GNUInstallDirs)
set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) if(GNSSTK_USES_GPSTK_NAMESPACE)
set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) 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() endif()
if(USE_CMAKE_TARGET_SOURCES) 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}) if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERSION})
add_dependencies(obsdiff matio-${GNSSSDR_MATIO_LOCAL_VERSION}) add_dependencies(obsdiff matio-${GNSSSDR_MATIO_LOCAL_VERSION})
endif() 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) if(NOT TARGET Gnsstk::gnsstk)
file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIR}/gnsstk) if(GNSSTK_USES_GPSTK_NAMESPACE)
add_library(Gnsstk::gnsstk STATIC IMPORTED) file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIR}/gpstk)
add_dependencies(Gnsstk::gnsstk gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) add_library(Gnsstk::gnsstk STATIC IMPORTED)
set_target_properties(Gnsstk::gnsstk PROPERTIES add_dependencies(Gnsstk::gnsstk gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION})
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" set_target_properties(Gnsstk::gnsstk PROPERTIES
IMPORTED_LOCATION "${GNSSTK_LIBRARY}" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" IMPORTED_LOCATION "${GNSSTK_LIBRARY}"
INTERFACE_LINK_LIBRARIES "${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() endif()
target_link_libraries(obsdiff target_link_libraries(obsdiff

View File

@ -23,8 +23,8 @@ Requirements:
- [Gflags](https://github.com/gflags/gflags): A C++ library that implements - [Gflags](https://github.com/gflags/gflags): A C++ library that implements
command-line flags processing. If not found in your system, the latest version command-line flags processing. If not found in your system, the latest version
will be downloaded, built and linked for you at building time. will be downloaded, built and linked for you at building time.
- [GPSTK](https://github.com/SGL-UT/GPSTk): The GPS Toolkit, used for RINEX - [GNSSTK](https://github.com/SGL-UT/gnsstk): The GNSSTk C++ Library, used for
files reading. If not found in your system, the latest version will be RINEX files reading. If not found in your system, the latest version will be
downloaded, built and linked for you at building time. downloaded, built and linked for you at building time.
- [Matio](https://github.com/tbeu/matio): A MATLAB MAT File I/O Library, - [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 version >= 1.5.3. If it is not found, or an older version is found, CMake will

View File

@ -21,6 +21,34 @@
#include "gnuplot_i.h" #include "gnuplot_i.h"
#include "obsdiff_flags.h" #include "obsdiff_flags.h"
#include <armadillo> #include <armadillo>
#include <matio.h>
#include <algorithm>
#include <array>
#include <fstream>
#include <iomanip>
#include <map>
#include <set>
#include <stdexcept>
#include <string>
#include <vector>
#if GNSSTK_USES_GPSTK_NAMESPACE
#include <gpstk/GGTropModel.hpp>
#include <gpstk/GNSSconstants.hpp>
#include <gpstk/GPSEphemerisStore.hpp>
#include <gpstk/PRSolution.hpp>
#include <gpstk/Rinex3NavData.hpp>
#include <gpstk/Rinex3NavHeader.hpp>
#include <gpstk/Rinex3NavStream.hpp>
#include <gpstk/Rinex3ObsData.hpp>
#include <gpstk/Rinex3ObsHeader.hpp>
#include <gpstk/Rinex3ObsStream.hpp>
#include <gpstk/RinexMetBase.hpp>
#include <gpstk/RinexMetData.hpp>
#include <gpstk/RinexMetHeader.hpp>
#include <gpstk/RinexMetStream.hpp>
namespace gnsstk = gpstk;
#else
// Classes for handling observations RINEX files (data) // Classes for handling observations RINEX files (data)
#include <gnsstk/Rinex3ObsData.hpp> #include <gnsstk/Rinex3ObsData.hpp>
#include <gnsstk/Rinex3ObsHeader.hpp> #include <gnsstk/Rinex3ObsHeader.hpp>
@ -49,16 +77,7 @@
// Class defining GPS system constants // Class defining GPS system constants
#include <gnsstk/GNSSconstants.hpp> #include <gnsstk/GNSSconstants.hpp>
#include <matio.h> #endif
#include <algorithm>
#include <array>
#include <fstream>
#include <iomanip>
#include <map>
#include <set>
#include <stdexcept>
#include <string>
#include <vector>
#if GFLAGS_OLD_NAMESPACE #if GFLAGS_OLD_NAMESPACE
namespace gflags namespace gflags
@ -111,15 +130,27 @@ std::map<int, arma::mat> ReadRinexObs(const std::string& rinex_file, char system
switch (system) switch (system)
{ {
case 'G': 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; PRN_set = available_gps_prn;
break; break;
case 'E': 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; PRN_set = available_galileo_prn;
break; break;
default: 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; 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 // pointer to the tropospheric model to be applied
try try
{ {
gnsstk::Matrix<double> invMC; #if OLD_GPSTK
std::vector<gpstk::SatID::SatelliteSystem> Syss;
#endif
gpstk::Matrix<double> invMC;
int iret; int iret;
// Call RAIMCompute // 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, iret = raimSolver.RAIMCompute(rod.time, prnVec, rangeVec, invMC,
&bcestore, tropModelPtr); &bcestore, tropModelPtr);
#endif
switch (iret) switch (iret)
{ {
/// @return Return values: /// @return Return values:

View File

@ -8,8 +8,13 @@
find_package(GNSSTK QUIET) find_package(GNSSTK QUIET)
if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK)
include(GNUInstallDirs) 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}) if(GNSSTK_USES_GPSTK_NAMESPACE)
set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) 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() endif()
@ -79,11 +84,25 @@ if(Boost_FOUND)
core_system_parameters core_system_parameters
) )
target_include_directories(rinex2assist if(GNSSTK_USES_GPSTK_NAMESPACE)
PRIVATE target_compile_definitions(rinex2assist PUBLIC -DGNSSTK_USES_GPSTK_NAMESPACE=1)
${GNSSTK_INCLUDE_DIR}/gnsstk target_include_directories(rinex2assist
${GNSSTK_INCLUDE_DIR} 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) if(NOT UNCOMPRESS_EXECUTABLE-NOTFOUND)
target_compile_definitions(rinex2assist PRIVATE -DUNCOMPRESS_EXECUTABLE="${UNCOMPRESS_EXECUTABLE}") target_compile_definitions(rinex2assist PRIVATE -DUNCOMPRESS_EXECUTABLE="${UNCOMPRESS_EXECUTABLE}")

View File

@ -28,14 +28,23 @@
#include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/serialization/map.hpp> #include <boost/serialization/map.hpp>
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <cstddef> // for size_t
#include <cstdlib>
#include <iostream>
#if GNSSTK_USES_GPSTK_NAMESPACE
#include <gpstk/GALWeekSecond.hpp>
#include <gpstk/GPSWeekSecond.hpp>
#include <gpstk/Rinex3NavData.hpp>
#include <gpstk/Rinex3NavHeader.hpp>
#include <gpstk/Rinex3NavStream.hpp>
namespace gnsstk = gpstk;
#else
#include <gnsstk/GALWeekSecond.hpp> #include <gnsstk/GALWeekSecond.hpp>
#include <gnsstk/GPSWeekSecond.hpp> #include <gnsstk/GPSWeekSecond.hpp>
#include <gnsstk/Rinex3NavData.hpp> #include <gnsstk/Rinex3NavData.hpp>
#include <gnsstk/Rinex3NavHeader.hpp> #include <gnsstk/Rinex3NavHeader.hpp>
#include <gnsstk/Rinex3NavStream.hpp> #include <gnsstk/Rinex3NavStream.hpp>
#include <cstddef> // for size_t #endif
#include <cstdlib>
#include <iostream>
#if GFLAGS_OLD_NAMESPACE #if GFLAGS_OLD_NAMESPACE
namespace gflags namespace gflags
@ -178,12 +187,17 @@ int main(int argc, char** argv)
gps_utc_model.valid = (hdr.valid > 2147483648) ? true : false; gps_utc_model.valid = (hdr.valid > 2147483648) ? true : false;
gps_utc_model.A1 = hdr.mapTimeCorr["GPUT"].A0; gps_utc_model.A1 = hdr.mapTimeCorr["GPUT"].A0;
gps_utc_model.A0 = hdr.mapTimeCorr["GPUT"].A1; 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) if (hdr.mapTimeCorr["GPUT"].refTime != gnsstk::CommonTime::BEGINNING_OF_TIME)
{ {
gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GPUT"].refTime); gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GPUT"].refTime);
gps_utc_model.tot = gws.getSOW(); gps_utc_model.tot = gws.getSOW();
gps_utc_model.WN_T = gws.getWeek(); gps_utc_model.WN_T = gws.getWeek();
} }
#endif
gps_utc_model.DeltaT_LS = hdr.leapSeconds; gps_utc_model.DeltaT_LS = hdr.leapSeconds;
gps_utc_model.WN_LSF = hdr.leapWeek; gps_utc_model.WN_LSF = hdr.leapWeek;
gps_utc_model.DN = hdr.leapDay; 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.A0 = hdr.mapTimeCorr["GAUT"].A0;
gal_utc_model.A1 = hdr.mapTimeCorr["GAUT"].A1; gal_utc_model.A1 = hdr.mapTimeCorr["GAUT"].A1;
gal_utc_model.Delta_tLS = hdr.leapSeconds; 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) if (hdr.mapTimeCorr["GAUT"].refTime != gnsstk::CommonTime::BEGINNING_OF_TIME)
{ {
gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GAUT"].refTime); gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GAUT"].refTime);
gal_utc_model.tot = gws.getSOW(); gal_utc_model.tot = gws.getSOW();
gal_utc_model.WNot = gws.getWeek(); gal_utc_model.WNot = gws.getWeek();
} }
#endif
gal_utc_model.WN_LSF = hdr.leapWeek; gal_utc_model.WN_LSF = hdr.leapWeek;
gal_utc_model.DN = hdr.leapDay; gal_utc_model.DN = hdr.leapDay;
gal_utc_model.Delta_tLSF = hdr.leapDelta; gal_utc_model.Delta_tLSF = hdr.leapDelta;