2020-12-30 12:35:06 +00:00
|
|
|
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
2020-02-18 18:39:53 +00:00
|
|
|
# This file is part of GNSS-SDR.
|
|
|
|
#
|
2020-12-30 12:35:06 +00:00
|
|
|
# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2020-02-18 18:39:53 +00:00
|
|
|
|
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
|
2020-02-22 09:41:18 +00:00
|
|
|
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)
|
2022-07-05 11:46:58 +00:00
|
|
|
if(GNSSTK_USES_GPSTK_NAMESPACE)
|
2022-08-12 10:11:54 +00:00
|
|
|
set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_STATIC_LIBRARY_SUFFIX})
|
2022-07-28 08:37:36 +00:00
|
|
|
set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include)
|
2022-07-05 11:46:58 +00:00
|
|
|
else()
|
2022-08-12 10:11:54 +00:00
|
|
|
set(GNSSTK_LIBRARY ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_STATIC_LIBRARY_SUFFIX})
|
2022-07-28 08:37:36 +00:00
|
|
|
set(GNSSTK_INCLUDE_DIR ${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install/include)
|
2022-07-05 11:46:58 +00:00
|
|
|
endif()
|
2020-02-18 20:21:46 +00:00
|
|
|
endif()
|
|
|
|
|
2020-06-12 22:32:40 +00:00
|
|
|
if(USE_CMAKE_TARGET_SOURCES)
|
2020-06-08 18:04:01 +00:00
|
|
|
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
|
|
|
|
2022-07-28 08:37:36 +00:00
|
|
|
target_include_directories(obsdiff PUBLIC ${GNSSSDR_SOURCE_DIR}/src/tests/common-files)
|
2020-02-22 09:41:18 +00:00
|
|
|
set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0
|
|
|
|
# Do not show warnings raised by GPSTk v3.0.0
|
2020-02-22 11:28:35 +00:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
2020-03-01 10:53:01 +00:00
|
|
|
target_compile_options(obsdiff
|
2020-06-08 18:04:01 +00:00
|
|
|
PRIVATE
|
2020-03-01 10:53:01 +00:00
|
|
|
-Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-reorder -Wno-deprecated-copy -Wno-extra -Wno-unused-but-set-variable -Wno-unknown-pragmas
|
|
|
|
)
|
2020-02-22 11:28:35 +00:00
|
|
|
endif()
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
target_compile_options(obsdiff
|
2020-06-08 18:04:01 +00:00
|
|
|
PRIVATE
|
2020-02-22 11:28:35 +00:00
|
|
|
-Wno-deprecated -Wno-unused-parameter -Wno-sign-compare -Wno-reorder
|
|
|
|
)
|
|
|
|
endif()
|
2020-02-22 12:52:34 +00:00
|
|
|
|
2020-02-18 21:16:31 +00:00
|
|
|
if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
|
|
|
|
add_dependencies(obsdiff armadillo-${armadillo_RELEASE})
|
|
|
|
endif()
|
2024-04-29 06:27:33 +00:00
|
|
|
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()
|
2022-07-05 11:46:58 +00:00
|
|
|
if(GNSSTK_USES_GPSTK_NAMESPACE)
|
2022-07-05 15:37:21 +00:00
|
|
|
target_compile_definitions(obsdiff PRIVATE -DGNSSTK_USES_GPSTK_NAMESPACE=1)
|
2022-07-05 11:46:58 +00:00
|
|
|
endif()
|
|
|
|
if(GNSSTK_OLDER_THAN_8)
|
2022-07-05 15:37:21 +00:00
|
|
|
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)
|
2022-07-05 11:46:58 +00:00
|
|
|
endif()
|
2022-07-04 08:05:54 +00:00
|
|
|
if(NOT TARGET Gnsstk::gnsstk)
|
2022-07-05 11:46:58 +00:00
|
|
|
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
|
2020-06-08 18:04:01 +00:00
|
|
|
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
|
|
|
)
|
|
|
|
|
2024-04-29 06:27:33 +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()
|
|
|
|
target_link_libraries(obsdiff PRIVATE absl::flags absl::flags_parse)
|
|
|
|
endif()
|
|
|
|
|
2020-06-10 15:22:03 +00:00
|
|
|
if(ENABLE_STRIP)
|
|
|
|
set_target_properties(obsdiff PROPERTIES LINK_FLAGS "-s")
|
|
|
|
endif()
|
|
|
|
|
2024-04-13 07:03:46 +00:00
|
|
|
include(XcodeRemoveWarningDuplicates)
|
|
|
|
xcode_remove_warning_duplicates(obsdiff)
|
|
|
|
|
2020-02-18 20:21:46 +00:00
|
|
|
add_custom_command(TARGET obsdiff POST_BUILD
|
2020-03-01 10:53:01 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:obsdiff>
|
2020-06-12 18:51:26 +00:00
|
|
|
${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"
|
|
|
|
)
|
2020-02-20 09:53:22 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "The Armadillo library version found (${ARMADILLO_VERSION_STRING}) is older than 9.800.")
|
2020-02-22 12:52:34 +00:00
|
|
|
message(STATUS " The obsdiff utility tool will not be built.")
|
|
|
|
message(STATUS " You could build it by setting -DENABLE_OWN_ARMADILLO=ON")
|
2020-02-18 18:39:53 +00:00
|
|
|
endif()
|