Fix when building for GNSSTk 12.1.0 or older

This commit is contained in:
Carles Fernandez 2022-07-05 17:37:21 +02:00
parent 109112be63
commit 9db6f55b3c
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 41 additions and 28 deletions

View File

@ -32,7 +32,7 @@ if(DEFINED ENV{GNSSTK_ROOT})
endif()
unset(GNSSTK_INCLUDE_DIR CACHE)
set(GNSSTK_USES_GPSTK_NAMESPACE FALSE)
unset(GNSSTK_USES_GPSTK_NAMESPACE CACHE)
find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp
PATHS ${GNSSTK_ROOT_USER_DEFINED}/include
/usr/include
@ -40,16 +40,18 @@ find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp
/opt/local/include
)
set(GNSSTK_NAMES ${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_SHARED_LIBRARY_SUFFIX})
if(NOT GNSSTK_INCLUDE_DIR)
if(NOT GNSSTK_INCLUDE_DIR_FOUND)
find_path(GNSSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp
PATHS ${GNSSTK_ROOT_USER_DEFINED}/include
/usr/include
/usr/local/include
/opt/local/include
)
if(GNSSTK_INCLUDE_DIR)
if(GNSSTK_INCLUDE_DIR_FOUND)
set(GNSSTK_NAMES gpstk ${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX})
set(GNSSTK_USES_GPSTK_NAMESPACE TRUE)
set(GNSSTK_OLDER_THAN_8 TRUE)
#set(GNSSTK_OLDER_THAN_9 TRUE)
endif()
endif()
@ -64,12 +66,7 @@ find_library(GNSSTK_LIBRARY NAMES ${GNSSTK_NAMES}
/opt/local/lib
)
# handle the QUIET and REQUIRED arguments and set GNSSTK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GNSSTK DEFAULT_MSG GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR)
if(GNSSTK_FOUND)
if(GNSSTK_LIBRARY AND GNSSTK_INCLUDE_DIR)
set(OLD_PACKAGE_VERSION ${PACKAGE_VERSION})
unset(PACKAGE_VERSION)
if(EXISTS ${CMAKE_INSTALL_FULL_DATADIR}/cmake/GNSSTK/GNSSTKConfigVersion.cmake)
@ -85,6 +82,17 @@ if(GNSSTK_FOUND)
set(PACKAGE_VERSION ${OLD_PACKAGE_VERSION})
endif()
if(GNSSTK_VERSION)
if(GNSSTK_VERSION VERSION_GREATER ${GNSSSDR_GNSSTK_LOCAL_VERSION})
unset(GNSSTK_LIBRARY CACHE)
unset(GNSSTK_INCLUDE_DIR CACHE)
endif()
endif()
# handle the QUIET and REQUIRED arguments and set GNSSTK_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GNSSTK DEFAULT_MSG GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR)
if(GNSSTK_FOUND AND GNSSTK_VERSION)
set_package_properties(GNSSTK PROPERTIES
DESCRIPTION "The GNSSTk C++ Library (found: v${GNSSTK_VERSION})"
@ -123,4 +131,9 @@ if(GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK AND NOT TARGET Gnsstk::gnsstk)
endif()
endif()
mark_as_advanced(GNSSTK_LIBRARY GNSSTK_INCLUDE_DIR GNSSTK_USES_GPSTK_NAMESPACE GNSSTK_OLDER_THAN_8)
mark_as_advanced(GNSSTK_LIBRARY
GNSSTK_INCLUDE_DIR
GNSSTK_USES_GPSTK_NAMESPACE
GNSSTK_OLDER_THAN_8
GNSSTK_OLDER_THAN_9
)

View File

@ -355,7 +355,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
include(GNUInstallDirs)
find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH)
if(NOT Patch_EXECUTABLE)
message(FATAL_ERROR "The patch command is not found. It is required to build GPSTk. Please check your OS documentation and install the patch command.")
message(FATAL_ERROR "The patch command is not found. It is required to build GNSSTk. Please check your OS documentation and install the patch command.")
endif()
set(GNSSTK_PATCH_COMMAND
cd ${CMAKE_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} &&

View File

@ -11,11 +11,11 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND
if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK)
include(GNUInstallDirs)
if(GNSSTK_USES_GPSTK_NAMESPACE)
set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include)
else()
set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gpstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include)
set(GNSSTK_LIBRARY ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GNSSTK_INCLUDE_DIR ${CMAKE_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include)
endif()
endif()
@ -60,12 +60,14 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND
add_dependencies(obsdiff matio-${GNSSSDR_MATIO_LOCAL_VERSION})
endif()
if(GNSSTK_USES_GPSTK_NAMESPACE)
target_compile_definitions(obsdiff PUBLIC -DGNSSTK_USES_GPSTK_NAMESPACE=1)
target_compile_definitions(obsdiff PRIVATE -DGNSSTK_USES_GPSTK_NAMESPACE=1)
endif()
if(GNSSTK_OLDER_THAN_8)
target_compile_definitions(obsdiff PUBLIC -DOLD_GPSTK=1)
target_compile_definitions(obsdiff PRIVATE -DOLD_GPSTK=1)
endif()
if(GNSSTK_OLDER_THAN_9)
target_compile_definitions(obsdiff PRIVATE -DGNSSTK_OLDER_THAN_9=1)
endif()
if(NOT TARGET Gnsstk::gnsstk)
if(GNSSTK_USES_GPSTK_NAMESPACE)
file(MAKE_DIRECTORY ${GNSSTK_INCLUDE_DIR}/gpstk)

View File

@ -131,25 +131,25 @@ std::map<int, arma::mat> ReadRinexObs(const std::string& rinex_file, char system
{
case 'G':
#if OLD_GPSTK
prn.system = gpstk::SatID::systemGPS;
prn.system = gnsstk::SatID::systemGPS;
#else
prn.system = gpstk::SatelliteSystem::GPS;
prn.system = gnsstk::SatelliteSystem::GPS;
#endif
PRN_set = available_gps_prn;
break;
case 'E':
#if OLD_GPSTK
prn.system = gpstk::SatID::systemGalileo;
prn.system = gnsstk::SatID::systemGalileo;
#else
prn.system = gpstk::SatelliteSystem::Galileo;
prn.system = gnsstk::SatelliteSystem::Galileo;
#endif
PRN_set = available_galileo_prn;
break;
default:
#if OLD_GPSTK
prn.system = gpstk::SatID::systemGPS;
prn.system = gnsstk::SatID::systemGPS;
#else
prn.system = gpstk::SatelliteSystem::GPS;
prn.system = gnsstk::SatelliteSystem::GPS;
#endif
PRN_set = available_gps_prn;
}
@ -1273,7 +1273,7 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std::
#if OLD_GPSTK
std::vector<gpstk::SatID::SatelliteSystem> Syss;
#endif
gpstk::Matrix<double> invMC;
gnsstk::Matrix<double> invMC;
int iret;
// Call RAIMCompute
#if OLD_GPSTK

View File

@ -17,7 +17,6 @@ if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK)
endif()
endif()
find_package(Boost COMPONENTS iostreams serialization QUIET)
if(CMAKE_VERSION VERSION_LESS 3.5)
if(NOT TARGET Boost::iostreams)
@ -40,7 +39,6 @@ if(CMAKE_VERSION VERSION_LESS 3.5)
endif()
endif()
find_program(UNCOMPRESS_EXECUTABLE uncompress
PATHS /bin
/usr/bin
@ -70,7 +68,7 @@ if(Boost_FOUND)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(rinex2assist
PRIVATE
-Wno-deprecated -Wno-unused-parameter -Wno-sign-compare
-Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-switch -Wno-inconsistent-missing-override
)
endif()
@ -100,7 +98,7 @@ if(Boost_FOUND)
endif()
if(GNSSTK_VERSION)
if(GNSSTK_VERSION VERSION_LESS "9.0.0")
target_compile_definitions(rinex2assist PUBLIC -DGNSSTK_OLDER_THAN_9=1)
target_compile_definitions(rinex2assist PRIVATE -DGNSSTK_OLDER_THAN_9=1)
endif()
endif()