diff --git a/CMakeLists.txt b/CMakeLists.txt index 106465e95..5d5a9969d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,7 +338,7 @@ else() set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.1") endif() set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") -set(GNSSSDR_GNSSTK_LOCAL_VERSION "12.1.0") +set(GNSSSDR_GNSSTK_LOCAL_VERSION "13.4.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.1") diff --git a/cmake/Modules/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake index b1b1d9076..121e48477 100644 --- a/cmake/Modules/FindGNSSTK.cmake +++ b/cmake/Modules/FindGNSSTK.cmake @@ -83,10 +83,16 @@ if(GNSSTK_LIBRARY AND GNSSTK_INCLUDE_DIR) endif() if(GNSSTK_VERSION) - if(GNSSTK_VERSION VERSION_GREATER ${GNSSSDR_GNSSTK_LOCAL_VERSION}) - unset(GNSSTK_LIBRARY CACHE) - unset(GNSSTK_INCLUDE_DIR CACHE) + if(GNSSTK_VERSION VERSION_LESS "9.0.0") + set(GNSSTK_OLDER_THAN_9 TRUE) endif() + if(GNSSTK_VERSION VERSION_LESS "13.0.0") + set(GNSSTK_OLDER_THAN_13 TRUE) + endif() +endif() + +if(NOT EXISTS ${GNSSTK_INCLUDE_DIR}/gnsstk/GPSEphemerisStore.hpp) + set(GNSSTK_OLDER_THAN_13 TRUE) endif() # handle the QUIET and REQUIRED arguments and set GNSSTK_FOUND to TRUE if @@ -136,4 +142,6 @@ mark_as_advanced(GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR GNSSTK_USES_GPSTK_NAMESPACE GNSSTK_OLDER_THAN_8 + GNSSTK_OLDER_THAN_9 + GNSSTK_OLDER_THAN_13 ) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 341b30b9f..cebfd2305 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -359,7 +359,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) endif() set(GNSSTK_PATCH_COMMAND cd ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} && - ${Patch_EXECUTABLE} ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt < ${CMAKE_SOURCE_DIR}/src/tests/data/gnsstk_static.patch + ${Patch_EXECUTABLE} ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt < ${CMAKE_SOURCE_DIR}/src/tests/data/gnsstk_static13.patch ) # Patch only once if(EXISTS ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt) @@ -561,6 +561,9 @@ if(ENABLE_UNIT_TESTING) if(GNSSTK_USES_GPSTK_NAMESPACE) target_compile_definitions(run_tests PRIVATE -DGNSSTK_USES_GPSTK_NAMESPACE=1) endif() + if(GNSSTK_OLDER_THAN_9) + target_compile_definitions(run_tests PRIVATE -DGNSSTK_OLDER_THAN_9=1) + endif() endif() if(ENABLE_STRIP) set_target_properties(run_tests PROPERTIES LINK_FLAGS "-s") diff --git a/src/tests/data/gnsstk_static.patch b/src/tests/data/gnsstk_static.patch deleted file mode 100644 index f660689cd..000000000 --- a/src/tests/data/gnsstk_static.patch +++ /dev/null @@ -1,39 +0,0 @@ -SPDX-License-Identifier: GPL-3.0-or-later -SPDX-FileCopyrightText: 2022 Carles Fernandez-Prades ---- CMakeLists.txt 2022-07-02 20:14:59.000000000 +0200 -+++ CMakeLists.txt 2022-07-02 20:16:55.000000000 +0200 -@@ -6,7 +6,7 @@ - # Is dependend on by $GNSSTK/build.sh - #============================================================ - --cmake_minimum_required( VERSION 2.8.5 ) -+cmake_minimum_required( VERSION 2.8.12 ) - - project( GNSSTK ) - set( GNSSTK_VERSION_MAJOR "12" ) -@@ -77,6 +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 +171,7 @@ - add_library( gnsstk ${STADYN} ${GNSSTK_SRC_FILES} ${GNSSTK_INC_FILES} ) - - # GNSSTk library install target --install( TARGETS gnsstk DESTINATION "${CMAKE_INSTALL_LIBDIR}" EXPORT "${EXPORT_TARGETS_FILENAME}" ) -+install( TARGETS gnsstk DESTINATION lib EXPORT "${EXPORT_TARGETS_FILENAME}" ) - - # GNSSTk header file install target (whether it is version dependent changes based on user flag) - install( FILES ${GNSSTK_INC_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/src/tests/data/gnsstk_static13.patch b/src/tests/data/gnsstk_static13.patch new file mode 100644 index 000000000..daf236cf7 --- /dev/null +++ b/src/tests/data/gnsstk_static13.patch @@ -0,0 +1,36 @@ +--- CMakeLists_old.txt 2022-07-10 09:58:33.000000000 +0200 ++++ CMakeLists.txt 2022-07-10 10:02:36.000000000 +0200 +@@ -6,7 +6,7 @@ + # Is dependend on by $GNSSTK/build.sh + #============================================================ + +-cmake_minimum_required( VERSION 2.8.5 ) ++cmake_minimum_required( VERSION 2.8.12 ) + + project( GNSSTK ) + set( GNSSTK_VERSION_MAJOR "13" ) +@@ -21,6 +21,15 @@ + + # This sets up variables contining GNU standard installation locations. + include( GNUInstallDirs ) ++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() + + # Set a filename for collecting exported targets. + set( EXPORT_TARGETS_FILENAME "GNSSTKTargets" ) +@@ -177,7 +186,7 @@ + elseif( WIN32 ) + add_library( gnsstk ${GNSSTK_SRC_FILES} ${GNSSTK_INC_FILES} ) + else() +- add_library( gnsstk SHARED ${GNSSTK_SRC_FILES} ${GNSSTK_INC_FILES} ) ++ add_library( gnsstk STATIC ${GNSSTK_SRC_FILES} ${GNSSTK_INC_FILES} ) + endif() + + # always generate the header because it's an include file whose 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 704005402..43388e8b2 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 @@ -66,6 +66,7 @@ #include #include #if GNSSTK_USES_GPSTK_NAMESPACE +#include #include #include #include @@ -73,6 +74,7 @@ #include namespace gnsstk = gpstk; #else +#include #include #include #include @@ -1612,8 +1614,12 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S } gnsstk::CommonTime time = r_ref_data.time; +#if GNSSTK_OLDER_THAN_9 double sow(static_cast(time).sow); - +#else + gnsstk::GPSWeekSecond gws(time); + double sow(gws.getSOW()); +#endif auto pointer = r_ref_data.obs.find(prn); if (pointer == r_ref_data.obs.end()) { 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 74e397d2e..b34f52d86 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 @@ -67,6 +67,7 @@ #include #if GNSSTK_USES_GPSTK_NAMESPACE +#include #include #include #include @@ -74,6 +75,7 @@ #include namespace gnsstk = gpstk; #else +#include #include #include #include @@ -1705,7 +1707,12 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn } gnsstk::CommonTime time = r_ref_data.time; +#if GNSSTK_OLDER_THAN_9 double sow(static_cast(time).sow); +#else + gnsstk::GPSWeekSecond gws(time); + double sow(gws.getSOW()); +#endif auto pointer = r_ref_data.obs.find(prn); if (pointer == r_ref_data.obs.end()) diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index c2967f231..8eca04cc0 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -7,7 +7,7 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND) OR ENABLE_OWN_ARMADILLO) # requires back(), introduced in Armadillo 9.800 message(STATUS "The obsdiff utility tool will be built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'") - if(NOT GNSSTK_FOUND) + if(NOT GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK) find_package(GNSSTK) endif() if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) @@ -67,8 +67,8 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND if(GNSSTK_OLDER_THAN_8) target_compile_definitions(obsdiff PRIVATE -DOLD_GPSTK=1) endif() - if(GNSSTK_OLDER_THAN_9) - target_compile_definitions(obsdiff PRIVATE -DGNSSTK_OLDER_THAN_9=1) + if(GNSSTK_OLDER_THAN_13) + target_compile_definitions(obsdiff PRIVATE -DGNSSTK_OLDER_THAN_13=1) endif() if(NOT TARGET Gnsstk::gnsstk) if(GNSSTK_USES_GPSTK_NAMESPACE) diff --git a/src/utils/rinex-tools/obsdiff.cc b/src/utils/rinex-tools/obsdiff.cc index f24a6c4cf..60c74fe9f 100644 --- a/src/utils/rinex-tools/obsdiff.cc +++ b/src/utils/rinex-tools/obsdiff.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -54,12 +55,6 @@ namespace gnsstk = gpstk; #include #include -// Classes for handling satellite navigation parameters RINEX -// files (ephemerides) -#include -#include -#include - // Classes for handling RINEX files with meteorological parameters #include #include @@ -68,15 +63,20 @@ namespace gnsstk = gpstk; // Class for handling tropospheric model #include - -// Class for storing >broadcast-type> ephemerides -#include - -// Class for handling RAIM +#include #include -// Class defining GPS system constants -#include +// Class for storing ephemeris +#include +#if GNSSTK_OLDER_THAN_13 +#include +#include +#include +#include +#else +#include +#include +#endif #endif #if GFLAGS_OLD_NAMESPACE @@ -161,7 +161,13 @@ std::map ReadRinexObs(const std::string& rinex_file, char system { prn.id = prn_it; gnsstk::CommonTime time = r_base_data.time; + +#if GNSSTK_OLDER_THAN_9 double sow(static_cast(time).sow); +#else + gnsstk::GPSWeekSecond gws(time); + double sow(gws.getSOW()); +#endif auto pointer = r_base_data.obs.find(prn); @@ -1153,8 +1159,17 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: std::cout << "Warning: RINEX Nav file " << rinex_nav_filename << " does not exist, receiver's clock error could not be computed!\n"; return 0.0; } - // Declaration of objects for storing ephemerides and handling RAIM + // Declaration of objects for storing ephemerides and handling RAIM +#if GNSSTK_OLDER_THAN_13 gnsstk::GPSEphemerisStore bcestore; +#else + gnsstk::NavLibrary navLib; + // Construct a NavDataFactory object + gnsstk::NavDataFactoryPtr ndfp( + std::make_shared()); + // Add the NavDataFactory to the NavLibrary + navLib.addFactory(ndfp); +#endif gnsstk::PRSolution raimSolver; // Object for void-type tropospheric model (in case no meteorological @@ -1172,22 +1187,26 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: double rx_clock_error_s = 0.0; try { +#if GNSSTK_OLDER_THAN_13 // Read nav file and store unique list of ephemerides gnsstk::Rinex3NavStream rnffs(rinex_nav_filename.c_str()); // Open ephemerides data file gnsstk::Rinex3NavData rne; gnsstk::Rinex3NavHeader hdr; - // Let's read the header (may be skipped) rnffs >> hdr; - - // Storing the ephemeris in "bcstore" while (rnffs >> rne) { bcestore.addEphemeris(rne); } - // Setting the criteria for looking up ephemeris bcestore.SearchNear(); +#else + if (!ndfp->addDataSource(rinex_nav_filename)) + { + std::cerr << "Unable to load " << rinex_nav_filename << '\n'; + return 0.0; + } +#endif // Open and read the observation file one epoch at a time. // For each epoch, compute and print a position solution @@ -1280,8 +1299,13 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: iret = raimSolver.RAIMCompute(rod.time, prnVec, Syss, rangeVec, invMC, &bcestore, tropModelPtr); #else +#if GNSSTK_OLDER_THAN_13 iret = raimSolver.RAIMCompute(rod.time, prnVec, rangeVec, invMC, &bcestore, tropModelPtr); +#else + iret = raimSolver.RAIMCompute(rod.time, prnVec, rangeVec, invMC, + navLib, tropModelPtr); +#endif #endif switch (iret) { diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 4b8c61b63..1f83c829d 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -if(NOT GNSSTK_FOUND) +if(NOT GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK) find_package(GNSSTK) endif() @@ -98,10 +98,8 @@ if(Boost_FOUND) ${GNSSTK_INCLUDE_DIR} ) endif() - if(GNSSTK_VERSION) - if(GNSSTK_VERSION VERSION_LESS "9.0.0") - target_compile_definitions(rinex2assist PRIVATE -DGNSSTK_OLDER_THAN_9=1) - endif() + if(GNSSTK_OLDER_THAN_9) + target_compile_definitions(rinex2assist PRIVATE -DGNSSTK_OLDER_THAN_9=1) endif() if(NOT UNCOMPRESS_EXECUTABLE-NOTFOUND)