1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-15 06:14:58 +00:00
gnss-sdr/src/utils/rinex-tools/CMakeLists.txt

140 lines
5.8 KiB
CMake
Raw Normal View History

# 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-License-Identifier: BSD-3-Clause
2020-02-18 20:21:46 +00:00
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}'")
2022-07-10 17:19:37 +00:00
if(NOT GNSSTK_FOUND AND NOT ENABLE_OWN_GNSSTK)
2022-07-06 11:49:45 +00:00
find_package(GNSSTK)
endif()
2022-07-04 08:05:54 +00:00
if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK)
2020-02-18 20:21:46 +00:00
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()
2020-02-18 20:21:46 +00:00
endif()
if(USE_CMAKE_TARGET_SOURCES)
add_executable(obsdiff)
target_sources(obsdiff
PRIVATE
obsdiff.cc
obsdiff_flags.h
)
else()
source_group(Headers FILES obsdiff_flags.h)
add_executable(obsdiff ${CMAKE_CURRENT_SOURCE_DIR}/obsdiff.cc obsdiff_flags.h)
endif()
2020-02-18 20:21:46 +00:00
target_include_directories(obsdiff PUBLIC ${GNSSSDR_SOURCE_DIR}/src/tests/common-files)
2024-07-10 12:28:16 +00:00
if(GNSSTK_VERSION AND "${GNSSTK_VERSION}" VERSION_LESS 3.0.1)
2024-05-01 07:00:46 +00:00
set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0
endif()
# Do not show warnings raised by GPSTk v3.0.0
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(obsdiff
PRIVATE
-Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-reorder -Wno-deprecated-copy -Wno-extra -Wno-unused-but-set-variable -Wno-unknown-pragmas
)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(obsdiff
PRIVATE
-Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-reorder
)
endif()
2020-02-18 21:16:31 +00:00
if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
add_dependencies(obsdiff armadillo-${armadillo_RELEASE})
endif()
if(ENABLE_GLOG_AND_GFLAGS)
if(NOT GFLAGS_FOUND)
add_dependencies(obsdiff gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION})
endif()
2020-02-18 21:16:31 +00:00
endif()
2022-07-04 08:05:54 +00:00
if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK)
add_dependencies(obsdiff gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION})
2020-02-18 20:21:46 +00:00
endif()
2020-02-18 21:16:31 +00:00
if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERSION})
add_dependencies(obsdiff matio-${GNSSSDR_MATIO_LOCAL_VERSION})
2020-02-18 20:21:46 +00:00
endif()
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()
2022-07-10 18:05:26 +00:00
if(GNSSTK_OLDER_THAN_9)
target_compile_definitions(obsdiff PRIVATE -DGNSSTK_OLDER_THAN_9=1)
endif()
2022-07-10 17:19:37 +00:00
if(GNSSTK_OLDER_THAN_13)
target_compile_definitions(obsdiff PRIVATE -DGNSSTK_OLDER_THAN_13=1)
endif()
2022-07-04 08:05:54 +00:00
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()
2022-04-05 18:55:10 +00:00
endif()
2020-02-18 20:21:46 +00:00
target_link_libraries(obsdiff
PRIVATE
2020-02-18 20:21:46 +00:00
Armadillo::armadillo
Threads::Threads
Matio::matio
2022-07-04 08:05:54 +00:00
Gnsstk::gnsstk
2020-02-18 20:21:46 +00:00
)
if(ENABLE_GLOG_AND_GFLAGS)
target_link_libraries(obsdiff PRIVATE Gflags::gflags)
target_compile_definitions(obsdiff PRIVATE -DUSE_GLOG_AND_GFLAGS=1)
else()
2024-05-01 07:00:46 +00:00
target_link_libraries(obsdiff PUBLIC absl::flags absl::flags_parse)
endif()
if(ENABLE_STRIP)
set_target_properties(obsdiff PROPERTIES LINK_FLAGS "-s")
endif()
include(XcodeRemoveWarningDuplicates)
xcode_remove_warning_duplicates(obsdiff)
2020-02-18 20:21:46 +00:00
add_custom_command(TARGET obsdiff POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:obsdiff>
${LOCAL_INSTALL_BASE_DIR}/install/$<TARGET_FILE_NAME:obsdiff>
2020-02-18 20:21:46 +00:00
)
install(TARGETS obsdiff
RUNTIME DESTINATION bin
COMPONENT "obsdiff"
)
else()
message(STATUS "The Armadillo library version found (${ARMADILLO_VERSION_STRING}) is older than 9.800.")
message(STATUS " The obsdiff utility tool will not be built.")
message(STATUS " You could build it by setting -DENABLE_OWN_ARMADILLO=ON")
endif()