diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 8e6d39f96..20fe6b8df 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -373,6 +373,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) IMPORTED_LOCATION "${GPSTK_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${GPSTK_INCLUDE_DIRS};${GPSTK_INCLUDE_DIRS}/gpstk" INTERFACE_LINK_LIBRARIES "${GPSTK_LIBRARY}" + CXX_STANDARD 14 ) else() set(GPSTK_BINDIR ${GPSTK_INCLUDE_DIR}/../bin/) diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 128b53a78..c91d1f41f 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -7,46 +7,51 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -find_package(GPSTK QUIET) -if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) - include(GNUInstallDirs) - set(GPSTK_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/../../../thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(GPSTK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/include) +if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND) OR ENABLE_OWN_ARMADILLO) # requires back(), introduced in Armadillo 9.800 + find_package(GPSTK QUIET) + if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) + include(GNUInstallDirs) + set(GPSTK_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/../../../thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(GPSTK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../thirdparty/gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}/install/include) + endif() + + set(obsdiff_HEADERS obsdiff_flags.h) + source_group(Headers FILES ${obsdiff_HEADERS}) + + add_executable(obsdiff ${CMAKE_CURRENT_SOURCE_DIR}/obsdiff.cc ${obsdiff_HEADERS}) + set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk + target_include_directories(obsdiff PUBLIC ${CMAKE_SOURCE_DIR}/src/tests/common-files) + + if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) + add_dependencies(obsdiff gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) + endif() + if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) + add_dependencies(obsdiff armadillo-${armadillo_RELEASE}) + endif() + + target_link_libraries(obsdiff + PUBLIC + Armadillo::armadillo + Threads::Threads + Gflags::gflags + Matio::matio + core_system_parameters + ${GPSTK_LIBRARY} + ) + + target_include_directories(obsdiff + PUBLIC + ${GPSTK_INCLUDE_DIR}/gpstk + ${GPSTK_INCLUDE_DIR} + ) + + add_custom_command(TARGET obsdiff POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ + ${CMAKE_SOURCE_DIR}/install/$ + ) + + install(TARGETS obsdiff + RUNTIME DESTINATION bin + COMPONENT "obsdiff" + ) endif() - -set(obsdiff_HEADERS obsdiff_flags.h) -source_group(Headers FILES ${obsdiff_HEADERS}) - -add_executable(obsdiff ${CMAKE_CURRENT_SOURCE_DIR}/obsdiff.cc ${obsdiff_HEADERS}) -set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk -target_include_directories(obsdiff PUBLIC ${CMAKE_SOURCE_DIR}/src/tests/common-files) - -if(NOT GPSTK_FOUND OR ENABLE_OWN_GPSTK) - add_dependencies(obsdiff gpstk-${GNSSSDR_GPSTK_LOCAL_VERSION}) -endif() - -target_link_libraries(obsdiff - PUBLIC - Armadillo::armadillo - Threads::Threads - Gflags::gflags - Matio::matio - core_system_parameters - ${GPSTK_LIBRARY} -) - -target_include_directories(obsdiff - PUBLIC - ${GPSTK_INCLUDE_DIR}/gpstk - ${GPSTK_INCLUDE_DIR} -) - -add_custom_command(TARGET obsdiff POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ - ${CMAKE_SOURCE_DIR}/install/$ -) - -install(TARGETS obsdiff - RUNTIME DESTINATION bin - COMPONENT "obsdiff" -) diff --git a/src/utils/rinex-tools/README.md b/src/utils/rinex-tools/README.md index 4d35582a5..4a75b24b4 100644 --- a/src/utils/rinex-tools/README.md +++ b/src/utils/rinex-tools/README.md @@ -13,6 +13,11 @@ This program computes single-differences and double-differences from RINEX obser ### Building +Requirements: + * [GPSTK](https://github.com/SGL-UT/GPSTk): The GPS Toolkit. If not found in your system, the latest version will be downloaded, built and linked for you at building time. + * [Armadillo](http://arma.sourceforge.net/): A C++ library for linear algebra and scientific computing. This program requires version 9.800 or higher. If your installed Armadillo version is older, see below. + + This program is built along with GNSS-SDR if the options `ENABLE_UNIT_TESTING_EXTRA` or `ENABLE_SYSTEM_TESTING_EXTRA` are set to `ON` when calling CMake: ``` @@ -23,6 +28,13 @@ $ sudo make install The last step is optional. Without it, you still will get the executable at `../install/obsdiff`. +This program requires Armadillo 9.800 or higher. If the available Armadillo version is older, this program will not be built. If your local Armadillo installed version is older, you can force CMake to download, build and link a recent one: + +``` +$ cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_OWN_ARMADILLO=ON .. +$ make obsdiff +$ sudo make install +``` ### Usage