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/.github/workflows/main.yml b/.github/workflows/main.yml index df0b9a372..268ec1b46 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,7 +62,7 @@ jobs: - name: install dependencies run: brew update && brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio log4cpp openssl pugixml protobuf && ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin && ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin && ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin && pip3 install mako - name: Prepare run - run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.12.0 core_monitor core_libs pvt_libs + run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.12.1 core_monitor core_libs pvt_libs - name: run clang-tidy run: cd build && run-clang-tidy -fix - name: check diff --git a/CMakeLists.txt b/CMakeLists.txt index 318f99112..b1372e3df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,9 +18,10 @@ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") cmake_minimum_required(VERSION 2.8.12...3.23) project(gnss-sdr CXX C) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) - +set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project +set(GNSSSDR_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +list(APPEND CMAKE_MODULE_PATH ${GNSSSDR_SOURCE_DIR}/cmake/Modules) ################################################################################ # Determine optional blocks/libraries to be built (default: not built) @@ -113,7 +114,17 @@ 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) + +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) + unset(Gnsstk:gnsstk CACHE) + unset(GNSSTK_FOUND CACHE) + 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) @@ -147,7 +158,7 @@ if(NOT ${THIS_IS_A_RELEASE}) # no: try to find it execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${GNSSSDR_SOURCE_DIR} OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -157,7 +168,7 @@ if(NOT ${THIS_IS_A_RELEASE}) # Get the latest abbreviated commit hash of the working branch execute_process( COMMAND ${GIT_EXECUTABLE} log -1 --format=%h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${GNSSSDR_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -267,10 +278,10 @@ if(UNIX) endif() # If this is an out-of-tree build, do not pollute the original source directory -if(${CMAKE_BINARY_DIR} MATCHES ${CMAKE_SOURCE_DIR}) - set(LOCAL_INSTALL_BASE_DIR ${CMAKE_SOURCE_DIR}) +if(${GNSSSDR_BINARY_DIR} MATCHES ${GNSSSDR_SOURCE_DIR}) + set(LOCAL_INSTALL_BASE_DIR ${GNSSSDR_SOURCE_DIR}) else() - set(LOCAL_INSTALL_BASE_DIR ${CMAKE_BINARY_DIR}) + set(LOCAL_INSTALL_BASE_DIR ${GNSSSDR_BINARY_DIR}) endif() # Determine if CMake scripts make use of target_sources() @@ -323,20 +334,20 @@ set(GNSSSDR_PROTOBUF_MIN_VERSION "3.0.0") ################################################################################ set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0") -set(GNSSSDR_ARMADILLO_LOCAL_VERSION "11.1.x") +set(GNSSSDR_ARMADILLO_LOCAL_VERSION "11.2.x") if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR CMAKE_VERSION VERSION_LESS 3.5) set(GNSSSDR_GTEST_LOCAL_VERSION "1.10.x") else() - set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.0") + 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_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") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.6.1") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.4") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.0") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") if(CMAKE_VERSION VERSION_LESS "3.16") @@ -656,16 +667,27 @@ 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) + unset(Gnsstk::gnsstk CACHE) + unset(GNSSTK_FOUND CACHE) + unset(GNSSTK_OLDER_THAN_8 CACHE) + unset(GNSSTK_OLDER_THAN_9 CACHE) + unset(GNSSTK_OLDER_THAN_13 CACHE) + find_package(GNSSTK) + set_package_properties(GNSSTK PROPERTIES PURPOSE "Used in some Extra Tests." ) +else() + unset(Gnsstk::gnsstk CACHE) + unset(GNSSTK_FOUND CACHE) + unset(GNSSTK_OLDER_THAN_8 CACHE) + unset(GNSSTK_OLDER_THAN_9 CACHE) + unset(GNSSTK_OLDER_THAN_13 CACHE) 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" @@ -1161,7 +1183,7 @@ if(NOT VOLKGNSSSDR_FOUND) endif() set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_COMPILER} - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install + -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install -DENABLE_STATIC_LIBS=ON -DENABLE_PROFILING=${ENABLE_PROFILING} -DENABLE_ORC=${ORC_ENABLED} @@ -1180,7 +1202,7 @@ if(NOT VOLKGNSSSDR_FOUND) ) if(NOT CMAKE_TOOLCHAIN_FILE) set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake + -DCMAKE_TOOLCHAIN_FILE=${GNSSSDR_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake ) else() set(VOLK_GNSSSDR_CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} @@ -1208,9 +1230,9 @@ if(NOT VOLKGNSSSDR_FOUND) endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(volk_gnsssdr_module - PREFIX ${CMAKE_BINARY_DIR}/volk_gnsssdr_module - SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - BINARY_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build + PREFIX ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module + SOURCE_DIR ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + BINARY_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=$<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:ASAN> -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} @@ -1218,13 +1240,13 @@ if(NOT VOLKGNSSSDR_FOUND) UPDATE_COMMAND "" PATCH_COMMAND "" BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile - INSTALL_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install + INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) else() if(SUPPORTED_CPU_FEATURES_ARCH) set(VOLK_GNSSSDR_BUILD_BYPRODUCTS - ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} - ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile + ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile ) if(ENABLE_CPUFEATURES) find_package(CPUFEATURES) @@ -1251,7 +1273,7 @@ if(NOT VOLKGNSSSDR_FOUND) ) set(VOLK_GNSSSDR_BUILD_BYPRODUCTS ${VOLK_GNSSSDR_BUILD_BYPRODUCTS} - ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() endif() @@ -1259,9 +1281,9 @@ if(NOT VOLKGNSSSDR_FOUND) -DVOLK_CPU_FEATURES=${ENABLE_CPUFEATURES} ) ExternalProject_Add(volk_gnsssdr_module - PREFIX ${CMAKE_BINARY_DIR}/volk_gnsssdr_module - SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - BINARY_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build + PREFIX ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module + SOURCE_DIR ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + BINARY_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=$<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:ASAN> -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} @@ -1270,7 +1292,7 @@ if(NOT VOLKGNSSSDR_FOUND) PATCH_COMMAND "" BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile BUILD_BYPRODUCTS ${VOLK_GNSSSDR_BUILD_BYPRODUCTS} - INSTALL_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install + INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) else() set(ENABLE_CPUFEATURES OFF) @@ -1278,9 +1300,9 @@ if(NOT VOLKGNSSSDR_FOUND) -DVOLK_CPU_FEATURES=${ENABLE_CPUFEATURES} ) ExternalProject_Add(volk_gnsssdr_module - PREFIX ${CMAKE_BINARY_DIR}/volk_gnsssdr_module - SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - BINARY_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build + PREFIX ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module + SOURCE_DIR ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + BINARY_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=$<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:ASAN> -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} @@ -1288,9 +1310,9 @@ if(NOT VOLKGNSSSDR_FOUND) UPDATE_COMMAND "" PATCH_COMMAND "" BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} volk_gnsssdr_profile - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} - ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile - INSTALL_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install + BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile + INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install ) endif() endif() @@ -1301,20 +1323,20 @@ if(NOT VOLKGNSSSDR_FOUND) endif() add_library(volk_gnsssdr UNKNOWN IMPORTED) - set_property(TARGET volk_gnsssdr PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(VOLK_GNSSSDR_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build/include/;${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include;${ORC_INCLUDE_DIRS}") + set_property(TARGET volk_gnsssdr PROPERTY IMPORTED_LOCATION ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(VOLK_GNSSSDR_INCLUDE_DIRS "${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build/include/;${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include;${ORC_INCLUDE_DIRS}") set(VOLK_GNSSSDR_LIBRARIES volk_gnsssdr ${ORC_LIBRARIES_STATIC}) if(CPUFEATURES_FOUND) set(VOLK_GNSSSDR_LIBRARIES ${VOLK_GNSSSDR_LIBRARIES} CpuFeature::cpu_features) endif() if(NOT TARGET Volkgnsssdr::volkgnsssdr) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build/include) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build/include) add_library(Volkgnsssdr::volkgnsssdr STATIC IMPORTED) add_dependencies(Volkgnsssdr::volkgnsssdr volk_gnsssdr_module) set_target_properties(Volkgnsssdr::volkgnsssdr PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}" INCLUDE_DIRECTORIES "${VOLK_GNSSSDR_INCLUDE_DIRS}" INTERFACE_INCLUDE_DIRECTORIES "${VOLK_GNSSSDR_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${VOLK_GNSSSDR_LIBRARIES}" @@ -1322,7 +1344,7 @@ if(NOT VOLKGNSSSDR_FOUND) if(CMAKE_VERSION VERSION_GREATER 3.0 AND SUPPORTED_CPU_FEATURES_ARCH) if(NOT CPUFEATURES_FOUND AND ENABLE_CPUFEATURES) set_target_properties(Volkgnsssdr::volkgnsssdr PROPERTIES - INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() endif() @@ -1330,19 +1352,19 @@ if(NOT VOLKGNSSSDR_FOUND) if(CMAKE_VERSION VERSION_LESS 3.2) add_custom_command(TARGET volk_gnsssdr_module POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile + COMMAND ${CMAKE_COMMAND} -E copy ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile ${LOCAL_INSTALL_BASE_DIR}/install/volk_gnsssdr_profile ) else() add_custom_command(TARGET volk_gnsssdr_module POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile + COMMAND ${CMAKE_COMMAND} -E copy ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile ${LOCAL_INSTALL_BASE_DIR}/install/volk_gnsssdr_profile BYPRODUCTS ${LOCAL_INSTALL_BASE_DIR}/install/volk_gnsssdr_profile ) endif() add_custom_command(TARGET volk_gnsssdr_module POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr-config-info + COMMAND ${CMAKE_COMMAND} -E copy ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr-config-info ${LOCAL_INSTALL_BASE_DIR}/install/volk_gnsssdr-config-info ) @@ -1359,9 +1381,18 @@ endif() # gflags - https://github.com/gflags/gflags ################################################################################ set(LOCAL_GFLAGS FALSE) -if(NOT ENABLE_OWN_GLOG) +if(ENABLE_OWN_GLOG) + unset(Glog::glog CACHE) + unset(GLOG_FOUND CACHE) + unset(Gflags::gflags CACHE) + unset(GLAGS_FOUND CACHE) + set(GFLAGS_GREATER_20 TRUE) +else() + unset(Glog::glog CACHE) + unset(GLOG_FOUND CACHE) find_package(GLOG) if(GLOG_FOUND) + unset(GFLAGS_GREATER_20 CACHE) find_package(GFLAGS) endif() endif() @@ -1379,7 +1410,7 @@ if(NOT GFLAGS_FOUND) message(STATUS " gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") set(GFLAGS_BUILD_COMMAND ${CMAKE_COMMAND} - "--build" "${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}" + "--build" "${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}" "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) if(CMAKE_GENERATOR STREQUAL Xcode) @@ -1391,11 +1422,11 @@ if(NOT GFLAGS_FOUND) if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} GIT_REPOSITORY https://github.com/gflags/gflags.git GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON @@ -1410,20 +1441,20 @@ if(NOT GFLAGS_FOUND) INSTALL_COMMAND "" ) else() - set(GFLAGS_BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX}) 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(GFLAGS_BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX}) endif() if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode)) set(PARALLEL_BUILD "--parallel 2") endif() ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} GIT_REPOSITORY https://github.com/gflags/gflags.git GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON @@ -1441,12 +1472,12 @@ if(NOT GFLAGS_FOUND) # Note: -DBUILD_gflags_nothreads_LIB=ON is required as a workaround to a bug in gflags 2.2.2. This is fixed in gflags master branch set(GFlags_INCLUDE_DIRS - ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/include CACHE PATH "Local Gflags headers" + ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/include CACHE PATH "Local Gflags headers" ) if(CMAKE_VERSION VERSION_LESS "3.0.2") set(GFlags_LIBS - ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() @@ -1462,24 +1493,24 @@ if(NOT GFLAGS_FOUND) MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_ASAN Debug - IMPORTED_LOCATION_NONE ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_INCLUDE_DIRECTORIES ${GFlags_INCLUDE_DIRS} - INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) if(MSVC) set(MSVC_POSTFIX _static) endif() set_target_properties(Gflags::gflags PROPERTIES - IMPORTED_LOCATION_DEBUG ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}_debug${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}_debug${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() endif() @@ -1515,6 +1546,11 @@ if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) endif() message(STATUS " glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") + find_package(LIBUNWIND) + set_package_properties(LIBUNWIND PROPERTIES + PURPOSE "Needed by glog." + TYPE OPTIONAL + ) if(NOT ${LOCAL_GFLAGS}) if(NOT TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) add_library(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} UNKNOWN IMPORTED) @@ -1522,11 +1558,11 @@ if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) set_property(TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PROPERTY IMPORTED_LOCATION "${GFlags_LIBS}") string(REPLACE /include "" GFLAGS_PREFIX_PATH ${GFlags_INCLUDE_DIRS}) else() - set(GFLAGS_PREFIX_PATH ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + set(GFLAGS_PREFIX_PATH ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) endif() set(TARGET_GFLAGS gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) set(GLOG_MAKE_PROGRAM ${CMAKE_COMMAND} - "--build" "${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}" + "--build" "${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}" "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) if(CMAKE_GENERATOR STREQUAL Xcode) @@ -1543,7 +1579,7 @@ if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) set(GLOG_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) set(GFLAGS_LIBRARIES_TO_LINK ${GFlags_LIBS}) if(${LOCAL_GFLAGS}) - set(GFLAGS_LIBRARY_DIR_TO_LINK ${CMAKE_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib) + set(GFLAGS_LIBRARY_DIR_TO_LINK ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib) else() set(GFLAGS_LIBRARY_DIR_TO_LINK ${GFlags_LIBRARY_DIRS}) endif() @@ -1559,7 +1595,7 @@ if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) set(GLOG_EXPORT_C_COMPILER "export CC=gcc") set(GLOG_EXPORT_CXX_COMPILER "export CXX=g++") endif() - file(WRITE ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags + file(WRITE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags "#!/bin/sh export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} export LDFLAGS=-L${GFLAGS_LIBRARY_DIR_TO_LINK} @@ -1567,21 +1603,21 @@ export LIBS=\"${GFLAGS_LIBRARIES_TO_LINK}\" ${GLOG_EXPORT_CXX_LIBRARIES} ${GLOG_EXPORT_C_COMPILER} ${GLOG_EXPORT_CXX_COMPILER} -cd ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/ +cd ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/ aclocal automake --add-missing autoreconf -vfi -cd ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} -${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure --enable-shared=no" +cd ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} +${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure --enable-shared=no" ) - file(COPY ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags - DESTINATION ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + file(COPY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags + DESTINATION ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) - set(GLOG_CONFIGURE ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags) + set(GLOG_CONFIGURE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags) # Ensure that aclocal and libtool are present if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") @@ -1633,11 +1669,11 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure endif() ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} DEPENDS ${TARGET_GFLAGS} - PREFIX ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} GIT_REPOSITORY https://github.com/google/glog/ GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix= BUILD_COMMAND "${GLOG_MAKE_PROGRAM}" UPDATE_COMMAND "" @@ -1645,20 +1681,20 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure INSTALL_COMMAND "" ) set(GLOG_LIBRARIES - ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} ) set(GLOG_INCLUDE_DIRS - ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src - ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src ) else() # CMake > 3.0 but < 3.3 ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} DEPENDS ${TARGET_GFLAGS} - PREFIX ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} GIT_REPOSITORY https://github.com/google/glog/ GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} @@ -1670,19 +1706,19 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure INSTALL_COMMAND "" ) set(GLOG_INCLUDE_DIRS - ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src - ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} ${GFlags_INCLUDE_DIRS} ) endif() else() # CMake > 3.3 set(GLOG_BUILD_BYPRODUCTS - ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} ) 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(GLOG_BUILD_BYPRODUCTS - ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode) AND NOT CMAKE_CROSSCOMPILING) @@ -1693,11 +1729,11 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure endif() ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} DEPENDS ${TARGET_GFLAGS} - PREFIX ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} GIT_REPOSITORY https://github.com/google/glog/ GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} ${GLOG_TOOLCHAIN_FILE} @@ -1712,8 +1748,8 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure INSTALL_COMMAND "" ) set(GLOG_INCLUDE_DIRS - ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src - ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} ${GFlags_INCLUDE_DIRS} ) endif() @@ -1722,8 +1758,8 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure # Create Glog::glog target if(NOT TARGET Glog::glog) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}) add_library(Glog::glog STATIC IMPORTED) add_dependencies(Glog::glog glog-${GNSSSDR_GLOG_LOCAL_VERSION}) if(CMAKE_VERSION VERSION_LESS 3.0) @@ -1743,26 +1779,29 @@ ${CMAKE_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_ASAN Debug - IMPORTED_LOCATION_NONE ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) set_target_properties(Glog::glog PROPERTIES - IMPORTED_LOCATION_DEBUG ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() endif() endif() + if(LIBUNWIND_FOUND) + target_link_libraries(Glog::glog INTERFACE Libunwind::libunwind) + endif() set(LOCAL_GLOG TRUE CACHE STRING "Glog downloaded, built, and statically linked automatically" FORCE) set_package_properties(GLOG PROPERTIES @@ -1865,7 +1904,15 @@ endif() ################################################################################ # Armadillo - http://arma.sourceforge.net/ ################################################################################ -find_package(Armadillo) +if(ENABLE_OWN_ARMADILLO) + unset(Armadillo::armadillo CACHE) + unset(ARMADILLO_FOUND CACHE) +else() + unset(Armadillo::armadillo CACHE) + unset(ARMADILLO_FOUND CACHE) + find_package(Armadillo) +endif() + set_package_properties(Armadillo PROPERTIES URL "http://arma.sourceforge.net/" PURPOSE "Used for matrix computations." @@ -1876,7 +1923,8 @@ if(ARMADILLO_FOUND) DESCRIPTION "C++ library for linear algebra and scientific computing (found: v${ARMADILLO_VERSION_STRING})" ) if(${ARMADILLO_VERSION_STRING} VERSION_LESS ${GNSSSDR_ARMADILLO_MIN_VERSION}) - set(ARMADILLO_FOUND FALSE) + unset(Armadillo::armadillo CACHE) + unset(ARMADILLO_FOUND CACHE) set(ENABLE_OWN_ARMADILLO ON) message(STATUS " Armadillo >= v${GNSSSDR_ARMADILLO_MIN_VERSION} has not been found.") else() @@ -1927,7 +1975,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) # Download and build Armadillo ############################################# set(ARMADILLO_BUILD_COMMAND ${CMAKE_COMMAND} - "--build" "${CMAKE_BINARY_DIR}/armadillo-${armadillo_RELEASE}" + "--build" "${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}" "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) if(CMAKE_TOOLCHAIN_FILE) @@ -1946,13 +1994,15 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(armadillo-${armadillo_RELEASE} - PREFIX ${CMAKE_BINARY_DIR}/armadillo-${armadillo_RELEASE} + PREFIX ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE} GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git GIT_TAG ${armadillo_BRANCH} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE} - BINARY_DIR ${CMAKE_BINARY_DIR}/armadillo-${armadillo_RELEASE} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE} CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DBUILD_SHARED_LIBS=OFF + -DBUILD_SMOKE_TEST=OFF + -DALLOW_BLAS_LAPACK_MACOS=ON ${ARMADILLO_CXX_VERSION} ${DARWIN_DISABLE_HDF5} ${ARMADILLO_TOOLCHAIN_FILE} @@ -1966,19 +2016,21 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) set(PARALLEL_BUILD "--parallel 2") endif() ExternalProject_Add(armadillo-${armadillo_RELEASE} - PREFIX ${CMAKE_BINARY_DIR}/armadillo-${armadillo_RELEASE} + PREFIX ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE} GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git GIT_TAG ${armadillo_BRANCH} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE} - BINARY_DIR ${CMAKE_BINARY_DIR}/armadillo-${armadillo_RELEASE} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE} CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DBUILD_SHARED_LIBS=OFF + -DBUILD_SMOKE_TEST=OFF + -DALLOW_BLAS_LAPACK_MACOS=ON ${ARMADILLO_CXX_VERSION} ${DARWIN_DISABLE_HDF5} ${ARMADILLO_TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> BUILD_COMMAND "${ARMADILLO_BUILD_COMMAND} ${PARALLEL_BUILD}" - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/armadillo-${armadillo_RELEASE}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX} + BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX} UPDATE_COMMAND "" INSTALL_COMMAND "" ) @@ -1992,7 +2044,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) set(ARMADILLO_STATIC_LIBRARY ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}) set(LOCAL_ARMADILLO TRUE CACHE STRING "Armadillo downloaded, built, and statically linked automatically" FORCE) set(ARMADILLO_VERSION_STRING ${armadillo_RELEASE}) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include) add_library(Armadillo::armadillo STATIC IMPORTED) add_dependencies(Armadillo::armadillo armadillo-${armadillo_RELEASE}) set_target_properties(Armadillo::armadillo PROPERTIES @@ -2008,7 +2060,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) IMPORTED_LOCATION_RELEASE ${ARMADILLO_STATIC_LIBRARY} IMPORTED_LOCATION_RELWITHDEBINFO ${ARMADILLO_STATIC_LIBRARY} IMPORTED_LOCATION_MINSIZEREL ${ARMADILLO_STATIC_LIBRARY} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include + INTERFACE_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include INTERFACE_LINK_LIBRARIES ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GFORTRAN} ${ARMADILLO_STATIC_LIBRARY} ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) @@ -2024,6 +2076,14 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) DESCRIPTION "C++ library for linear algebra and scientific computing" PURPOSE "Armadillo ${GNSSSDR_ARMADILLO_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." ) + # Fix for macOS + find_library(ARPACK_LIBRARY + NAMES arpack + PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /opt/local/lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 + ) + if(ARPACK_LIBRARY) + target_link_libraries(Armadillo::armadillo INTERFACE ${ARPACK_LIBRARY}) + endif() endif() @@ -2279,30 +2339,30 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS endif() set(MATIO_MAKE_PROGRAM ${MATIO_MAKE_EXECUTABLE}) endif() - set(MATIO_STATIC_LIB ${CMAKE_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(MATIO_STATIC_LIB ${GNSSSDR_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX}) ExternalProject_Add(matio-${GNSSSDR_MATIO_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/matio + PREFIX ${GNSSSDR_BINARY_DIR}/matio GIT_REPOSITORY https://github.com/tbeu/matio GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION} - UPDATE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/autogen.sh - CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/configure --with-hdf5=${HDF5_BASE_DIR} --with-zlib=${ZLIB_BASE_DIR} --with-default-file-ver=7.3 --enable-mat73=yes --prefix= + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION} + UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/autogen.sh + CONFIGURE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/configure --with-hdf5=${HDF5_BASE_DIR} --with-zlib=${ZLIB_BASE_DIR} --with-default-file-ver=7.3 --enable-mat73=yes --prefix= BUILD_COMMAND ${MATIO_MAKE_PROGRAM} ) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/matio/lib) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/matio/lib) else() # CMake >= 3.7 include(GNUInstallDirs) - set(MATIO_STATIC_LIB ${CMAKE_BINARY_DIR}/matio/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(MATIO_STATIC_LIB ${GNSSSDR_BINARY_DIR}/matio/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX}) if("${HDF5_VERSION}" VERSION_GREATER "1.8.18" AND "${HDF5_VERSION}" VERSION_LESS "1.10.4") # weird workaround, but it works in all tested distros (Ubuntu, Debian, Fedora, CentOS, OpenSUSE) set(EXTRA_MATIO_BUILD_FLAGS -DMATIO_WITH_ZLIB=OFF -DHAVE_ZLIB=1) endif() ExternalProject_Add(matio-${GNSSSDR_MATIO_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/matio + PREFIX ${GNSSSDR_BINARY_DIR}/matio GIT_REPOSITORY https://github.com/tbeu/matio GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/matio + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/matio CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> @@ -2311,23 +2371,23 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS -DHDF5_USE_STATIC_LIBRARIES=OFF -DMATIO_DEFAULT_FILE_VERSION:STRING=7.3 -DMATIO_MAT73=ON - -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/matio + -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/matio BUILD_COMMAND ${CMAKE_COMMAND} - "--build" "${CMAKE_BINARY_DIR}/matio" + "--build" "${GNSSSDR_BINARY_DIR}/matio" "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> BUILD_BYPRODUCTS ${MATIO_STATIC_LIB} ) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/matio/${CMAKE_INSTALL_LIBDIR}) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/matio/${CMAKE_INSTALL_LIBDIR}) endif() if(NOT TARGET Matio::matio) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/matio/include) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/matio/include) add_library(Matio::matio STATIC IMPORTED) add_dependencies(Matio::matio matio-${GNSSSDR_MATIO_LOCAL_VERSION}) set_target_properties(Matio::matio PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION ${MATIO_STATIC_LIB} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/matio/include + INTERFACE_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/matio/include INTERFACE_LINK_LIBRARIES "${MATIO_STATIC_LIB};${HDF5_LIBRARIES};${ZLIB_LIBRARIES}" ) endif() @@ -2350,7 +2410,7 @@ if(NOT PUGIXML_FOUND) if(DEFINED ENV{OECORE_TARGET_SYSROOT}) set(PUGIXML_COMPILER "") if(NOT CMAKE_TOOLCHAIN_FILE) - set(PUGIXML_CMAKE_FLAGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake") + set(PUGIXML_CMAKE_FLAGS "-DCMAKE_TOOLCHAIN_FILE=${GNSSSDR_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake") else() set(PUGIXML_CMAKE_FLAGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") endif() @@ -2360,16 +2420,16 @@ if(NOT PUGIXML_FOUND) endif() endif() set(PUGIXML_BUILD_COMMAND ${CMAKE_COMMAND} - "--build" "${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}" + "--build" "${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}" "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} GIT_REPOSITORY https://github.com/zeux/pugixml GIT_TAG v${GNSSSDR_PUGIXML_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} CMAKE_ARGS ${PUGIXML_COMPILER} ${PUGIXML_CMAKE_FLAGS} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> @@ -2383,26 +2443,26 @@ if(NOT PUGIXML_FOUND) set(PARALLEL_BUILD "--parallel 2") endif() ExternalProject_Add(pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} GIT_REPOSITORY https://github.com/zeux/pugixml GIT_TAG v${GNSSSDR_PUGIXML_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION} CMAKE_ARGS ${PUGIXML_COMPILER} ${PUGIXML_CMAKE_FLAGS} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> UPDATE_COMMAND "" PATCH_COMMAND "" BUILD_COMMAND "${PUGIXML_BUILD_COMMAND} ${PARALLEL_BUILD}" - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} + BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} INSTALL_COMMAND "" ) endif() - set(PUGIXML_LIBRARIES ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(PUGIXML_LIBRARIES ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX}) if(NOT TARGET Pugixml::pugixml) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/src) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/src) add_library(Pugixml::pugixml STATIC IMPORTED) add_dependencies(Pugixml::pugixml pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}) set_target_properties(Pugixml::pugixml PROPERTIES @@ -2418,16 +2478,16 @@ if(NOT PUGIXML_FOUND) IMPORTED_LOCATION_RELEASE ${PUGIXML_LIBRARIES} IMPORTED_LOCATION_RELWITHDEBINFO ${PUGIXML_LIBRARIES} IMPORTED_LOCATION_MINSIZEREL ${PUGIXML_LIBRARIES} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/src + INTERFACE_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/thirdparty/pugixml/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/src INTERFACE_LINK_LIBRARIES ${PUGIXML_LIBRARIES} ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) set_target_properties(Pugixml::pugixml PROPERTIES - IMPORTED_LOCATION_DEBUG ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/pugixml-${GNSSSDR_PUGIXML_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() endif() @@ -2533,19 +2593,19 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI if(CMAKE_CROSSCOMPILING) if(NOT Protobuf_FOUND) ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} GIT_REPOSITORY https://github.com/protocolbuffers/protobuf GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - UPDATE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh - CONFIGURE_COMMAND "${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} --host=$ENV{OECORE_TARGET_ARCH} --with-protoc=${PROTOC_EXECUTABLE}" + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh + CONFIGURE_COMMAND "${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} --host=$ENV{OECORE_TARGET_ARCH} --with-protoc=${PROTOC_EXECUTABLE}" BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} DESTDIR= install - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX} - ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc + BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc ) - set(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc") + set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc") endif() else() if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") @@ -2620,13 +2680,13 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} GIT_REPOSITORY https://github.com/protocolbuffers/protobuf GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - UPDATE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh - CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh + CONFIGURE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} BUILD_COMMAND ${PROTOBUF_MAKE_PROGRAM} INSTALL_COMMAND ${PROTOBUF_MAKE_PROGRAM} DESTDIR= install ) @@ -2639,17 +2699,17 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI endif() endif() ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - PREFIX ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} GIT_REPOSITORY https://github.com/protocolbuffers/protobuf GIT_TAG v${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} - UPDATE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh - CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} + UPDATE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/autogen.sh + CONFIGURE_COMMAND ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/configure --prefix=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} BUILD_COMMAND ${PROTOBUF_MAKE_PROGRAM} ${PROTOBUF_PARALLEL_BUILD} INSTALL_COMMAND ${PROTOBUF_MAKE_PROGRAM} DESTDIR= install - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX} - ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc + BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc ) endif() @@ -2658,23 +2718,23 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}) endif() unset(Protobuf_PROTOC_EXECUTABLE) - set(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc") + set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc") set_target_properties(protobuf::protoc PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc" - INTERFACE_LINK_LIBRARIES "${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc" + INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}" ) endif() - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include) if(NOT TARGET protobuf::libprotobuf) add_library(protobuf::libprotobuf STATIC IMPORTED) add_dependencies(protobuf::libprotobuf protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}) endif() set_target_properties(protobuf::libprotobuf PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}" - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include" - INTERFACE_LINK_LIBRARIES "${CMAKE_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include" + INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}" ) if(CMAKE_VERSION VERSION_LESS 3.10) set(Protobuf_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE}) @@ -2747,7 +2807,7 @@ set_package_properties(MATHJAX2 PROPERTIES if(DOXYGEN_FOUND) message(STATUS "Doxygen found.") message(STATUS " You can build the documentation with '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} doc'.") - message(STATUS " When done, point your browser to ${CMAKE_BINARY_DIR}/docs/html/index.html") + message(STATUS " When done, point your browser to ${GNSSSDR_BINARY_DIR}/docs/html/index.html") if(CMAKE_VERSION VERSION_LESS 3.9.6) if(DOXYGEN_DOT_FOUND) set(HAVE_DOT "YES") @@ -2765,8 +2825,8 @@ if(DOXYGEN_FOUND) set(HAVE_DOT "NO") endif() endif() - file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} top_srcdir) - file(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} top_builddir) + file(TO_NATIVE_PATH ${GNSSSDR_SOURCE_DIR} top_srcdir) + file(TO_NATIVE_PATH ${GNSSSDR_BINARY_DIR} top_builddir) set(PDFMANUAL_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) if(PDFMANUAL_MAKE_PROGRAM MATCHES "ninja") find_program(PDFMANUAL_MAKE_EXECUTABLE make @@ -2792,39 +2852,39 @@ if(DOXYGEN_FOUND) else() set(GNSSSDR_USE_MATHJAX "NO") endif() - configure_file(${CMAKE_SOURCE_DIR}/docs/doxygen/Doxyfile.in - ${CMAKE_BINARY_DIR}/docs/doxygen/Doxyfile + configure_file(${GNSSSDR_SOURCE_DIR}/docs/doxygen/Doxyfile.in + ${GNSSSDR_BINARY_DIR}/docs/doxygen/Doxyfile @ONLY ) add_custom_target(doc - Doxygen::doxygen ${CMAKE_BINARY_DIR}/docs/doxygen/Doxyfile - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + Doxygen::doxygen ${GNSSSDR_BINARY_DIR}/docs/doxygen/Doxyfile + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR} COMMENT "Generating HTML documentation from source code with Doxygen..." VERBATIM ) if(PDFLATEX_COMPILER) - message(STATUS " '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} pdfmanual' will generate a manual at ${CMAKE_BINARY_DIR}/docs/GNSS-SDR_manual.pdf") + message(STATUS " '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} pdfmanual' will generate a manual at ${GNSSSDR_BINARY_DIR}/docs/GNSS-SDR_manual.pdf") add_custom_target(pdfmanual COMMAND ${PDFMANUAL_MAKE_PROGRAM} - COMMAND ${CMAKE_COMMAND} -E copy refman.pdf ${CMAKE_BINARY_DIR}/docs/GNSS-SDR_manual.pdf + COMMAND ${CMAKE_COMMAND} -E copy refman.pdf ${GNSSSDR_BINARY_DIR}/docs/GNSS-SDR_manual.pdf COMMAND ${PDFMANUAL_MAKE_PROGRAM} clean DEPENDS doc - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/docs/latex + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR}/docs/latex COMMENT "Generating PDF manual with LaTeX and pdflatex..." VERBATIM ) endif() message(STATUS " '${CMAKE_MAKE_PROGRAM_PRETTY_NAME} doc-clean' will clean the documentation.") if(CMAKE_VERSION VERSION_LESS 3.17) add_custom_target(doc-clean - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/docs/html - COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/docs/latex - COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/docs/GNSS-SDR_manual.pdf + COMMAND ${CMAKE_COMMAND} -E remove_directory ${GNSSSDR_BINARY_DIR}/docs/html + COMMAND ${CMAKE_COMMAND} -E remove_directory ${GNSSSDR_BINARY_DIR}/docs/latex + COMMAND ${CMAKE_COMMAND} -E remove ${GNSSSDR_BINARY_DIR}/docs/GNSS-SDR_manual.pdf COMMENT "Cleaning documentation." VERBATIM ) else() add_custom_target(doc-clean - COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_BINARY_DIR}/docs/html - COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_BINARY_DIR}/docs/latex - COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_BINARY_DIR}/docs/GNSS-SDR_manual.pdf + COMMAND ${CMAKE_COMMAND} -E rm -rf ${GNSSSDR_BINARY_DIR}/docs/html + COMMAND ${CMAKE_COMMAND} -E rm -rf ${GNSSSDR_BINARY_DIR}/docs/latex + COMMAND ${CMAKE_COMMAND} -E rm -f ${GNSSSDR_BINARY_DIR}/docs/GNSS-SDR_manual.pdf COMMENT "Cleaning documentation." VERBATIM ) endif() @@ -3315,13 +3375,13 @@ endif() # Create uninstall target ################################################################################ configure_file( - ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in - ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake + ${GNSSSDR_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in + ${GNSSSDR_BINARY_DIR}/cmake_uninstall.cmake @ONLY ) add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake + COMMAND ${CMAKE_COMMAND} -P ${GNSSSDR_BINARY_DIR}/cmake_uninstall.cmake ) @@ -3366,7 +3426,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.") @@ -3396,27 +3456,27 @@ if(CUDA_FOUND) message(STATUS "The CUDA compiler identification is ${CMAKE_CUDA_COMPILER_ID} ${CMAKE_CUDA_COMPILER_VERSION}. Standard: C++${CMAKE_CUDA_STANDARD}.") endif() message(STATUS "") -file(REMOVE ${CMAKE_BINARY_DIR}/features.log) -file(WRITE ${CMAKE_BINARY_DIR}/features.log "**********************************\n") -file(APPEND ${CMAKE_BINARY_DIR}/features.log "* BUILDING CONFIGURATION SUMMARY *\n") -file(APPEND ${CMAKE_BINARY_DIR}/features.log "**********************************\n\n") -file(APPEND ${CMAKE_BINARY_DIR}/features.log "GNSS-SDR version: ${VERSION}\n") +file(REMOVE ${GNSSSDR_BINARY_DIR}/features.log) +file(WRITE ${GNSSSDR_BINARY_DIR}/features.log "**********************************\n") +file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "* BUILDING CONFIGURATION SUMMARY *\n") +file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "**********************************\n\n") +file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "GNSS-SDR version: ${VERSION}\n") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") if(CMAKE_CROSSCOMPILING) - file(APPEND ${CMAKE_BINARY_DIR}/features.log "Cross-compiling on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR} ${ARCHITECTURE_STRING}\n") + file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "Cross-compiling on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR} ${ARCHITECTURE_STRING}\n") else() - file(APPEND ${CMAKE_BINARY_DIR}/features.log "Building on GNU/Linux ${LINUX_DISTRIBUTION} ${LINUX_VER} ${ARCHITECTURE_STRING}\n") + file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "Building on GNU/Linux ${LINUX_DISTRIBUTION} ${LINUX_VER} ${ARCHITECTURE_STRING}\n") endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - file(APPEND ${CMAKE_BINARY_DIR}/features.log "Building on ${MACOS_DISTRIBUTION}\n") + file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "Building on ${MACOS_DISTRIBUTION}\n") endif() -file(APPEND ${CMAKE_BINARY_DIR}/features.log "CMake version: ${CMAKE_VERSION}\n") -file(APPEND ${CMAKE_BINARY_DIR}/features.log "The CXX compiler identification is ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}. Standard: C++${CMAKE_CXX_STANDARD}.\n") -file(APPEND ${CMAKE_BINARY_DIR}/features.log "The C compiler identification is ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}. Standard: C${CMAKE_C_STANDARD}.\n\n") +file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "CMake version: ${CMAKE_VERSION}\n") +file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "The CXX compiler identification is ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}. Standard: C++${CMAKE_CXX_STANDARD}.\n") +file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "The C compiler identification is ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}. Standard: C${CMAKE_C_STANDARD}.\n\n") if(CMAKE_VERSION VERSION_LESS 3.4) feature_summary(WHAT ALL) - feature_summary(FILENAME ${CMAKE_BINARY_DIR}/features.log APPEND WHAT ALL) + feature_summary(FILENAME ${GNSSSDR_BINARY_DIR}/features.log APPEND WHAT ALL) else() feature_summary(WHAT REQUIRED_PACKAGES_FOUND @@ -3426,7 +3486,7 @@ else() ENABLED_FEATURES DISABLED_FEATURES ) - feature_summary(FILENAME ${CMAKE_BINARY_DIR}/features.log APPEND WHAT + feature_summary(FILENAME ${GNSSSDR_BINARY_DIR}/features.log APPEND WHAT REQUIRED_PACKAGES_FOUND REQUIRED_PACKAGES_NOT_FOUND OPTIONAL_PACKAGES_FOUND diff --git a/README.md b/README.md index 23175ee5e..59742d294 100644 --- a/README.md +++ b/README.md @@ -385,9 +385,9 @@ $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/Linux $ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux -$ wget https://sourceforge.net/projects/arma/files/armadillo-11.1.1.tar.xz -$ tar xvfz armadillo-11.1.1.tar.xz -$ cd armadillo-11.1.1 +$ wget https://sourceforge.net/projects/arma/files/armadillo-11.2.1.tar.xz +$ tar xvfz armadillo-11.2.1.tar.xz +$ cd armadillo-11.2.1 $ cmake . $ make $ sudo make install @@ -428,8 +428,8 @@ $ sudo ldconfig #### Download the [Google C++ Testing Framework](https://github.com/google/googletest "Googletest Homepage"), also known as Google Test: ``` -$ wget https://github.com/google/googletest/archive/release-1.12.0.zip -$ unzip release-1.12.0.zip +$ wget https://github.com/google/googletest/archive/release-1.12.1.zip +$ unzip release-1.12.1.zip ``` Please **DO NOT build or install** Google Test. Every user needs to compile @@ -453,10 +453,10 @@ downloaded resides. Just type in your terminal (or add it to your `$HOME/.bashrc` file for a permanent solution) the following line: ``` -export GTEST_DIR=/home/username/googletest-release-1.12.0 +export GTEST_DIR=/home/username/googletest-release-1.12.1 ``` -changing `/home/username/googletest-release-1.12.0` by the actual path where you +changing `/home/username/googletest-release-1.12.1` by the actual path where you unpacked Google Test. If the CMake script does not find that folder, or the environment variable is not defined, or the source code is not installed by a package, then it will download a fresh copy of the Google Test source code and @@ -882,7 +882,7 @@ $ brew update && brew upgrade $ brew install armadillo cmake hdf5 gflags glog gnuradio lapack libmatio log4cpp \ openssl pkg-config protobuf pugixml $ pip3 install mako -$ brew cask install mactex # when completed, restart Terminal +$ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen ``` @@ -969,9 +969,8 @@ compile time if they are not detected in your machine. [https://github.com/carlesfernandez/docker-pybombs-gnsssdr](https://github.com/carlesfernandez/docker-pybombs-gnsssdr) for instructions. -- **Snap package**: [Snaps](https://snapcraft.io) are universal Linux packages - aimed to work on any distribution or device, from IoT devices to servers, - desktops to mobile devices. Visit +- **Snap package**: [Snaps](https://snapcraft.io) are Linux packages aimed for + Ubuntu or Ubuntu-like distros. Visit [https://github.com/carlesfernandez/snapcraft-sandbox](https://github.com/carlesfernandez/snapcraft-sandbox) for instructions, or directly [get the software from the Snap Store](https://snapcraft.io/gnss-sdr-next): @@ -2048,10 +2047,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/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake new file mode 100644 index 000000000..3826f30a0 --- /dev/null +++ b/cmake/Modules/FindGNSSTK.cmake @@ -0,0 +1,147 @@ +# 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() + +unset(GNSSTK_INCLUDE_DIR CACHE) +unset(GNSSTK_USES_GPSTK_NAMESPACE CACHE) +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 ${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) + +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 +) + +if(GNSSTK_LIBRARY AND GNSSTK_INCLUDE_DIR) + set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION}) + unset(PACKAGE_VERSION) + 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 ${GNSSTK_INCLUDE_DIR}/../share/cmake/GNSSTK/GNSSTKConfigVersion.cmake) + include(${GNSSTK_INCLUDE_DIR}/../share/cmake/GNSSTK/GNSSTKConfigVersion.cmake) + endif() + endif() + if(PACKAGE_VERSION) + set(GNSSTK_VERSION ${PACKAGE_VERSION}) + endif() + set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION}) +endif() + +if(GNSSTK_VERSION) + 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(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 +# 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})" + ) +else() + set_package_properties(GNSSTK PROPERTIES + DESCRIPTION "The GNSSTk C++ Library" + ) +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) + 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 + GNSSTK_USES_GPSTK_NAMESPACE + GNSSTK_OLDER_THAN_8 + GNSSTK_OLDER_THAN_9 + GNSSTK_OLDER_THAN_13 +) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 93e6082cd..3df296cc5 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -346,6 +346,8 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99) if(GNURADIO_IIO_LIBRARIES) message(STATUS " * INCLUDES=${GNURADIO_IIO_INCLUDE_DIRS}") message(STATUS " * LIBS=${GNURADIO_IIO_LIBRARIES}") + else() + message(STATUS " * IIO GNU Radio Module not found.") endif() if(GNURADIO_IIO_LIBRARIES AND GNURADIO_IIO_INCLUDE_DIRS) set(GNURADIO_IIO_FOUND TRUE) diff --git a/cmake/Modules/FindGPSTK.cmake b/cmake/Modules/FindGPSTK.cmake deleted file mode 100644 index 5e8dddef7..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/GPSTk" -) - -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/cmake/Modules/FindLIBUNWIND.cmake b/cmake/Modules/FindLIBUNWIND.cmake new file mode 100644 index 000000000..f2c88b569 --- /dev/null +++ b/cmake/Modules/FindLIBUNWIND.cmake @@ -0,0 +1,145 @@ +# 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 the libunwind library +# +# LIBUNWIND_FOUND - True if libunwind was found. +# LIBUNWIND_LIBRARIES - The libraries needed to use libunwind +# LIBUNWIND_INCLUDE_DIR - Location of libunwind.h + +# INPUT (Optional): +# LIBUNWIND_ROOT - path where include + lib of libunwind install is located + +if(NOT COMMAND feature_summary) + include(FeatureSummary) +endif() + +find_path(LIBUNWIND_INCLUDE_DIR + NAMES + libunwind.h + unwind.h + HINTS + /usr + /usr/local + /opt/local + PATH_SUFFIXES include + PATHS "${LIBUNWIND_ROOT}/include" +) + +find_library(LIBUNWIND_GENERIC_LIBRARY + NAMES + libunwind + unwind + HINTS + /usr + /usr/local + /opt/local + PATH_SUFFIXES lib lib64 + PATHS + "${LIBUNWIND_ROOT}/lib" + "${LIBUNWIND_ROOT}/lib64" +) + +if(LIBUNWIND_INCLUDE_DIR) + if(LIBUNWIND_GENERIC_LIBRARY) + set(LIBUNWIND_LIBRARIES ${LIBUNWIND_GENERIC_LIBRARY}) + if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)") + set(LIBUNWIND_ARCH "aarch64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + set(LIBUNWIND_ARCH "arm") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(corei7-64)") + set(LIBUNWIND_ARCH "x86_64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") + set(LIBUNWIND_ARCH "x86") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64") + set(LIBUNWIND_ARCH "ppc64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc") + set(LIBUNWIND_ARCH "ppc32") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + set(LIBUNWIND_ARCH "mips") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^hppa") + set(LIBUNWIND_ARCH "hppa") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ia64") + set(LIBUNWIND_ARCH "ia64") + endif() + if(LIBUNWIND_ARCH) + find_library(LIBUNWIND_SPECIFIC_LIBRARY + NAMES + libunwind-${LIBUNWIND_ARCH} + "unwind-${LIBUNWIND_ARCH}" + HINTS + /usr + /usr/local + /opt/local + PATH_SUFFIXES lib lib64 + PATHS "${LIBUNWIND_ROOT}" + ) + if(NOT LIBUNWIND_SPECIFIC_LIBRARY) + message(STATUS " -- Failed to find unwind-${LIBUNWIND_ARCH}") + else() + set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES} ${LIBUNWIND_SPECIFIC_LIBRARY}) + endif() + endif() + endif() +else() + message(STATUS " -- Could NOT find libunwind.h") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBUNWIND DEFAULT_MSG LIBUNWIND_INCLUDE_DIR) + +if(LIBUNWIND_FOUND) + set(_Unwind_VERSION_HEADER ${LIBUNWIND_INCLUDE_DIR}/libunwind-common.h) + if(EXISTS ${_Unwind_VERSION_HEADER}) + file(READ ${_Unwind_VERSION_HEADER} _Unwind_VERSION_CONTENTS) + string(REGEX REPLACE ".*#define UNW_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" + LIBUNWIND_VERSION_MAJOR "${_Unwind_VERSION_CONTENTS}") + string(REGEX REPLACE ".*#define UNW_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" + LIBUNWIND_VERSION_MINOR "${_Unwind_VERSION_CONTENTS}") + string(REGEX REPLACE ".*#define UNW_VERSION_EXTRA[ \t]+([0-9]+).*" "\\1" + LIBUNWIND_VERSION_PATCH "${_Unwind_VERSION_CONTENTS}") + set(LIBUNWIND_VERSION ${LIBUNWIND_VERSION_MAJOR}.${LIBUNWIND_VERSION_MINOR}) + if(CMAKE_MATCH_0) + # Third version component may be empty + set(LIBUNWIND_VERSION ${LIBUNWIND_VERSION}.${LIBUNWIND_VERSION_PATCH}) + set(LIBUNWIND_VERSION_COMPONENTS 3) + else() + set(LIBUNWIND_VERSION_COMPONENTS 2) + endif() + endif() +endif() + +if(LIBUNWIND_FOUND AND NOT TARGET Libunwind::libunwind) + if(LIBUNWIND_GENERIC_LIBRARY) + add_library(Libunwind::libunwind SHARED IMPORTED) + set_target_properties(Libunwind::libunwind PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${LIBUNWIND_GENERIC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LIBUNWIND_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${LIBUNWIND_LIBRARIES}" + ) + else() + add_library(Libunwind::libunwind INTERFACE IMPORTED) + set_target_properties(Libunwind::libunwind PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBUNWIND_INCLUDE_DIR}" + ) + endif() +endif() + +set_package_properties(LIBUNWIND PROPERTIES + URL "https://www.nongnu.org/libunwind/" +) +if(LIBUNWIND_VERSION) + set_package_properties(LIBUNWIND PROPERTIES + DESCRIPTION "Portable and efficient C programming interface to determine the call-chain of a program (found: v${LIBUNWIND_VERSION})" + ) +else() + set_package_properties(LIBUNWIND PROPERTIES + DESCRIPTION "Portable and efficient C programming interface to determine the call-chain of a program" + ) +endif() + +mark_as_advanced(LIBUNWIND_LIBRARIES LIBUNWIND_INCLUDE_DIR) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index be0d63cb7..a06529e00 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -18,6 +18,8 @@ All notable changes to GNSS-SDR will be documented in this file. - Fixed bug that made the PVT block to not resolve position anymore after a loss of samples event. +- Improved non-coherent acquisition when `Acquisition_XX.blocking=false`. +- Implemented processing of BeiDou PRN 34 up to PRN 63 signals. ### Improvements in Interoperability: @@ -35,6 +37,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` @@ -47,6 +56,10 @@ All notable changes to GNSS-SDR will be documented in this file. - Fixed running time error if the binary is built with the `-Wp,-D_GLIBCXX_ASSERTIONS` compiler option. This is added by default in some GNU/Linux distributions. +- Fixed linking against libunwind when the glog library is built locally. +- The configuration options at building time `-DENABLE_OWN_GLOG`, + `-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON` + and `OFF` without the need to start from an empty buiding folder. ### Improvements in Usability: @@ -60,6 +73,11 @@ All notable changes to GNSS-SDR will be documented in this file. load on the data link and thus allow more bandwidth. - Added gain setting and reading for the XTRX board when using the `Osmosdr_Signal_Source` implementation of a `SignalSource`. +- The `Osmosdr_Signal_Source` implementation learned a new parameter `if_bw` to + manually set the bandwidth of the bandpass filter on the radio frontend. +- The new configuration parameter `Channels_XX.RF_channel_ID` allows to specify + the signal source per channel group. +- Allowed the CMake project to be a sub-project. See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ @@ -90,7 +108,7 @@ https://gnss-sdr.org/design-forces/ - Added a script at `src/utils/scripts/download-galileo-almanac.sh` that downloads an XML file with the latest Galileo almanac published by the - European GNSS Service Centre at https://www.gsc-europa.eu/product-almanacs + European GNSS Service Centre at https://www.gsc-europa.eu/gsc-products/almanac See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ @@ -991,7 +1009,8 @@ features and bug fixes: - Improvements in the RTCM server stability. - Improvements in the correctness of generated RINEX files. - The receiver can read and make use of Galileo almanac XML files published by - the European GNSS Service Centre at https://www.gsc-europa.eu/product-almanacs + the European GNSS Service Centre at + https://www.gsc-europa.eu/gsc-products/almanac - Own-defined XML schemas for navigation data published at https://github.com/gnss-sdr/gnss-sdr/tree/next/docs/xml-schemas - Added program `rinex2assist` to convert RINEX navigation files into XML files 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 diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 57ab83031..3cf70fe95 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -29,7 +29,7 @@ target_link_libraries(pvt_adapters target_include_directories(pvt_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(USE_OLD_BOOST_MATH_COMMON_FACTOR) diff --git a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt index e59a38c7e..3cfae32f6 100644 --- a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt @@ -40,7 +40,7 @@ endif() target_include_directories(pvt_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(USE_GENERIC_LAMBDAS) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index dca10600a..a12949e0f 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -142,6 +142,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_rinex_version(conf_.rinex_version), d_rx_time(0.0), d_local_counter_ms(0ULL), + d_timestamp_rx_clock_offset_correction_msg_ms(0LL), d_rinexobs_rate_ms(conf_.rinexobs_rate_ms), d_kml_rate_ms(conf_.kml_rate_ms), d_gpx_rate_ms(conf_.gpx_rate_ms), @@ -155,6 +156,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_nchannels(nchannels), d_type_of_rx(conf_.type_of_receiver), d_observable_interval_ms(conf_.observable_interval_ms), + d_pvt_errors_counter(0), d_dump(conf_.dump), d_dump_mat(conf_.dump_mat && conf_.dump), d_rinex_output_enabled(conf_.rinex_output_enabled), @@ -166,13 +168,10 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_flag_monitor_pvt_enabled(conf_.monitor_enabled), d_flag_monitor_ephemeris_enabled(conf_.monitor_ephemeris_enabled), d_show_local_time_zone(conf_.show_local_time_zone), - d_timestamp_rx_clock_offset_correction_msg_ms(0LL), d_enable_rx_clock_correction(conf_.enable_rx_clock_correction), d_an_printer_enabled(conf_.an_output_enabled), d_log_timetag(conf_.log_source_timetag) { - // debug - d_pvt_errors_counter = 0; // Send feedback message to observables block with the receiver clock offset this->message_port_register_out(pmt::mp("pvt_to_observables")); // Experimental: VLT commands from PVT to tracking channels diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index c9a627e72..61a00eb3d 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -243,6 +243,7 @@ private: double d_rinex_version; double d_rx_time; uint64_t d_local_counter_ms; + uint64_t d_timestamp_rx_clock_offset_correction_msg_ms; key_t d_sysv_msg_key; int d_sysv_msqid; @@ -268,6 +269,7 @@ private: uint32_t d_nchannels; uint32_t d_type_of_rx; uint32_t d_observable_interval_ms; + uint32_t d_pvt_errors_counter; bool d_dump; bool d_dump_mat; @@ -282,8 +284,6 @@ private: bool d_flag_monitor_pvt_enabled; bool d_flag_monitor_ephemeris_enabled; bool d_show_local_time_zone; - uint64_t d_timestamp_rx_clock_offset_correction_msg_ms; - uint32_t d_pvt_errors_counter; bool d_enable_rx_clock_correction; bool d_enable_has_messages; bool d_an_printer_enabled; diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 9af6b61c2..8e2785144 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -4,9 +4,9 @@ # SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/docs/protobuf/monitor_pvt.proto) -protobuf_generate_cpp(PROTO_SRCS2 PROTO_HDRS2 ${CMAKE_SOURCE_DIR}/docs/protobuf/gps_ephemeris.proto) -protobuf_generate_cpp(PROTO_SRCS3 PROTO_HDRS3 ${CMAKE_SOURCE_DIR}/docs/protobuf/galileo_ephemeris.proto) +protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${GNSSSDR_SOURCE_DIR}/docs/protobuf/monitor_pvt.proto) +protobuf_generate_cpp(PROTO_SRCS2 PROTO_HDRS2 ${GNSSSDR_SOURCE_DIR}/docs/protobuf/gps_ephemeris.proto) +protobuf_generate_cpp(PROTO_SRCS3 PROTO_HDRS3 ${GNSSSDR_SOURCE_DIR}/docs/protobuf/galileo_ephemeris.proto) set(PVT_LIB_SOURCES an_packet_printer.cc @@ -98,7 +98,7 @@ get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY) # for concurrent_queue.h target_include_directories(pvt_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/receiver + ${GNSSSDR_SOURCE_DIR}/src/core/receiver ) # Do not apply clang-tidy fixes to protobuf generated headers diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index e0e68a780..ef0c0dd77 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -1015,7 +1015,7 @@ private: }; -// Implementation of inline functions (modified versions from GPSTk https://github.com/SGL-UT/GPSTk) +// Implementation of inline functions (modified versions from GNSSTk https://github.com/SGL-UT/gnsstk) inline std::string& Rinex_Printer::leftJustify(std::string& s, std::string::size_type length, diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index bbd0abeb1..6023f19ee 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -32,7 +32,6 @@ #include // for std::fmod, std::lround #include // for strtol #include // for std::cout -#include // for std::stringstream Rtcm::Rtcm(uint16_t port) : RTCM_port(port), server_is_running(false) diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 91b7ac275..2fe68299c 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -30,17 +30,18 @@ #include #include #include -#include // for min +#include // for std::max, std::min, std::copy_n #include #include #include // for size_t #include -#include // for memcpy #include +#include // for std::setw #include #include #include #include +#include // for std::stringstream #include #include #include @@ -612,8 +613,10 @@ private: inline void encode_header() { char header[header_length + 1] = ""; - std::snprintf(header, header_length + 1, "GS%4d", std::max(std::min(static_cast(body_length_), static_cast(max_body_length)), 0)); - std::memcpy(data_.data(), header, header_length); + std::stringstream ss; + ss << "GS" << std::setw(4) << std::max(std::min(static_cast(body_length_), static_cast(max_body_length)), 0); + std::copy_n(ss.str().c_str(), header_length + 1, header); + std::copy_n(header, header_length, data_.data()); } private: @@ -895,7 +898,7 @@ private: const char* char_msg = message.c_str(); msg.body_length(message.length()); - std::memcpy(msg.body(), char_msg, msg.body_length()); + std::copy_n(char_msg, msg.body_length(), msg.body()); msg.encode_header(); c->write(msg); } diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 597ee0c5c..085cefe50 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -463,7 +463,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ std::map::const_iterator glonass_gnav_ephemeris_iter; std::map::const_iterator beidou_ephemeris_iter; - const Glonass_Gnav_Utc_Model gnav_utc = this->glonass_gnav_utc_model; + const Glonass_Gnav_Utc_Model &gnav_utc = this->glonass_gnav_utc_model; this->set_averaging_flag(flag_averaging); @@ -941,89 +941,89 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ if ((valid_obs + glo_valid_obs) > 3) { int result = 0; - nav_t nav_data{}; - nav_data.eph = eph_data.data(); - nav_data.geph = geph_data.data(); - nav_data.n = valid_obs; - nav_data.ng = glo_valid_obs; + d_nav_data = {}; + d_nav_data.eph = eph_data.data(); + d_nav_data.geph = geph_data.data(); + d_nav_data.n = valid_obs; + d_nav_data.ng = glo_valid_obs; if (gps_iono.valid) { - nav_data.ion_gps[0] = gps_iono.alpha0; - nav_data.ion_gps[1] = gps_iono.alpha1; - nav_data.ion_gps[2] = gps_iono.alpha2; - nav_data.ion_gps[3] = gps_iono.alpha3; - nav_data.ion_gps[4] = gps_iono.beta0; - nav_data.ion_gps[5] = gps_iono.beta1; - nav_data.ion_gps[6] = gps_iono.beta2; - nav_data.ion_gps[7] = gps_iono.beta3; + d_nav_data.ion_gps[0] = gps_iono.alpha0; + d_nav_data.ion_gps[1] = gps_iono.alpha1; + d_nav_data.ion_gps[2] = gps_iono.alpha2; + d_nav_data.ion_gps[3] = gps_iono.alpha3; + d_nav_data.ion_gps[4] = gps_iono.beta0; + d_nav_data.ion_gps[5] = gps_iono.beta1; + d_nav_data.ion_gps[6] = gps_iono.beta2; + d_nav_data.ion_gps[7] = gps_iono.beta3; } if (!(gps_iono.valid) and gps_cnav_iono.valid) { - nav_data.ion_gps[0] = gps_cnav_iono.alpha0; - nav_data.ion_gps[1] = gps_cnav_iono.alpha1; - nav_data.ion_gps[2] = gps_cnav_iono.alpha2; - nav_data.ion_gps[3] = gps_cnav_iono.alpha3; - nav_data.ion_gps[4] = gps_cnav_iono.beta0; - nav_data.ion_gps[5] = gps_cnav_iono.beta1; - nav_data.ion_gps[6] = gps_cnav_iono.beta2; - nav_data.ion_gps[7] = gps_cnav_iono.beta3; + d_nav_data.ion_gps[0] = gps_cnav_iono.alpha0; + d_nav_data.ion_gps[1] = gps_cnav_iono.alpha1; + d_nav_data.ion_gps[2] = gps_cnav_iono.alpha2; + d_nav_data.ion_gps[3] = gps_cnav_iono.alpha3; + d_nav_data.ion_gps[4] = gps_cnav_iono.beta0; + d_nav_data.ion_gps[5] = gps_cnav_iono.beta1; + d_nav_data.ion_gps[6] = gps_cnav_iono.beta2; + d_nav_data.ion_gps[7] = gps_cnav_iono.beta3; } if (galileo_iono.ai0 != 0.0) { - nav_data.ion_gal[0] = galileo_iono.ai0; - nav_data.ion_gal[1] = galileo_iono.ai1; - nav_data.ion_gal[2] = galileo_iono.ai2; - nav_data.ion_gal[3] = 0.0; + d_nav_data.ion_gal[0] = galileo_iono.ai0; + d_nav_data.ion_gal[1] = galileo_iono.ai1; + d_nav_data.ion_gal[2] = galileo_iono.ai2; + d_nav_data.ion_gal[3] = 0.0; } if (beidou_dnav_iono.valid) { - nav_data.ion_cmp[0] = beidou_dnav_iono.alpha0; - nav_data.ion_cmp[1] = beidou_dnav_iono.alpha1; - nav_data.ion_cmp[2] = beidou_dnav_iono.alpha2; - nav_data.ion_cmp[3] = beidou_dnav_iono.alpha3; - nav_data.ion_cmp[4] = beidou_dnav_iono.beta0; - nav_data.ion_cmp[5] = beidou_dnav_iono.beta0; - nav_data.ion_cmp[6] = beidou_dnav_iono.beta0; - nav_data.ion_cmp[7] = beidou_dnav_iono.beta3; + d_nav_data.ion_cmp[0] = beidou_dnav_iono.alpha0; + d_nav_data.ion_cmp[1] = beidou_dnav_iono.alpha1; + d_nav_data.ion_cmp[2] = beidou_dnav_iono.alpha2; + d_nav_data.ion_cmp[3] = beidou_dnav_iono.alpha3; + d_nav_data.ion_cmp[4] = beidou_dnav_iono.beta0; + d_nav_data.ion_cmp[5] = beidou_dnav_iono.beta0; + d_nav_data.ion_cmp[6] = beidou_dnav_iono.beta0; + d_nav_data.ion_cmp[7] = beidou_dnav_iono.beta3; } if (gps_utc_model.valid) { - nav_data.utc_gps[0] = gps_utc_model.A0; - nav_data.utc_gps[1] = gps_utc_model.A1; - nav_data.utc_gps[2] = gps_utc_model.tot; - nav_data.utc_gps[3] = gps_utc_model.WN_T; - nav_data.leaps = gps_utc_model.DeltaT_LS; + d_nav_data.utc_gps[0] = gps_utc_model.A0; + d_nav_data.utc_gps[1] = gps_utc_model.A1; + d_nav_data.utc_gps[2] = gps_utc_model.tot; + d_nav_data.utc_gps[3] = gps_utc_model.WN_T; + d_nav_data.leaps = gps_utc_model.DeltaT_LS; } if (!(gps_utc_model.valid) and gps_cnav_utc_model.valid) { - nav_data.utc_gps[0] = gps_cnav_utc_model.A0; - nav_data.utc_gps[1] = gps_cnav_utc_model.A1; - nav_data.utc_gps[2] = gps_cnav_utc_model.tot; - nav_data.utc_gps[3] = gps_cnav_utc_model.WN_T; - nav_data.leaps = gps_cnav_utc_model.DeltaT_LS; + d_nav_data.utc_gps[0] = gps_cnav_utc_model.A0; + d_nav_data.utc_gps[1] = gps_cnav_utc_model.A1; + d_nav_data.utc_gps[2] = gps_cnav_utc_model.tot; + d_nav_data.utc_gps[3] = gps_cnav_utc_model.WN_T; + d_nav_data.leaps = gps_cnav_utc_model.DeltaT_LS; } if (glonass_gnav_utc_model.valid) { - nav_data.utc_glo[0] = glonass_gnav_utc_model.d_tau_c; // ?? - nav_data.utc_glo[1] = 0.0; // ?? - nav_data.utc_glo[2] = 0.0; // ?? - nav_data.utc_glo[3] = 0.0; // ?? + d_nav_data.utc_glo[0] = glonass_gnav_utc_model.d_tau_c; // ?? + d_nav_data.utc_glo[1] = 0.0; // ?? + d_nav_data.utc_glo[2] = 0.0; // ?? + d_nav_data.utc_glo[3] = 0.0; // ?? } if (galileo_utc_model.A0 != 0.0) { - nav_data.utc_gal[0] = galileo_utc_model.A0; - nav_data.utc_gal[1] = galileo_utc_model.A1; - nav_data.utc_gal[2] = galileo_utc_model.tot; - nav_data.utc_gal[3] = galileo_utc_model.WNot; - nav_data.leaps = galileo_utc_model.Delta_tLS; + d_nav_data.utc_gal[0] = galileo_utc_model.A0; + d_nav_data.utc_gal[1] = galileo_utc_model.A1; + d_nav_data.utc_gal[2] = galileo_utc_model.tot; + d_nav_data.utc_gal[3] = galileo_utc_model.WNot; + d_nav_data.leaps = galileo_utc_model.Delta_tLS; } if (beidou_dnav_utc_model.valid) { - nav_data.utc_cmp[0] = beidou_dnav_utc_model.A0_UTC; - nav_data.utc_cmp[1] = beidou_dnav_utc_model.A1_UTC; - nav_data.utc_cmp[2] = 0.0; // ?? - nav_data.utc_cmp[3] = 0.0; // ?? - nav_data.leaps = beidou_dnav_utc_model.DeltaT_LS; + d_nav_data.utc_cmp[0] = beidou_dnav_utc_model.A0_UTC; + d_nav_data.utc_cmp[1] = beidou_dnav_utc_model.A1_UTC; + d_nav_data.utc_cmp[2] = 0.0; // ?? + d_nav_data.utc_cmp[3] = 0.0; // ?? + d_nav_data.leaps = beidou_dnav_utc_model.DeltaT_LS; } /* update carrier wave length using native function call in RTKlib */ @@ -1031,11 +1031,11 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ { for (int j = 0; j < NFREQ; j++) { - nav_data.lam[i][j] = satwavelen(i + 1, d_rtklib_freq_index[j], &nav_data); + d_nav_data.lam[i][j] = satwavelen(i + 1, d_rtklib_freq_index[j], &d_nav_data); } } - result = rtkpos(&d_rtk, d_obs_data.data(), valid_obs + glo_valid_obs, &nav_data); + result = rtkpos(&d_rtk, d_obs_data.data(), valid_obs + glo_valid_obs, &d_nav_data); if (result == 0) { @@ -1136,7 +1136,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ // TOW d_monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms; // WEEK - d_monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009()); + d_monitor_pvt.week = adjgpsweek(d_nav_data.eph[0].week, this->is_pre_2009()); // PVT GPS time d_monitor_pvt.RX_time = gnss_observables_map.cbegin()->second.RX_time; // User clock offset [s] @@ -1202,7 +1202,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ tmp_uint32 = gnss_observables_map.cbegin()->second.TOW_at_current_symbol_ms; d_dump_file.write(reinterpret_cast(&tmp_uint32), sizeof(uint32_t)); // WEEK - tmp_uint32 = adjgpsweek(nav_data.eph[0].week, this->is_pre_2009()); + tmp_uint32 = adjgpsweek(d_nav_data.eph[0].week, this->is_pre_2009()); d_dump_file.write(reinterpret_cast(&tmp_uint32), sizeof(uint32_t)); // PVT GPS time tmp_double = gnss_observables_map.cbegin()->second.RX_time; diff --git a/src/algorithms/PVT/libs/rtklib_solver.h b/src/algorithms/PVT/libs/rtklib_solver.h index 697e46687..2e7fc8010 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.h +++ b/src/algorithms/PVT/libs/rtklib_solver.h @@ -128,6 +128,7 @@ private: std::string d_dump_filename; std::ofstream d_dump_file; rtk_t d_rtk{}; + nav_t d_nav_data{}; Monitor_Pvt d_monitor_pvt{}; uint32_t d_type_of_rx; bool d_flag_dump_enabled; diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 010027d8d..41cfe8a8a 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause @@ -123,14 +123,13 @@ if(ENABLE_FPGA) target_link_libraries(acquisition_adapters PRIVATE algorithms_libs - core_libs Volk::volk ) endif() target_include_directories(acquisition_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 9e3deb0fe..629179924 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -21,7 +21,6 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include "uio_fpga.h" #include #include // for fft_complex #include // for gr_complex @@ -43,56 +42,21 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_fpga_t acq_parameters; - - std::string default_dump_filename = "./data/acquisition.dat"; + acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); DLOG(INFO) << "role " << role; - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 4000000); - int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - - acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false); - DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; - - uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 4); - acq_parameters.downsampling_factor = downsampling_factor; - - fs_in = fs_in / downsampling_factor; - - acq_parameters.fs_in = fs_in; - - doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { - doppler_max_ = FLAGS_doppler_max; + acq_parameters_.doppler_max = FLAGS_doppler_max; } - acq_parameters.doppler_max = doppler_max_; - + doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; acquire_pilot_ = configuration->property(role + ".acquire_pilot", false); // could be true in future versions - // Find number of samples per spreading code (4 ms) - auto code_length = static_cast(std::round(static_cast(fs_in) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); - acq_parameters.code_length = code_length; - - // The FPGA can only use FFT lengths that are a power of two. - float nbits = ceilf(log2f(static_cast(code_length) * 2.0F)); - uint32_t nsamples_total = pow(2, nbits); - uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0); - acq_parameters.select_queue_Fpga = select_queue_Fpga; - - // UIO device file - std::string device_io_name; - // find the uio device file corresponding to the acquisition - if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) - { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl; - throw std::exception(); - } - acq_parameters.device_name = device_io_name; - - acq_parameters.samples_per_code = nsamples_total; - acq_parameters.excludelimit = static_cast(1 + ceil((1.0 / GALILEO_E1_CODE_CHIP_RATE_CPS) * static_cast(fs_in))); + uint32_t code_length = acq_parameters_.code_length; + uint32_t nsamples_total = acq_parameters_.samples_per_code; // compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -116,13 +80,13 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // set local signal generator to Galileo E1 pilot component (1C) std::array pilot_signal = {{'1', 'C', '\0'}}; galileo_e1_code_gen_complex_sampled(code, pilot_signal, - cboc, PRN, fs_in, 0, false); + cboc, PRN, fs_in_, 0, false); } else { std::array data_signal = {{'1', 'B', '\0'}}; galileo_e1_code_gen_complex_sampled(code, data_signal, - cboc, PRN, fs_in, 0, false); + cboc, PRN, fs_in_, 0, false); } for (uint32_t s = code_length; s < 2 * code_length; s++) @@ -165,16 +129,9 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( } } - acq_parameters.all_fft_codes = d_all_fft_codes_.data(); + acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast(125.0)); - acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false); - acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2); - // reference for the FPGA FFT-IFFT attenuation factor - acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13); - - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); + acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index 95283fae5..e28fdd087 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -18,7 +18,7 @@ #ifndef GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H -#include "acq_conf.h" +#include "acq_conf_fpga.h" #include "channel_fsm.h" #include "gnss_synchro.h" #include "pcps_acquisition_fpga.h" @@ -181,7 +181,9 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; private: - const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name + static const uint32_t fpga_downsampling_factor = 4; // downampling factor in the FPGA + static const uint32_t fpga_buff_num = 0; // L1/E1 band + static const uint32_t fpga_blk_exp = 13; // default block exponent // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. @@ -195,8 +197,10 @@ private: volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts std::weak_ptr channel_fsm_; Gnss_Synchro* gnss_synchro_; - std::string dump_filename_; + const ConfigurationInterface* configuration_; + Acq_Conf_Fpga acq_parameters_; std::string role_; + int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 8f68bc73c..444a56d7f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -21,7 +21,6 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include "uio_fpga.h" #include #include // for gr_complex #include // for volk_32fc_conjugate_32fc @@ -42,29 +41,17 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_fpga_t acq_parameters; - const std::string default_dump_filename("../data/acquisition.dat"); + acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); DLOG(INFO) << "Role " << role; - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 32000000); - int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - - acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false); - DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; - - uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1); - acq_parameters.downsampling_factor = downsampling_factor; - fs_in = fs_in / downsampling_factor; - - acq_parameters.fs_in = fs_in; - - doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { - doppler_max_ = FLAGS_doppler_max; + acq_parameters_.doppler_max = FLAGS_doppler_max; } - acq_parameters.doppler_max = doppler_max_; + doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; acq_pilot_ = configuration->property(role + ".acquire_pilot", false); acq_iq_ = configuration->property(role + ".acquire_iq", false); @@ -73,27 +60,8 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( acq_pilot_ = false; } - auto code_length = static_cast(std::round(static_cast(fs_in) / GALILEO_E5A_CODE_CHIP_RATE_CPS * static_cast(GALILEO_E5A_CODE_LENGTH_CHIPS))); - acq_parameters.code_length = code_length; - - // The FPGA can only use FFT lengths that are a power of two. - float nbits = ceilf(log2f(static_cast(code_length) * 2.0F)); - uint32_t nsamples_total = pow(2, nbits); - uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1); - acq_parameters.select_queue_Fpga = select_queue_Fpga; - - // UIO device file - std::string device_io_name; - // find the uio device file corresponding to the acquisition - if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) - { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl; - throw std::exception(); - } - acq_parameters.device_name = device_io_name; - - acq_parameters.samples_per_code = nsamples_total; - acq_parameters.excludelimit = static_cast(1 + ceil((1.0 / GALILEO_E5A_CODE_CHIP_RATE_CPS) * static_cast(fs_in))); + uint32_t code_length = acq_parameters_.code_length; + uint32_t nsamples_total = acq_parameters_.samples_per_code; // compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -127,7 +95,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( signal_[1] = 'I'; } - galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, fs_in, 0); + galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0); for (uint32_t s = code_length; s < 2 * code_length; s++) { @@ -168,16 +136,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( } } - acq_parameters.all_fft_codes = d_all_fft_codes_.data(); + acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - // reference for the FPGA FFT-IFFT attenuation factor - acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13); - - acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast(125.0)); - acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false); - acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2); - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); + acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) { diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index 11321bf68..9968ccd72 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -18,7 +18,7 @@ #ifndef GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H #define GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H - +#include "acq_conf_fpga.h" #include "channel_fsm.h" #include "gnss_synchro.h" #include "pcps_acquisition_fpga.h" @@ -188,7 +188,9 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; private: - const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name + static const uint32_t fpga_downsampling_factor = 1; // downampling factor in the FPGA + static const uint32_t fpga_buff_num = 1; // L5/E5a band + static const uint32_t fpga_blk_exp = 13; // default block exponent // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. @@ -202,9 +204,10 @@ private: std::weak_ptr channel_fsm_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts Gnss_Synchro* gnss_synchro_; + const ConfigurationInterface* configuration_; + Acq_Conf_Fpga acq_parameters_; std::string role_; - std::string item_type_; - std::string dump_filename_; + int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index 39ecea729..be2e26680 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -10,7 +10,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -22,7 +22,6 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include "uio_fpga.h" #include #include // for gr_complex #include // for volk_32fc_conjugate_32fc @@ -41,29 +40,15 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_fpga_t acq_parameters; - std::string default_dump_filename = "../data/acquisition.dat"; + acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); - DLOG(INFO) << "Role " << role; - - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 32000000); - int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - - acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false); - DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; - - uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1); - acq_parameters.downsampling_factor = downsampling_factor; - fs_in = fs_in / downsampling_factor; - - acq_parameters.fs_in = fs_in; - - doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { - doppler_max_ = FLAGS_doppler_max; + acq_parameters_.doppler_max = FLAGS_doppler_max; } - acq_parameters.doppler_max = doppler_max_; + doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; acq_pilot_ = configuration->property(role + ".acquire_pilot", false); acq_iq_ = configuration->property(role + ".acquire_iq", false); @@ -72,27 +57,8 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration acq_pilot_ = false; } - auto code_length = static_cast(std::round(static_cast(fs_in) / GALILEO_E5B_CODE_CHIP_RATE_CPS * static_cast(GALILEO_E5B_CODE_LENGTH_CHIPS))); - acq_parameters.code_length = code_length; - - // The FPGA can only use FFT lengths that are a power of two. - float nbits = ceilf(log2f(static_cast(code_length) * 2.0F)); - uint32_t nsamples_total = pow(2, nbits); - uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1); - acq_parameters.select_queue_Fpga = select_queue_Fpga; - - // UIO device file - std::string device_io_name; - // find the uio device file corresponding to the acquisition - if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) - { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl; - throw std::exception(); - } - acq_parameters.device_name = device_io_name; - - acq_parameters.samples_per_code = nsamples_total; - acq_parameters.excludelimit = static_cast(1 + ceil((1.0 / GALILEO_E5B_CODE_CHIP_RATE_CPS) * static_cast(fs_in))); + uint32_t code_length = acq_parameters_.code_length; + uint32_t nsamples_total = acq_parameters_.samples_per_code; // compute all the GALILEO E5b PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -126,7 +92,7 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration signal_[1] = 'I'; } - galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, fs_in, 0); + galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0); for (uint32_t s = code_length; s < 2 * code_length; s++) { @@ -167,16 +133,9 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration } } - acq_parameters.all_fft_codes = d_all_fft_codes_.data(); + acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - // reference for the FPGA FFT-IFFT attenuation factor - acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13); - - acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast(125.0)); - acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false); - acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2); - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); + acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) { diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h index 6563bb0aa..6e7403906 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h @@ -10,7 +10,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -19,7 +19,7 @@ #ifndef GNSS_SDR_GALILEO_E5B_PCPS_ACQUISITION_FPGA_H #define GNSS_SDR_GALILEO_E5B_PCPS_ACQUISITION_FPGA_H - +#include "acq_conf_fpga.h" #include "channel_fsm.h" #include "gnss_synchro.h" #include "pcps_acquisition_fpga.h" @@ -187,7 +187,9 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; private: - const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name + static const uint32_t fpga_downsampling_factor = 1; // downampling factor in the FPGA + static const uint32_t fpga_buff_num = 1; // E5b band + static const uint32_t fpga_blk_exp = 13; // default block exponent // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. @@ -202,10 +204,10 @@ private: std::weak_ptr channel_fsm_; Gnss_Synchro* gnss_synchro_; - - std::string item_type_; - std::string dump_filename_; + const ConfigurationInterface* configuration_; + Acq_Conf_Fpga acq_parameters_; std::string role_; + int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 617329230..5b01d13f4 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -12,7 +12,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -24,7 +24,6 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include "uio_fpga.h" #include #include // for gr_complex #include // for volk_32fc_conjugate_32fc @@ -44,47 +43,20 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_fpga_t acq_parameters; + acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_CODE_LENGTH_CHIPS); DLOG(INFO) << "role " << role; - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - - acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false); - DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; - - uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 4); - acq_parameters.downsampling_factor = downsampling_factor; - fs_in = fs_in / downsampling_factor; - - acq_parameters.fs_in = fs_in; - doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { - doppler_max_ = FLAGS_doppler_max; + acq_parameters_.doppler_max = FLAGS_doppler_max; } - acq_parameters.doppler_max = doppler_max_; - auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); - acq_parameters.code_length = code_length; - // The FPGA can only use FFT lengths that are a power of two. - float nbits = ceilf(log2f(static_cast(code_length) * 2.0F)); - uint32_t nsamples_total = pow(2, nbits); - uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0); - acq_parameters.select_queue_Fpga = select_queue_Fpga; + doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; - // UIO device file - std::string device_io_name; - // find the uio device file corresponding to the acquisition - if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) - { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl; - throw std::exception(); - } - acq_parameters.device_name = device_io_name; - - acq_parameters.samples_per_code = nsamples_total; - acq_parameters.excludelimit = static_cast(1 + ceil(GPS_L1_CA_CHIP_PERIOD_S * static_cast(fs_in))); + uint32_t code_length = acq_parameters_.code_length; + uint32_t nsamples_total = acq_parameters_.samples_per_code; // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -101,7 +73,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // temporary maxima search for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code + gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in_, 0); // generate PRN code for (uint32_t s = code_length; s < 2 * code_length; s++) { @@ -143,16 +115,9 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( } // acq_parameters - acq_parameters.all_fft_codes = d_all_fft_codes_.data(); + acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - // reference for the FPGA FFT-IFFT attenuation factor - acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 10); - - acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast(125.0)); - acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false); - acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2); - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); + acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) { diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index a69c8839f..5cb8728d6 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -12,7 +12,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -21,7 +21,7 @@ #ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H #define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H - +#include "acq_conf_fpga.h" #include "channel_fsm.h" #include "gnss_synchro.h" #include "pcps_acquisition_fpga.h" @@ -129,6 +129,8 @@ public: /*! * \brief Set statistics threshold of PCPS algorithm */ + std::string item_type_; + void set_threshold(float threshold) override; /*! @@ -184,7 +186,9 @@ public: private: static const uint32_t NUM_PRNs = 32; - const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name + static const uint32_t fpga_downsampling_factor = 4; // downampling factor in the FPGA + static const uint32_t fpga_buff_num = 0; // L1/E1 band + static const uint32_t fpga_blk_exp = 10; // default block exponent // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. @@ -198,7 +202,10 @@ private: std::weak_ptr channel_fsm_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts Gnss_Synchro* gnss_synchro_; + const ConfigurationInterface* configuration_; + Acq_Conf_Fpga acq_parameters_; std::string role_; + int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 593fb3785..771607f88 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -11,7 +11,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -24,7 +24,6 @@ #include "gnss_sdr_flags.h" #include "gnss_synchro.h" #include "gps_l2c_signal_replica.h" -#include "uio_fpga.h" #include #include // for gr_complex #include // for volk_32fc_conjugate_32fc @@ -45,47 +44,20 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_fpga_t acq_parameters; - std::string default_dump_filename = "./acquisition.mat"; + acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GPS_L2_M_CODE_RATE_CPS, GPS_L2_M_CODE_LENGTH_CHIPS); LOG(INFO) << "role " << role; - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - acq_parameters.fs_in = fs_in_; - - acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false); - DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; - - doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { - doppler_max_ = FLAGS_doppler_max; + acq_parameters_.doppler_max = FLAGS_doppler_max; } - acq_parameters.doppler_max = doppler_max_; + doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; - auto code_length = static_cast(std::round(static_cast(fs_in_) / (GPS_L2_M_CODE_RATE_CPS / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS)))); - acq_parameters.code_length = code_length; - // The FPGA can only use FFT lengths that are a power of two. - float nbits = ceilf(log2f(static_cast(code_length))); - unsigned int nsamples_total = pow(2, nbits); - unsigned int select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 0); - acq_parameters.select_queue_Fpga = select_queue_Fpga; - - // UIO device file - std::string device_io_name; - // find the uio device file corresponding to the acquisition - if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) - { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl; - throw std::exception(); - } - acq_parameters.device_name = device_io_name; - - acq_parameters.samples_per_code = nsamples_total; - acq_parameters.downsampling_factor = configuration->property(role + ".downsampling_factor", 1.0); - acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 14); - acq_parameters.excludelimit = static_cast(std::round(static_cast(fs_in_) / GPS_L2_M_CODE_RATE_CPS)); + uint32_t code_length = acq_parameters_.code_length; + uint32_t nsamples_total = acq_parameters_.samples_per_code; // compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -139,15 +111,9 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( } } - acq_parameters.all_fft_codes = d_all_fft_codes_.data(); + acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); - - channel_ = 0; - doppler_step_ = 0; - gnss_synchro_ = nullptr; - - threshold_ = 0.0; + acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) { diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 916cd3ea4..7fb6bbc9f 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -11,7 +11,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -20,6 +20,7 @@ #ifndef GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H #define GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H +#include "acq_conf_fpga.h" #include "channel_fsm.h" #include "pcps_acquisition_fpga.h" #include // for basic_block_sptr, top_block_sptr @@ -148,7 +149,9 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; private: - const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name + static const uint32_t fpga_downsampling_factor = 4; // downampling factor in the FPGA + static const uint32_t fpga_buff_num = 0; // L2 band + static const uint32_t fpga_blk_exp = 13; // default block exponent static const uint32_t NUM_PRNs = 32; static const uint32_t QUANT_BITS_LOCAL_CODE = 16; @@ -161,8 +164,8 @@ private: volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts std::weak_ptr channel_fsm_; Gnss_Synchro* gnss_synchro_; - std::string item_type_; - std::string dump_filename_; + const ConfigurationInterface* configuration_; + Acq_Conf_Fpga acq_parameters_; std::string role_; int64_t fs_in_; float threshold_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 682e7b1e4..269672f65 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -12,7 +12,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -24,7 +24,6 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_l5_signal_replica.h" -#include "uio_fpga.h" #include #include // for gr_complex #include // for volk_32fc_conjugate_32fc @@ -45,51 +44,20 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_fpga_t acq_parameters; - std::string default_dump_filename = "./data/acquisition.dat"; + acq_parameters_.SetFromConfiguration(configuration, role, fpga_downsampling_factor, fpga_buff_num, fpga_blk_exp, GPS_L5I_CODE_RATE_CPS, GPS_L5I_CODE_LENGTH_CHIPS); LOG(INFO) << "role " << role; - int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - int64_t fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - - acq_parameters.repeat_satellite = configuration->property(role + ".repeat_satellite", false); - DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; - - uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", 1); - acq_parameters.downsampling_factor = downsampling_factor; - - fs_in = fs_in / downsampling_factor; - - acq_parameters.fs_in = fs_in; - doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) { - doppler_max_ = FLAGS_doppler_max; + acq_parameters_.doppler_max = FLAGS_doppler_max; } - acq_parameters.doppler_max = doppler_max_; + doppler_max_ = acq_parameters_.doppler_max; + doppler_step_ = static_cast(acq_parameters_.doppler_step); + fs_in_ = acq_parameters_.fs_in; - // -- Find number of samples per spreading code ------------------------- - auto code_length = static_cast(std::round(static_cast(fs_in) / (GPS_L5I_CODE_RATE_CPS / static_cast(GPS_L5I_CODE_LENGTH_CHIPS)))); - acq_parameters.code_length = code_length; - // The FPGA can only use FFT lengths that are a power of two. - float nbits = ceilf(log2f(static_cast(code_length) * 2.0F)); - uint32_t nsamples_total = pow(2, nbits); - uint32_t select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", 1); - acq_parameters.select_queue_Fpga = select_queue_Fpga; - - // UIO device file - std::string device_io_name; - // find the uio device file corresponding to the acquisition - if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) - { - std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl; - throw std::exception(); - } - acq_parameters.device_name = device_io_name; - - acq_parameters.samples_per_code = nsamples_total; - acq_parameters.excludelimit = static_cast(1 + ceil((1.0 / GPS_L5I_CODE_RATE_CPS) * static_cast(fs_in))); + uint32_t code_length = acq_parameters_.code_length; + uint32_t nsamples_total = acq_parameters_.samples_per_code; // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -106,7 +74,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - gps_l5i_code_gen_complex_sampled(code, PRN, fs_in); + gps_l5i_code_gen_complex_sampled(code, PRN, fs_in_); for (uint32_t s = code_length; s < 2 * code_length; s++) { @@ -146,16 +114,9 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( } } - acq_parameters.all_fft_codes = d_all_fft_codes_.data(); + acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - // reference for the FPGA FFT-IFFT attenuation factor - acq_parameters.total_block_exp = configuration->property(role + ".total_block_exp", 13); - - acq_parameters.num_doppler_bins_step2 = configuration->property(role + ".second_nbins", 4); - acq_parameters.doppler_step2 = configuration->property(role + ".second_doppler_step", static_cast(125.0)); - acq_parameters.make_2_steps = configuration->property(role + ".make_two_steps", false); - acq_parameters.max_num_acqs = configuration->property(role + ".max_num_acqs", 2); - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); + acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); if (in_streams_ > 1) { diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index e1c5eedb2..5a700d34f 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -12,7 +12,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -21,6 +21,7 @@ #ifndef GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H #define GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H +#include "acq_conf_fpga.h" #include "channel_fsm.h" #include "gnss_synchro.h" #include "pcps_acquisition_fpga.h" @@ -185,7 +186,9 @@ public: private: static const uint32_t NUM_PRNs = 32; - const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name + static const uint32_t fpga_downsampling_factor = 1; // downampling factor in the FPGA + static const uint32_t fpga_buff_num = 1; // L5/E5a band + static const uint32_t fpga_blk_exp = 13; // default block exponent // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. @@ -201,9 +204,10 @@ private: std::weak_ptr channel_fsm_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts Gnss_Synchro* gnss_synchro_; - std::string item_type_; - std::string dump_filename_; + const ConfigurationInterface* configuration_; + Acq_Conf_Fpga acq_parameters_; std::string role_; + int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index 81429538f..9ecdf6cdb 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -72,7 +72,7 @@ target_link_libraries(acquisition_gr_blocks target_include_directories(acquisition_gr_blocks PRIVATE - ${CMAKE_SOURCE_DIR}/src/core/receiver + ${GNSSSDR_SOURCE_DIR}/src/core/receiver ) if(GNURADIO_USES_STD_POINTERS) @@ -97,7 +97,7 @@ if(ENABLE_OPENCL) target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL) target_include_directories(acquisition_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/opencl ) endif() @@ -113,5 +113,5 @@ endif() set_property(TARGET acquisition_gr_blocks APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ - $ + $ ) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 872382f4f..a8ac0428e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -909,7 +909,9 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), gr::thread::scoped_lock lk(d_setlock); if (!d_active or d_worker_active) { - if (!d_acq_parameters.blocking_on_standby) + // do not consume samples while performing a non-coherent integration + bool consume_samples = ((!d_active) || (d_active && (d_num_noncoherent_integrations_counter == d_acq_parameters.max_dwells))); + if ((!d_acq_parameters.blocking_on_standby) && consume_samples) { d_sample_counter += static_cast(ninput_items[0]); consume_each(ninput_items[0]); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index e61d65e3e..0414a2d79 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -11,7 +11,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -27,14 +27,14 @@ #include // for move -pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_) +pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_) { - return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(std::move(conf_))); + return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_)); } -pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) - : d_acq_parameters(std::move(conf_)), +pcps_acquisition_fpga::pcps_acquisition_fpga(Acq_Conf_Fpga& conf_) + : d_acq_parameters(conf_), d_gnss_synchro(nullptr), d_sample_counter(0ULL), d_threshold(0.0), diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index 3b3e534ee..d0c0c3849 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -17,7 +17,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -26,7 +26,7 @@ #ifndef GNSS_SDR_PCPS_ACQUISITION_FPGA_H #define GNSS_SDR_PCPS_ACQUISITION_FPGA_H - +#include "acq_conf_fpga.h" #include "channel_fsm.h" #include "fpga_acquisition.h" #include @@ -42,31 +42,11 @@ class Gnss_Synchro; -typedef struct -{ - /* pcps acquisition configuration */ - std::string device_name; - int64_t fs_in; - float doppler_step2; - uint32_t* all_fft_codes; // pointer to memory that contains all the code ffts - uint32_t doppler_max; - uint32_t select_queue_Fpga; - uint32_t downsampling_factor; - uint32_t total_block_exp; - uint32_t excludelimit; - uint32_t num_doppler_bins_step2; - uint32_t max_num_acqs; - int32_t samples_per_code; - int32_t code_length; - bool make_2_steps; - bool repeat_satellite; -} pcpsconf_fpga_t; - class pcps_acquisition_fpga; using pcps_acquisition_fpga_sptr = std::shared_ptr; -pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); +pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_); /*! * \brief This class implements a Parallel Code Phase Search Acquisition that uses the FPGA. @@ -195,8 +175,8 @@ public: void stop_acquisition(); private: - friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); - explicit pcps_acquisition_fpga(pcpsconf_fpga_t conf_); + friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_); + explicit pcps_acquisition_fpga(Acq_Conf_Fpga& conf_); void send_negative_acquisition(); void send_positive_acquisition(); @@ -206,7 +186,7 @@ private: std::shared_ptr d_acquisition_fpga; std::weak_ptr d_channel_fsm; - pcpsconf_fpga_t d_acq_parameters; + Acq_Conf_Fpga d_acq_parameters; Gnss_Synchro* d_gnss_synchro; diff --git a/src/algorithms/acquisition/libs/CMakeLists.txt b/src/algorithms/acquisition/libs/CMakeLists.txt index c42f59340..9d0894d62 100644 --- a/src/algorithms/acquisition/libs/CMakeLists.txt +++ b/src/algorithms/acquisition/libs/CMakeLists.txt @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2010-2022 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause @@ -9,6 +9,8 @@ set(ACQUISITION_LIB_HEADERS acq_conf.h) set(ACQUISITION_LIB_SOURCES acq_conf.cc) if(ENABLE_FPGA) + set(ACQUISITION_LIB_SOURCES ${ACQUISITION_LIB_SOURCES} acq_conf_fpga.cc) + set(ACQUISITION_LIB_HEADERS ${ACQUISITION_LIB_HEADERS} acq_conf_fpga.h) set(ACQUISITION_LIB_SOURCES ${ACQUISITION_LIB_SOURCES} fpga_acquisition.cc) set(ACQUISITION_LIB_HEADERS ${ACQUISITION_LIB_HEADERS} fpga_acquisition.h) endif() @@ -55,3 +57,11 @@ set_property(TARGET acquisition_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ ) + +if(ENABLE_FPGA) + target_link_libraries(acquisition_libs + PRIVATE + core_libs + ) +endif() + diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.cc b/src/algorithms/acquisition/libs/acq_conf_fpga.cc new file mode 100644 index 000000000..93cf6dc28 --- /dev/null +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.cc @@ -0,0 +1,75 @@ +/*! + * \file acq_conf_fpga.cc + * \brief Class that contains all the configuration parameters for generic + * acquisition block based on the PCPS algorithm running in the FPGA. + * \author Marc Majoral, 2022. mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "acq_conf_fpga.h" +#include "item_type_helpers.h" +#include "uio_fpga.h" +#include +#include +#include + +void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configuration, + const std::string &role, uint32_t downs_factor, uint32_t sel_queue_fpga, uint32_t blk_exp, double chip_rate, double code_length_chips) +{ + // sampling frequency + const int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", fs_in); + fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + + // max doppler + doppler_max = configuration->property(role + ".doppler_max", doppler_max); + + // downsampling factor + uint32_t downsampling_factor = configuration->property(role + ".downsampling_factor", downs_factor); + downsampling_factor = downsampling_factor; + fs_in = fs_in / downsampling_factor; + + // code length in samples + code_length = static_cast(std::round(static_cast(fs_in) / (chip_rate / code_length_chips))); + + // The FPGA can only use FFT lengths that are a power of two. + float nbits = ceilf(log2f(static_cast(code_length) * 2.0F)); + samples_per_code = pow(2, nbits); + + // repeat satellite + repeat_satellite = configuration->property(role + ".repeat_satellite", false); + + // FPGA buffer number + select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", sel_queue_fpga); + + // UIO device file + std::string device_io_name; + // find the uio device file corresponding to the acquisition + if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) + { + std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl; + throw std::exception(); + } + device_name = device_io_name; + + // exclusion limit + excludelimit = static_cast(1 + ceil((1.0 / chip_rate) * static_cast(fs_in))); + + // acquisition step 2 parameters + num_doppler_bins_step2 = configuration->property(role + ".second_nbins", num_doppler_bins_step2); + doppler_step2 = configuration->property(role + ".second_doppler_step", doppler_step2); + doppler_step = configuration->property(role + ".doppler_step", doppler_step); + make_2_steps = configuration->property(role + ".make_two_steps", make_2_steps); + max_num_acqs = configuration->property(role + ".max_num_acqs", 2); + + // reference for the FPGA FFT-IFFT attenuation factor + total_block_exp = configuration->property(role + ".total_block_exp", blk_exp); +} diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.h b/src/algorithms/acquisition/libs/acq_conf_fpga.h new file mode 100644 index 000000000..5bac585f4 --- /dev/null +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.h @@ -0,0 +1,69 @@ +/*! + * \file acq_conf_fpga.h + * \brief Class that contains all the configuration parameters for generic + * acquisition block based on the PCPS algorithm running in the FPGA. + * \author Marc Majoral, 2022. mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ACQ_CONF_FPGA_H +#define GNSS_SDR_ACQ_CONF_FPGA_H + +#include "configuration_interface.h" +#include +#include +#include + +/** \addtogroup Acquisition + * \{ */ +/** \addtogroup acquisition_libs acquisition_libs + * Library with utilities for GNSS signal acquisition + * \{ */ + + +class Acq_Conf_Fpga +{ +public: + Acq_Conf_Fpga() = default; + + void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, uint32_t downs_factor, uint32_t sel_queue_fpga, uint32_t blk_exp, double chip_rate, double code_length_chips); + + /* PCPS Acquisition configuration */ + std::string device_name = "uio0"; + uint32_t *all_fft_codes = NULL; // pointer to memory that contains all the code ffts + int64_t fs_in{4000000LL}; + + float doppler_step{250.0}; + float doppler_step2{125.0}; + + uint32_t num_doppler_bins_step2{4U}; + + int32_t doppler_max{5000}; + + uint32_t select_queue_Fpga{0U}; + uint32_t downsampling_factor{4U}; + uint32_t total_block_exp{13U}; + uint32_t excludelimit{5U}; + uint32_t max_num_acqs{2U}; + uint32_t samples_per_code{1U}; + uint32_t code_length{16000U}; + bool make_2_steps{false}; + bool repeat_satellite{false}; + +private: + const std::string acquisition_device_name = "acquisition_S00_AXI"; // UIO device name +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_ACQ_CONF_FPGA_H diff --git a/src/algorithms/channel/adapters/CMakeLists.txt b/src/algorithms/channel/adapters/CMakeLists.txt index d5bbea2af..7d9ddcf83 100644 --- a/src/algorithms/channel/adapters/CMakeLists.txt +++ b/src/algorithms/channel/adapters/CMakeLists.txt @@ -31,8 +31,8 @@ target_link_libraries(channel_adapters target_include_directories(channel_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces - ${CMAKE_SOURCE_DIR}/src/core/receiver + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/receiver ) if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index 1454d9d7c..90607d700 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -45,7 +45,7 @@ target_link_libraries(channel_libs target_include_directories(channel_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/receiver + ${GNSSSDR_SOURCE_DIR}/src/core/receiver ) if(GNURADIO_USES_STD_POINTERS) diff --git a/src/algorithms/conditioner/adapters/CMakeLists.txt b/src/algorithms/conditioner/adapters/CMakeLists.txt index cb4db5424..265965e67 100644 --- a/src/algorithms/conditioner/adapters/CMakeLists.txt +++ b/src/algorithms/conditioner/adapters/CMakeLists.txt @@ -52,7 +52,7 @@ endif() target_include_directories(conditioner_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt index aa736ab64..f3829b5ab 100644 --- a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt @@ -44,7 +44,7 @@ endif() target_include_directories(data_type_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) target_link_libraries(data_type_adapters diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt index 56c821b01..a0e1f2ddc 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(data_type_gr_blocks target_include_directories(data_type_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(GNURADIO_USES_STD_POINTERS) diff --git a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt index a6a22a351..c652131ea 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt @@ -65,7 +65,7 @@ endif() target_include_directories(input_filter_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(GNURADIO_USES_STD_POINTERS) diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 693d17c43..e8f0d6366 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -94,7 +94,7 @@ endif() if(NOT has_span) target_include_directories(algorithms_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/algorithms/libs/gsl/include + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/gsl/include ) endif() @@ -164,7 +164,7 @@ endif() target_include_directories(algorithms_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) target_compile_definitions(algorithms_libs @@ -221,7 +221,7 @@ target_link_libraries(gnss_sdr_flags Gflags::gflags ) -if(${GFLAGS_GREATER_20}) +if(GFLAGS_GREATER_20 OR ${LOCAL_GFLAGS}) target_compile_definitions(gnss_sdr_flags PRIVATE -DGFLAGS_GREATER_2_0=1) endif() diff --git a/src/algorithms/libs/beidou_b1i_signal_replica.cc b/src/algorithms/libs/beidou_b1i_signal_replica.cc index 513a78cac..ce52bbc8c 100644 --- a/src/algorithms/libs/beidou_b1i_signal_replica.cc +++ b/src/algorithms/libs/beidou_b1i_signal_replica.cc @@ -26,11 +26,9 @@ const auto AUX_CEIL = [](float x) { return static_cast(static_cast dest, int32_t prn, uint32_t chip_shift) { constexpr uint32_t code_length = 2046; - const std::array delays = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547, - 1102, 578, 357, 1577, 1410, 1546, 1101, 707, 1576, 1409, 1545, 354 /*PRN32*/, - 705}; - const std::array phase1 = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10}; - const std::array phase2 = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11}; + const std::array phase1 = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 8, 9, 9, 3, 5, 7, 4, 4, 5, 5, 5, 5, 6}; + const std::array phase2 = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11, 7, 4, 6, 8, 10, 11, 5, 9, 6, 8, 10, 11, 9, 9, 10, 11, 7, 7, 9, 5, 9, 6, 8, 10, 11, 9}; + const std::array phase3 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3}; std::bitset G1{}; std::bitset G2{}; @@ -50,7 +48,7 @@ void beidou_b1i_code_gen_int(own::span dest, int32_t prn, uint32_t chip prn_idx = prn - 1; // A simple error check - if ((prn_idx < 0) || (prn_idx > 32)) + if ((prn_idx < 0) || (prn_idx > 62)) { return; } @@ -59,7 +57,7 @@ void beidou_b1i_code_gen_int(own::span dest, int32_t prn, uint32_t chip for (lcv = 0; lcv < code_length; lcv++) { G1[lcv] = G1_register[0]; - G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] xor G2_register[-(phase2[prn_idx] - 11)]; + G2[lcv] = G2_register[-(phase1[prn_idx] - 11)] xor G2_register[-(phase2[prn_idx] - 11)] xor (phase3[prn_idx] ? G2_register[-(phase3[prn_idx] - 11)] : 0); feedback1 = G1_register[0] xor G1_register[1] xor G1_register[2] xor G1_register[3] xor G1_register[4] xor G1_register[10]; feedback2 = G2_register[0] xor G2_register[2] xor G2_register[3] xor G2_register[6] xor G2_register[7] xor G2_register[8] xor G2_register[9] xor G2_register[10]; @@ -75,7 +73,7 @@ void beidou_b1i_code_gen_int(own::span dest, int32_t prn, uint32_t chip } // Set the delay - delay = code_length - delays[prn_idx] * 0; // ********************************* + delay = code_length; // ********************************* delay += chip_shift; delay %= code_length; diff --git a/src/algorithms/libs/rtklib/rtklib.h b/src/algorithms/libs/rtklib/rtklib.h index 379e75b75..216183d48 100644 --- a/src/algorithms/libs/rtklib/rtklib.h +++ b/src/algorithms/libs/rtklib/rtklib.h @@ -202,7 +202,7 @@ const int NSYSQZS = 0; #define ENABDS #ifdef ENABDS const int MINPRNBDS = 1; //!< min satellite sat number of BeiDou -const int MAXPRNBDS = 37; //!< max satellite sat number of BeiDou +const int MAXPRNBDS = 63; //!< max satellite sat number of BeiDou const int NSATBDS = (MAXPRNBDS - MINPRNBDS + 1); //!< number of BeiDou satellites const int NSYSBDS = 1; #else diff --git a/src/algorithms/libs/rtklib/rtklib_ephemeris.cc b/src/algorithms/libs/rtklib/rtklib_ephemeris.cc index 1aed8663e..6b095bdcd 100644 --- a/src/algorithms/libs/rtklib/rtklib_ephemeris.cc +++ b/src/algorithms/libs/rtklib/rtklib_ephemeris.cc @@ -34,6 +34,7 @@ #include "rtklib_preceph.h" #include "rtklib_rtkcmn.h" #include "rtklib_sbas.h" +#include /* constants -----------------------------------------------------------------*/ @@ -284,7 +285,7 @@ void eph2pos(gtime_t time, const eph_t *eph, double *rs, double *dts, cosi = cos(i); /* beidou geo satellite (ref [9]) */ - if (sys == SYS_BDS && prn <= 5) + if (sys == SYS_BDS && (prn <= 5 || prn > 58)) { O = eph->OMG0 + eph->OMGd * tk - omge * eph->toes; sinO = sin(O); @@ -1023,7 +1024,7 @@ int satpos(gtime_t time, gtime_t teph, int sat, int ephopt, void satposs(gtime_t teph, const obsd_t *obs, int n, const nav_t *nav, int ephopt, double *rs, double *dts, double *var, int *svh) { - gtime_t time[MAXOBS] = {}; + std::vector time(MAXOBS); double dt; double pr; int i; diff --git a/src/algorithms/libs/rtklib/rtklib_ionex.cc b/src/algorithms/libs/rtklib/rtklib_ionex.cc index 4bce957ea..418782557 100644 --- a/src/algorithms/libs/rtklib/rtklib_ionex.cc +++ b/src/algorithms/libs/rtklib/rtklib_ionex.cc @@ -39,6 +39,7 @@ #include "rtklib_ionex.h" #include "rtklib_rtkcmn.h" #include +#include /* get index -----------------------------------------------------------------*/ int getindex(double value, const double *range) @@ -425,8 +426,8 @@ void readtec(const char *file, nav_t *nav, int opt) double hgts[3] = {0}; double rb = 0.0; double nexp = -1.0; - double dcb[MAXSAT] = {0}; - double rms[MAXSAT] = {0}; + std::vector dcb(MAXSAT, 0); + std::vector rms(MAXSAT, 0); int i; int n; char *efiles[MAXEXFILE]; @@ -463,7 +464,7 @@ void readtec(const char *file, nav_t *nav, int opt) } /* read ionex header */ - if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb, rms) <= 0.0) + if (readionexh(fp, lats, lons, hgts, &rb, &nexp, dcb.data(), rms.data()) <= 0.0) { trace(2, "ionex file format error %s\n", efiles[i]); fclose(fp); diff --git a/src/algorithms/libs/rtklib/rtklib_pntpos.cc b/src/algorithms/libs/rtklib/rtklib_pntpos.cc index 5d023842b..abc3c2579 100644 --- a/src/algorithms/libs/rtklib/rtklib_pntpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_pntpos.cc @@ -34,6 +34,7 @@ #include "rtklib_ionex.h" #include "rtklib_sbas.h" #include +#include /* pseudorange measurement error variance ------------------------------------*/ double varerr(const prcopt_t *opt, double el, int sys) @@ -988,8 +989,8 @@ int pntpos(const obsd_t *obs, int n, const nav_t *nav, double *resp; int i; int stat; - int vsat[MAXOBS] = {0}; - int svh[MAXOBS]; + std::vector vsat(MAXOBS, 0); + std::vector svh(MAXOBS, 0); sol->stat = SOLQ_NONE; @@ -1019,20 +1020,20 @@ int pntpos(const obsd_t *obs, int n, const nav_t *nav, opt_.tropopt = TROPOPT_SAAS; } /* satellite positions, velocities and clocks */ - satposs(sol->time, obs, n, nav, opt_.sateph, rs, dts, var, svh); + satposs(sol->time, obs, n, nav, opt_.sateph, rs, dts, var, svh.data()); /* estimate receiver position with pseudorange */ - stat = estpos(obs, n, rs, dts, var, svh, nav, &opt_, sol, azel_, vsat, resp, msg); + stat = estpos(obs, n, rs, dts, var, svh.data(), nav, &opt_, sol, azel_, vsat.data(), resp, msg); /* raim fde */ if (!stat && n >= 6 && opt->posopt[4]) { - stat = raim_fde(obs, n, rs, dts, var, svh, nav, &opt_, sol, azel_, vsat, resp, msg); + stat = raim_fde(obs, n, rs, dts, var, svh.data(), nav, &opt_, sol, azel_, vsat.data(), resp, msg); } /* estimate receiver velocity with doppler */ if (stat) { - estvel(obs, n, rs, dts, nav, &opt_, sol, azel_, vsat); + estvel(obs, n, rs, dts, nav, &opt_, sol, azel_, vsat.data()); } if (azel) diff --git a/src/algorithms/libs/rtklib/rtklib_ppp.cc b/src/algorithms/libs/rtklib/rtklib_ppp.cc index 84d1689be..5e4280f41 100644 --- a/src/algorithms/libs/rtklib/rtklib_ppp.cc +++ b/src/algorithms/libs/rtklib/rtklib_ppp.cc @@ -38,6 +38,7 @@ #include "rtklib_sbas.h" #include "rtklib_tides.h" #include +#include /* wave length of LC (m) -----------------------------------------------------*/ double lam_LC(int i, int j, int k) @@ -351,7 +352,7 @@ int sel_amb(int *sat1, int *sat2, double *N, double *var, int n) { int i; int j; - int flgs[MAXSAT] = {0}; + std::vector flgs(MAXSAT, 0); int max_flg = 0; /* sort by variance */ @@ -372,7 +373,7 @@ int sel_amb(int *sat1, int *sat2, double *N, double *var, int n) /* select linearly independent satellite pair */ for (i = j = 0; i < n; i++) { - if (!is_depend(sat1[i], sat2[i], flgs, &max_flg)) + if (!is_depend(sat1[i], sat2[i], flgs.data(), &max_flg)) { continue; } @@ -546,7 +547,7 @@ int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n) int m = 0; int info; int stat; - int flgs[MAXSAT] = {0}; + std::vector flgs(MAXSAT, 0); int max_flg = 0; lam1 = LAM_CARR[0]; @@ -565,7 +566,7 @@ int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n) for (i = 0; i < n; i++) { /* check linear independency */ - if (!is_depend(sat1[i], sat2[i], flgs, &max_flg)) + if (!is_depend(sat1[i], sat2[i], flgs.data(), &max_flg)) { continue; } @@ -1362,7 +1363,7 @@ void udbias_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) { double meas[2]; double var[2]; - double bias[MAXOBS] = {0}; + std::vector bias(MAXOBS, 0.0); double offset = 0.0; double pos[3] = {0}; int i; @@ -1562,7 +1563,7 @@ int res_ppp(int iter __attribute__((unused)), const obsd_t *obs, int n, const do double dtdx[3]; double dantr[NFREQ] = {0}; double dants[NFREQ] = {0}; - double var[MAXOBS * 2]; + std::vector var(MAXOBS * 2, 0.0); double dtrp = 0.0; double vart = 0.0; double varm[2] = {0}; @@ -1781,7 +1782,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) int i; int nv; int info; - int svh[MAXOBS]; + std::vector svh(MAXOBS); int stat = SOLQ_SINGLE; trace(3, "pppos : nx=%d n=%d\n", rtk->nx, n); @@ -1803,7 +1804,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) tracemat(4, rtk->x, 1, NR_PPP(opt), 13, 4); /* satellite positions and clocks */ - satposs(obs[0].time, obs, n, nav, rtk->opt.sateph, rs, dts, var, svh); + satposs(obs[0].time, obs, n, nav, rtk->opt.sateph, rs, dts, var, svh.data()); /* exclude measurements of eclipsing satellite */ if (rtk->opt.posopt[3]) @@ -1821,7 +1822,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) for (i = 0; i < rtk->opt.niter; i++) { /* phase and code residuals */ - if ((nv = res_ppp(i, obs, n, rs, dts, var, svh, nav, xp, rtk, v, H, R, azel)) <= 0) + if ((nv = res_ppp(i, obs, n, rs, dts, var, svh.data(), nav, xp, rtk, v, H, R, azel)) <= 0) { break; } @@ -1842,7 +1843,7 @@ void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav) if (stat == SOLQ_PPP) { /* postfit residuals */ - res_ppp(1, obs, n, rs, dts, var, svh, nav, xp, rtk, v, H, R, azel); + res_ppp(1, obs, n, rs, dts, var, svh.data(), nav, xp, rtk, v, H, R, azel); /* update state and covariance matrix */ matcpy(rtk->x, xp, rtk->nx, 1); diff --git a/src/algorithms/libs/rtklib/rtklib_preceph.cc b/src/algorithms/libs/rtklib/rtklib_preceph.cc index 5d297fe44..9c09dd392 100644 --- a/src/algorithms/libs/rtklib/rtklib_preceph.cc +++ b/src/algorithms/libs/rtklib/rtklib_preceph.cc @@ -43,6 +43,7 @@ #include "rtklib_preceph.h" #include "rtklib_rtkcmn.h" #include +#include /* satellite code to satellite system ----------------------------------------*/ int code2sys(char code) @@ -390,7 +391,7 @@ void readsp3(const char *file, nav_t *nav, int opt) int j; int n; int ns; - int sats[MAXSAT] = {}; + std::vector sats(MAXSAT); char *efiles[MAXEXFILE]; char *ext; char type = ' '; @@ -431,10 +432,10 @@ void readsp3(const char *file, nav_t *nav, int opt) continue; } /* read sp3 header */ - ns = readsp3h(fp, &time, &type, sats, bfact, tsys); + ns = readsp3h(fp, &time, &type, sats.data(), bfact, tsys); /* read sp3 body */ - readsp3b(fp, type, sats, ns, bfact, tsys, j++, opt, nav); + readsp3b(fp, type, sats.data(), ns, bfact, tsys, j++, opt, nav); fclose(fp); } diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 53c1c47cd..81842d48a 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -31,6 +31,7 @@ #include "rtklib_rtkcmn.h" #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include const double GPST0[] = {1980, 1, 6, 0, 0, 0}; /* gps time reference */ @@ -4496,7 +4498,7 @@ double satazel(const double *pos, const double *e, double *azel) *-----------------------------------------------------------------------------*/ void dops(int ns, const double *azel, double elmin, double *dop) { - double H[4 * MAXSAT]; + std::vector H(4 * MAXSAT); double Q[16]; double cosel; double sinel; @@ -4525,7 +4527,7 @@ void dops(int ns, const double *azel, double elmin, double *dop) return; } - matmul("NT", 4, 4, n, 1.0, H, H, 0.0, Q); + matmul("NT", 4, 4, n, 1.0, H.data(), H.data(), 0.0, Q); if (!matinv(Q, 4)) { dop[0] = std::sqrt(Q[0] + Q[5] + Q[10] + Q[15]); /* GDOP */ @@ -5029,16 +5031,23 @@ void sunmoonpos(gtime_t tutc, const double *erpv, double *rsun, *-----------------------------------------------------------------------------*/ void csmooth(obs_t *obs, int ns) { - double Ps[2][MAXSAT][NFREQ] = {}; - double Lp[2][MAXSAT][NFREQ] = {}; + std::vector> Ps[2]; + std::vector> Lp[2]; double dcp; int i; int j; int s; int r; - int n[2][MAXSAT][NFREQ] = {}; + std::vector> n[2]; obsd_t *p; + Ps[0].resize(MAXSAT); + Ps[1].resize(MAXSAT); + Lp[0].resize(MAXSAT); + Lp[1].resize(MAXSAT); + n[0].resize(MAXSAT); + n[1].resize(MAXSAT); + trace(3, "csmooth: nobs=%d,ns=%d\n", obs->n, ns); for (i = 0; i < obs->n; i++) diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index 490321f2a..54bcaa802 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -37,6 +37,7 @@ #include "rtklib_tides.h" #include #include +#include static int resamb_WLNL(rtk_t *rtk __attribute((unused)), const obsd_t *obs __attribute((unused)), const int *sat __attribute((unused)), const int *iu __attribute((unused)), const int *ir __attribute((unused)), int ns __attribute__((unused)), const nav_t *nav __attribute((unused)), @@ -2029,7 +2030,7 @@ void restamb(rtk_t *rtk, const double *bias, int nb __attribute((unused)), doubl int n; int m; int f; - int index[MAXSAT]; + std::vector index(MAXSAT); int nv = 0; int nf = NF_RTK(&rtk->opt); @@ -2083,7 +2084,7 @@ void holdamb(rtk_t *rtk, const double *xa) int m; int f; int info; - int index[MAXSAT]; + std::vector index(MAXSAT); int nb = rtk->nx - rtk->na; int nv = 0; int nf = NF_RTK(&rtk->opt); @@ -2371,13 +2372,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, int ns; int ny; int nv; - int sat[MAXSAT]; - int iu[MAXSAT]; - int ir[MAXSAT]; + std::vector sat(MAXSAT); + std::vector iu(MAXSAT); + std::vector ir(MAXSAT); int niter; int info; - int vflg[MAXOBS * NFREQ * 2 + 1]; - int svh[MAXOBS * 2]; + std::vector vflg(MAXOBS * NFREQ * 2 + 1); + std::vector svh(MAXOBS * 2); int stat = rtk->opt.mode <= PMODE_DGPS ? SOLQ_DGPS : SOLQ_FLOAT; int nf = opt->ionoopt == IONOOPT_IFLC ? 1 : opt->nf; @@ -2401,10 +2402,10 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, } } /* satellite positions/clocks */ - satposs(time, obs, n, nav, opt->sateph, rs, dts, var, svh); + satposs(time, obs, n, nav, opt->sateph, rs, dts, var, svh.data()); /* undifferenced residuals for base station */ - if (!zdres(1, obs + nu, nr, rs + nu * 6, dts + nu * 2, svh + nu, nav, rtk->rb, opt, 1, + if (!zdres(1, obs + nu, nr, rs + nu * 6, dts + nu * 2, &svh[nu], nav, rtk->rb, opt, 1, y + nu * nf * 2, e + nu * 3, azel + nu * 2)) { errmsg(rtk, "initial base station position error\n"); @@ -2423,7 +2424,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, dt = intpres(time, obs + nu, nr, nav, rtk, y + nu * nf * 2); } /* select common satellites between rover and base-station */ - if ((ns = selsat(obs, azel, nu, nr, opt, sat, iu, ir)) <= 0) + if ((ns = selsat(obs, azel, nu, nr, opt, sat.data(), iu.data(), ir.data())) <= 0) { errmsg(rtk, "no common satellite\n"); @@ -2436,7 +2437,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, return 0; } /* temporal update of states */ - udstate(rtk, obs, sat, iu, ir, ns, nav); + udstate(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav); trace(4, "x(0)="); tracemat(4, rtk->x, 1, NR_RTK(opt), 13, 4); @@ -2458,14 +2459,14 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, for (i = 0; i < niter; i++) { /* undifferenced residuals for rover */ - if (!zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel)) + if (!zdres(0, obs, nu, rs, dts, svh.data(), nav, xp, opt, 0, y, e, azel)) { errmsg(rtk, "rover initial position error\n"); stat = SOLQ_NONE; break; } /* double-differenced residuals and partial derivatives */ - if ((nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, H, R, vflg)) < 1) + if ((nv = ddres(rtk, nav, dt, xp, Pp, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, H, R, vflg.data())) < 1) { errmsg(rtk, "no double-differenced residual\n"); stat = SOLQ_NONE; @@ -2482,13 +2483,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, trace(4, "x(%d)=", i + 1); tracemat(4, xp, 1, NR_RTK(opt), 13, 4); } - if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh, nav, xp, opt, 0, y, e, azel)) + if (stat != SOLQ_NONE && zdres(0, obs, nu, rs, dts, svh.data(), nav, xp, opt, 0, y, e, azel)) { /* post-fit residuals for float solution */ - nv = ddres(rtk, nav, dt, xp, Pp, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg); + nv = ddres(rtk, nav, dt, xp, Pp, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, nullptr, R, vflg.data()); /* validation of float solution */ - if (valpos(rtk, v, R, vflg, nv, 4.0)) + if (valpos(rtk, v, R, vflg.data(), nv, 4.0)) { /* update state and covariance matrix */ matcpy(rtk->x, xp, rtk->nx, 1); @@ -2526,7 +2527,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, /* resolve integer ambiguity by WL-NL */ if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_WLNL) { - if (resamb_WLNL(rtk, obs, sat, iu, ir, ns, nav, azel)) + if (resamb_WLNL(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav, azel)) { stat = SOLQ_FIX; } @@ -2534,7 +2535,7 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, /* resolve integer ambiguity by TCAR */ else if (stat != SOLQ_NONE && rtk->opt.modear == ARMODE_TCAR) { - if (resamb_TCAR(rtk, obs, sat, iu, ir, ns, nav, azel)) + if (resamb_TCAR(rtk, obs, sat.data(), iu.data(), ir.data(), ns, nav, azel)) { stat = SOLQ_FIX; } @@ -2542,13 +2543,13 @@ int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr, /* resolve integer ambiguity by LAMBDA */ else if (stat != SOLQ_NONE && resamb_LAMBDA(rtk, bias, xa) > 1) { - if (zdres(0, obs, nu, rs, dts, svh, nav, xa, opt, 0, y, e, azel)) + if (zdres(0, obs, nu, rs, dts, svh.data(), nav, xa, opt, 0, y, e, azel)) { /* post-fit reisiduals for fixed solution */ - nv = ddres(rtk, nav, dt, xa, nullptr, sat, y, e, azel, iu, ir, ns, v, nullptr, R, vflg); + nv = ddres(rtk, nav, dt, xa, nullptr, sat.data(), y, e, azel, iu.data(), ir.data(), ns, v, nullptr, R, vflg.data()); /* validation of fixed solution */ - if (valpos(rtk, v, R, vflg, nv, 4.0)) + if (valpos(rtk, v, R, vflg.data(), nv, 4.0)) { /* hold integer ambiguity */ if (++rtk->nfix >= rtk->opt.minfix && diff --git a/src/algorithms/libs/rtklib/rtklib_sbas.cc b/src/algorithms/libs/rtklib/rtklib_sbas.cc index 4d682692c..deebafd7a 100644 --- a/src/algorithms/libs/rtklib/rtklib_sbas.cc +++ b/src/algorithms/libs/rtklib/rtklib_sbas.cc @@ -211,7 +211,7 @@ int decode_sbstype6(const sbsmsg_t *msg, sbssat_t *sbssat) } for (i = 0; i < sbssat->nsat && i < MAXSAT; i++) { - if (sbssat->sat[i].fcorr.iodf != iodf[i / 39]) + if (sbssat->sat[i].fcorr.iodf != iodf[i / 46]) { continue; } diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index 57aa8e26e..17ad78ead 100644 --- a/src/algorithms/libs/rtklib/rtklib_solution.cc +++ b/src/algorithms/libs/rtklib/rtklib_solution.cc @@ -37,6 +37,7 @@ #include #include #include +#include /* constants and macros ------------------------------------------------------*/ @@ -1654,7 +1655,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol, int sat; int sys; int nsat; - int prn[MAXSAT]; + std::vector prn(MAXSAT); char *p = reinterpret_cast(buff); char *q; char *s; @@ -1683,7 +1684,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol, { continue; } - sys = satsys(sat, prn + nsat); + sys = satsys(sat, &prn[nsat]); if (sys != SYS_GPS && sys != SYS_SBS) { continue; @@ -1728,7 +1729,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol, { continue; } - if (satsys(sat, prn + nsat) != SYS_GLO) + if (satsys(sat, &prn[nsat]) != SYS_GLO) { continue; } @@ -1769,7 +1770,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol, { continue; } - if (satsys(sat, prn + nsat) != SYS_GAL) + if (satsys(sat, &prn[nsat]) != SYS_GAL) { continue; } @@ -1809,7 +1810,7 @@ int outnmea_gsa(unsigned char *buff, const sol_t *sol, { continue; } - if (satsys(sat, prn + nsat) != SYS_BDS) + if (satsys(sat, &prn[nsat]) != SYS_BDS) { continue; } @@ -1861,7 +1862,7 @@ int outnmea_gsv(unsigned char *buff, const sol_t *sol, int prn; int sys; int nmsg; - int sats[MAXSAT]; + std::vector sats(MAXSAT); char *p = reinterpret_cast(buff); char *q; char *s; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index ea21b15d8..de55de80e 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -491,8 +491,8 @@ endif() ######################################################################## configure_file( - ${CMAKE_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake.in - ${CMAKE_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake + ${PROJECT_SOURCE_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake.in + ${PROJECT_BINARY_DIR}/cmake/Modules/VolkGnsssdrConfig.cmake @ONLY ) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt index 2bda43927..acb748a3c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt @@ -82,6 +82,7 @@ macro(add_cpu_features_headers_and_sources HDRS_LIST_NAME SRCS_LIST_NAME) elseif(PROCESSOR_IS_X86) list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_x86.h) list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/cpuid_x86.h) + list(APPEND ${SRCS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/internal/windows_utils.h) elseif(PROCESSOR_IS_POWER) list(APPEND ${HDRS_LIST_NAME} ${PROJECT_SOURCE_DIR}/include/cpuinfo_ppc.h) else() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md index f15f0b340..ce13d72e6 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/README.md @@ -209,25 +209,41 @@ Please check the [CMake build instructions](cmake/README.md). - Run `list_cpu_features` -```sh -cmake -S. -Bbuild -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -cmake --build build --config Release -j -./build/list_cpu_features --json -``` + ```sh + cmake -S. -Bbuild -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release -j + ./build/list_cpu_features --json + ``` -_Note_: Use `--target ALL_BUILD` on the second line for `Visual Studio` and -`XCode`. + _Note_: Use `--target ALL_BUILD` on the second line for `Visual Studio` and + `XCode`. - run tests -```sh -cmake -S. -Bbuild -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -cmake --build build --config Debug -j -cmake --build build --config Debug --target test -``` + ```sh + cmake -S. -Bbuild -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug + cmake --build build --config Debug -j + cmake --build build --config Debug --target test + ``` -_Note_: Use `--target RUN_TESTS` on the last line for `Visual Studio` and -`--target RUN_TEST` for `XCode`. + _Note_: Use `--target RUN_TESTS` on the last line for `Visual Studio` and + `--target RUN_TEST` for `XCode`. + +- install `cpu_features` + + ```sh + cmake --build build --config Release --target install -v + ``` + + _Note_: Use `--target INSTALL` for `Visual Studio`. + + _Note_: When using `Makefile` or `XCode` generator, you can use + [`DESTDIR`](https://www.gnu.org/software/make/manual/html_node/DESTDIR.html) + to install on a local repository.
e.g. + + ```sh + cmake --build build --config Release --target install -v -- DESTDIR=install + ``` diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h index e23a476eb..2eb11e264 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h @@ -52,6 +52,22 @@ #define CPU_FEATURES_ARCH_PPC #endif +#if defined(__riscv) +#define CPU_FEATURES_ARCH_RISCV +#endif + +#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32 +#define CPU_FEATURES_ARCH_RISCV32 +#endif + +#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 +#define CPU_FEATURES_ARCH_RISCV64 +#endif + +#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 128 +#define CPU_FEATURES_ARCH_RISCV128 +#endif + //////////////////////////////////////////////////////////////////////////////// // Os //////////////////////////////////////////////////////////////////////////////// @@ -215,8 +231,121 @@ #else #define CPU_FEATURES_COMPILED_MIPS_MSA 0 #endif // defined(__mips_msa) +#if defined(__mips3d) +#define CPU_FEATURES_COMPILED_MIPS_MIPS3D 1 +#else +#define CPU_FEATURES_COMPILED_MIPS_MIPS3D 0 +#endif #endif // defined(CPU_FEATURES_ARCH_MIPS) +#if defined(CPU_FEATURES_ARCH_RISCV) +#if defined(__riscv_e) +#define CPU_FEATURES_COMPILED_RISCV_E 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_E 0 +#endif +#if defined(__riscv_i) +#define CPU_FEATURES_COMPILED_RISCV_I 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_I 0 +#endif +#if defined(__riscv_m) +#define CPU_FEATURES_COMPILED_RISCV_M 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_M 0 +#endif +#if defined(__riscv_a) +#define CPU_FEATURES_COMPILED_RISCV_A 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_A 0 +#endif +#if defined(__riscv_f) +#define CPU_FEATURES_COMPILED_RISCV_F 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_F 0 +#endif +#if defined(__riscv_d) +#define CPU_FEATURES_COMPILED_RISCV_D 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_D 0 +#endif +#if defined(__riscv_q) +#define CPU_FEATURES_COMPILED_RISCV_Q 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_Q 0 +#endif +#if defined(__riscv_c) +#define CPU_FEATURES_COMPILED_RISCV_C 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_C 0 +#endif +#if defined(__riscv_v) +#define CPU_FEATURES_COMPILED_RISCV_V 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_V 0 +#endif +#if defined(__riscv_zba) +#define CPU_FEATURES_COMPILED_RISCV_ZBA 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZBA 0 +#endif +#if defined(__riscv_zbb) +#define CPU_FEATURES_COMPILED_RISCV_ZBB 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZBB 0 +#endif +#if defined(__riscv_zbc) +#define CPU_FEATURES_COMPILED_RISCV_ZBC 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZBC 0 +#endif +#if defined(__riscv_zbs) +#define CPU_FEATURES_COMPILED_RISCV_ZBS 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZBS 0 +#endif +#if defined(__riscv_zfh) +#define CPU_FEATURES_COMPILED_RISCV_ZFH 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZFH 0 +#endif +#if defined(__riscv_zfhmin) +#define CPU_FEATURES_COMPILED_RISCV_ZFHMIN 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZFHMIN 0 +#endif +#if defined(__riscv_zknd) +#define CPU_FEATURES_COMPILED_RISCV_ZKND 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZKND 0 +#endif +#if defined(__riscv_zkne) +#define CPU_FEATURES_COMPILED_RISCV_ZKNE 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZKNE 0 +#endif +#if defined(__riscv_zknh) +#define CPU_FEATURES_COMPILED_RISCV_ZKNH 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZKNH 0 +#endif +#if defined(__riscv_zksed) +#define CPU_FEATURES_COMPILED_RISCV_ZKSED 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZKSED 0 +#endif +#if defined(__riscv_zksh) +#define CPU_FEATURES_COMPILED_RISCV_ZKSH 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZKSH 0 +#endif +#if defined(__riscv_zkr) +#define CPU_FEATURES_COMPILED_RISCV_ZKR 1 +#else +#define CPU_FEATURES_COMPILED_RISCV_ZKR 0 +#endif +#endif // defined(CPU_FEATURES_ARCH_RISCV) + //////////////////////////////////////////////////////////////////////////////// // Utils //////////////////////////////////////////////////////////////////////////////// @@ -233,6 +362,8 @@ // Communicates to the compiler that the function is now deprecated #if defined(CPU_FEATURES_COMPILER_CLANG) || defined(CPU_FEATURES_COMPILER_GCC) #define CPU_FEATURES_DEPRECATED(message) __attribute__((deprecated(message))) +#elif defined(CPU_FEATURES_COMPILER_MSC) +#define CPU_FEATURES_DEPRECATED(message) __declspec(deprecated(message)) #else #define CPU_FEATURES_DEPRECATED(message) #endif diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h index a18209f3a..b68869e3f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h @@ -62,6 +62,9 @@ typedef struct int rng : 1; // True random number generator support. int bti : 1; // Branch target identification. int mte : 1; // Memory tagging extension. + int ecv : 1; // Enhanced counter virtualization. + int afp : 1; // Alternate floating-point behaviour. + int rpres : 1; // 12-bit reciprocal (square root) estimate precision. // Make sure to update Aarch64FeaturesEnum below if you add a field here. } Aarch64Features; @@ -133,6 +136,9 @@ typedef enum AARCH64_RNG, AARCH64_BTI, AARCH64_MTE, + AARCH64_ECV, + AARCH64_AFP, + AARCH64_RPRES, AARCH64_LAST_, } Aarch64FeaturesEnum; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_mips.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_mips.h index 61e0299de..038232bd0 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_mips.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_mips.h @@ -11,11 +11,20 @@ CPU_FEATURES_START_CPP_NAMESPACE typedef struct { - int msa : 1; // MIPS SIMD Architecture - // https://www.mips.com/products/architectures/ase/simd/ - int eva : 1; // Enhanced Virtual Addressing - // https://www.mips.com/products/architectures/mips64/ - int r6 : 1; // True if is release 6 of the processor. + int msa : 1; // MIPS SIMD Architecture + // https://www.mips.com/products/architectures/ase/simd/ + int eva : 1; // Enhanced Virtual Addressing + // https://www.mips.com/products/architectures/mips64/ + int r6 : 1; // True if is release 6 of the processor. + int mips16 : 1; // Compressed instructions + int mdmx : 1; // MIPS Digital Media Extension + int mips3d : 1; // 3D graphics acceleration + // MIPS(r) Architecture for Programmers, Volume IV-c + int smart : 1; // Smart-card cryptography + // MIPS(r) Architecture for Programmers, Volume IV-d + int dsp : 1; // Digital Signal Processing + // MIPS(r) Architecture for Programmers, Volume IV-e + // https://www.mips.com/products/architectures/ase/dsp/ // Make sure to update MipsFeaturesEnum below if you add a field here. } MipsFeatures; @@ -35,6 +44,11 @@ typedef enum MIPS_MSA, MIPS_EVA, MIPS_R6, + MIPS_MIPS16, + MIPS_MDMX, + MIPS_MIPS3D, + MIPS_SMART, + MIPS_DSP, MIPS_LAST_, } MipsFeaturesEnum; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h index d26de6e52..3a968a862 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h @@ -65,7 +65,7 @@ typedef struct int avx512bitalg : 1; int avx512vpopcntdq : 1; int avx512_4vnniw : 1; - int avx512_4vbmi2 : 1; + int avx512_4vbmi2 : 1; // Note: this is an alias to avx512_4fmaps. int avx512_second_fma : 1; int avx512_4fmaps : 1; int avx512_bf16 : 1; @@ -132,6 +132,7 @@ typedef enum INTEL_KBL, // KABY LAKE INTEL_CFL, // COFFEE LAKE INTEL_WHL, // WHISKEY LAKE + INTEL_CML, // COMET LAKE INTEL_CNL, // CANNON LAKE INTEL_ICL, // ICE LAKE INTEL_TGL, // TIGER LAKE @@ -158,6 +159,7 @@ typedef enum AMD_ZEN_PLUS, // K17 ZEN+ AMD_ZEN2, // K17 ZEN 2 AMD_ZEN3, // K19 ZEN 3 + AMD_ZEN4, // K19 ZEN 4 X86_MICROARCHITECTURE_LAST_, } X86Microarchitecture; @@ -218,7 +220,7 @@ typedef enum X86_AVX512BITALG, X86_AVX512VPOPCNTDQ, X86_AVX512_4VNNIW, - X86_AVX512_4VBMI2, + X86_AVX512_4VBMI2, // Note: this is an alias to X86_AVX512_4FMAPS. X86_AVX512_SECOND_FMA, X86_AVX512_4FMAPS, X86_AVX512_BF16, diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h index bb18a9a9e..94f5f43e2 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h @@ -68,6 +68,9 @@ CPU_FEATURES_START_CPP_NAMESPACE #define AARCH64_HWCAP2_RNG (1UL << 16) #define AARCH64_HWCAP2_BTI (1UL << 17) #define AARCH64_HWCAP2_MTE (1UL << 18) +#define AARCH64_HWCAP2_ECV (1UL << 19) +#define AARCH64_HWCAP2_AFP (1UL << 20) +#define AARCH64_HWCAP2_RPRES (1UL << 21) // http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h #define ARM_HWCAP_SWP (1UL << 0) @@ -102,6 +105,13 @@ CPU_FEATURES_START_CPP_NAMESPACE #define MIPS_HWCAP_R6 (1UL << 0) #define MIPS_HWCAP_MSA (1UL << 1) #define MIPS_HWCAP_CRC32 (1UL << 2) +#define MIPS_HWCAP_MIPS16 (1UL << 3) +#define MIPS_HWCAP_MDMX (1UL << 4) +#define MIPS_HWCAP_MIPS3D (1UL << 5) +#define MIPS_HWCAP_SMARTMIPS (1UL << 6) +#define MIPS_HWCAP_DSP (1UL << 7) +#define MIPS_HWCAP_DSP2 (1UL << 8) +#define MIPS_HWCAP_DSP3 (1UL << 9) // http://elixir.free-electrons.com/linux/latest/source/arch/powerpc/include/uapi/asm/cputable.h #ifndef _UAPI__ASM_POWERPC_CPUTABLE_H @@ -154,6 +164,17 @@ CPU_FEATURES_START_CPP_NAMESPACE #define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 #endif +// https://elixir.bootlin.com/linux/latest/source/arch/riscv/include/uapi/asm/hwcap.h +#define RISCV_HWCAP_A (1UL << ('A' - 'A')) +#define RISCV_HWCAP_C (1UL << ('C' - 'A')) +#define RISCV_HWCAP_D (1UL << ('D' - 'A')) +#define RISCV_HWCAP_E (1UL << ('E' - 'A')) +#define RISCV_HWCAP_F (1UL << ('F' - 'A')) +#define RISCV_HWCAP_I (1UL << ('I' - 'A')) +#define RISCV_HWCAP_M (1UL << ('M' - 'A')) +#define RISCV_HWCAP_V (1UL << ('V' - 'A')) +#define RISCV_HWCAP_Q (1UL << ('Q' - 'A')) + typedef struct { unsigned long hwcaps; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/windows_utils.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/windows_utils.h new file mode 100644 index 000000000..246bb20c9 --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/windows_utils.h @@ -0,0 +1,21 @@ +// SPDX-FileCopyrightText: 2022 Google LLC +// SPDX-License-Identifier: Apache-2.0 +#ifndef CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_ +#define CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_ + +#include // IsProcessorFeaturePresent + +// modern WinSDK winnt.h contains newer features detection definitions +#if !defined(PF_SSSE3_INSTRUCTIONS_AVAILABLE) +#define PF_SSSE3_INSTRUCTIONS_AVAILABLE 36 +#endif + +#if !defined(PF_SSE4_1_INSTRUCTIONS_AVAILABLE) +#define PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37 +#endif + +#if !defined(PF_SSE4_2_INSTRUCTIONS_AVAILABLE) +#define PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38 +#endif + +#endif // CPU_FEATURES_INCLUDE_INTERNAL_WINDOWS_UTILS_H_ diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_linux_or_android.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_linux_or_android.c index fec374025..98417fbdf 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_linux_or_android.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_linux_or_android.c @@ -63,7 +63,10 @@ LINE(AARCH64_DGH, dgh, "dgh", 0, AARCH64_HWCAP2_DGH) \ LINE(AARCH64_RNG, rng, "rng", 0, AARCH64_HWCAP2_RNG) \ LINE(AARCH64_BTI, bti, "bti", 0, AARCH64_HWCAP2_BTI) \ - LINE(AARCH64_MTE, mte, "mte", 0, AARCH64_HWCAP2_MTE) + LINE(AARCH64_MTE, mte, "mte", 0, AARCH64_HWCAP2_MTE) \ + LINE(AARCH64_ECV, ecv, "ecv", 0, AARCH64_HWCAP2_ECV) \ + LINE(AARCH64_AFP, afp, "afp", 0, AARCH64_HWCAP2_AFP) \ + LINE(AARCH64_RPRES, rpres, "rpres", 0, AARCH64_HWCAP2_RPRES) #define INTROSPECTION_PREFIX Aarch64 #define INTROSPECTION_ENUM_PREFIX AARCH64 #include "define_introspection_and_hwcaps.inl" diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_mips_linux_or_android.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_mips_linux_or_android.c index cb874ffc6..80aba872a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_mips_linux_or_android.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_mips_linux_or_android.c @@ -11,10 +11,15 @@ //////////////////////////////////////////////////////////////////////////////// // Definitions for introspection. //////////////////////////////////////////////////////////////////////////////// -#define INTROSPECTION_TABLE \ - LINE(MIPS_MSA, msa, "msa", MIPS_HWCAP_MSA, 0) \ - LINE(MIPS_EVA, eva, "eva", 0, 0) \ - LINE(MIPS_R6, r6, "r6", MIPS_HWCAP_R6, 0) +#define INTROSPECTION_TABLE \ + LINE(MIPS_MSA, msa, "msa", MIPS_HWCAP_MSA, 0) \ + LINE(MIPS_EVA, eva, "eva", 0, 0) \ + LINE(MIPS_R6, r6, "r6", MIPS_HWCAP_R6, 0) \ + LINE(MIPS_MIPS16, mips16, "mips16", MIPS_HWCAP_MIPS16, 0) \ + LINE(MIPS_MDMX, mdmx, "mdmx", MIPS_HWCAP_MDMX, 0) \ + LINE(MIPS_MIPS3D, mips3d, "mips3d", MIPS_HWCAP_MIPS3D, 0) \ + LINE(MIPS_SMART, smart, "smartmips", MIPS_HWCAP_SMARTMIPS, 0) \ + LINE(MIPS_DSP, dsp, "dsp", MIPS_HWCAP_DSP, 0) #define INTROSPECTION_PREFIX Mips #define INTROSPECTION_ENUM_PREFIX MIPS #include "define_introspection_and_hwcaps.inl" diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl index 56e6a82d6..29ad4b76c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86__base_implementation.inl @@ -561,6 +561,8 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) return INTEL_CFL; // https://en.wikipedia.org/wiki/Coffee_Lake case 11: return INTEL_WHL; // https://en.wikipedia.org/wiki/Whiskey_Lake_(microarchitecture) + case 12: + return INTEL_CML; // https://en.wikichip.org/wiki/intel/microarchitectures/comet_lake default: return X86_UNKNOWN; } @@ -579,6 +581,9 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) case CPUID(0x06, 0x9A): // https://en.wikichip.org/wiki/intel/microarchitectures/alder_lake return INTEL_ADL; + case CPUID(0x06, 0xA5): + // https://en.wikichip.org/wiki/intel/microarchitectures/comet_lake + return INTEL_CML; case CPUID(0x06, 0xA7): // https://en.wikichip.org/wiki/intel/microarchitectures/rocket_lake return INTEL_RCL; @@ -744,13 +749,19 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) case CPUID(0x17, 0x98): // https://en.wikichip.org/wiki/amd/microarchitectures/zen_2 return AMD_ZEN2; + case CPUID(0x19, 0x00): case CPUID(0x19, 0x01): + case CPUID(0x19, 0x08): case CPUID(0x19, 0x21): case CPUID(0x19, 0x30): case CPUID(0x19, 0x40): + case CPUID(0x19, 0x44): case CPUID(0x19, 0x50): // https://en.wikichip.org/wiki/amd/microarchitectures/zen_3 return AMD_ZEN3; + case CPUID(0x19, 0x10): + // https://en.wikichip.org/wiki/amd/microarchitectures/zen_4 + return AMD_ZEN4; default: return X86_UNKNOWN; } @@ -760,6 +771,7 @@ X86Microarchitecture GetX86Microarchitecture(const X86Info* info) switch (CPUID(info->family, info->model)) { case CPUID(0x18, 0x00): + case CPUID(0x18, 0x01): return AMD_ZEN; } } @@ -1823,6 +1835,7 @@ CacheInfo GetX86CacheInfo(void) LINE(INTEL_KBL) \ LINE(INTEL_CFL) \ LINE(INTEL_WHL) \ + LINE(INTEL_CML) \ LINE(INTEL_CNL) \ LINE(INTEL_ICL) \ LINE(INTEL_TGL) \ @@ -1848,7 +1861,8 @@ CacheInfo GetX86CacheInfo(void) LINE(AMD_ZEN) \ LINE(AMD_ZEN_PLUS) \ LINE(AMD_ZEN2) \ - LINE(AMD_ZEN3) + LINE(AMD_ZEN3) \ + LINE(AMD_ZEN4) const char* GetX86MicroarchitectureName(X86Microarchitecture value) { diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86_windows.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86_windows.c index 66d47c7be..44dfde643 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86_windows.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_x86_windows.c @@ -14,7 +14,7 @@ static void OverrideOsPreserves(OsPreserves* os_preserves) // No override } -#include // IsProcessorFeaturePresent +#include "internal/windows_utils.h" #if defined(CPU_FEATURES_MOCK_CPUID_X86) extern bool GetWindowsIsProcessorFeaturePresent(DWORD); @@ -35,16 +35,15 @@ static void DetectFeaturesFromOs(X86Info* info, X86Features* features) GetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE); features->sse3 = GetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE); + features->ssse3 = + GetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE); + features->sse4_1 = + GetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE); + features->sse4_2 = + GetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE); -// https://github.com/google/cpu_features/issues/200 -#if (_WIN32_WINNT >= 0x0601) // Win7+ - if (GetX86Microarchitecture(info) == INTEL_WSM) - { - features->ssse3 = true; - features->sse4_1 = true; - features->sse4_2 = true; - } -#endif + // do not bother checking PF_AVX* + // cause AVX enabled processor will have XCR0 be exposed and this function will be skipped at all } #endif // CPU_FEATURES_OS_WINDOWS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c index 51a53a462..859ef6954 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c @@ -43,7 +43,7 @@ char gGlobalBuffer[64 * 1024]; BumpAllocator gBumpAllocator = {.ptr = gGlobalBuffer, .size = sizeof(gGlobalBuffer)}; -static void internal_error() +static void internal_error(void) { fputs("internal error\n", stderr); exit(EXIT_FAILURE); @@ -51,12 +51,12 @@ static void internal_error() #define ALIGN 8 -static void assertAligned() +static void assertAligned(void) { if ((uintptr_t)(gBumpAllocator.ptr) % ALIGN) internal_error(); } -static void BA_Align() +static void BA_Align(void) { while (gBumpAllocator.size && (uintptr_t)(gBumpAllocator.ptr) % ALIGN) { @@ -128,10 +128,10 @@ static Node* CreateConstantString(const char* value) } // Adds a map node. -static Node* CreateMap() { return BA_CreateNode(NT_MAP); } +static Node* CreateMap(void) { return BA_CreateNode(NT_MAP); } // Adds an array node. -static Node* CreateArray() { return BA_CreateNode(NT_ARRAY); } +static Node* CreateArray(void) { return BA_CreateNode(NT_ARRAY); } // Adds a formatted string node. static Node* CreatePrintfString(const char* format, ...) @@ -385,16 +385,15 @@ static void AddCacheInfo(Node* root, const CacheInfo* cache_info) AddMapEntry(root, "cache_info", array); } -static Node* CreateTree() +static Node* CreateTree(void) { Node* root = CreateMap(); #if defined(CPU_FEATURES_ARCH_X86) char brand_string[49]; const X86Info info = GetX86Info(); const CacheInfo cache_info = GetX86CacheInfo(); - FillX86BrandString(brand_string); AddMapEntry(root, "arch", CreateString("x86")); - AddMapEntry(root, "brand", CreateString(brand_string)); + AddMapEntry(root, "brand", CreateString(info.brand_string)); AddMapEntry(root, "family", CreateInt(info.family)); AddMapEntry(root, "model", CreateInt(info.model)); AddMapEntry(root, "stepping", CreateInt(info.stepping)); diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc index d7b9304ed..8d88e49d3 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc @@ -135,6 +135,20 @@ void DisableHardwareCapabilities() SetHardwareCapabilities(0, 0); } +TEST(CpuinfoAarch64Test, Aarch64FeaturesEnum) +{ + const char *last_name = GetAarch64FeaturesEnumName(AARCH64_LAST_); + EXPECT_STREQ(last_name, "unknown_feature"); + for (int i = static_cast(AARCH64_FP); i != static_cast(AARCH64_LAST_); ++i) + { + const auto feature = static_cast(i); + const char *name = GetAarch64FeaturesEnumName(feature); + ASSERT_FALSE(name == nullptr); + EXPECT_STRNE(name, ""); + EXPECT_STRNE(name, last_name); + } +} + TEST(CpuinfoAarch64Test, FromHardwareCap) { ResetHwcaps(); @@ -208,7 +222,7 @@ TEST(CpuinfoAarch64Test, FromHardwareCap2) TEST(CpuinfoAarch64Test, ARMCortexA53) { ResetHwcaps(); - auto& fs = GetEmptyFilesystem(); + auto &fs = GetEmptyFilesystem(); fs.CreateFile("/proc/cpuinfo", R"(Processor : AArch64 Processor rev 3 (aarch64) processor : 0 @@ -283,6 +297,9 @@ CPU revision : 3)"); EXPECT_FALSE(info.features.rng); EXPECT_FALSE(info.features.bti); EXPECT_FALSE(info.features.mte); + EXPECT_FALSE(info.features.ecv); + EXPECT_FALSE(info.features.afp); + EXPECT_FALSE(info.features.rpres); } #endif diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_arm_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_arm_test.cc index 735f8e123..714def32a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_arm_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_arm_test.cc @@ -10,6 +10,21 @@ namespace cpu_features { namespace { + +TEST(CpuinfoArmTest, ArmFeaturesEnum) +{ + const char* last_name = GetArmFeaturesEnumName(ARM_LAST_); + EXPECT_STREQ(last_name, "unknown_feature"); + for (int i = static_cast(ARM_SWP); i != static_cast(ARM_LAST_); ++i) + { + const auto feature = static_cast(i); + const char* name = GetArmFeaturesEnumName(feature); + ASSERT_FALSE(name == nullptr); + EXPECT_STRNE(name, ""); + EXPECT_STRNE(name, last_name); + } +} + TEST(CpuinfoArmTest, FromHardwareCap) { ResetHwcaps(); diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc index f5ec19ff8..bcad73616 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc @@ -12,6 +12,20 @@ namespace cpu_features { namespace { +TEST(CpuinfoMipsTest, MipsFeaturesEnum) +{ + const char* last_name = GetMipsFeaturesEnumName(MIPS_LAST_); + EXPECT_STREQ(last_name, "unknown_feature"); + for (int i = static_cast(MIPS_MSA); i != static_cast(MIPS_LAST_); ++i) + { + const auto feature = static_cast(i); + const char* name = GetMipsFeaturesEnumName(feature); + ASSERT_FALSE(name == nullptr); + EXPECT_STRNE(name, ""); + EXPECT_STRNE(name, last_name); + } +} + TEST(CpuinfoMipsTest, FromHardwareCapBoth) { ResetHwcaps(); @@ -60,6 +74,12 @@ VPE : 0 const auto info = GetMipsInfo(); EXPECT_FALSE(info.features.msa); EXPECT_TRUE(info.features.eva); + EXPECT_FALSE(info.features.r6); + EXPECT_TRUE(info.features.mips16); + EXPECT_FALSE(info.features.mdmx); + EXPECT_FALSE(info.features.mips3d); + EXPECT_FALSE(info.features.smart); + EXPECT_TRUE(info.features.dsp); } TEST(CpuinfoMipsTest, AR7161) @@ -87,6 +107,7 @@ VCEI exceptions : not available const auto info = GetMipsInfo(); EXPECT_FALSE(info.features.msa); EXPECT_FALSE(info.features.eva); + EXPECT_TRUE(info.features.mips16); } TEST(CpuinfoMipsTest, Goldfish) @@ -115,5 +136,37 @@ VCEI exceptions : not available EXPECT_FALSE(info.features.eva); } +TEST(CpuinfoMipsTest, BCM1250) +{ + ResetHwcaps(); + auto& fs = GetEmptyFilesystem(); + fs.CreateFile("/proc/cpuinfo", R"(system type : SiByte BCM91250A (SWARM) +processor : 0 +cpu model : SiByte SB1 V0.2 FPU V0.2 +BogoMIPS : 532.48 +wait instruction : no +microsecond timers : yes +tlb_entries : 64 +extra interrupt vector : yes +hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8] +isa : mips1 mips2 mips3 mips4 mips5 mips32r1 mips32r2 mips64r1 mips64r2 +ASEs implemented : mdmx mips3d +shadow register sets : 1 +kscratch registers : 0 +package : 0 +core : 0 +VCED exceptions : not available +VCEI exceptions : not available +)"); + const auto info = GetMipsInfo(); + EXPECT_FALSE(info.features.msa); + EXPECT_FALSE(info.features.eva); + EXPECT_FALSE(info.features.mips16); + EXPECT_TRUE(info.features.mdmx); + EXPECT_TRUE(info.features.mips3d); + EXPECT_FALSE(info.features.smart); + EXPECT_FALSE(info.features.dsp); +} + } // namespace } // namespace cpu_features diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_ppc_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_ppc_test.cc index 78e556734..ac5615344 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_ppc_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_ppc_test.cc @@ -11,6 +11,20 @@ namespace cpu_features { namespace { +TEST(CpustringsPPCTest, PPCFeaturesEnum) +{ + const char* last_name = GetPPCFeaturesEnumName(PPC_LAST_); + EXPECT_STREQ(last_name, "unknown_feature"); + for (int i = static_cast(PPC_32); i != static_cast(PPC_LAST_); ++i) + { + const auto feature = static_cast(i); + const char* name = GetPPCFeaturesEnumName(feature); + ASSERT_FALSE(name == nullptr); + EXPECT_STRNE(name, ""); + EXPECT_STRNE(name, last_name); + } +} + TEST(CpustringsPPCTest, FromHardwareCap) { ResetHwcaps(); diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc index fe3b07e64..15f2e3217 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_x86_test.cc @@ -77,9 +77,9 @@ private: uint32_t xcr0_eax_; }; -static FakeCpu* g_fake_cpu_instance = nullptr; +static FakeCpu *g_fake_cpu_instance = nullptr; -static FakeCpu& cpu() +static FakeCpu &cpu() { assert(g_fake_cpu_instance != nullptr); return *g_fake_cpu_instance; @@ -93,7 +93,7 @@ extern "C" Leaf GetCpuidLeaf(uint32_t leaf_id, int ecx) extern "C" uint32_t GetXCR0Eax(void) { return cpu().GetXCR0Eax(); } #if defined(CPU_FEATURES_OS_MACOS) -extern "C" bool GetDarwinSysCtlByName(const char* name) +extern "C" bool GetDarwinSysCtlByName(const char *name) { return cpu().GetDarwinSysCtlByName(name); } @@ -124,6 +124,34 @@ protected: } }; +TEST_F(CpuidX86Test, X86MicroarchitectureEnum) +{ + const char *last_name = GetX86MicroarchitectureName(X86_MICROARCHITECTURE_LAST_); + EXPECT_STREQ(last_name, "unknown microarchitecture"); + for (int i = static_cast(X86_UNKNOWN); i != static_cast(X86_MICROARCHITECTURE_LAST_); ++i) + { + const auto micro = static_cast(i); + const char *name = GetX86MicroarchitectureName(micro); + ASSERT_FALSE(name == nullptr); + EXPECT_STRNE(name, ""); + EXPECT_STRNE(name, last_name); + } +} + +TEST_F(CpuidX86Test, X86FeaturesEnum) +{ + const char *last_name = GetX86FeaturesEnumName(X86_LAST_); + EXPECT_STREQ(last_name, "unknown_feature"); + for (int i = static_cast(X86_FPU); i != static_cast(X86_LAST_); ++i) + { + const auto feature = static_cast(i); + const char *name = GetX86FeaturesEnumName(feature); + ASSERT_FALSE(name == nullptr); + EXPECT_STRNE(name, ""); + EXPECT_STRNE(name, last_name); + } +} + TEST_F(CpuidX86Test, SandyBridge) { cpu().SetOsBackupsExtendedRegisters(true); @@ -216,9 +244,8 @@ TEST_F(CpuidX86Test, Branding) {{0x80000003, 0}, Leaf{0x37692029, 0x3035362D, 0x43205530, 0x40205550}}, {{0x80000004, 0}, Leaf{0x352E3220, 0x7A484730, 0x00000000, 0x00000000}}, }); - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz"); + const auto info = GetX86Info(); + EXPECT_STREQ(info.brand_string, "Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz"); } TEST_F(CpuidX86Test, KabyLakeCache) @@ -436,10 +463,6 @@ TEST_F(CpuidX86Test, AMD_K15_EXCAVATOR_STONEY_RIDGE) "AMD A9-9410 RADEON R5, 5 COMPUTE CORES 2C+3G "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_EXCAVATOR); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD A9-9410 RADEON R5, 5 COMPUTE CORES 2C+3G "); } // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F20_K15_AbuDhabi_CPUID0.txt @@ -465,9 +488,7 @@ TEST_F(CpuidX86Test, AMD_K15_PILEDRIVER_ABU_DHABI) EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_PILEDRIVER); - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD Opteron(tm) Processor 6376 "); + EXPECT_STREQ(info.brand_string, "AMD Opteron(tm) Processor 6376 "); } // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0600F20_K15_AbuDhabi_CPUID0.txt @@ -541,10 +562,6 @@ TEST_F(CpuidX86Test, AMD_K15_BULLDOZER_INTERLAGOS) "AMD Opteron(TM) Processor 6238 "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_BULLDOZER); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD Opteron(TM) Processor 6238 "); } // http://users.atw.hu/instlatx64/AuthenticAMD0630F81_K15_Godavari_CPUID.txt @@ -571,10 +588,6 @@ TEST_F(CpuidX86Test, AMD_K15_STREAMROLLER_GODAVARI) "AMD A8-7670K Radeon R7, 10 Compute Cores 4C+6G "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_STREAMROLLER); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD A8-7670K Radeon R7, 10 Compute Cores 4C+6G "); } // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0700F01_K16_Kabini_CPUID.txt @@ -598,10 +611,6 @@ TEST_F(CpuidX86Test, AMD_K16_JAGUAR_KABINI) EXPECT_STREQ(info.brand_string, "AMD A4-5000 APU with Radeon(TM) HD Graphics "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_JAGUAR); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD A4-5000 APU with Radeon(TM) HD Graphics "); } // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0730F01_K16_Beema_CPUID2.txt @@ -625,10 +634,6 @@ TEST_F(CpuidX86Test, AMD_K16_PUMA_BEEMA) EXPECT_STREQ(info.brand_string, "AMD A6-6310 APU with AMD Radeon R4 Graphics "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_PUMA); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD A6-6310 APU with AMD Radeon R4 Graphics "); } // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0820F01_K17_Dali_CPUID.txt @@ -652,10 +657,6 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_DALI) EXPECT_STREQ(info.brand_string, "AMD 3020e with Radeon Graphics "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD 3020e with Radeon Graphics "); } // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0800F82_K17_ZenP_CPUID.txt @@ -679,10 +680,6 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN_PLUS_PINNACLE_RIDGE) EXPECT_STREQ(info.brand_string, "AMD Ryzen 7 2700X Eight-Core Processor "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN_PLUS); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD Ryzen 7 2700X Eight-Core Processor "); } // http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0840F70_K17_CPUID.txt @@ -705,10 +702,6 @@ TEST_F(CpuidX86Test, AMD_K17_ZEN2_XBOX_SERIES_X) EXPECT_EQ(info.model, 0x47); EXPECT_STREQ(info.brand_string, "AMD 4700S 8-Core Processor Desktop Kit"); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN2); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD 4700S 8-Core Processor Desktop Kit"); } // http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F02_Hygon_CPUID3.txt @@ -732,10 +725,6 @@ TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA) EXPECT_STREQ(info.brand_string, "Hygon C86 3185 8-core Processor "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN); - - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "Hygon C86 3185 8-core Processor "); } // http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F02_Hygon_CPUID.txt @@ -808,10 +797,50 @@ TEST_F(CpuidX86Test, AMD_K19_ZEN3_VERMEER) EXPECT_STREQ(info.brand_string, "AMD Ryzen 9 5900X 12-Core Processor "); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN3); +} - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "AMD Ryzen 9 5900X 12-Core Processor "); +// http://users.atw.hu/instlatx64/AuthenticAMD/AuthenticAMD0A40F41_K19_Rembrandt_03_CPUID.txt +TEST_F(CpuidX86Test, AMD_K19_ZEN3) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000010, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x00000001, 0}, Leaf{0x00A40F41, 0x00100800, 0x7EF8320B, 0x178BFBFF}}, + {{0x80000000, 0}, Leaf{0x80000023, 0x68747541, 0x444D4163, 0x69746E65}}, + {{0x80000001, 0}, Leaf{0x00A40F41, 0x50000000, 0x75C237FF, 0x2FD3FBFF}}, + {{0x80000002, 0}, Leaf{0x20444D41, 0x657A7952, 0x2039206E, 0x30303936}}, + {{0x80000003, 0}, Leaf{0x77205848, 0x20687469, 0x65646152, 0x47206E6F}}, + {{0x80000004, 0}, Leaf{0x68706172, 0x20736369, 0x20202020, 0x00202020}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, "AuthenticAMD"); + EXPECT_EQ(info.family, 0x19); + EXPECT_EQ(info.model, 0x44); + EXPECT_STREQ(info.brand_string, + "AMD Ryzen 9 6900HX with Radeon Graphics "); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN3); +} + +// http://users.atw.hu/instlatx64/HygonGenuine/HygonGenuine0900F11_Hygon_01_CPUID.txt +TEST_F(CpuidX86Test, AMD_K18_ZEN_DHYANA_OCTAL_CORE_C86_3250) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x0000000D, 0x6F677948, 0x656E6975, 0x6E65476E}}, + {{0x00000001, 0}, Leaf{0x00900F11, 0x00100800, 0x76D8320B, 0x178BFBFF}}, + {{0x80000000, 0}, Leaf{0x8000001F, 0x6F677948, 0x656E6975, 0x6E65476E}}, + {{0x80000001, 0}, Leaf{0x00900F11, 0x60000000, 0x35C233FF, 0x2FD3FBFF}}, + {{0x80000002, 0}, Leaf{0x6F677948, 0x3843206E, 0x32332036, 0x20203035}}, + {{0x80000003, 0}, Leaf{0x6F632D38, 0x50206572, 0x65636F72, 0x726F7373}}, + {{0x80000004, 0}, Leaf{0x20202020, 0x20202020, 0x20202020, 0x00202020}}, + }); + const auto info = GetX86Info(); + + EXPECT_EQ(info.model, 0x01); + EXPECT_EQ(info.family, 0x18); + EXPECT_STREQ(info.vendor, "HygonGenuine"); + EXPECT_STREQ(info.brand_string, + "Hygon C86 3250 8-core Processor "); + EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::AMD_ZEN); } // https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel00106A1_Nehalem_CPUID.txt @@ -823,6 +852,9 @@ TEST_F(CpuidX86Test, Nehalem) cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE); cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE); cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE); #elif defined(CPU_FEATURES_OS_MACOS) cpu().SetDarwinSysCtlByName("hw.optional.sse"); cpu().SetDarwinSysCtlByName("hw.optional.sse2"); @@ -831,7 +863,7 @@ TEST_F(CpuidX86Test, Nehalem) cpu().SetDarwinSysCtlByName("hw.optional.sse4_1"); cpu().SetDarwinSysCtlByName("hw.optional.sse4_2"); #elif defined(CPU_FEATURES_OS_FREEBSD) - auto& fs = GetEmptyFilesystem(); + auto &fs = GetEmptyFilesystem(); fs.CreateFile("/var/run/dmesg.boot", R"( ---<>--- Copyright (c) 1992-2020 The FreeBSD Project. @@ -841,7 +873,7 @@ FreeBSD is a registered trademark of The FreeBSD Foundation. real memory = 2147418112 (2047 MB) )"); #elif defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID) - auto& fs = GetEmptyFilesystem(); + auto &fs = GetEmptyFilesystem(); fs.CreateFile("/proc/cpuinfo", R"(processor : flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2 )"); @@ -883,20 +915,12 @@ flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2 "Genuine Intel(R) CPU @ 0000 @ 1.87GHz"); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_NHM); - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, "Genuine Intel(R) CPU @ 0000 @ 1.87GHz"); - EXPECT_TRUE(info.features.sse); EXPECT_TRUE(info.features.sse2); EXPECT_TRUE(info.features.sse3); -#if !defined(CPU_FEATURES_OS_WINDOWS) - // Currently disabled on Windows as IsProcessorFeaturePresent do not support - // feature detection > sse3. EXPECT_TRUE(info.features.ssse3); EXPECT_TRUE(info.features.sse4_1); EXPECT_TRUE(info.features.sse4_2); -#endif // !defined(CPU_FEATURES_OS_WINDOWS) } // https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0030673_Silvermont3_CPUID.txt @@ -908,6 +932,9 @@ TEST_F(CpuidX86Test, Atom) cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE); cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE); cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE); #elif defined(CPU_FEATURES_OS_MACOS) cpu().SetDarwinSysCtlByName("hw.optional.sse"); cpu().SetDarwinSysCtlByName("hw.optional.sse2"); @@ -916,7 +943,7 @@ TEST_F(CpuidX86Test, Atom) cpu().SetDarwinSysCtlByName("hw.optional.sse4_1"); cpu().SetDarwinSysCtlByName("hw.optional.sse4_2"); #elif defined(CPU_FEATURES_OS_FREEBSD) - auto& fs = GetEmptyFilesystem(); + auto &fs = GetEmptyFilesystem(); fs.CreateFile("/var/run/dmesg.boot", R"( ---<>--- Copyright (c) 1992-2020 The FreeBSD Project. @@ -926,7 +953,7 @@ FreeBSD is a registered trademark of The FreeBSD Foundation. real memory = 2147418112 (2047 MB) )"); #elif defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID) - auto& fs = GetEmptyFilesystem(); + auto &fs = GetEmptyFilesystem(); fs.CreateFile("/proc/cpuinfo", R"( flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2 )"); @@ -968,20 +995,12 @@ flags : fpu mmx sse sse2 pni ssse3 sse4_1 sse4_2 EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_ATOM_SMT); - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, " Intel(R) Celeron(R) CPU J1900 @ 1.99GHz"); - EXPECT_TRUE(info.features.sse); EXPECT_TRUE(info.features.sse2); EXPECT_TRUE(info.features.sse3); -#if !defined(CPU_FEATURES_OS_WINDOWS) - // Currently disabled on Windows as IsProcessorFeaturePresent do not support - // feature detection > sse3. EXPECT_TRUE(info.features.ssse3); EXPECT_TRUE(info.features.sse4_1); EXPECT_TRUE(info.features.sse4_2); -#endif // !defined(CPU_FEATURES_OS_WINDOWS) } // https://www.felixcloutier.com/x86/cpuid#example-3-1--example-of-cache-and-tlb-interpretation @@ -1047,7 +1066,7 @@ TEST_F(CpuidX86Test, P3) #elif defined(CPU_FEATURES_OS_MACOS) cpu().SetDarwinSysCtlByName("hw.optional.sse"); #elif defined(CPU_FEATURES_OS_FREEBSD) - auto& fs = GetEmptyFilesystem(); + auto &fs = GetEmptyFilesystem(); fs.CreateFile("/var/run/dmesg.boot", R"( ---<>--- Copyright (c) 1992-2020 The FreeBSD Project. @@ -1056,7 +1075,7 @@ FreeBSD is a registered trademark of The FreeBSD Foundation. real memory = 2147418112 (2047 MB) )"); #elif defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID) - auto& fs = GetEmptyFilesystem(); + auto &fs = GetEmptyFilesystem(); fs.CreateFile("/proc/cpuinfo", R"( flags : fpu mmx sse )"); @@ -1076,21 +1095,13 @@ flags : fpu mmx sse EXPECT_STREQ(info.brand_string, ""); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::X86_UNKNOWN); - char brand_string[49]; - FillX86BrandString(brand_string); - EXPECT_STREQ(brand_string, ""); - EXPECT_TRUE(info.features.mmx); EXPECT_TRUE(info.features.sse); EXPECT_FALSE(info.features.sse2); EXPECT_FALSE(info.features.sse3); -#if !defined(CPU_FEATURES_OS_WINDOWS) - // Currently disabled on Windows as IsProcessorFeaturePresent do not support - // feature detection > sse3. EXPECT_FALSE(info.features.ssse3); EXPECT_FALSE(info.features.sse4_1); EXPECT_FALSE(info.features.sse4_2); -#endif // !defined(CPU_FEATURES_OS_WINDOWS) } // https://github.com/InstLatx64/InstLatx64/blob/master/GenuineIntel/GenuineIntel0000480_486_CPUID.txt @@ -1155,11 +1166,53 @@ TEST_F(CpuidX86Test, INTEL_KNIGHTS_LANDING) X86Microarchitecture::INTEL_KNIGHTS_L); } +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00806EC_CometLake_CPUID2.txt +TEST_F(CpuidX86Test, INTEL_CML_U) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000806EC, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0x8E); + EXPECT_EQ(info.stepping, 0x0C); + EXPECT_EQ(GetX86Microarchitecture(&info), + X86Microarchitecture::INTEL_CML); +} + +// http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00A0652_CometLake_CPUID1.txt +TEST_F(CpuidX86Test, INTEL_CML_H) +{ + cpu().SetLeaves({ + {{0x00000000, 0}, Leaf{0x00000016, 0x756E6547, 0x6C65746E, 0x49656E69}}, + {{0x00000001, 0}, Leaf{0x000A0652, 0x00100800, 0x7FFAFBBF, 0xBFEBFBFF}}, + }); + const auto info = GetX86Info(); + + EXPECT_STREQ(info.vendor, "GenuineIntel"); + EXPECT_EQ(info.family, 0x06); + EXPECT_EQ(info.model, 0xA5); + EXPECT_EQ(GetX86Microarchitecture(&info), + X86Microarchitecture::INTEL_CML); +} + // https://github.com/google/cpu_features/issues/200 // http://users.atw.hu/instlatx64/GenuineIntel/GenuineIntel00206F2_Eagleton_CPUID.txt #if defined(CPU_FEATURES_OS_WINDOWS) TEST_F(CpuidX86Test, WIN_INTEL_WESTMERE_EX) { + // Pre AVX cpus don't have xsave + cpu().SetOsBackupsExtendedRegisters(false); + cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE); + cpu().SetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE); + cpu().SetLeaves({ {{0x00000000, 0}, Leaf{0x0000000B, 0x756E6547, 0x6C65746E, 0x49656E69}}, {{0x00000001, 0}, Leaf{0x000206F2, 0x00400800, 0x02BEE3FF, 0xBFEBFBFF}}, @@ -1170,15 +1223,12 @@ TEST_F(CpuidX86Test, WIN_INTEL_WESTMERE_EX) EXPECT_EQ(info.model, 0x2F); EXPECT_EQ(GetX86Microarchitecture(&info), X86Microarchitecture::INTEL_WSM); -#if (_WIN32_WINNT < 0x0601) // before Win7 - EXPECT_FALSE(info.features.ssse3); - EXPECT_FALSE(info.features.sse4_1); - EXPECT_FALSE(info.features.sse4_2); -#else + EXPECT_TRUE(info.features.sse); + EXPECT_TRUE(info.features.sse2); + EXPECT_TRUE(info.features.sse3); EXPECT_TRUE(info.features.ssse3); EXPECT_TRUE(info.features.sse4_1); EXPECT_TRUE(info.features.sse4_2); -#endif } #endif // CPU_FEATURES_OS_WINDOWS diff --git a/src/algorithms/observables/adapters/CMakeLists.txt b/src/algorithms/observables/adapters/CMakeLists.txt index e2b0ce826..a4097a4dd 100644 --- a/src/algorithms/observables/adapters/CMakeLists.txt +++ b/src/algorithms/observables/adapters/CMakeLists.txt @@ -20,7 +20,7 @@ endif() target_include_directories(obs_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) target_link_libraries(obs_adapters diff --git a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt index 3a27a58d4..7f6537ccf 100644 --- a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt @@ -20,7 +20,7 @@ endif() target_include_directories(obs_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/algorithms/libs + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) target_link_libraries(obs_gr_blocks @@ -47,7 +47,7 @@ endif() target_include_directories(obs_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(GNURADIO_USES_STD_POINTERS) diff --git a/src/algorithms/resampler/adapters/CMakeLists.txt b/src/algorithms/resampler/adapters/CMakeLists.txt index 1a0cc1e24..ac4eca082 100644 --- a/src/algorithms/resampler/adapters/CMakeLists.txt +++ b/src/algorithms/resampler/adapters/CMakeLists.txt @@ -45,7 +45,7 @@ target_link_libraries(resampler_adapters target_include_directories(resampler_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(GNURADIO_IS_38_OR_GREATER) diff --git a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt index 0a27cf6d8..ae521eeb9 100644 --- a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt @@ -60,7 +60,7 @@ endif() target_include_directories(resampler_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/signal_generator/adapters/CMakeLists.txt b/src/algorithms/signal_generator/adapters/CMakeLists.txt index aa3d3d9fc..e8486b326 100644 --- a/src/algorithms/signal_generator/adapters/CMakeLists.txt +++ b/src/algorithms/signal_generator/adapters/CMakeLists.txt @@ -34,8 +34,8 @@ target_link_libraries(signal_generator_adapters target_include_directories(signal_generator_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces - ${CMAKE_SOURCE_DIR}/src/core/receiver + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/receiver ) if(GNURADIO_USES_STD_POINTERS) diff --git a/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt index 1551b9eeb..d62f34cbd 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt @@ -38,7 +38,7 @@ endif() target_include_directories(signal_generator_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) # Workaround for CentOS 7 diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc index 8fc999673..66fe87abc 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -28,6 +28,7 @@ #include "gps_sdr_signal_replica.h" #include #include +#include #include #include #include @@ -187,8 +188,8 @@ void signal_generator_c::generate_codes() // Concatenate "num_of_codes_per_vector_" codes for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++) { - memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]), - code.data(), sizeof(gr_complex) * samples_per_code_[sat]); + std::copy_n(code.data(), samples_per_code_[sat], + &(sampled_code_data_[sat][i * samples_per_code_[sat]])); } } else if (system_[sat] == "R") @@ -209,8 +210,8 @@ void signal_generator_c::generate_codes() // Concatenate "num_of_codes_per_vector_" codes for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++) { - memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]), - code.data(), sizeof(gr_complex) * samples_per_code_[sat]); + std::copy_n(code.data(), samples_per_code_[sat], + &(sampled_code_data_[sat][i * samples_per_code_[sat]])); } } else if (system_[sat] == "E") @@ -261,8 +262,8 @@ void signal_generator_c::generate_codes() // Concatenate "num_of_codes_per_vector_" codes for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++) { - memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]), - code.data(), sizeof(gr_complex) * samples_per_code_[sat]); + std::copy_n(code.data(), samples_per_code_[sat], + &(sampled_code_data_[sat][i * samples_per_code_[sat]])); } // Generate E6C signal (100 code-periods, with secondary code) galileo_e6_c_code_gen_complex_sampled(sampled_code_pilot_[sat], PRN_[sat], fs_in_, @@ -297,8 +298,8 @@ void signal_generator_c::generate_codes() // Concatenate "num_of_codes_per_vector_" codes for (unsigned int i = 0; i < num_of_codes_per_vector_[sat]; i++) { - memcpy(&(sampled_code_data_[sat][i * samples_per_code_[sat]]), - code.data(), sizeof(gr_complex) * samples_per_code_[sat]); + std::copy_n(code.data(), samples_per_code_[sat], + &(sampled_code_data_[sat][i * samples_per_code_[sat]])); } // Generate E1C signal (25 code-periods, with secondary code) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 32a9c6bc9..e99748358 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -148,7 +148,7 @@ endif() target_include_directories(signal_source_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_FPGA OR ENABLE_AD9361) diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 0d952d6e7..f7ab32057 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -42,6 +42,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configura gain_(configuration->property(role + ".gain", 40.0)), if_gain_(configuration->property(role + ".if_gain", 40.0)), rf_gain_(configuration->property(role + ".rf_gain", 40.0)), + if_bw_(configuration->property(role + ".if_bw", 0.0)), samples_(configuration->property(role + ".samples", static_cast(0))), in_stream_(in_stream), out_stream_(out_stream), @@ -118,6 +119,12 @@ OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configura } } + // 5. set bandwidth + if (if_bw_ > 0.0) + { + osmosdr_source_->set_bandwidth(if_bw_, 0); + } + // Get actual bandwidth std::cout << "Actual Bandwidth: " << osmosdr_source_->get_bandwidth(0) << " [Hz]...\n"; } diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h index cc34de155..b9fd4763b 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h @@ -79,6 +79,7 @@ private: double gain_; double if_gain_; double rf_gain_; + double if_bw_; size_t item_size_; int64_t samples_; diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 6172102bc..c1198c08b 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -76,7 +76,7 @@ target_link_libraries(signal_source_gr_blocks target_include_directories(signal_source_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/receiver + ${GNSSSDR_SOURCE_DIR}/src/core/receiver ) if(GNURADIO_USES_STD_POINTERS) diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 9d57575e6..34cb13e88 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -69,9 +69,9 @@ target_link_libraries(signal_source_libs target_include_directories(signal_source_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/receiver - ${CMAKE_SOURCE_DIR}/src/core/interfaces - ${CMAKE_SOURCE_DIR}/src/algorithms/libs + ${GNSSSDR_SOURCE_DIR}/src/core/receiver + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) if(GNURADIO_USES_STD_POINTERS) diff --git a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt index a374f25d0..9c0ae28ee 100644 --- a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt @@ -66,7 +66,7 @@ target_link_libraries(telemetry_decoder_adapters target_include_directories(telemetry_decoder_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index 7506f1fb8..d6bed4f97 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -79,12 +79,12 @@ endif() target_include_directories(telemetry_decoder_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) target_include_directories(telemetry_decoder_gr_blocks PRIVATE - ${CMAKE_SOURCE_DIR}/src/algorithms/libs # for gnss_sdr_make_unique.h + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs # for gnss_sdr_make_unique.h ) if(has_rotl) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index 2de471af1..729dd2af3 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -264,7 +264,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols) d_nav_msg_packet.nav_message = data_bits; } - if (d_satellite.get_PRN() > 0 && d_satellite.get_PRN() < 6) + if ((d_satellite.get_PRN() > 0 && d_satellite.get_PRN() < 6) || d_satellite.get_PRN() > 58) { d_nav.d2_subframe_decoder(data_bits); } @@ -339,7 +339,7 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell d_nav.set_signal_type(1); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q) // Update tel dec parameters for D2 NAV Messages - if (sat_prn > 0 && sat_prn < 6) + if ((sat_prn > 0 && sat_prn < 6) || sat_prn > 58) { d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index b5c93428f..0ea53fad5 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -356,7 +356,7 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite( d_nav.set_signal_type(5); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q) // Update tel dec parameters for D2 NAV Messages - if (sat_prn > 0 && sat_prn < 6) + if ((sat_prn > 0 && sat_prn < 6) || sat_prn > 58) { d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; diff --git a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt index 4bf84f6d7..befb48ddf 100644 --- a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt @@ -54,7 +54,7 @@ target_link_libraries(telemetry_decoder_libs target_include_directories(telemetry_decoder_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index b4110e1c0..863fcba8e 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -105,7 +105,7 @@ target_link_libraries(tracking_adapters target_include_directories(tracking_adapters PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_FPGA) diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index e397f6c40..eae1f6c8d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -96,7 +96,7 @@ endif() target_include_directories(tracking_gr_blocks PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_CUDA) diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index aa0f23e63..346369dc1 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -109,6 +109,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) d_state(0), // initial state: standby d_current_prn_length_samples(static_cast(d_trk_parameters.vector_length)), d_extend_correlation_symbols_count(0), + d_extend_correlation_symbols(d_trk_parameters.extend_correlation_symbols), d_cn0_estimation_counter(0), d_carrier_lock_fail_counter(0), d_code_lock_fail_counter(0), @@ -652,6 +653,7 @@ void dll_pll_veml_tracking::start_tracking() Signal_[0] = d_acquisition_gnss_synchro->Signal[0]; Signal_[1] = d_acquisition_gnss_synchro->Signal[1]; Signal_[2] = d_acquisition_gnss_synchro->Signal[2]; + d_extend_correlation_symbols = d_trk_parameters.extend_correlation_symbols; if (d_systemName == "GPS" and d_signal_type == "1C") { @@ -757,7 +759,7 @@ void dll_pll_veml_tracking::start_tracking() { beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); // GEO Satellites use different secondary code - if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) + if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or (d_acquisition_gnss_synchro->PRN > 58)) { d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_correlation_length_ms = 1; @@ -769,6 +771,10 @@ void dll_pll_veml_tracking::start_tracking() d_secondary_code_string = BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR; d_data_secondary_code_length = 0; d_Prompt_circular_buffer.set_capacity(d_secondary_code_length); + if (d_extend_correlation_symbols > BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT) + { + d_extend_correlation_symbols = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; + } } else { @@ -790,7 +796,7 @@ void dll_pll_veml_tracking::start_tracking() { beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); // Update secondary code settings for geo satellites - if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) + if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or (d_acquisition_gnss_synchro->PRN > 58)) { d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_correlation_length_ms = 1; @@ -802,6 +808,10 @@ void dll_pll_veml_tracking::start_tracking() d_secondary_code_string = BEIDOU_B3I_GEO_PREAMBLE_SYMBOLS_STR; d_data_secondary_code_length = 0; d_Prompt_circular_buffer.set_capacity(d_secondary_code_length); + if (d_extend_correlation_symbols > BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT) + { + d_extend_correlation_symbols = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; + } } else { @@ -1876,12 +1886,12 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) { // UPDATE INTEGRATION TIME d_extend_correlation_symbols_count = 0; - d_current_correlation_time_s = static_cast(d_trk_parameters.extend_correlation_symbols) * static_cast(d_code_period); + d_current_correlation_time_s = static_cast(d_extend_correlation_symbols) * static_cast(d_code_period); d_state = 3; // next state is the extended correlator integrator - LOG(INFO) << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " + LOG(INFO) << "Enabled " << d_extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " << d_channel << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN); - std::cout << "Enabled " << d_trk_parameters.extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " + std::cout << "Enabled " << d_extend_correlation_symbols * static_cast(d_code_period * 1000.0) << " ms extended correlator in channel " << d_channel << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << '\n'; // Set narrow taps delay values [chips] @@ -1947,7 +1957,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) d_P_data_accu = gr_complex(0.0, 0.0); } d_extend_correlation_symbols_count++; - if (d_extend_correlation_symbols_count == (d_trk_parameters.extend_correlation_symbols - 1)) + if (d_extend_correlation_symbols_count == (d_extend_correlation_symbols - 1)) { d_extend_correlation_symbols_count = 0; d_state = 4; @@ -1961,7 +1971,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) save_correlation_results(); // check lock status - if (!cn0_and_tracking_lock_status(d_code_period * static_cast(d_trk_parameters.extend_correlation_symbols))) + if (!cn0_and_tracking_lock_status(d_code_period * static_cast(d_extend_correlation_symbols))) { clear_tracking_vars(); d_state = 0; // loss-of-lock detected diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h index 1026a6635..0c0856ee2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h @@ -180,6 +180,7 @@ private: int32_t d_n_correlator_taps; int32_t d_current_prn_length_samples; int32_t d_extend_correlation_symbols_count; + int32_t d_extend_correlation_symbols; int32_t d_current_symbol; int32_t d_current_data_symbol; int32_t d_cn0_estimation_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_vtl_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_vtl_tracking.cc index f0fce6afd..a01caaf99 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_vtl_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_vtl_tracking.cc @@ -732,7 +732,7 @@ void kf_vtl_tracking::start_tracking() { beidou_b1i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); // GEO Satellites use different secondary code - if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) + if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or d_acquisition_gnss_synchro->PRN > 58) { d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_correlation_length_ms = 1; @@ -765,7 +765,7 @@ void kf_vtl_tracking::start_tracking() { beidou_b3i_code_gen_float(d_tracking_code, d_acquisition_gnss_synchro->PRN, 0); // Update secondary code settings for geo satellites - if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) + if ((d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6) or d_acquisition_gnss_synchro->PRN > 58) { d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; // todo: enable after fixing beidou symbol synchronization d_correlation_length_ms = 1; @@ -844,18 +844,17 @@ void kf_vtl_tracking::init_kf(double acq_code_phase_chips, double acq_doppler_hz const double Ti = d_correlation_length_ms * 0.001; // state vector: code_phase_chips, carrier_phase_rads, carrier_freq_hz,carrier_freq_rate_hz, code_freq_chips_s d_F = arma::mat(5, 5); - d_F << 1 << 0 << 0 << 0 << Ti << arma::endr - << 0 << 1 << 2.0 * GNSS_PI * Ti << GNSS_PI * (Ti * Ti) << 0 << arma::endr - << 0 << 0 << 1 << Ti << 0 << arma::endr - << 0 << 0 << 0 << 1 << 0 << arma::endr - << 0 << 0 << 0 << 0 << 1 << arma::endr; + d_F = {{1, 0, 0, 0, Ti}, + {0, 1, 2.0 * GNSS_PI * Ti, GNSS_PI * (Ti * Ti), 0}, + {0, 0, 1, Ti, 0}, + {0, 0, 0, 1, 0}, + {0, 0, 0, 0, 1}}; const double B = d_code_chip_rate / d_signal_carrier_freq; // carrier to code rate factor d_H = arma::mat(2, 5); - d_H << 1 << 0 << -B * Ti / 2.0 << B * (Ti * Ti) / 6.0 << 0 << arma::endr - << 0 << 1 << -GNSS_PI * Ti << GNSS_PI * (Ti * Ti) / 3.0 << 0 << arma::endr; - + d_H = {{1, 0, -B * Ti / 2.0, B * (Ti * Ti) / 6.0, 0}, + {0, 1, -GNSS_PI * Ti, GNSS_PI * (Ti * Ti) / 3.0, 0}}; // Phase noise variance // const double CN0_lin = pow(10.0, d_trk_parameters.expected_cn0_dbhz / 10.0); // CN0 in Hz // const double N_periods = 1; // Only 1 interval @@ -866,32 +865,26 @@ void kf_vtl_tracking::init_kf(double acq_code_phase_chips, double acq_doppler_hz d_R = arma::mat(2, 2); // d_R << Sigma2_Tau << 0 << arma::endr // << 0 << Sigma2_Phase << arma::endr; - - d_R << pow(d_trk_parameters.code_disc_sd_chips, 2.0) << 0 << arma::endr - << 0 << pow(d_trk_parameters.carrier_disc_sd_rads, 2.0) << arma::endr; - + d_R = {{pow(d_trk_parameters.code_disc_sd_chips, 2.0), 0}, + {0, pow(d_trk_parameters.carrier_disc_sd_rads, 2.0)}}; // system covariance matrix (static) d_Q = arma::mat(5, 5); - d_Q << pow(d_trk_parameters.code_phase_sd_chips, 2.0) << 0 << 0 << 0 << 0 << arma::endr - << 0 << pow(d_trk_parameters.carrier_phase_sd_rad, 2.0) << 0 << 0 << 0 << arma::endr - << 0 << 0 << pow(d_trk_parameters.carrier_freq_sd_hz, 2.0) << 0 << 0 << arma::endr - << 0 << 0 << 0 << pow(d_trk_parameters.carrier_freq_rate_sd_hz_s, 2.0) << 0 << arma::endr - << 0 << 0 << 0 << 0 << pow(d_trk_parameters.code_rate_sd_chips_s, 2.0) << arma::endr; - + d_Q = {{pow(d_trk_parameters.code_phase_sd_chips, 2.0), 0, 0, 0, 0}, + {0, pow(d_trk_parameters.carrier_phase_sd_rad, 2.0), 0, 0, 0}, + {0, 0, pow(d_trk_parameters.carrier_freq_sd_hz, 2.0), 0, 0}, + {0, 0, 0, pow(d_trk_parameters.carrier_freq_rate_sd_hz_s, 2.0), 0}, + {0, 0, 0, 0, pow(d_trk_parameters.code_rate_sd_chips_s, 2.0)}}; // initial Kalman covariance matrix d_P_old_old = arma::mat(5, 5); - - d_P_old_old << pow(d_trk_parameters.init_code_phase_sd_chips, 2.0) << 0 << 0 << 0 << 0 << arma::endr - << 0 << pow(d_trk_parameters.init_carrier_phase_sd_rad, 2.0) << 0 << 0 << 0 << arma::endr - << 0 << 0 << pow(d_trk_parameters.init_carrier_freq_sd_hz, 2.0) << 0 << 0 << arma::endr - << 0 << 0 << 0 << pow(d_trk_parameters.init_carrier_freq_rate_sd_hz_s, 2.0) << 0 << arma::endr - << 0 << 0 << 0 << 0 << pow(d_trk_parameters.init_code_rate_sd_chips_s, 2.0) << arma::endr; - + d_P_old_old = {{pow(d_trk_parameters.init_code_phase_sd_chips, 2.0), 0, 0, 0, 0}, + {0, pow(d_trk_parameters.init_carrier_phase_sd_rad, 2.0), 0, 0, 0}, + {0, 0, pow(d_trk_parameters.init_carrier_freq_rate_sd_hz_s, 2.0), 0, 0}, + {0, 0, 0, pow(d_trk_parameters.init_carrier_freq_rate_sd_hz_s, 2.0), 0}, + {0, 0, 0, 0, pow(d_trk_parameters.init_code_rate_sd_chips_s, 2.0)}}; // init state vector d_x_old_old = arma::vec(5); // states: code_phase_chips, carrier_phase_rads, carrier_freq_hz, carrier_freq_rate_hz_s, code_freq_rate_chips_s - d_x_old_old << acq_code_phase_chips << 0 << acq_doppler_hz << 0 << 0 << arma::endr; - + d_x_old_old = {acq_code_phase_chips, 0, acq_doppler_hz, 0, 0}; // std::cout << "F: " << d_F << "\n"; // std::cout << "H: " << d_H << "\n"; // std::cout << "R: " << d_R << "\n"; @@ -907,27 +900,26 @@ void kf_vtl_tracking::update_kf_narrow_integration_time() const double Ti = d_current_correlation_time_s; // state vector: code_phase_chips, carrier_phase_rads, carrier_freq_hz,carrier_freq_rate_hz, code_freq_chips_s - d_F << 1 << 0 << 0 << 0 << Ti << arma::endr - << 0 << 1 << 2.0 * GNSS_PI * Ti << GNSS_PI * (Ti * Ti) << 0 << arma::endr - << 0 << 0 << 1 << Ti << 0 << arma::endr - << 0 << 0 << 0 << 1 << 0 << arma::endr - << 0 << 0 << 0 << 0 << 1 << arma::endr; - + d_F = {{1, 0, 0, 0, Ti}, + {0, 1, 2.0 * GNSS_PI * Ti, GNSS_PI * (Ti * Ti), 0}, + {0, 0, 1, Ti, 0}, + {0, 0, 0, 1, 0}, + {0, 0, 0, 0, 1}}; const double B = d_code_chip_rate / d_signal_carrier_freq; // carrier to code rate factor - d_H << 1 << 0 << -B * Ti / 2.0 << B * (Ti * Ti) / 6.0 << 0 << arma::endr - << 0 << 1 << -GNSS_PI * Ti << GNSS_PI * (Ti * Ti) / 3.0 << 0 << arma::endr; + d_H = {{1, 0, -B * Ti / 2.0, B * (Ti * Ti) / 6.0, 0}, + {0, 1, -GNSS_PI * Ti, GNSS_PI * (Ti * Ti) / 3.0, 0}}; // measurement covariance matrix (static) - d_R << pow(d_trk_parameters.code_disc_sd_chips, 2.0) << 0 << arma::endr - << 0 << pow(d_trk_parameters.carrier_disc_sd_rads, 2.0) << arma::endr; + d_R = {{pow(d_trk_parameters.code_disc_sd_chips, 2.0), 0}, + {0, pow(d_trk_parameters.carrier_disc_sd_rads, 2.0)}}; // system covariance matrix (static) - d_Q << pow(d_trk_parameters.narrow_code_phase_sd_chips, 2.0) << 0 << 0 << 0 << 0 << arma::endr - << 0 << pow(d_trk_parameters.narrow_carrier_phase_sd_rad, 2.0) << 0 << 0 << 0 << arma::endr - << 0 << 0 << pow(d_trk_parameters.narrow_carrier_freq_sd_hz, 2.0) << 0 << 0 << arma::endr - << 0 << 0 << 0 << pow(d_trk_parameters.narrow_carrier_freq_rate_sd_hz_s, 2.0) << 0 << arma::endr - << 0 << 0 << 0 << 0 << pow(d_trk_parameters.narrow_code_rate_sd_chips_s, 2.0) << arma::endr; + d_Q = {{pow(d_trk_parameters.narrow_code_phase_sd_chips, 2.0), 0, 0, 0, 0}, + {0, pow(d_trk_parameters.narrow_carrier_phase_sd_rad, 2.0), 0, 0, 0}, + {0, 0, pow(d_trk_parameters.narrow_carrier_freq_sd_hz, 2.0), 0, 0}, + {0, 0, 0, pow(d_trk_parameters.narrow_carrier_freq_rate_sd_hz_s, 2.0), 0}, + {0, 0, 0, 0, pow(d_trk_parameters.narrow_code_rate_sd_chips_s, 2.0)}}; } @@ -938,8 +930,8 @@ void kf_vtl_tracking::update_kf_cn0(double current_cn0_dbhz) const double B = d_code_chip_rate / d_signal_carrier_freq; // carrier to code rate factor d_H = arma::mat(2, 5); - d_H << 1 << 0 << -B * Ti / 2.0 << B * (Ti * Ti) / 6.0 << 0 << arma::endr - << 0 << 1 << -GNSS_PI * Ti << GNSS_PI * (Ti * Ti) / 3.0 << 0 << arma::endr; + d_H = {{1, 0, -B * Ti / 2.0, B * (Ti * Ti) / 6.0, 0}, + {0, 1, -GNSS_PI * Ti, GNSS_PI * (Ti * Ti) / 3.0, 0}}; // Phase noise variance const double CN0_lin = pow(10.0, current_cn0_dbhz / 10.0); // CN0 in Hz @@ -949,8 +941,8 @@ void kf_vtl_tracking::update_kf_cn0(double current_cn0_dbhz) // measurement covariance matrix (static) d_R = arma::mat(2, 2); - d_R << Sigma2_Tau << 0 << arma::endr - << 0 << Sigma2_Phase << arma::endr; + d_R = {{Sigma2_Tau, 0}, + {0, Sigma2_Phase}}; } diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index b8e80cd37..5b9520c0a 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -144,7 +144,7 @@ endif() target_include_directories(tracking_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(ENABLE_CLANG_TIDY) diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 7b4a271cb..994501ecf 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/docs/protobuf/nav_message.proto) +protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${GNSSSDR_SOURCE_DIR}/docs/protobuf/nav_message.proto) add_subdirectory(supl) @@ -114,7 +114,7 @@ endif() target_include_directories(core_libs PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) if(USE_GENERIC_LAMBDAS) @@ -172,5 +172,5 @@ endif() set_property(TARGET core_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ - $ + $ ) diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index e2e9a3c73..6bc814334 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -839,7 +839,7 @@ bool Gnss_Sdr_Supl_Client::load_gal_almanac_xml(const std::string& file_name) } catch (std::exception& e) { - // Maybe the file is from https://www.gsc-europa.eu/product-almanacs ? + // Maybe the file is from https://www.gsc-europa.eu/gsc-products/almanac ? return this->read_gal_almanac_from_gsa(file_name); } LOG(INFO) << "Loaded Galileo almanac map data with " << this->gal_almanac_map.size() << " satellites"; diff --git a/src/core/monitor/CMakeLists.txt b/src/core/monitor/CMakeLists.txt index fe8743c05..4f6211a40 100644 --- a/src/core/monitor/CMakeLists.txt +++ b/src/core/monitor/CMakeLists.txt @@ -5,7 +5,7 @@ # SPDX-License-Identifier: BSD-3-Clause -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/docs/protobuf/gnss_synchro.proto) +protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${GNSSSDR_SOURCE_DIR}/docs/protobuf/gnss_synchro.proto) set(CORE_MONITOR_LIBS_SOURCES gnss_synchro_monitor.cc @@ -56,9 +56,9 @@ get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY) target_include_directories(core_monitor PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces PRIVATE - ${CMAKE_SOURCE_DIR}/src/algorithms/libs # for gnss_sdr_make_unique + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs # for gnss_sdr_make_unique ) # Do not apply clang-tidy fixes to protobuf generated headers diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index b2eacfcfd..65b1a2072 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -29,14 +29,14 @@ list(SORT GNSS_RECEIVER_HEADERS) list(SORT GNSS_RECEIVER_SOURCES) set(GNSS_RECEIVER_INTERFACE_HEADERS - ${CMAKE_SOURCE_DIR}/src/core/interfaces/acquisition_interface.h - ${CMAKE_SOURCE_DIR}/src/core/interfaces/channel_interface.h - ${CMAKE_SOURCE_DIR}/src/core/interfaces/configuration_interface.h - ${CMAKE_SOURCE_DIR}/src/core/interfaces/gnss_block_interface.h - ${CMAKE_SOURCE_DIR}/src/core/interfaces/observables_interface.h - ${CMAKE_SOURCE_DIR}/src/core/interfaces/pvt_interface.h - ${CMAKE_SOURCE_DIR}/src/core/interfaces/telemetry_decoder_interface.h - ${CMAKE_SOURCE_DIR}/src/core/interfaces/tracking_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/acquisition_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/channel_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/configuration_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/gnss_block_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/observables_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/pvt_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/telemetry_decoder_interface.h + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces/tracking_interface.h ) list(SORT GNSS_RECEIVER_INTERFACE_HEADERS) @@ -252,6 +252,6 @@ if(ENABLE_CLANG_TIDY) endif() set_property(TARGET core_receiver APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES - $ - $ + $ + $ ) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 990780e3d..eaf193c76 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -1010,7 +1010,8 @@ int GNSSFlowgraph::connect_signal_conditioners_to_channels() try { - selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0); + selected_signal_conditioner_ID = configuration_->property("Channels_" + channels_.at(i)->get_signal().get_signal_str() + ".RF_channel_ID", 0); + selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", selected_signal_conditioner_ID); } catch (const std::exception& e) { diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 49d8fdb80..3e25387ed 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -122,7 +122,7 @@ target_link_libraries(core_system_parameters # for gnss_sdr_make_unique.h target_include_directories(core_system_parameters PUBLIC - ${CMAKE_SOURCE_DIR}/src/algorithms/libs + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) if(ENABLE_CLANG_TIDY) diff --git a/src/core/system_parameters/MATH_CONSTANTS.h b/src/core/system_parameters/MATH_CONSTANTS.h index 937ab12b0..cba448d32 100644 --- a/src/core/system_parameters/MATH_CONSTANTS.h +++ b/src/core/system_parameters/MATH_CONSTANTS.h @@ -77,8 +77,8 @@ constexpr double TWO_N9 = 0.001953125; //!< 2^-9 constexpr double TWO_N10 = 0.0009765625; //!< 2^-10 constexpr double TWO_N11 = 4.882812500000000e-004; //!< 2^-11 constexpr double TWO_N14 = 0.00006103515625; //!< 2^-14 -constexpr double TWO_N15 = 0.00003051757813; //!< 2^-15 -constexpr double TWO_N16 = 0.0000152587890625; //!< 2^-16 +constexpr double TWO_N15 = 3.051757812500000e-005; //!< 2^-15 +constexpr double TWO_N16 = 1.525878906250000e-005; //!< 2^-16 constexpr double TWO_N17 = 7.629394531250000e-006; //!< 2^-17 constexpr double TWO_N18 = 3.814697265625000e-006; //!< 2^-18 constexpr double TWO_N19 = 1.907348632812500e-006; //!< 2^-19 diff --git a/src/core/system_parameters/beidou_dnav_ephemeris.cc b/src/core/system_parameters/beidou_dnav_ephemeris.cc index b3a5e41ee..0b12e7754 100644 --- a/src/core/system_parameters/beidou_dnav_ephemeris.cc +++ b/src/core/system_parameters/beidou_dnav_ephemeris.cc @@ -22,7 +22,7 @@ Beidou_Dnav_Ephemeris::Beidou_Dnav_Ephemeris() { auto gnss_sat = Gnss_Satellite(); const std::string _system("Beidou"); - for (unsigned int i = 1; i < 36; i++) + for (unsigned int i = 1; i < 64; i++) { satelliteBlock[i] = gnss_sat.what_block(_system, i); } diff --git a/src/core/system_parameters/beidou_dnav_navigation_message.cc b/src/core/system_parameters/beidou_dnav_navigation_message.cc index a9eecc2e5..78e9570dc 100644 --- a/src/core/system_parameters/beidou_dnav_navigation_message.cc +++ b/src/core/system_parameters/beidou_dnav_navigation_message.cc @@ -27,11 +27,11 @@ Beidou_Dnav_Navigation_Message::Beidou_Dnav_Navigation_Message() { auto gnss_sat = Gnss_Satellite(); const std::string _system("Beidou"); - for (uint32_t i = 1; i < 36; i++) + for (uint32_t i = 1; i < 64; i++) { satelliteBlock[i] = gnss_sat.what_block(_system, i); } - for (uint32_t i = 1; i < 36; i++) + for (uint32_t i = 1; i < 64; i++) { almanacHealth[i] = 0; } @@ -647,7 +647,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris() const { Beidou_Dnav_Ephemeris eph; - if (i_satellite_PRN > 0 and i_satellite_PRN < 6) + if ((i_satellite_PRN > 0 and i_satellite_PRN < 6) or i_satellite_PRN > 58) { std::bitset subframe_bits; @@ -785,7 +785,7 @@ Beidou_Dnav_Utc_Model Beidou_Dnav_Navigation_Message::get_utc_model() bool Beidou_Dnav_Navigation_Message::have_new_ephemeris() // Check if we have a new ephemeris stored in the galileo navigation class { - if (i_satellite_PRN > 0 and i_satellite_PRN < 6) + if ((i_satellite_PRN > 0 and i_satellite_PRN < 6) or i_satellite_PRN > 58) { if ((flag_sf1_p1 == true) and (flag_sf1_p2 == true) and (flag_sf1_p3 == true) and (flag_sf1_p4 == true) and (flag_sf1_p5 == true) and (flag_sf1_p6 == true) and diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 67520f45b..2895d5973 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -84,23 +84,23 @@ install(TARGETS gnss-sdr COMPONENT "gnss-sdr" ) -install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf +install(DIRECTORY ${GNSSSDR_SOURCE_DIR}/conf DESTINATION share/gnss-sdr FILES_MATCHING PATTERN "*.conf" ) -install(FILES ${CMAKE_SOURCE_DIR}/conf/gnss-sdr.conf +install(FILES ${GNSSSDR_SOURCE_DIR}/conf/gnss-sdr.conf DESTINATION share/gnss-sdr/conf RENAME default.conf ) if(NOT VOLKGNSSSDR_FOUND) - install(PROGRAMS ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build/apps/volk_gnsssdr_profile + install(PROGRAMS ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build/apps/volk_gnsssdr_profile DESTINATION bin COMPONENT "volk_gnsssdr" ) - install(PROGRAMS ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build/apps/volk_gnsssdr-config-info + install(PROGRAMS ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build/apps/volk_gnsssdr-config-info DESTINATION bin COMPONENT "volk_gnsssdr" ) @@ -116,40 +116,40 @@ find_program(GZIP ) if(NOT GZIP_NOTFOUND) - execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/gnss-sdr-manpage - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_FILE "${CMAKE_BINARY_DIR}/gnss-sdr.1.gz" + execute_process(COMMAND gzip -9 -c ${GNSSSDR_SOURCE_DIR}/docs/manpage/gnss-sdr-manpage + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR} + OUTPUT_FILE "${GNSSSDR_BINARY_DIR}/gnss-sdr.1.gz" ) - install(FILES ${CMAKE_BINARY_DIR}/gnss-sdr.1.gz + install(FILES ${GNSSSDR_BINARY_DIR}/gnss-sdr.1.gz DESTINATION share/man/man1 ) - execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/CHANGELOG.md - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_FILE "${CMAKE_BINARY_DIR}/changelog.gz" + execute_process(COMMAND gzip -9 -c ${GNSSSDR_SOURCE_DIR}/docs/CHANGELOG.md + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR} + OUTPUT_FILE "${GNSSSDR_BINARY_DIR}/changelog.gz" ) - install(FILES ${CMAKE_BINARY_DIR}/changelog.gz + install(FILES ${GNSSSDR_BINARY_DIR}/changelog.gz DESTINATION share/doc/gnss-sdr ) if(NOT VOLKGNSSSDR_FOUND) - execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_FILE "${CMAKE_BINARY_DIR}/volk_gnsssdr_profile.1.gz" + execute_process(COMMAND gzip -9 -c ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR} + OUTPUT_FILE "${GNSSSDR_BINARY_DIR}/volk_gnsssdr_profile.1.gz" ) - execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - OUTPUT_FILE "${CMAKE_BINARY_DIR}/volk_gnsssdr-config-info.1.gz" + execute_process(COMMAND gzip -9 -c ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR} + OUTPUT_FILE "${GNSSSDR_BINARY_DIR}/volk_gnsssdr-config-info.1.gz" ) - install(FILES ${CMAKE_BINARY_DIR}/volk_gnsssdr_profile.1.gz + install(FILES ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_profile.1.gz DESTINATION share/man/man1 ) - install(FILES ${CMAKE_BINARY_DIR}/volk_gnsssdr-config-info.1.gz + install(FILES ${GNSSSDR_BINARY_DIR}/volk_gnsssdr-config-info.1.gz DESTINATION share/man/man1 ) endif() diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d73362ad2..098f41cd2 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -15,7 +15,7 @@ set(GTEST_COMPILER -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER set(TOOLCHAIN_ARG "") if(DEFINED ENV{OECORE_TARGET_SYSROOT}) set(GTEST_COMPILER "") - set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake") + set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${GNSSSDR_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake") else() if(CMAKE_TOOLCHAIN_FILE) set(TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") @@ -27,7 +27,7 @@ endif() if(NOT GOOGLETEST_FOUND) set(GTEST_BUILD_COMMAND "${CMAKE_COMMAND}" - "--build" "${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}" + "--build" "${GNSSSDR_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}" "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) if(CMAKE_VERSION VERSION_GREATER 3.12 AND NOT CMAKE_CROSSCOMPILING) @@ -43,12 +43,17 @@ if(NOT GOOGLETEST_FOUND) else() set(GOOGLETEST_GIT_TAG release-${GNSSSDR_GTEST_LOCAL_VERSION}) endif() + if(GNSSSDR_GTEST_LOCAL_VERSION VERSION_LESS 1.12.0) + set(DEBUG_DECORATION "d") + else() + set(DEBUG_DECORATION "") + endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(gtest-${GNSSSDR_GTEST_LOCAL_VERSION} GIT_REPOSITORY https://github.com/google/googletest GIT_TAG ${GOOGLETEST_GIT_TAG} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} CMAKE_ARGS ${GTEST_COMPILER} -DINSTALL_GTEST=OFF -DBUILD_GMOCK=OFF @@ -62,21 +67,22 @@ if(NOT GOOGLETEST_FOUND) ) else() set(GOOGLETEST_BUILD_BYPRODUCTS - ${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} - ${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX} ) + 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} + ${GNSSSDR_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${DEBUG_DECORATION}${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main${DEBUG_DECORATION}${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() ExternalProject_Add(gtest-${GNSSSDR_GTEST_LOCAL_VERSION} GIT_REPOSITORY https://github.com/google/googletest GIT_TAG ${GOOGLETEST_GIT_TAG} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} - BINARY_DIR ${CMAKE_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gtest-${GNSSSDR_GTEST_LOCAL_VERSION} CMAKE_ARGS ${GTEST_COMPILER} -DINSTALL_GTEST=OFF -DBUILD_GMOCK=OFF @@ -93,7 +99,7 @@ if(NOT GOOGLETEST_FOUND) ExternalProject_Get_Property(gtest-${GNSSSDR_GTEST_LOCAL_VERSION} binary_dir) if(NOT TARGET GTest::GTest) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include) add_library(GTest::GTest STATIC IMPORTED) add_dependencies(GTest::GTest gtest-${GNSSSDR_GTEST_LOCAL_VERSION}) set_target_properties(GTest::GTest PROPERTIES @@ -105,20 +111,20 @@ 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_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include + INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/gtest$<$:${DEBUG_DECORATION}>${CMAKE_STATIC_LIBRARY_SUFFIX} ) 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${DEBUG_DECORATION}${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} - 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$<$:${DEBUG_DECORATION}>${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() set_target_properties(GTest::GTest PROPERTIES @@ -137,20 +143,20 @@ 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${DEBUG_DECORATION}${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_INCLUDE_DIRECTORIES ${GNSSSDR_BINARY_DIR}/thirdparty/gtest/gtest-${GNSSSDR_GTEST_LOCAL_VERSION}/googletest/include + INTERFACE_LINK_LIBRARIES ${binary_dir}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main$<$:${DEBUG_DECORATION}>${CMAKE_STATIC_LIBRARY_SUFFIX} ) 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${DEBUG_DECORATION}${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} - 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$<$:${DEBUG_DECORATION}>${CMAKE_STATIC_LIBRARY_SUFFIX} ) endif() endif() @@ -273,7 +279,7 @@ endif() ################################################################################ -# GPSTk and optional generator +# gnsstk and optional generator ################################################################################ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) @@ -301,73 +307,78 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) if(CMAKE_GENERATOR STREQUAL Xcode) set(GNSS_SIM_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}" "-target" "gnss_sim") endif() + if(TOOLCHAIN_ARG) + set(TOOLCHAIN_ARG_GNSS_SIM "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON") + else() + set(TOOLCHAIN_ARG_GNSS_SIM "") + endif() ExternalProject_Add(gnss-sim GIT_REPOSITORY https://bitbucket.org/jarribas/gnss-simulator GIT_TAG ${GNSSSDR_GNSS_SIM_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/gnss-sim - BINARY_DIR ${CMAKE_BINARY_DIR}/gnss-sim - CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} ${CROSS_INSTALL_DIR} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-sim + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-sim + CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} ${CROSS_INSTALL_DIR} ${TOOLCHAIN_ARG_GNSS_SIM} BUILD_COMMAND ${GNSS_SIM_BUILD_COMMAND} UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_COMMAND "" ) if(ENABLE_INSTALL_TESTS) - install(PROGRAMS ${CMAKE_BINARY_DIR}/gnss-sim/gnss_sim DESTINATION bin) - install(FILES ${CMAKE_BINARY_DIR}/thirdparty/gnss-sim/brdc3540.14n DESTINATION share/gnss-sim) - install(FILES ${CMAKE_BINARY_DIR}/thirdparty/gnss-sim/circle.csv DESTINATION share/gnss-sim) + install(PROGRAMS ${GNSSSDR_BINARY_DIR}/gnss-sim/gnss_sim DESTINATION bin) + install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-sim/brdc3540.14n DESTINATION share/gnss-sim) + install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-sim/circle.csv DESTINATION share/gnss-sim) set(SW_GENERATOR_BIN ${CMAKE_INSTALL_PREFIX}/bin/gnss_sim) add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/brdc3540.14n") add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_INSTALL_PREFIX}/share/gnss-sim/circle.csv") else() - set(SW_GENERATOR_BIN ${CMAKE_BINARY_DIR}/gnss-sim/gnss_sim) + set(SW_GENERATOR_BIN ${GNSSSDR_BINARY_DIR}/gnss-sim/gnss_sim) if(CMAKE_GENERATOR STREQUAL Xcode) - set(SW_GENERATOR_BIN ${CMAKE_BINARY_DIR}/gnss-sim/${CMAKE_BUILD_TYPE}/gnss_sim) + set(SW_GENERATOR_BIN ${GNSSSDR_BINARY_DIR}/gnss-sim/${CMAKE_BUILD_TYPE}/gnss_sim) endif() add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") - add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_BINARY_DIR}/thirdparty/gnss-sim/brdc3540.14n") - add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_BINARY_DIR}/thirdparty/gnss-sim/circle.csv") + add_definitions(-DDEFAULT_RINEX_NAV="${GNSSSDR_BINARY_DIR}/thirdparty/gnss-sim/brdc3540.14n") + add_definitions(-DDEFAULT_POSITION_FILE="${GNSSSDR_BINARY_DIR}/thirdparty/gnss-sim/circle.csv") endif() 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.") + 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(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 ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} && + ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt < ${GNSSSDR_SOURCE_DIR}/src/tests/data/gnsstk_static13.patch ) # Patch only once - if(EXISTS ${CMAKE_BINARY_DIR}/thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/CMakeLists.txt) - set(GPSTK_PATCH_COMMAND "") + if(EXISTS ${GNSSSDR_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} - GIT_REPOSITORY https://github.com/SGL-UT/GPSTk - 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} + ExternalProject_Add(gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/SGL-UT/gnsstk + GIT_TAG v${GNSSSDR_GNSSTK_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_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=${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install -DBUILD_EXT=ON -DBUILD_PYTHON=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} @@ -375,7 +386,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 +394,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} - GIT_REPOSITORY https://github.com/SGL-UT/GPSTk - 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} + ExternalProject_Add(gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/SGL-UT/gnsstk + GIT_TAG v${GNSSSDR_GNSSTK_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_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=${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install -DBUILD_EXT=ON -DBUILD_PYTHON=OFF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} @@ -402,28 +413,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 ${GNSSSDR_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 ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include CACHE PATH "Local GNSSTK headers") + set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_BINDIR ${GNSSSDR_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() @@ -431,59 +442,59 @@ endif() if(ENABLE_UNIT_TESTING_EXTRA) add_definitions(-DEXTRA_TESTS) message(STATUS "Downloading some data files for testing...") - if(NOT EXISTS ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat) + if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat) message(STATUS "Downloading file: gps_l2c_m_prn7_5msps.dat") - file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/gps_l2c_m_prn7_5msps.dat ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat + file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/gps_l2c_m_prn7_5msps.dat ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat SHOW_PROGRESS EXPECTED_HASH MD5=a6fcbefe155137945d3c33c5ef7bd0f9 ) endif() - if(NOT EXISTS ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat) + if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat) message(STATUS "Downloading file: Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat") - file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat + file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=ffb72fc63c116be58d5e5ccb1daaed3a ) endif() - if(NOT EXISTS ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat) + if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat) message(STATUS "Downloading file: BdsB1IStr01_fs25e6_if0_4ms.dat") - file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/BdsB1IStr01_fs25e6_if0_4ms.dat ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat + file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/BdsB1IStr01_fs25e6_if0_4ms.dat ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=5a4336dad9d80f3313a16dec4fff9233 ) endif() - if(NOT EXISTS ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat) + if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat) message(STATUS "Downloading file: BdsB3IStr01_fs50e6_if0_4ms.dat") - file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/BdsB3IStr01_fs50e6_if0_4ms.dat ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat + file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/BdsB3IStr01_fs50e6_if0_4ms.dat ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=066d0d8434a8bc81e161778b7c34cc07 ) endif() message(STATUS "Done.") if(ENABLE_INSTALL_TESTS) - install(FILES ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${CMAKE_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat DESTINATION share/gnss-sdr/signal_samples) endif() endif() if(ENABLE_INSTALL_TESTS) - install(FILES ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${CMAKE_SOURCE_DIR}/src/tests/data/rtklib_test/obs_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) - install(FILES ${CMAKE_SOURCE_DIR}/src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) + install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/obs_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) + install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) add_definitions(-DTEST_PATH="${CMAKE_INSTALL_PREFIX}/share/gnss-sdr/") else() - file(COPY ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat DESTINATION ${CMAKE_BINARY_DIR}/thirdparty/signal_samples) - file(COPY ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat DESTINATION ${CMAKE_BINARY_DIR}/thirdparty/signal_samples) - file(COPY ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat DESTINATION ${CMAKE_BINARY_DIR}/thirdparty/signal_samples) - file(COPY ${CMAKE_SOURCE_DIR}/src/tests/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin DESTINATION ${CMAKE_BINARY_DIR}/thirdparty/signal_samples) - file(COPY ${CMAKE_SOURCE_DIR}/src/tests/data/rtklib_test/obs_test1.xml DESTINATION ${CMAKE_BINARY_DIR}/thirdparty/data/rtklib_test) - file(COPY ${CMAKE_SOURCE_DIR}/src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION ${CMAKE_BINARY_DIR}/thirdparty/data/rtklib_test) - add_definitions(-DTEST_PATH="${CMAKE_BINARY_DIR}/thirdparty/") + file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples) + file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples) + file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples) + file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples) + file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/obs_test1.xml DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/data/rtklib_test) + file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/data/rtklib_test) + add_definitions(-DTEST_PATH="${GNSSSDR_BINARY_DIR}/thirdparty/") endif() @@ -535,7 +546,7 @@ if(ENABLE_UNIT_TESTING) ) target_include_directories(run_tests INTERFACE - ${CMAKE_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(run_tests @@ -548,10 +559,16 @@ if(ENABLE_UNIT_TESTING) ) endif() if(ENABLE_UNIT_TESTING_EXTRA) - target_link_libraries(run_tests PRIVATE Gpstk::gpstk) - if(GPSTK_OLDER_THAN_8) + 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_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") @@ -673,7 +690,7 @@ if(ENABLE_FPGA) core_receiver ) target_include_directories(gps_l1_ca_dll_pll_tracking_test_fpga - INTERFACE ${CMAKE_SOURCE_DIR}/src/tests/common-files + INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) install(TARGETS gps_l1_ca_dll_pll_tracking_test_fpga RUNTIME DESTINATION bin @@ -707,7 +724,7 @@ function(add_system_test executable) endif() target_include_directories(${executable} PRIVATE ${OPT_INCLUDES_} - INTERFACE ${CMAKE_SOURCE_DIR}/src/tests/common-files + INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) target_link_libraries(${executable} PRIVATE ${OPT_LIBS_} algorithms_libs) if(GNURADIO_USES_STD_POINTERS) @@ -841,7 +858,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_include_directories(flowgraph_test PRIVATE - ${CMAKE_SOURCE_DIR}/src/algorithms/libs + ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) add_test(flowgraph_test flowgraph_test) @@ -891,8 +908,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) ) target_include_directories(gnss_block_test - PRIVATE ${CMAKE_SOURCE_DIR}/src/algorithms/libs - INTERFACE ${CMAKE_SOURCE_DIR}/src/tests/common-files + PRIVATE ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs + INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) if(ENABLE_FPGA) @@ -967,7 +984,7 @@ target_link_libraries(matio_test target_include_directories(matio_test INTERFACE - ${CMAKE_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) add_test(matio_test matio_test) @@ -1010,7 +1027,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) ) target_include_directories(acq_test INTERFACE - ${CMAKE_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) if(PMT_USES_BOOST_ANY) target_compile_definitions(acq_test diff --git a/src/tests/benchmarks/CMakeLists.txt b/src/tests/benchmarks/CMakeLists.txt index 680a616f5..3ef8a4eb3 100644 --- a/src/tests/benchmarks/CMakeLists.txt +++ b/src/tests/benchmarks/CMakeLists.txt @@ -12,7 +12,7 @@ if(NOT benchmark_FOUND) set(BENCHMARK_TOOLCHAIN_ARG "") if(DEFINED ENV{OECORE_TARGET_SYSROOT}) set(BENCHMARK_COMPILER "") - set(BENCHMARK_TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake") + set(BENCHMARK_TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${GNSSSDR_SOURCE_DIR}/cmake/Toolchains/oe-sdk_cross.cmake") else() if(CMAKE_TOOLCHAIN_FILE) set(BENCHMARK_TOOLCHAIN_ARG "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") @@ -22,7 +22,7 @@ if(NOT benchmark_FOUND) endif() endif() set(BENCHMARK_BUILD_COMMAND "${CMAKE_COMMAND}" - "--build" "${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}" + "--build" "${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}" "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) @@ -33,22 +33,24 @@ if(NOT benchmark_FOUND) ExternalProject_Add(google-benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION} GIT_REPOSITORY https://github.com/google/benchmark GIT_TAG v${GNSSSDR_BENCHMARK_LOCAL_VERSION} - SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/benchmark - BINARY_DIR ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/benchmark + BINARY_DIR ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION} CMAKE_ARGS ${BENCHMARK_COMPILER} -DBENCHMARK_ENABLE_TESTING=OFF + -DBENCHMARK_USE_BUNDLED_GTEST=OFF ${BENCHMARK_TOOLCHAIN_ARG} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> BUILD_COMMAND "${BENCHMARK_BUILD_COMMAND} ${BENCHMARK_PARALLEL_BUILD}" UPDATE_COMMAND "" PATCH_COMMAND "" - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} INSTALL_COMMAND "" ) add_library(benchmark::benchmark STATIC IMPORTED) add_dependencies(benchmark::benchmark google-benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/thirdparty/benchmark/include) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/benchmark/include) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/include) set_target_properties(benchmark::benchmark PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" @@ -57,28 +59,27 @@ if(NOT benchmark_FOUND) MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo MAP_IMPORTED_CONFIG_ASAN Debug - IMPORTED_LOCATION_NONE ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/thirdparty/benchmark/include - INTERFACE_LINK_LIBRARIES "${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX};${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/thirdparty/benchmark/include" + INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}" ) if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) set_target_properties(benchmark::benchmark PROPERTIES - IMPORTED_LOCATION_DEBUG ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/Release/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES "${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}; - ${CMAKE_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/Release/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}; + ${GNSSSDR_BINARY_DIR}/benchmark-${GNSSSDR_BENCHMARK_LOCAL_VERSION}/src/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>benchmark_main${CMAKE_STATIC_LIBRARY_SUFFIX}" ) endif() set_target_properties(benchmark::benchmark PROPERTIES INTERFACE_LINK_LIBRARIES Threads::Threads ) - endif() macro(add_benchmark) diff --git a/src/tests/data/gnsstk_static13.patch b/src/tests/data/gnsstk_static13.patch new file mode 100644 index 000000000..9c05ed883 --- /dev/null +++ b/src/tests/data/gnsstk_static13.patch @@ -0,0 +1,38 @@ +SPDX-License-Identifier: GPL-3.0-or-later +SPDX-FileCopyrightText: 2022 Carles Fernandez-Prades +--- CMakeLists.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/data/gpstk_static.patch b/src/tests/data/gpstk_static.patch deleted file mode 100644 index 7acf49dbf..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 - #============================================================ -@@ -160,7 +169,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/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index f5da39a39..6740932fb 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -48,9 +48,9 @@ target_link_libraries(signal_processing_testing_lib target_include_directories(signal_processing_testing_lib PUBLIC - ${CMAKE_SOURCE_DIR}/src/core/interfaces + ${GNSSSDR_SOURCE_DIR}/src/core/interfaces INTERFACE - ${CMAKE_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) if(GNURADIO_USES_SPDLOG) 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..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 @@ -57,11 +57,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -70,6 +65,22 @@ #include #include #include +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#include +#include +#include +#include +#include +namespace gnsstk = gpstk; +#else +#include +#include +#include +#include +#include +#include +#endif #if HAS_GENERIC_LAMBDA #else @@ -1556,17 +1567,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,29 +1593,33 @@ 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; +#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()) { @@ -1680,12 +1695,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..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 @@ -56,11 +56,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -71,6 +66,23 @@ #include #include +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#include +#include +#include +#include +#include +namespace gnsstk = gpstk; +#else +#include +#include +#include +#include +#include +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -1648,17 +1660,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 +1686,33 @@ 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; +#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()) @@ -1773,12 +1790,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/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index 2fc93dad4..14e55ca99 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -134,8 +134,8 @@ find_program(GZIP gzip ) if(NOT GZIP_NOTFOUND) - execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/front-end-cal-manpage - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/front-end-cal.1.gz" + execute_process(COMMAND gzip -9 -c ${GNSSSDR_SOURCE_DIR}/docs/manpage/front-end-cal-manpage + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR} OUTPUT_FILE "${GNSSSDR_BINARY_DIR}/front-end-cal.1.gz" ) - install(FILES ${CMAKE_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1) + install(FILES ${GNSSSDR_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1) endif() diff --git a/src/utils/nav-listener/CMakeLists.txt b/src/utils/nav-listener/CMakeLists.txt index cedb4707e..048a862f4 100644 --- a/src/utils/nav-listener/CMakeLists.txt +++ b/src/utils/nav-listener/CMakeLists.txt @@ -4,11 +4,14 @@ # SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.9...3.21) +cmake_minimum_required(VERSION 3.9...3.23) project(nav-msg-listener CXX) set(CMAKE_CXX_STANDARD 11) +set(NAVLISTENER_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # allows this to be a sub-project +set(NAVLISTENER_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(Boost_USE_STATIC_LIBS OFF) find_package(Boost COMPONENTS system REQUIRED) @@ -17,9 +20,9 @@ if(${Protobuf_VERSION} VERSION_LESS "3.0.0") message(FATAL_ERROR "Fatal error: Protocol Buffers >= v3.0.0 required.") endif() -protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/nav_message.proto) +protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${NAVLISTENER_SOURCE_DIR}/nav_message.proto) -add_library(navmsg_lib ${CMAKE_SOURCE_DIR}/nav_msg_udp_listener.cc ${PROTO_SRCS}) +add_library(navmsg_lib ${NAVLISTENER_SOURCE_DIR}/nav_msg_udp_listener.cc ${PROTO_SRCS}) target_link_libraries(navmsg_lib PUBLIC @@ -30,9 +33,9 @@ target_link_libraries(navmsg_lib target_include_directories(navmsg_lib PUBLIC - ${CMAKE_BINARY_DIR} + ${NAVLISTENER_BINARY_DIR} ) -add_executable(nav_msg_listener ${CMAKE_SOURCE_DIR}/main.cc) +add_executable(nav_msg_listener ${NAVLISTENER_SOURCE_DIR}/main.cc) target_link_libraries(nav_msg_listener PUBLIC navmsg_lib) diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index e51c7dddb..7a3bdb598 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -7,11 +7,18 @@ 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) + if(NOT GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK) + find_package(GNSSTK) + endif() + 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) + if(GNSSTK_USES_GPSTK_NAMESPACE) + set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + else() + set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + endif() endif() if(USE_CMAKE_TARGET_SOURCES) @@ -26,7 +33,7 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND add_executable(obsdiff ${CMAKE_CURRENT_SOURCE_DIR}/obsdiff.cc obsdiff_flags.h) endif() - target_include_directories(obsdiff PUBLIC ${CMAKE_SOURCE_DIR}/src/tests/common-files) + target_include_directories(obsdiff PUBLIC ${GNSSSDR_SOURCE_DIR}/src/tests/common-files) set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 # Do not show warnings raised by GPSTk v3.0.0 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -48,23 +55,46 @@ 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 - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GPSTK_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${GPSTK_INCLUDE_DIR};${GPSTK_INCLUDE_DIR}/gpstk" - INTERFACE_LINK_LIBRARIES "${GPSTK_LIBRARY}" - ) + if(GNSSTK_USES_GPSTK_NAMESPACE) + target_compile_definitions(obsdiff PRIVATE -DGNSSTK_USES_GPSTK_NAMESPACE=1) + endif() + 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) + endif() + 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) + 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 @@ -73,13 +103,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/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 16c753f03..60c74fe9f 100644 --- a/src/utils/rinex-tools/obsdiff.cc +++ b/src/utils/rinex-tools/obsdiff.cc @@ -21,34 +21,6 @@ #include "gnuplot_i.h" #include "obsdiff_flags.h" #include -// Classes for handling observations RINEX files (data) -#include -#include -#include - -// Classes for handling satellite navigation parameters RINEX -// files (ephemerides) -#include -#include -#include - -// Classes for handling RINEX files with meteorological parameters -#include -#include -#include -#include - -// Class for handling tropospheric model -#include - -// Class for storing >broadcast-type> ephemerides -#include - -// Class for handling RAIM -#include - -// Class defining GPS system constants -#include #include #include #include @@ -60,6 +32,53 @@ #include #include +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#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 +#include + +// Classes for handling RINEX files with meteorological parameters +#include +#include +#include +#include + +// Class for handling tropospheric model +#include +#include +#include + +// Class for storing ephemeris +#include +#if GNSSTK_OLDER_THAN_13 +#include +#include +#include +#include +#else +#include +#include +#endif +#endif + #if GFLAGS_OLD_NAMESPACE namespace gflags { @@ -97,40 +116,40 @@ 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; + 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; } @@ -141,8 +160,14 @@ 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; + +#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); @@ -220,12 +245,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 +931,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 +1076,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); @@ -1134,48 +1159,61 @@ 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 - gpstk::GPSEphemerisStore bcestore; - gpstk::PRSolution raimSolver; + // 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 // 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 { +#if GNSSTK_OLDER_THAN_13 // 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; - - // 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 - 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 +1235,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 @@ -1254,15 +1292,20 @@ 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 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) { @@ -1294,7 +1337,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 +1350,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 +1368,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..4f9e31b88 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -4,14 +4,20 @@ # SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause - -find_package(GPSTK QUIET) -if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) - 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) +if(NOT GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK) + find_package(GNSSTK) endif() +if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) + include(GNUInstallDirs) + if(GNSSTK_USES_GPSTK_NAMESPACE) + set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + else() + set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include) + endif() +endif() find_package(Boost COMPONENTS iostreams serialization QUIET) if(CMAKE_VERSION VERSION_LESS 3.5) @@ -35,7 +41,6 @@ if(CMAKE_VERSION VERSION_LESS 3.5) endif() endif() - find_program(UNCOMPRESS_EXECUTABLE uncompress PATHS /bin /usr/bin @@ -65,7 +70,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() @@ -73,17 +78,29 @@ if(Boost_FOUND) PRIVATE Boost::iostreams Boost::serialization - ${GPSTK_LIBRARY} + ${GNSSTK_LIBRARY} Gflags::gflags Threads::Threads core_system_parameters ) - target_include_directories(rinex2assist - PRIVATE - ${GPSTK_INCLUDE_DIR}/gpstk - ${GPSTK_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_OLDER_THAN_9) + target_compile_definitions(rinex2assist PRIVATE -DGNSSTK_OLDER_THAN_9=1) + endif() if(NOT UNCOMPRESS_EXECUTABLE-NOTFOUND) target_compile_definitions(rinex2assist PRIVATE -DUNCOMPRESS_EXECUTABLE="${UNCOMPRESS_EXECUTABLE}") @@ -91,8 +108,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 1b685040d..b100ac95d 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -28,12 +28,21 @@ #include #include #include -#include -#include -#include #include // for size_t #include #include +#if GNSSTK_USES_GPSTK_NAMESPACE +#include +#include +#include +#include +namespace gnsstk = gpstk; +#else +#include +#include +#include +#include +#endif #if GFLAGS_OLD_NAMESPACE namespace gflags @@ -155,9 +164,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; @@ -176,8 +185,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; @@ -199,8 +217,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; diff --git a/src/utils/scripts/download-galileo-almanac.sh b/src/utils/scripts/download-galileo-almanac.sh index 1967a03a1..56202f65b 100755 --- a/src/utils/scripts/download-galileo-almanac.sh +++ b/src/utils/scripts/download-galileo-almanac.sh @@ -16,7 +16,7 @@ help() { echo "This script tries to download the most recent Galileo Almanac XML file" echo "published by the European GNSS Service Centre." - echo "More info at https://www.gsc-europa.eu/product-almanacs" + echo "More info at https://www.gsc-europa.eu/gsc-products/almanac" echo "If today there is no published file, the script will look up to one week ago." echo "" echo "Usage:"