From f2ae0ddb33785febcd13db8637bc864ae280a2ed Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 1 Jul 2022 16:24:48 +0200 Subject: [PATCH 1/9] Transition from GPSTk to gnsstk: update to 11.2.3 --- CMakeLists.txt | 2 +- src/tests/CMakeLists.txt | 4 ++-- src/tests/data/gpstk_static.patch | 2 +- src/utils/rinex2assist/main.cc | 10 ++++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2831e6a8f..6a02a94fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,7 +330,7 @@ else() set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.1") endif() set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") -set(GNSSSDR_GPSTK_LOCAL_VERSION "8.0.0") +set(GNSSSDR_GPSTK_LOCAL_VERSION "11.2.3") 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/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d73362ad2..a87357fce 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -361,7 +361,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/SGL-UT/GPSTk + GIT_REPOSITORY https://github.com/SGL-UT/gnsstk GIT_TAG v${GNSSSDR_GPSTK_LOCAL_VERSION} SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} BINARY_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} @@ -388,7 +388,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) endif() ExternalProject_Add(gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/SGL-UT/GPSTk + GIT_REPOSITORY https://github.com/SGL-UT/gnsstk GIT_TAG v${GNSSSDR_GPSTK_LOCAL_VERSION} SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} BINARY_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} diff --git a/src/tests/data/gpstk_static.patch b/src/tests/data/gpstk_static.patch index 7acf49dbf..bfddec0e2 100644 --- a/src/tests/data/gpstk_static.patch +++ b/src/tests/data/gpstk_static.patch @@ -20,7 +20,7 @@ SPDX-FileCopyrightText: 2020 Carles Fernandez-Prades #============================================================ # Core Library Target Files #============================================================ -@@ -160,7 +169,7 @@ +@@ -161,7 +170,7 @@ add_library( gpstk ${STADYN} ${GPSTK_SRC_FILES} ${GPSTK_INC_FILES} ) # GPSTk library install target diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index 1b685040d..b80d90604 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -176,8 +178,8 @@ 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; - gps_utc_model.tot = hdr.mapTimeCorr["GPUT"].refSOW; - gps_utc_model.WN_T = hdr.mapTimeCorr["GPUT"].refWeek; + gps_utc_model.tot = static_cast(hdr.mapTimeCorr["GPUT"].refTime).sow; + gps_utc_model.WN_T = static_cast(hdr.mapTimeCorr["GPUT"].refTime).week; gps_utc_model.DeltaT_LS = hdr.leapSeconds; gps_utc_model.WN_LSF = hdr.leapWeek; gps_utc_model.DN = hdr.leapDay; @@ -199,8 +201,8 @@ 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; - gal_utc_model.tot = hdr.mapTimeCorr["GAUT"].refSOW; - gal_utc_model.WNot = hdr.mapTimeCorr["GAUT"].refWeek; + gal_utc_model.tot = static_cast(hdr.mapTimeCorr["GAUT"].refTime).sow; + gal_utc_model.WNot = static_cast(hdr.mapTimeCorr["GAUT"].refTime).week; gal_utc_model.WN_LSF = hdr.leapWeek; gal_utc_model.DN = hdr.leapDay; gal_utc_model.Delta_tLSF = hdr.leapDelta; From d9c4eba5fe25ab694434e020d290f19c4eb52224 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 4 Jul 2022 10:05:54 +0200 Subject: [PATCH 2/9] Add work on gnsstk transition --- CMakeLists.txt | 16 ++-- cmake/Modules/FindGNSSTK.cmake | 99 +++++++++++++++++++++ src/tests/CMakeLists.txt | 108 +++++++++++------------ src/tests/data/gnsstk_static.patch | 39 +++++++++ src/utils/rinex-tools/CMakeLists.txt | 34 ++++---- src/utils/rinex-tools/obsdiff.cc | 119 +++++++++++--------------- src/utils/rinex2assist/CMakeLists.txt | 18 ++-- src/utils/rinex2assist/main.cc | 36 +++++--- 8 files changed, 298 insertions(+), 171 deletions(-) create mode 100644 cmake/Modules/FindGNSSTK.cmake create mode 100644 src/tests/data/gnsstk_static.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a02a94fc..7379fa1e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,7 +111,7 @@ if(ENABLE_SYSTEM_TESTING_EXTRA) set(ENABLE_SYSTEM_TESTING ON) endif() -option(ENABLE_OWN_GPSTK "Force to download, build and link GPSTk 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) option(ENABLE_INSTALL_TESTS "Install QA code system-wide" OFF) if(ENABLE_FPGA) @@ -330,7 +330,7 @@ else() set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.1") endif() set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") -set(GNSSSDR_GPSTK_LOCAL_VERSION "11.2.3") +set(GNSSSDR_GNSSTK_LOCAL_VERSION "12.1.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.12") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.1") @@ -654,16 +654,16 @@ endif() # Detect availability of std::filesystem and set C++ standard accordingly ################################################################################ set(FILESYSTEM_FOUND FALSE) -if(NOT ENABLE_OWN_GPSTK) - find_package(GPSTK) - set_package_properties(GPSTK PROPERTIES +if(NOT ENABLE_OWN_GNSSTK) + find_package(GNSSTK) + set_package_properties(GNSSTK PROPERTIES PURPOSE "Used in some Extra Tests." ) 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 GPSTK_FOUND OR NOT (GPSTK_FOUND AND GPSTK_OLDER_THAN_8)) # Fix for GPSTk < 8.0.0 find_package(FILESYSTEM COMPONENTS Final Experimental) set_package_properties(FILESYSTEM PROPERTIES URL "https://en.cppreference.com/w/cpp/filesystem" @@ -671,7 +671,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) @@ -3361,7 +3361,7 @@ add_feature_info(ENABLE_UNIT_TESTING_MINIMAL ENABLE_UNIT_TESTING_MINIMAL "Enable add_feature_info(ENABLE_UNIT_TESTING_EXTRA ENABLE_UNIT_TESTING_EXTRA "Enables building of Extra Unit Tests and downloading of external data files.") add_feature_info(ENABLE_SYSTEM_TESTING ENABLE_SYSTEM_TESTING "Enables building of System Tests.") add_feature_info(ENABLE_SYSTEM_TESTING_EXTRA ENABLE_SYSTEM_TESTING_EXTRA "Enables building of Extra System Tests and downloading of external tools.") -add_feature_info(ENABLE_OWN_GPSTK ENABLE_OWN_GPSTK "Forces the downloading and building of GPSTk for system tests.") +add_feature_info(ENABLE_OWN_GNSSTK ENABLE_OWN_GNSSTK "Forces the downloading and building of gnsstk for system tests.") add_feature_info(ENABLE_GNSS_SIM_INSTALL ENABLE_GNSS_SIM_INSTALL "Enables downloading and building of gnss-sim.") add_feature_info(ENABLE_INSTALL_TESTS ENABLE_INSTALL_TESTS "Install test binaries when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} install'.") add_feature_info(ENABLE_BENCHMARKS ENABLE_BENCHMARKS "Enables building of code snippet benchmarks.") diff --git a/cmake/Modules/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake new file mode 100644 index 000000000..48c4bcdc3 --- /dev/null +++ b/cmake/Modules/FindGNSSTK.cmake @@ -0,0 +1,99 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2022 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +# - Find gnsstk library +# Find the native gnsstk includes and library +# This module defines +# GNSSTK_INCLUDE_DIR, where to find Rinex3ObsBase.hpp, etc. +# GNSSTK_FOUND, If false, do not try to use GNSSTK. +# GNSSTK_LIBRARY, where to find the GNSSTK library. +# +# Provides the following imported target: +# Gnsstk::gnsstk +# + +if(NOT COMMAND feature_summary) + include(FeatureSummary) +endif() + +if(NOT GNSSTK_ROOT) + set(GNSSTK_ROOT_USER_DEFINED /usr/local) +else() + set(GNSSTK_ROOT_USER_DEFINED ${GNSSTK_ROOT}) +endif() +if(DEFINED ENV{GNSSTK_ROOT}) + set(GNSSTK_ROOT_USER_DEFINED + ${GNSSTK_ROOT_USER_DEFINED} + $ENV{GNSSTK_ROOT} + ) +endif() + +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) + +include(GNUInstallDirs) + +find_library(GNSSTK_LIBRARY NAMES ${GNSSTK_NAMES} + PATHS ${GNSSTK_ROOT_USER_DEFINED}/lib + ${GNSSTK_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 GNSSTK_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GNSSTK DEFAULT_MSG GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR) + +if(GNSSTK_FOUND) + set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION}) + unset(PACKAGE_VERSION) + if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) + include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) + endif() + if(PACKAGE_VERSION) + set(GNSSTK_VERSION ${PACKAGE_VERSION}) + endif() + set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION}) +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})" + ) +else() + set_package_properties(GNSSTK PROPERTIES + DESCRIPTION "Library and suite of applications for satellite navigation" + ) +endif() + +#if(GNSSTK_FOUND AND NOT EXISTS ${GNSSTK_INCLUDE_DIR}/gnsstk/SatelliteSystem.hpp) +# set(GNSSTK_OLDER_THAN_8 TRUE) +#endif() + +set_package_properties(GNSSTK PROPERTIES + URL "https://github.com/SGL-UT/gnsstk/" +) + +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}" + ) +endif() + +mark_as_advanced(GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index a87357fce..d5f47c2a9 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -68,8 +68,8 @@ if(NOT GOOGLETEST_FOUND) if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator set(GOOGLETEST_BUILD_BYPRODUCTS - ${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtestd${CMAKE_STATIC_LIBRARY_SUFFIX} - ${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_maind${CMAKE_STATIC_LIBRARY_SUFFIX} + #${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtestd${CMAKE_STATIC_LIBRARY_SUFFIX} + #${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_maind${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() ExternalProject_Add(gtest-${GNSSSDR_GTEST_LOCAL_VERSION} @@ -105,12 +105,12 @@ if(NOT GOOGLETEST_FOUND) MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_ASAN Debug IMPORTED_LOCATION_NONE ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtestd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELEASE ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include - INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/gtest$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/gtest${CMAKE_STATIC_LIBRARY_SUFFIX} ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) set_target_properties(GTest::GTest PROPERTIES @@ -118,7 +118,7 @@ if(NOT GOOGLETEST_FOUND) IMPORTED_LOCATION_RELEASE ${binary_dir}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>gtest$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>gtest${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() set_target_properties(GTest::GTest PROPERTIES @@ -137,12 +137,12 @@ if(NOT GOOGLETEST_FOUND) MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_ASAN Debug IMPORTED_LOCATION_NONE ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_maind${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELEASE ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include - INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) set_target_properties(GTest::Main PROPERTIES @@ -150,7 +150,7 @@ if(NOT GOOGLETEST_FOUND) IMPORTED_LOCATION_RELEASE ${binary_dir}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() endif() @@ -273,7 +273,7 @@ endif() ################################################################################ -# GPSTk and optional generator +# gnsstk and optional generator ################################################################################ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) @@ -332,42 +332,42 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) endif() ############################################################################ - # Local installation of GPSTk https://github.com/SGL-UT/GPSTk + # Local installation of gnsstk https://github.com/SGL-UT/gnsstk ############################################################################ - if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) - set_package_properties(GPSTK PROPERTIES - PURPOSE "GPSTk v${GNSSSDR_GPSTK_LOCAL_VERSION} will be automatically downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." + if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) + set_package_properties(GNSSTK PROPERTIES + PURPOSE "gnsstk v${GNSSSDR_GNSSTK_LOCAL_VERSION} will be automatically downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." ) if("${TOOLCHAIN_ARG}" STREQUAL "") set(TOOLCHAIN_ARG "-DCMAKE_CXX_FLAGS=-Wno-deprecated") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") endif() - set(GPSTK_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}") + set(GNSSTK_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}") if(CMAKE_GENERATOR STREQUAL Xcode) - set(GPSTK_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}") + set(GNSSTK_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}") endif() include(GNUInstallDirs) find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH) if(NOT Patch_EXECUTABLE) message(FATAL_ERROR "The patch command is not found. It is required to build GPSTk. Please check your OS documentation and install the patch command.") endif() - set(GPSTK_PATCH_COMMAND - cd ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} && - ${Patch_EXECUTABLE} ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/CMakeLists.txt < ${CMAKE_SOURCE_DIR}/src/tests/data/gpstk_static.patch + 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 only once - if(EXISTS ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/CMakeLists.txt) - set(GPSTK_PATCH_COMMAND "") + if(EXISTS ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt) + set(GNSSTK_PATCH_COMMAND "") endif() if(CMAKE_VERSION VERSION_LESS 3.2) - ExternalProject_Add(gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} + ExternalProject_Add(gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} GIT_REPOSITORY https://github.com/SGL-UT/gnsstk - GIT_TAG v${GNSSSDR_GPSTK_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} - PATCH_COMMAND ${GPSTK_PATCH_COMMAND} + GIT_TAG v${GNSSSDR_GNSSTK_LOCAL_VERSION} + SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + BINARY_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + PATCH_COMMAND ${GNSSTK_PATCH_COMMAND} CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install -DBUILD_EXT=ON -DBUILD_PYTHON=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} @@ -375,7 +375,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) -DCMAKE_CXX_EXTENSIONS=ON -DCMAKE_C_STANDARD=11 -DCMAKE_C_EXTENSIONS=ON - BUILD_COMMAND ${GPSTK_BUILD_COMMAND} + BUILD_COMMAND ${GNSSTK_BUILD_COMMAND} UPDATE_COMMAND "" ) else() @@ -383,18 +383,18 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) include(ProcessorCount) ProcessorCount(NUMBER_OF_PROCESSORS) if(NUMBER_OF_PROCESSORS GREATER 1) - set(GPSTK_PARALLEL_BUILD "-j${NUMBER_OF_PROCESSORS}") + set(GNSSTK_PARALLEL_BUILD "-j${NUMBER_OF_PROCESSORS}") endif() endif() - ExternalProject_Add(gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} + ExternalProject_Add(gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} GIT_REPOSITORY https://github.com/SGL-UT/gnsstk - GIT_TAG v${GNSSSDR_GPSTK_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION} - PATCH_COMMAND ${GPSTK_PATCH_COMMAND} + GIT_TAG v${GNSSSDR_GNSSTK_LOCAL_VERSION} + SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + BINARY_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + PATCH_COMMAND ${GNSSTK_PATCH_COMMAND} CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install -DBUILD_EXT=ON -DBUILD_PYTHON=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} @@ -402,28 +402,28 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) -DCMAKE_CXX_EXTENSIONS=ON -DCMAKE_C_STANDARD=11 -DCMAKE_C_EXTENSIONS=ON - BUILD_COMMAND ${GPSTK_BUILD_COMMAND} ${GPSTK_PARALLEL_BUILD} - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX} + BUILD_COMMAND ${GNSSTK_BUILD_COMMAND} ${GNSSTK_PARALLEL_BUILD} + BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX} UPDATE_COMMAND "" ) endif() - set(GPSTK_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/include CACHE PATH "Local GPSTK headers") - set(GPSTK_LIBRARY ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(GPSTK_BINDIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/bin/) - add_definitions(-DGPSTK_BINDIR="${GPSTK_BINDIR}") - add_library(Gpstk::gpstk STATIC IMPORTED) - add_dependencies(Gpstk::gpstk gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) - file(MAKE_DIRECTORY ${GPSTK_INCLUDE_DIRS}) - file(MAKE_DIRECTORY ${GPSTK_INCLUDE_DIRS}/gpstk) - set_target_properties(Gpstk::gpstk PROPERTIES + set(GNSSTK_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include CACHE PATH "Local GNSSTK headers") + set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_BINDIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/bin/) + add_definitions(-DGNSSTK_BINDIR="${GNSSTK_BINDIR}") + add_library(Gnsstk::gnsstk STATIC IMPORTED) + add_dependencies(Gnsstk::gnsstk gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) + file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIRS}) + file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIRS}/gnsstk) + set_target_properties(Gnsstk::gnsstk PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GPSTK_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GPSTK_INCLUDE_DIRS};${GPSTK_INCLUDE_DIRS}/gpstk" - INTERFACE_LINK_LIBRARIES "${GPSTK_LIBRARY}" + IMPORTED_LOCATION "${GNSSTK_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIRS};${GNSSTK_INCLUDE_DIRS}/gnsstk" + INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" ) else() - set(GPSTK_BINDIR ${GPSTK_INCLUDE_DIR}/../bin/) - add_definitions(-DGPSTK_BINDIR="${GPSTK_BINDIR}") + set(GNSSTK_BINDIR ${GNSSTK_INCLUDE_DIR}/../bin/) + add_definitions(-DGNSSTK_BINDIR="${GNSSTK_BINDIR}") endif() endif() @@ -548,10 +548,10 @@ if(ENABLE_UNIT_TESTING) ) endif() if(ENABLE_UNIT_TESTING_EXTRA) - target_link_libraries(run_tests PRIVATE Gpstk::gpstk) - if(GPSTK_OLDER_THAN_8) - target_compile_definitions(run_tests PRIVATE -DOLD_GPSTK=1) - endif() + target_link_libraries(run_tests PRIVATE Gnsstk::gnsstk) + #if(GNSSTK_OLDER_THAN_8) + # target_compile_definitions(run_tests PRIVATE -DOLD_GPSTK=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 new file mode 100644 index 000000000..f660689cd --- /dev/null +++ b/src/tests/data/gnsstk_static.patch @@ -0,0 +1,39 @@ +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/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index e51c7dddb..5ba60ae5c 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -7,11 +7,11 @@ 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}'") - find_package(GPSTK QUIET) - if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) + find_package(GNSSTK QUIET) + if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) include(GNUInstallDirs) - set(GPSTK_LIBRARY ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(GPSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_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) endif() if(USE_CMAKE_TARGET_SOURCES) @@ -48,22 +48,22 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND if(NOT GFLAGS_FOUND) add_dependencies(obsdiff gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) endif() - if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) - add_dependencies(obsdiff gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) + if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) + add_dependencies(obsdiff gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) endif() if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERSION}) add_dependencies(obsdiff matio-${GNSSSDR_MATIO_LOCAL_VERSION}) endif() - if(NOT TARGET Gpstk::gpstk) - file(MAKE_DIRECTORY ${GPSTK_INCLUDE_DIR}/gpstk) - add_library(Gpstk::gpstk STATIC IMPORTED) - add_dependencies(Gpstk::gpstk gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) - set_target_properties(Gpstk::gpstk PROPERTIES + 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 "${GPSTK_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GPSTK_INCLUDE_DIR};${GPSTK_INCLUDE_DIR}/gpstk" - INTERFACE_LINK_LIBRARIES "${GPSTK_LIBRARY}" + IMPORTED_LOCATION "${GNSSTK_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSTK_INCLUDE_DIR};${GNSSTK_INCLUDE_DIR}/gnsstk" + INTERFACE_LINK_LIBRARIES "${GNSSTK_LIBRARY}" ) endif() @@ -73,13 +73,9 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND Threads::Threads Gflags::gflags Matio::matio - Gpstk::gpstk + Gnsstk::gnsstk ) - if(GPSTK_OLDER_THAN_8) - target_compile_definitions(obsdiff PUBLIC -DOLD_GPSTK=1) - endif() - if(ENABLE_STRIP) set_target_properties(obsdiff PROPERTIES LINK_FLAGS "-s") endif() diff --git a/src/utils/rinex-tools/obsdiff.cc b/src/utils/rinex-tools/obsdiff.cc index 16c753f03..cc03ae660 100644 --- a/src/utils/rinex-tools/obsdiff.cc +++ b/src/utils/rinex-tools/obsdiff.cc @@ -22,33 +22,33 @@ #include "obsdiff_flags.h" #include // Classes for handling observations RINEX files (data) -#include -#include -#include +#include +#include +#include // Classes for handling satellite navigation parameters RINEX // files (ephemerides) -#include -#include -#include +#include +#include +#include // Classes for handling RINEX files with meteorological parameters -#include -#include -#include -#include +#include +#include +#include +#include // Class for handling tropospheric model -#include +#include // Class for storing >broadcast-type> ephemerides -#include +#include // Class for handling RAIM -#include +#include // Class defining GPS system constants -#include +#include #include #include #include @@ -97,41 +97,29 @@ std::map ReadRinexObs(const std::string& rinex_file, char system // Open and read _baseerence RINEX observables file try { - gpstk::Rinex3ObsStream r_base(rinex_file); + gnsstk::Rinex3ObsStream r_base(rinex_file); - gpstk::Rinex3ObsData r_base_data; - gpstk::Rinex3ObsHeader r_base_header; + gnsstk::Rinex3ObsData r_base_data; + gnsstk::Rinex3ObsHeader r_base_header; - gpstk::RinexDatum dataobj; + gnsstk::RinexDatum dataobj; r_base >> r_base_header; std::set PRN_set; - gpstk::SatID prn; + gnsstk::SatID prn; switch (system) { case 'G': -#if OLD_GPSTK - prn.system = gpstk::SatID::systemGPS; -#else - prn.system = gpstk::SatelliteSystem::GPS; -#endif + prn.system = gnsstk::SatelliteSystem::GPS; PRN_set = available_gps_prn; break; case 'E': -#if OLD_GPSTK - prn.system = gpstk::SatID::systemGalileo; -#else - prn.system = gpstk::SatelliteSystem::Galileo; -#endif + prn.system = gnsstk::SatelliteSystem::Galileo; PRN_set = available_galileo_prn; break; default: -#if OLD_GPSTK - prn.system = gpstk::SatID::systemGPS; -#else - prn.system = gpstk::SatelliteSystem::GPS; -#endif + prn.system = gnsstk::SatelliteSystem::GPS; PRN_set = available_gps_prn; } @@ -141,8 +129,8 @@ std::map ReadRinexObs(const std::string& rinex_file, char system for (const auto& prn_it : PRN_set) { prn.id = prn_it; - gpstk::CommonTime time = r_base_data.time; - double sow(static_cast(time).sow); + gnsstk::CommonTime time = r_base_data.time; + double sow(static_cast(time).sow); auto pointer = r_base_data.obs.find(prn); @@ -220,12 +208,12 @@ std::map ReadRinexObs(const std::string& rinex_file, char system } } // end while } // End of 'try' block - catch (const gpstk::FFStreamError& e) + catch (const gnsstk::FFStreamError& e) { std::cout << e; return obs_map; } - catch (const gpstk::Exception& e) + catch (const gnsstk::Exception& e) { std::cout << e; return obs_map; @@ -906,7 +894,7 @@ void coderate_phaserate_consistence( arma::vec prange = measured_ch0.col(1); // todo: This code is only valid for L1/E1 carrier frequency. - arma::vec phase = measured_ch0.col(3) * (gpstk::C_MPS / gpstk::L1_FREQ_GPS); + arma::vec phase = measured_ch0.col(3) * (gnsstk::C_MPS / gnsstk::L1_FREQ_GPS); double mincodeval = 5000000.0; double maxcodeval = 40000000.0; @@ -1051,7 +1039,7 @@ void code_phase_diff( arma::interp1(measured_ch1.col(0), measured_ch1.col(3), measurement_time, carrier_phase_ch1_obs_interp); // generate Code - Phase vector - arma::vec code_minus_phase = (measured_ch0.col(1) - code_range_ch1_obs_interp) - (measured_ch0.col(3) - carrier_phase_ch1_obs_interp) * (gpstk::C_MPS / gpstk::L1_FREQ_GPS); + arma::vec code_minus_phase = (measured_ch0.col(1) - code_range_ch1_obs_interp) - (measured_ch0.col(3) - carrier_phase_ch1_obs_interp) * (gnsstk::C_MPS / gnsstk::L1_FREQ_GPS); // remove NaN arma::uvec NaN_in_measured_data = arma::find_nonfinite(code_minus_phase); @@ -1135,28 +1123,28 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: return 0.0; } // Declaration of objects for storing ephemerides and handling RAIM - gpstk::GPSEphemerisStore bcestore; - gpstk::PRSolution raimSolver; + gnsstk::GPSEphemerisStore bcestore; + gnsstk::PRSolution raimSolver; // Object for void-type tropospheric model (in case no meteorological // RINEX is available) - gpstk::ZeroTropModel noTropModel; + gnsstk::ZeroTropModel noTropModel; // Object for GG-type tropospheric model (Goad and Goodman, 1974) // Default constructor => default values for model - gpstk::GGTropModel ggTropModel; + gnsstk::GGTropModel ggTropModel; // Pointer to one of the two available tropospheric models. It points // to the void model by default - gpstk::TropModel* tropModelPtr = &noTropModel; + gnsstk::TropModel* tropModelPtr = &noTropModel; double rx_clock_error_s = 0.0; try { // Read nav file and store unique list of ephemerides - gpstk::Rinex3NavStream rnffs(rinex_nav_filename.c_str()); // Open ephemerides data file - gpstk::Rinex3NavData rne; - gpstk::Rinex3NavHeader hdr; + 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; @@ -1172,10 +1160,10 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: // Open and read the observation file one epoch at a time. // For each epoch, compute and print a position solution - gpstk::Rinex3ObsStream roffs(rinex_obs_file.c_str()); // Open observations data file + gnsstk::Rinex3ObsStream roffs(rinex_obs_file.c_str()); // Open observations data file - gpstk::Rinex3ObsHeader roh; - gpstk::Rinex3ObsData rod; + gnsstk::Rinex3ObsHeader roh; + gnsstk::Rinex3ObsData rod; // Let's read the header roffs >> roh; @@ -1197,14 +1185,14 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: // Apply editing criteria if (rod.epochFlag == 0 || rod.epochFlag == 1) // Begin usable data { - std::vector prnVec; + std::vector prnVec; std::vector rangeVec; // Define the "it" iterator to visit the observations PRN map. // Rinex3ObsData::DataMap is a map from RinexSatID to // vector: // std::map > - gpstk::Rinex3ObsData::DataMap::const_iterator it; + gnsstk::Rinex3ObsData::DataMap::const_iterator it; // This part gets the PRN numbers and ionosphere-corrected // pseudoranges for the current epoch. They are correspondly fed @@ -1251,19 +1239,12 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: // pointer to the tropospheric model to be applied try { -#if OLD_GPSTK - std::vector Syss; -#endif - gpstk::Matrix invMC; + gnsstk::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: @@ -1294,7 +1275,7 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: } // return iret; } - catch (const gpstk::Exception& e) + catch (const gnsstk::Exception& e) { } @@ -1307,14 +1288,14 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: << std::setw(12) << raimSolver.Solution(2) << "\n"; std::cout << "RX CLK " << std::fixed << std::setprecision(16) - << raimSolver.Solution(3) / gpstk::C_MPS << " [s] \n"; + << raimSolver.Solution(3) / gnsstk::C_MPS << " [s] \n"; std::cout << "NSATS, DOPs " << std::setw(2) << raimSolver.Nsvs << std::fixed << std::setprecision(2) << " " << std::setw(4) << raimSolver.PDOP << " " << std::setw(4) << raimSolver.GDOP << " " << std::setw(8) << raimSolver.RMSResidual << "\n"; - gpstk::Position rx_pos; - rx_pos.setECEF(gpstk::Triple(raimSolver.Solution(0), raimSolver.Solution(1), raimSolver.Solution(2))); + gnsstk::Position rx_pos; + rx_pos.setECEF(gnsstk::Triple(raimSolver.Solution(0), raimSolver.Solution(1), raimSolver.Solution(2))); double lat_deg = rx_pos.geodeticLatitude(); double lon_deg = rx_pos.longitude(); @@ -1325,17 +1306,17 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: << std::setw(12) << Alt_m << " [deg],[deg],[m]\n"; // set computed RX clock error and stop iterating obs epochs - rx_clock_error_s = raimSolver.Solution(3) / gpstk::C_MPS; + rx_clock_error_s = raimSolver.Solution(3) / gnsstk::C_MPS; break; } // End of 'if( raimSolver.isValid() )' } // End of 'if( rod.epochFlag == 0 || rod.epochFlag == 1 )' } // End of 'while( roffs >> rod )' } - catch (const gpstk::FFStreamError& e) + catch (const gnsstk::FFStreamError& e) { std::cout << "GPSTK exception: " << e << '\n'; } - catch (const gpstk::Exception& e) + catch (const gnsstk::Exception& e) { std::cout << "GPSTK exception: " << e << '\n'; } diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index e665d95a9..fa0dd40c3 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -5,11 +5,11 @@ # SPDX-License-Identifier: BSD-3-Clause -find_package(GPSTK QUIET) -if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) +find_package(GNSSTK QUIET) +if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) include(GNUInstallDirs) - set(GPSTK_LIBRARY ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(GPSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/include) + 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() @@ -73,7 +73,7 @@ if(Boost_FOUND) PRIVATE Boost::iostreams Boost::serialization - ${GPSTK_LIBRARY} + ${GNSSTK_LIBRARY} Gflags::gflags Threads::Threads core_system_parameters @@ -81,8 +81,8 @@ if(Boost_FOUND) target_include_directories(rinex2assist PRIVATE - ${GPSTK_INCLUDE_DIR}/gpstk - ${GPSTK_INCLUDE_DIR} + ${GNSSTK_INCLUDE_DIR}/gnsstk + ${GNSSTK_INCLUDE_DIR} ) if(NOT UNCOMPRESS_EXECUTABLE-NOTFOUND) @@ -91,8 +91,8 @@ if(Boost_FOUND) target_compile_definitions(rinex2assist PRIVATE -DUNCOMPRESS_EXECUTABLE="") endif() - if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) - add_dependencies(rinex2assist gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) + if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) + add_dependencies(rinex2assist gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) endif() if(ENABLE_STRIP) diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index b80d90604..948860817 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -28,11 +28,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include // for size_t #include #include @@ -157,9 +157,9 @@ int main(int argc, char** argv) try { // Read nav file - gpstk::Rinex3NavStream rnffs(input_filename.c_str()); // Open navigation data file - gpstk::Rinex3NavData rne; - gpstk::Rinex3NavHeader hdr; + gnsstk::Rinex3NavStream rnffs(input_filename.c_str()); // Open navigation data file + gnsstk::Rinex3NavData rne; + gnsstk::Rinex3NavHeader hdr; // Read header rnffs >> hdr; @@ -178,8 +178,14 @@ 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; - gps_utc_model.tot = static_cast(hdr.mapTimeCorr["GPUT"].refTime).sow; - gps_utc_model.WN_T = static_cast(hdr.mapTimeCorr["GPUT"].refTime).week; + if (std::find(hdr.commentList.begin(), hdr.commentList.end(), "GPUT") != hdr.commentList.end()) + { + gnsstk::GPSWeekSecond ct; + ct = gnsstk::GPSWeekSecond(hdr.mapTimeCorr["GPUT"].refTime); + // std::cout << "gps sow: " << ct.sow << '\n'; + gps_utc_model.tot = ct.sow; + gps_utc_model.WN_T = ct.week; + } gps_utc_model.DeltaT_LS = hdr.leapSeconds; gps_utc_model.WN_LSF = hdr.leapWeek; gps_utc_model.DN = hdr.leapDay; @@ -201,8 +207,14 @@ 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; - gal_utc_model.tot = static_cast(hdr.mapTimeCorr["GAUT"].refTime).sow; - gal_utc_model.WNot = static_cast(hdr.mapTimeCorr["GAUT"].refTime).week; + if (std::find(hdr.commentList.begin(), hdr.commentList.end(), "GAUT") != hdr.commentList.end()) + { + gnsstk::GALWeekSecond ct; + ct = gnsstk::GALWeekSecond(hdr.mapTimeCorr["GAUT"].refTime); + // std::cout << "gal sow: " << ct.sow << '\n'; + gal_utc_model.tot = ct.sow; + gal_utc_model.WNot = ct.week; + } gal_utc_model.WN_LSF = hdr.leapWeek; gal_utc_model.DN = hdr.leapDay; gal_utc_model.Delta_tLSF = hdr.leapDelta; From d94778b27ab117eb9d25a05c74aec91a2d24738a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 4 Jul 2022 10:26:13 +0200 Subject: [PATCH 3/9] Fixes for Xcode --- src/tests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d5f47c2a9..5d42e9550 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -114,7 +114,7 @@ if(NOT GOOGLETEST_FOUND) ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) set_target_properties(GTest::GTest PROPERTIES - IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtestd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELEASE ${binary_dir}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} @@ -146,7 +146,7 @@ if(NOT GOOGLETEST_FOUND) ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) set_target_properties(GTest::Main PROPERTIES - IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_maind${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${binary_dir}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELEASE ${binary_dir}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_RELWITHDEBINFO ${binary_dir}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} IMPORTED_LOCATION_MINSIZEREL ${binary_dir}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} From b48ef135a71247ec1a9694a2f5be5584cfc5c23e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 4 Jul 2022 13:47:05 +0200 Subject: [PATCH 4/9] Fix for gnsstk > 9.0.0 --- src/utils/rinex2assist/main.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index 948860817..0e16560cf 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -178,13 +178,11 @@ 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 (std::find(hdr.commentList.begin(), hdr.commentList.end(), "GPUT") != hdr.commentList.end()) + if (hdr.mapTimeCorr["GPUT"].refTime != gnsstk::CommonTime::BEGINNING_OF_TIME) { - gnsstk::GPSWeekSecond ct; - ct = gnsstk::GPSWeekSecond(hdr.mapTimeCorr["GPUT"].refTime); - // std::cout << "gps sow: " << ct.sow << '\n'; - gps_utc_model.tot = ct.sow; - gps_utc_model.WN_T = ct.week; + gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GPUT"].refTime); + gps_utc_model.tot = gws.getSOW(); + gps_utc_model.WN_T = gws.getWeek(); } gps_utc_model.DeltaT_LS = hdr.leapSeconds; gps_utc_model.WN_LSF = hdr.leapWeek; @@ -207,13 +205,11 @@ 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 (std::find(hdr.commentList.begin(), hdr.commentList.end(), "GAUT") != hdr.commentList.end()) + if (hdr.mapTimeCorr["GAUT"].refTime != gnsstk::CommonTime::BEGINNING_OF_TIME) { - gnsstk::GALWeekSecond ct; - ct = gnsstk::GALWeekSecond(hdr.mapTimeCorr["GAUT"].refTime); - // std::cout << "gal sow: " << ct.sow << '\n'; - gal_utc_model.tot = ct.sow; - gal_utc_model.WNot = ct.week; + gnsstk::GPSWeekSecond gws(hdr.mapTimeCorr["GAUT"].refTime); + gal_utc_model.tot = gws.getSOW(); + gal_utc_model.WNot = gws.getWeek(); } gal_utc_model.WN_LSF = hdr.leapWeek; gal_utc_model.DN = hdr.leapDay; From 3d5da94b276a6f865ce644b847e32f790f3ba5f0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 4 Jul 2022 14:51:22 +0200 Subject: [PATCH 5/9] Document transition from GPSTk to GNSSTk --- README.md | 8 ++++---- cmake/Modules/FindGPSTK.cmake | 2 +- docs/doxygen/other/main_page.dox | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 29e469530..4beb8d4be 100644 --- a/README.md +++ b/README.md @@ -2048,10 +2048,10 @@ PVT.rtcm_MT1077_rate_ms=1000 the user to post-process the received data to produce a more accurate result (usually with other data unknown to the original receiver, such as better models of the atmospheric conditions at time of measurement). RINEX files can - be used by software packages such as [GPSTk](https://github.com/SGL-UT/GPSTk), - [RTKLIB](http://www.rtklib.com/), and [gLAB](https://gage.upc.edu/gLAB/). - GNSS-SDR by default generates RINEX version - [3.02](ftp://igs.org/pub/data/format/rinex302.pdf). If + be used by software packages such as + [GNSSTK](https://github.com/SGL-UT/gnsstk), [RTKLIB](http://www.rtklib.com/), + and [gLAB](https://gage.upc.edu/gLAB/). GNSS-SDR by default generates RINEX + version [3.02](ftp://igs.org/pub/data/format/rinex302.pdf). If [2.11](ftp://igs.org/pub/data/format/rinex211.txt) is needed, it can be requested through the `rinex_version` parameter in the configuration file: diff --git a/cmake/Modules/FindGPSTK.cmake b/cmake/Modules/FindGPSTK.cmake index 5e8dddef7..5ea1beb54 100644 --- a/cmake/Modules/FindGPSTK.cmake +++ b/cmake/Modules/FindGPSTK.cmake @@ -83,7 +83,7 @@ if(GPSTK_FOUND AND NOT EXISTS ${GPSTK_INCLUDE_DIR}/gpstk/SatelliteSystem.hpp) endif() set_package_properties(GPSTK PROPERTIES - URL "https://github.com/SGL-UT/GPSTk" + URL "https://github.com/SGL-UT/gnsstk" ) if(GPSTK_FOUND AND NOT ENABLE_OWN_GPSTK AND NOT TARGET Gpstk::gpstk) diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 419cd9848..0968c3eb9 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -514,7 +514,7 @@ Observables.dump_filename=./observables.dat \subsection pvt Computation of Position, Velocity and Time Although data processing for obtaining high-accuracy PVT solutions is out of the scope of GNSS-SDR, we provide a module that can compute a simple least square solution and leaves room for more sophisticated positioning methods. The integration with libraries and software tools that are able to deal with multi-constellation -data such as GPSTk or gLAB appears as a viable solution for high performance, completely customizable GNSS receivers. +data such as GNSSTk or gLAB appears as a viable solution for high performance, completely customizable GNSS receivers. The common interface is PvtInterface. For instance, in order to use the implementation RTKLIB_PVT, add to the configuration file: \verbatim From 109112be63c39671ed1368d503d01427a7b47a3c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 Jul 2022 13:46:58 +0200 Subject: [PATCH 6/9] Allow backward compatibility with GPSTK --- .clang-format | 2 +- CMakeLists.txt | 12 ++- cmake/Modules/FindGNSSTK.cmake | 55 ++++++++--- cmake/Modules/FindGPSTK.cmake | 99 ------------------- docs/CHANGELOG.md | 7 ++ src/tests/CMakeLists.txt | 9 +- src/tests/data/gpstk_static.patch | 31 ------ .../observables/hybrid_observables_test.cc | 49 +++++---- .../hybrid_observables_test_fpga.cc | 50 ++++++---- src/utils/rinex-tools/CMakeLists.txt | 45 ++++++--- src/utils/rinex-tools/README.md | 4 +- src/utils/rinex-tools/obsdiff.cc | 68 ++++++++++--- src/utils/rinex2assist/CMakeLists.txt | 33 +++++-- src/utils/rinex2assist/main.cc | 25 ++++- 14 files changed, 261 insertions(+), 228 deletions(-) delete mode 100644 cmake/Modules/FindGPSTK.cmake delete mode 100644 src/tests/data/gpstk_static.patch 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; From 9db6f55b3cf49faef9732fd15c77c5f57abb332f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 Jul 2022 17:37:21 +0200 Subject: [PATCH 7/9] Fix when building for GNSSTk 12.1.0 or older --- cmake/Modules/FindGNSSTK.cmake | 33 +++++++++++++++++++-------- src/tests/CMakeLists.txt | 2 +- src/utils/rinex-tools/CMakeLists.txt | 14 +++++++----- src/utils/rinex-tools/obsdiff.cc | 14 ++++++------ src/utils/rinex2assist/CMakeLists.txt | 6 ++--- 5 files changed, 41 insertions(+), 28 deletions(-) diff --git a/cmake/Modules/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake index ba0accb6e..310afe0b7 100644 --- a/cmake/Modules/FindGNSSTK.cmake +++ b/cmake/Modules/FindGNSSTK.cmake @@ -32,7 +32,7 @@ if(DEFINED ENV{GNSSTK_ROOT}) endif() unset(GNSSTK_INCLUDE_DIR CACHE) -set(GNSSTK_USES_GPSTK_NAMESPACE FALSE) +unset(GNSSTK_USES_GPSTK_NAMESPACE CACHE) find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp PATHS ${GNSSTK_ROOT_USER_DEFINED}/include /usr/include @@ -40,16 +40,18 @@ find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp /opt/local/include ) set(GNSSTK_NAMES ${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_SHARED_LIBRARY_SUFFIX}) -if(NOT GNSSTK_INCLUDE_DIR) +if(NOT GNSSTK_INCLUDE_DIR_FOUND) 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) + if(GNSSTK_INCLUDE_DIR_FOUND) set(GNSSTK_NAMES gpstk ${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX}) set(GNSSTK_USES_GPSTK_NAMESPACE TRUE) + set(GNSSTK_OLDER_THAN_8 TRUE) + #set(GNSSTK_OLDER_THAN_9 TRUE) endif() endif() @@ -64,12 +66,7 @@ find_library(GNSSTK_LIBRARY NAMES ${GNSSTK_NAMES} /opt/local/lib ) -# handle the QUIET and REQUIRED arguments and set GNSSTK_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GNSSTK DEFAULT_MSG GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR) - -if(GNSSTK_FOUND) +if(GNSSTK_LIBRARY AND GNSSTK_INCLUDE_DIR) set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION}) unset(PACKAGE_VERSION) if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) @@ -85,6 +82,17 @@ if(GNSSTK_FOUND) set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION}) endif() +if(GNSSTK_VERSION) + if(GNSSTK_VERSION VERSION_GREATER ${GNSSSDR_GNSSTK_LOCAL_VERSION}) + unset(GNSSTK_LIBRARY CACHE) + unset(GNSSTK_INCLUDE_DIR CACHE) + endif() +endif() +# handle the QUIET and REQUIRED arguments and set GNSSTK_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GNSSTK DEFAULT_MSG GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR) + if(GNSSTK_FOUND AND GNSSTK_VERSION) set_package_properties(GNSSTK PROPERTIES DESCRIPTION "The GNSSTk C++ Library (found: v${GNSSTK_VERSION})" @@ -123,4 +131,9 @@ if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk) endif() endif() -mark_as_advanced(GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR GNSSTK_USES_GPSTK_NAMESPACE GNSSTK_OLDER_THAN_8) +mark_as_advanced(GNSSTK_LIBRARY + GNSSTK_INCLUDE_DIR + GNSSTK_USES_GPSTK_NAMESPACE + GNSSTK_OLDER_THAN_8 + GNSSTK_OLDER_THAN_9 +) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 9c0e34762..cc4ec78a8 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -355,7 +355,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) include(GNUInstallDirs) find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH) if(NOT Patch_EXECUTABLE) - message(FATAL_ERROR "The patch command is not found. It is required to build GPSTk. Please check your OS documentation and install the patch command.") + message(FATAL_ERROR "The patch command is not found. It is required to build GNSSTk. Please check your OS documentation and install the patch command.") endif() set(GNSSTK_PATCH_COMMAND cd ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} && diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 0071bf3dc..46c90bd6f 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -11,11 +11,11 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) include(GNUInstallDirs) 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_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${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}/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) + 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) endif() endif() @@ -60,12 +60,14 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND add_dependencies(obsdiff matio-${GNSSSDR_MATIO_LOCAL_VERSION}) endif() if(GNSSTK_USES_GPSTK_NAMESPACE) - target_compile_definitions(obsdiff PUBLIC -DGNSSTK_USES_GPSTK_NAMESPACE=1) + target_compile_definitions(obsdiff PRIVATE -DGNSSTK_USES_GPSTK_NAMESPACE=1) endif() if(GNSSTK_OLDER_THAN_8) - target_compile_definitions(obsdiff PUBLIC -DOLD_GPSTK=1) + target_compile_definitions(obsdiff PRIVATE -DOLD_GPSTK=1) + endif() + if(GNSSTK_OLDER_THAN_9) + target_compile_definitions(obsdiff PRIVATE -DGNSSTK_OLDER_THAN_9=1) endif() - if(NOT TARGET Gnsstk::gnsstk) if(GNSSTK_USES_GPSTK_NAMESPACE) file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIR}/gpstk) diff --git a/src/utils/rinex-tools/obsdiff.cc b/src/utils/rinex-tools/obsdiff.cc index c44817551..f24a6c4cf 100644 --- a/src/utils/rinex-tools/obsdiff.cc +++ b/src/utils/rinex-tools/obsdiff.cc @@ -131,25 +131,25 @@ std::map ReadRinexObs(const std::string& rinex_file, char system { case 'G': #if OLD_GPSTK - prn.system = gpstk::SatID::systemGPS; + prn.system = gnsstk::SatID::systemGPS; #else - prn.system = gpstk::SatelliteSystem::GPS; + prn.system = gnsstk::SatelliteSystem::GPS; #endif PRN_set = available_gps_prn; break; case 'E': #if OLD_GPSTK - prn.system = gpstk::SatID::systemGalileo; + prn.system = gnsstk::SatID::systemGalileo; #else - prn.system = gpstk::SatelliteSystem::Galileo; + prn.system = gnsstk::SatelliteSystem::Galileo; #endif PRN_set = available_galileo_prn; break; default: #if OLD_GPSTK - prn.system = gpstk::SatID::systemGPS; + prn.system = gnsstk::SatID::systemGPS; #else - prn.system = gpstk::SatelliteSystem::GPS; + prn.system = gnsstk::SatelliteSystem::GPS; #endif PRN_set = available_gps_prn; } @@ -1273,7 +1273,7 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: #if OLD_GPSTK std::vector Syss; #endif - gpstk::Matrix invMC; + gnsstk::Matrix invMC; int iret; // Call RAIMCompute #if OLD_GPSTK diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index d788109c7..d53df14df 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -17,7 +17,6 @@ if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) endif() endif() - find_package(Boost COMPONENTS iostreams serialization QUIET) if(CMAKE_VERSION VERSION_LESS 3.5) if(NOT TARGET Boost::iostreams) @@ -40,7 +39,6 @@ if(CMAKE_VERSION VERSION_LESS 3.5) endif() endif() - find_program(UNCOMPRESS_EXECUTABLE uncompress PATHS /bin /usr/bin @@ -70,7 +68,7 @@ if(Boost_FOUND) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options(rinex2assist PRIVATE - -Wno-deprecated -Wno-unused-parameter -Wno-sign-compare + -Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-switch -Wno-inconsistent-missing-override ) endif() @@ -100,7 +98,7 @@ if(Boost_FOUND) endif() if(GNSSTK_VERSION) if(GNSSTK_VERSION VERSION_LESS "9.0.0") - target_compile_definitions(rinex2assist PUBLIC -DGNSSTK_OLDER_THAN_9=1) + target_compile_definitions(rinex2assist PRIVATE -DGNSSTK_OLDER_THAN_9=1) endif() endif() From a81e53377b366bd8a0d7bc58fe8ca697c920b60e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 6 Jul 2022 11:02:09 +0200 Subject: [PATCH 8/9] Improve finding of GPSTk --- cmake/Modules/FindGNSSTK.cmake | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/Modules/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake index 310afe0b7..b1b1d9076 100644 --- a/cmake/Modules/FindGNSSTK.cmake +++ b/cmake/Modules/FindGNSSTK.cmake @@ -40,18 +40,16 @@ find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp /opt/local/include ) set(GNSSTK_NAMES ${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_SHARED_LIBRARY_SUFFIX}) -if(NOT GNSSTK_INCLUDE_DIR_FOUND) +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_FOUND) + if(GNSSTK_INCLUDE_DIR) set(GNSSTK_NAMES gpstk ${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX}) set(GNSSTK_USES_GPSTK_NAMESPACE TRUE) - set(GNSSTK_OLDER_THAN_8 TRUE) - #set(GNSSTK_OLDER_THAN_9 TRUE) endif() endif() @@ -69,11 +67,13 @@ find_library(GNSSTK_LIBRARY NAMES ${GNSSTK_NAMES} if(GNSSTK_LIBRARY AND GNSSTK_INCLUDE_DIR) set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION}) unset(PACKAGE_VERSION) - if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) - include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake) + if(GNSSTK_USES_GPSTK_NAMESPACE) + if(EXISTS ${GNSSTK_INCLUDE_DIR}/../share/cmake/GPSTK/GPSTKConfigVersion.cmake) + include(${GNSSTK_INCLUDE_DIR}/../share/cmake/GPSTK/GPSTKConfigVersion.cmake) + endif() else() - if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake) - include(${CMAKE_INSTALL_FULL_DATADIR}/cmake/GPSTK/GPSTKConfigVersion.cmake) + if(EXISTS ${GNSSTK_INCLUDE_DIR}/../share/cmake/GNSSTK/GNSSTKConfigVersion.cmake) + include(${GNSSTK_INCLUDE_DIR}/../share/cmake/GNSSTK/GNSSTKConfigVersion.cmake) endif() endif() if(PACKAGE_VERSION) @@ -88,6 +88,7 @@ if(GNSSTK_VERSION) unset(GNSSTK_INCLUDE_DIR CACHE) endif() endif() + # handle the QUIET and REQUIRED arguments and set GNSSTK_FOUND to TRUE if # all listed variables are TRUE include(FindPackageHandleStandardArgs) @@ -135,5 +136,4 @@ mark_as_advanced(GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR GNSSTK_USES_GPSTK_NAMESPACE GNSSTK_OLDER_THAN_8 - GNSSTK_OLDER_THAN_9 ) From 06ed558fb161fce9530485465bf5bbf817d0fd67 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 6 Jul 2022 13:49:45 +0200 Subject: [PATCH 9/9] Report GNSSTk in CMake summary --- src/tests/CMakeLists.txt | 2 +- src/utils/rinex-tools/CMakeLists.txt | 4 +++- src/utils/rinex2assist/CMakeLists.txt | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index cc4ec78a8..341b30b9f 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -342,7 +342,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) ############################################################################ if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) set_package_properties(GNSSTK PROPERTIES - PURPOSE "gnsstk v${GNSSSDR_GNSSTK_LOCAL_VERSION} will be automatically downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." + PURPOSE "GNSSTk v${GNSSSDR_GNSSTK_LOCAL_VERSION} will be automatically downloaded and built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." ) if("${TOOLCHAIN_ARG}" STREQUAL "") set(TOOLCHAIN_ARG "-DCMAKE_CXX_FLAGS=-Wno-deprecated") diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 46c90bd6f..c2967f231 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -7,7 +7,9 @@ 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}'") - find_package(GNSSTK QUIET) + if(NOT GNSSTK_FOUND) + find_package(GNSSTK) + endif() if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) include(GNUInstallDirs) if(GNSSTK_USES_GPSTK_NAMESPACE) diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index d53df14df..4b8c61b63 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -4,8 +4,10 @@ # SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause +if(NOT GNSSTK_FOUND) + find_package(GNSSTK) +endif() -find_package(GNSSTK QUIET) if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) include(GNUInstallDirs) if(GNSSTK_USES_GPSTK_NAMESPACE)