Update local version of Protocol Buffers to v22.2 (requires abseil-cpp >= 20230117). If abseil is not found or is too old, it falls back to Protocol Buffers v21.12

This commit is contained in:
Carles Fernandez 2023-03-31 13:23:31 +02:00
parent 79ebc32d8c
commit bf3c3918ef
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 361 additions and 139 deletions

View File

@ -351,7 +351,10 @@ else()
endif()
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.13")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.9")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "22.2")
if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12")
endif()
set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.7.1")
set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7")
@ -2341,6 +2344,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
PREFIX ${GNSSSDR_BINARY_DIR}/matio
GIT_REPOSITORY https://github.com/tbeu/matio
GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION}
UPDATE_COMMAND ""
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}
@ -2588,136 +2592,177 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI
set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc")
endif()
else()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(NOT EXISTS "/usr/bin/libtoolize")
message(" libtool has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install libtoool")
if(CMAKE_VERSION VERSION_GREATER "3.13")
find_package(absl)
set_package_properties(absl PROPERTIES
URL "https://github.com/abseil/abseil-cpp"
PURPOSE "Abseil-cpp >= 20230117 required to be installed before building Protocol Buffers >22.x on the fly."
TYPE OPTIONAL
)
if(absl_FOUND)
if(absl_VERSION)
if(${absl_VERSION} VERSION_LESS "20230117")
unset(absl_FOUND CACHE)
set(absl_FOUND OFF)
endif()
else()
message(" sudo apt-get install libtool")
unset(absl_FOUND CACHE)
set(absl_FOUND OFF)
endif()
message(FATAL_ERROR "libtool is required to build Protocol Buffers from source")
endif()
if(EXISTS "/usr/bin/aclocal" OR
EXISTS "/usr/bin/aclocal-1.16" OR
EXISTS "/usr/bin/aclocal-1.15" OR
EXISTS "/usr/bin/aclocal-1.14" OR
EXISTS "/usr/bin/aclocal-1.13" OR
EXISTS "/usr/bin/aclocal-1.11" OR
EXISTS "/usr/bin/aclocal-1.10")
message(STATUS "Automake found.")
if(absl_FOUND)
set_package_properties(absl PROPERTIES
DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library (found: v${absl_VERSION})"
)
else()
message(" aclocal has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install automake")
if(absl_VERSION)
set_package_properties(absl PROPERTIES
DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library (found: v${absl_VERSION})"
)
else()
message(" sudo apt-get install automake")
set_package_properties(absl PROPERTIES
DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library"
)
endif()
message(FATAL_ERROR "aclocal is required to build Protocol Buffers from source")
message(STATUS "The Abseil library (https://github.com/abseil/abseil-cpp) >= v20230117 is required to be installed before building Protocol Buffers >22.x on the fly.")
message(STATUS " Instead, Protocol Buffers v21.12 will be built, which does not require Abseil.")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12")
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS /opt/local/bin/glibtoolize) OR
(NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS /opt/local/bin/aclocal))
message(" libtool/automake tools have not been found.")
message(" You can try to install them by typing:")
message(" 'sudo port install libtool automake', if you use Macports, or 'brew install libtool automake', if you use Homebrew")
message(FATAL_ERROR "libtool/automake tools are required to build Protocol Buffers from source")
if(CMAKE_VERSION VERSION_LESS "3.13" OR NOT absl_FOUND)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(NOT EXISTS "/usr/bin/libtoolize")
message(" libtool has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install libtoool")
else()
message(" sudo apt-get install libtool")
endif()
message(FATAL_ERROR "libtool is required to build Protocol Buffers from source")
endif()
if(EXISTS "/usr/bin/aclocal" OR
EXISTS "/usr/bin/aclocal-1.16" OR
EXISTS "/usr/bin/aclocal-1.15" OR
EXISTS "/usr/bin/aclocal-1.14" OR
EXISTS "/usr/bin/aclocal-1.13" OR
EXISTS "/usr/bin/aclocal-1.11" OR
EXISTS "/usr/bin/aclocal-1.10")
message(STATUS "Automake found.")
else()
message(" aclocal has not been found.")
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum groupinstall 'Development Tools'")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install automake")
else()
message(" sudo apt-get install automake")
endif()
message(FATAL_ERROR "aclocal is required to build Protocol Buffers from source")
endif()
endif()
if(CMAKE_GENERATOR STREQUAL Xcode)
if(EXISTS /opt/local/bin/glibtoolize OR EXISTS /opt/local/bin/aclocal)
if(NOT EXISTS /usr/local/bin/glibtoolize OR NOT EXISTS /usr/local/bin/aclocal)
message(" WARNING: libtool/automake binaries cannot be found by Xcode. Please do:")
message("sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/")
message("sudo ln -s /opt/local/bin/aclocal /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autom4te /usr/local/bin/")
message("sudo ln -s /opt/local/bin/automake /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoconf /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoreconf /usr/local/bin/")
message(FATAL_ERROR "libtool/automake tools cannot be found by Xcode")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS /opt/local/bin/glibtoolize) OR
(NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS /opt/local/bin/aclocal))
message(" libtool/automake tools have not been found.")
message(" You can try to install them by typing:")
message(" 'sudo port install libtool automake', if you use Macports, or 'brew install libtool automake', if you use Homebrew")
message(FATAL_ERROR "libtool/automake tools are required to build Protocol Buffers from source")
endif()
if(CMAKE_GENERATOR STREQUAL Xcode)
if(EXISTS /opt/local/bin/glibtoolize OR EXISTS /opt/local/bin/aclocal)
if(NOT EXISTS /usr/local/bin/glibtoolize OR NOT EXISTS /usr/local/bin/aclocal)
message(" WARNING: libtool/automake binaries cannot be found by Xcode. Please do:")
message("sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/")
message("sudo ln -s /opt/local/bin/aclocal /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autom4te /usr/local/bin/")
message("sudo ln -s /opt/local/bin/automake /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoconf /usr/local/bin/")
message("sudo ln -s /opt/local/bin/autoreconf /usr/local/bin/")
message(FATAL_ERROR "libtool/automake tools cannot be found by Xcode")
endif()
endif()
endif()
endif()
endif()
set(PROTOBUF_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM})
if(PROTOBUF_MAKE_PROGRAM MATCHES "ninja" OR CMAKE_GENERATOR STREQUAL Xcode)
find_program(MAKE_EXECUTABLE make
PATHS
/usr/bin
/usr/local/bin
)
if(NOT MAKE_EXECUTABLE)
message(FATAL_ERROR "make is required to build Protocol Buffers from source.")
endif()
set(PROTOBUF_MAKE_PROGRAM ${MAKE_EXECUTABLE})
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(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 ${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
)
else()
if(CMAKE_MAKE_PROGRAM MATCHES "make")
include(ProcessorCount)
ProcessorCount(NUMBER_OF_PROCESSORS)
if(NUMBER_OF_PROCESSORS GREATER 1)
set(PROTOBUF_PARALLEL_BUILD "-j${NUMBER_OF_PROCESSORS}")
set(PROTOBUF_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM})
if(PROTOBUF_MAKE_PROGRAM MATCHES "ninja" OR CMAKE_GENERATOR STREQUAL Xcode)
find_program(MAKE_EXECUTABLE make
PATHS
/usr/bin
/usr/local/bin
)
if(NOT MAKE_EXECUTABLE)
message(FATAL_ERROR "make is required to build Protocol Buffers from source.")
endif()
set(PROTOBUF_MAKE_PROGRAM ${MAKE_EXECUTABLE})
endif()
if(CMAKE_VERSION VERSION_LESS 3.2)
ExternalProject_Add(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 ${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
)
else()
if(CMAKE_MAKE_PROGRAM MATCHES "make")
include(ProcessorCount)
ProcessorCount(NUMBER_OF_PROCESSORS)
if(NUMBER_OF_PROCESSORS GREATER 1)
set(PROTOBUF_PARALLEL_BUILD "-j${NUMBER_OF_PROCESSORS}")
endif()
endif()
ExternalProject_Add(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 ${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 ${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()
ExternalProject_Add(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 ${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 ${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()
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
endif()
unset(Protobuf_PROTOC_EXECUTABLE)
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 "${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}"
)
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 "${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})
endif()
else() # CMake >= 3.13 and Abseil found
include(BuildProtobuf)
endif()
unset(Protobuf_PROTOC_EXECUTABLE)
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 "${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 ${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 "${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})
endif()
if(${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION})
if(NOT (${Protobuf_VERSION} EQUAL "0.0.0"))

View File

@ -125,7 +125,7 @@ This section describes how to set up the compilation environment in GNU/Linux or
## GNU/Linux
- Tested distributions: Ubuntu 14.04 LTS and above; Debian 8.0 "jessie" and
- Tested distributions: Ubuntu 14.04 LTS and above; Debian 9.0 "stretch" and
above; Arch Linux; CentOS 7; Fedora 26 and above; OpenSUSE 42.3 and above.
- Supported microprocessor architectures:
- i386: Intel x86 instruction set (32-bit microprocessors).
@ -160,7 +160,7 @@ packages.
#### Debian / Ubuntu
If you are using Debian 8, Ubuntu 14.10 or above, this can be done by copying
If you are using Debian 9, Ubuntu 14.10 or above, this can be done by copying
and pasting the following line in a terminal:
```
@ -172,10 +172,9 @@ $ sudo apt-get install build-essential cmake git pkg-config libboost-dev libboos
libprotobuf-dev protobuf-compiler python3-mako
```
Please note that the required files from `libgtest-dev` were moved to
`googletest` in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and moved back
again to `libgtest-dev` in Debian 10 "buster" and Ubuntu 18.10 "cosmic" (and
above).
Please note that the required files from `libgtest-dev` were named `googletest`
in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and renamed to `libgtest-dev`
in Debian 10 "buster" and above.
Since Ubuntu 21.04 Hirsute / Debian 11, the package `libcpu-features-dev` is
also required.
@ -195,10 +194,6 @@ In distributions older than Ubuntu 16.04 or Debian 9, `python3-mako` must be
replaced by `python-mako`. For Ubuntu 14.04, you will need to add the package
`python-six` to the list of dependencies.
**Note for Debian 8 "jessie" users:** please see the note about `libmatio-dev`
above. Install `libtool`, `automake` and `libhdf5-dev` instead. You will also
need `python-six`.
Once you have installed these packages, you can jump directly to
[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository).
@ -477,24 +472,14 @@ $ sudo ldconfig
#### Install [Protocol Buffers](https://developers.google.com/protocol-buffers/ "Protocol Buffers' Homepage"), a portable mechanism for serialization of structured data
GNSS-SDR requires Protocol Buffers v3.0.0 or later. If the packages that come
with your distribution are older than that (_e.g._, Ubuntu 16.04 Xenial and
Debian 8 Jessie came with older versions), then you will need to install it
manually. First, install the dependencies:
with your distribution are older than that (_e.g._, Ubuntu 16.04 Xenial came
with an older versions), then you will need to install it manually:
```
$ sudo apt-get install autoconf automake libtool curl make g++ unzip
```
and then:
```
$ git clone https://github.com/protocolbuffers/protobuf.git
$ git clone --recursive https://github.com/protocolbuffers/protobuf.git
$ cd protobuf
$ git submodule update --init --recursive
$ ./autogen.sh
$ /configure
$ make -j$(nproc)
$ sudo make install
$ cmake -DABSL_PROPAGATE_CXX_STD=ON -Dprotobuf_BUILD_TESTS=OFF .
$ cmake --build --config Release --target install .
$ sudo ldconfig
```

View File

@ -0,0 +1,172 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION)
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "22.2")
endif()
if(NOT ZLIB_FOUND)
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES
URL "https://www.zlib.net/"
PURPOSE "Required to build Protocol Buffers."
TYPE REQUIRED
)
if(ZLIB_FOUND AND ZLIB_VERSION_STRING)
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library (found: v${ZLIB_VERSION_STRING})"
)
else()
set_package_properties(ZLIB PROPERTIES
DESCRIPTION "A Massively Spiffy Yet Delicately Unobtrusive Compression Library"
)
endif()
if(ZLIB_FOUND)
set(ZLIB_LIBRARIES_ ${ZLIB_LIBRARIES})
set(USE_ZLIB -Dprotobuf_WITH_ZLIB=ON)
else()
set(ZLIB_LIBRARIES_ "")
set(USE_ZLIB -Dprotobuf_WITH_ZLIB=OFF)
endif()
else()
set(ZLIB_LIBRARIES_ ${ZLIB_LIBRARIES})
set(USE_ZLIB -Dprotobuf_WITH_ZLIB=ON)
endif()
include(GNUInstallDirs)
list(APPEND UTF8_LIBRARIES
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}utf8_validity${CMAKE_STATIC_LIBRARY_SUFFIX}
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}utf8_range${CMAKE_STATIC_LIBRARY_SUFFIX}
)
# Fix for GCC 13
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "12.99")
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 Protocol Buffers. Please check your OS documentation and install the patch command.")
endif()
set(PROTOBUF_PATCH_COMMAND
cd ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/ &&
${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/port.h < ${GNSSSDR_SOURCE_DIR}/src/tests/data/protobuf22.patch
)
# Patch only once
if(EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/src/google/protobuf/port.h)
set(PROTOBUF_PATCH_COMMAND "")
endif()
else()
set(PROTOBUF_PATCH_COMMAND "")
endif()
else()
set(PROTOBUF_PATCH_COMMAND "")
endif()
ExternalProject_Add(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}
GIT_PROGRESS ON
UPDATE_COMMAND ""
PATCH_COMMAND ${PROTOBUF_PATCH_COMMAND}
SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/protobuf/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
BINARY_DIR ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
CMAKE_ARGS
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_VISIBILITY_INLINES_HIDDEN=1
-DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}
-Dprotobuf_BUILD_TESTS=OFF
-Dprotobuf_ABSL_PROVIDER=package
${USE_ZLIB}
BUILD_COMMAND ${CMAKE_COMMAND}
"--build" "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}"
"--config" $<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:Debug>$<$<CONFIG:Coverage>:Debug>$<$<CONFIG:O2WithASM>:RelWithDebInfo>$<$<CONFIG:O3WithASM>:RelWithDebInfo>$<$<CONFIG:ASAN>:Debug>
"--target" install
BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}
${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc
${ABSL_LIBRARIES}
${UTF8_LIBRARIES}
INSTALL_COMMAND ""
)
file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include)
file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(CoreFoundation CoreFoundation)
else()
set(CoreFoundation "")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "ASAN")
set(DEBUG_POSTFIX d)
else()
set(DEBUG_POSTFIX "")
endif()
set(PROTOBUF_ABSL_USED_TARGETS
absl::absl_check
absl::absl_log
absl::algorithm
absl::base
absl::bind_front
absl::bits
absl::btree
absl::cleanup
absl::cord
absl::core_headers
absl::debugging
absl::die_if_null
absl::dynamic_annotations
absl::flags
absl::flat_hash_map
absl::flat_hash_set
absl::function_ref
absl::hash
absl::layout
absl::log_initialize
absl::log_severity
absl::memory
absl::node_hash_map
absl::node_hash_set
absl::optional
absl::span
absl::status
absl::statusor
absl::strings
absl::synchronization
absl::time
absl::type_traits
absl::utility
absl::variant
)
if(NOT TARGET protobuf::libprotobuf)
add_library(protobuf::libprotobuf STATIC IMPORTED)
add_dependencies(protobuf::libprotobuf protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${DEBUG_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/include"
INTERFACE_LINK_LIBRARIES "${ZLIB_LIBRARIES_};${CoreFoundation};${UTF8_LIBRARIES};${PROTOBUF_ABSL_USED_TARGETS};${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endif()
if(NOT TARGET protobuf::protoc)
add_executable(protobuf::protoc IMPORTED)
add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION})
unset(Protobuf_PROTOC_EXECUTABLE)
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 "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc"
INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
endif()

View File

@ -87,6 +87,14 @@ All notable changes to GNSS-SDR will be documented in this file.
to CMake deactivates file downloading.
- The `ENABLE_GENERIC_ARCH` building option was removed, simplifying the process
of buiding the software in non-x86 processor architectures.
- If the Protocol Buffers dependency is not found, it is downloaded, built and
statically linked at buiding time. If CMake >= 3.13 and the
[Abseil C++ libraries](https://github.com/abseil/abseil-cpp) >= 20230117 are
installed on your system, Protocol Buffers v22.2 will be used. If those
requirements are not met, Protocol Buffers v21.4 will be used instead
(requires autotools).
- Since Debian 8 "Jessie", which enjoyed Long Term Support until the end of June
2020, is not anymore in the Debian official repositories, we drop its support.
### Improvements in Usability:

View File

@ -0,0 +1,12 @@
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-FileCopyrightText: 2023 Carles Fernandez-Prades <carles.fernandez@cttc.es>
--- port.h 2023-03-31 11:40:38.000000000 +0100
+++ port.h 2023-03-31 11:56:49.000000000 +0100
@@ -38,6 +38,7 @@
#include <cassert>
#include <cstddef>
+#include <cstdint>
#include <new>
#include <string>
#include <type_traits>