Simplify cmake scripts, fix volk_gnsssdr cross-compilation, update ProtocolBuffers to 3.11.2

This commit is contained in:
Carles Fernandez 2020-01-13 01:49:00 +01:00
parent 24a2d6c5d9
commit bc9725c745
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
11 changed files with 219 additions and 180 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) # Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -190,148 +190,14 @@ endif()
# Detect Linux Distribution # Detect Linux Distribution
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
set(OperatingSystem "Linux") include(DetectLinuxDistro)
set(OS_IS_LINUX TRUE)
if(ARCH_64BITS)
set(ARCH_ "(64 bits)")
else()
set(ARCH_ "(32 bits)")
endif()
if(EXISTS "/etc/lsb-release")
execute_process(COMMAND cat /etc/lsb-release
COMMAND grep DISTRIB_ID
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_DISTRIBUTION
RESULT_VARIABLE LINUX_ID_RESULT
)
execute_process(COMMAND cat /etc/lsb-release
COMMAND grep DISTRIB_RELEASE
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_VER
RESULT_VARIABLE LINUX_VER_RESULT
)
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/linuxmint/info")
set(LINUX_DISTRIBUTION "LinuxMint")
execute_process(COMMAND cat /etc/linuxmint/info
COMMAND grep -m1 RELEASE
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_VER
RESULT_VARIABLE LINUX_VER_RESULT
)
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/os-release")
execute_process(COMMAND cat /etc/os-release
COMMAND grep -m1 NAME
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_DISTRIBUTION
RESULT_VARIABLE LINUX_ID_RESULT
)
execute_process(COMMAND cat /etc/os-release
COMMAND grep VERSION_ID
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_VER
RESULT_VARIABLE LINUX_VER_RESULT
)
if(${LINUX_DISTRIBUTION} MATCHES "Debian")
set(LINUX_DISTRIBUTION "Debian")
file(READ /etc/debian_version LINUX_VER)
endif()
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/redhat-release")
set(LINUX_DISTRIBUTION "Red Hat")
file(READ /etc/redhat-release LINUX_VER)
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/debian_version")
set(LINUX_DISTRIBUTION "Debian")
file(READ /etc/debian_version LINUX_VER)
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
set(LINUX_DISTRIBUTION "Generic")
set(LINUX_VER "Unknown")
endif()
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on ${LINUX_DISTRIBUTION} GNU/Linux Release ${LINUX_VER} ${ARCH_}") message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on ${LINUX_DISTRIBUTION} GNU/Linux Release ${LINUX_VER} ${ARCH_}")
endif() endif()
if(NOT LINUX_DISTRIBUTION)
set(LINUX_DISTRIBUTION "Unknown")
endif()
# Detect macOS / Mac OS X Version # Detect macOS / Mac OS X Version
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(OperatingSystem "Mac OS X") include(DetectMacOSVersion)
set(OS_IS_MACOSX TRUE) message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on ${MACOS_DISTRIBUTION}")
execute_process(COMMAND uname -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
if(${DARWIN_VERSION} MATCHES "19")
set(MACOS_CATALINA TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS Catalina 10.15")
endif()
if(${DARWIN_VERSION} MATCHES "18")
set(MACOS_MOJAVE TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS Mojave 10.14")
endif()
if(${DARWIN_VERSION} MATCHES "17")
set(MACOS_HIGH_SIERRA TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS High Sierra 10.13")
endif()
if(${DARWIN_VERSION} MATCHES "16")
set(MACOS_SIERRA TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS Sierra 10.12")
endif()
if(${DARWIN_VERSION} MATCHES "15")
set(MACOSX_EL_CAPITAN TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on Mac OS X 10.11 El Capitan")
endif()
if(${DARWIN_VERSION} MATCHES "14")
set(MACOSX_YOSEMITE TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on Mac OS X 10.10 Yosemite")
endif()
if(${DARWIN_VERSION} MATCHES "13")
set(MACOSX_MAVERICKS TRUE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION="com.apple.compilers.llvm.clang.1_0")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on Mac OS X 10.9 Mavericks")
endif()
if(${DARWIN_VERSION} MATCHES "12")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on Mac OS X 10.8 Mountain Lion")
endif()
if(${DARWIN_VERSION} MATCHES "11")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on Mac OS X 10.7 Lion")
endif()
if(${DARWIN_VERSION} MATCHES "10")
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on Mac OS X 10.6 Snow Leopard")
endif()
endif() endif()
# Define extra build types and select Release by default to get optimization flags # Define extra build types and select Release by default to get optimization flags
@ -410,7 +276,7 @@ set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master")
set(GNSSSDR_GPSTK_LOCAL_VERSION "2.12") set(GNSSSDR_GPSTK_LOCAL_VERSION "2.12")
set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.17") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.17")
set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10")
set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.11.1") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.11.2")
if(CMAKE_VERSION VERSION_LESS "3.0.2") if(CMAKE_VERSION VERSION_LESS "3.0.2")
set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.1") # Fix for CentOS 7 set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.1") # Fix for CentOS 7
@ -512,7 +378,7 @@ endif()
################################################################################ ################################################################################
# Check if the compiler defines the architecture as ARM # Check if the compiler defines the architecture as ARM
################################################################################ ################################################################################
if(NOT OS_IS_MACOSX) if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
if(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
set(IS_ARM TRUE) set(IS_ARM TRUE)
if(NOT CMAKE_NO_SYSTEM_FROM_IMPORTED) if(NOT CMAKE_NO_SYSTEM_FROM_IMPORTED)
@ -960,17 +826,13 @@ if(NOT VOLKGNSSSDR_FOUND)
if(PYTHON_EXECUTABLE) if(PYTHON_EXECUTABLE)
set(USE_THIS_PYTHON "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}") set(USE_THIS_PYTHON "-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}")
endif() endif()
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(CMAKE_GENERATOR STREQUAL Xcode) if(CMAKE_GENERATOR STREQUAL Xcode)
set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}" "-target") set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}" "-target")
endif() endif()
endif() endif()
if(CMAKE_CROSSCOMPILING) set(VOLK_GNSSSDR_COMPILER -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
set(VOLK_GNSSSDR_COMPILER "")
else()
set(VOLK_GNSSSDR_COMPILER -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
endif()
find_package(ORC) find_package(ORC)
set_package_properties(ORC PROPERTIES set_package_properties(ORC PROPERTIES
@ -1239,7 +1101,7 @@ if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS})
else() else()
set(GFLAGS_LIBRARY_DIR_TO_LINK ${GFlags_LIBRARY_DIRS}) set(GFLAGS_LIBRARY_DIR_TO_LINK ${GFlags_LIBRARY_DIRS})
endif() endif()
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(GFLAGS_LIBRARIES_TO_LINK "${GFLAGS_LIBRARIES_TO_LINK} -lc++") set(GFLAGS_LIBRARIES_TO_LINK "${GFLAGS_LIBRARIES_TO_LINK} -lc++")
set(GLOG_EXPORT_CXX_LIBRARIES "export CXXFLAGS=\"-stdlib=libc++\"") set(GLOG_EXPORT_CXX_LIBRARIES "export CXXFLAGS=\"-stdlib=libc++\"")
endif() endif()
@ -1272,7 +1134,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/c
set(GLOG_CONFIGURE ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags) set(GLOG_CONFIGURE ${CMAKE_CURRENT_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags)
# Ensure that aclocal and libtool are present # Ensure that aclocal and libtool are present
if(OS_IS_LINUX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(EXISTS "/usr/bin/libtoolize") if(EXISTS "/usr/bin/libtoolize")
if(EXISTS "/usr/bin/aclocal" OR if(EXISTS "/usr/bin/aclocal" OR
EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.16" OR
@ -1448,7 +1310,7 @@ endif()
# Check that BLAS (Basic Linear Algebra Subprograms) is found in the system # Check that BLAS (Basic Linear Algebra Subprograms) is found in the system
# See http://www.netlib.org/blas/ # See http://www.netlib.org/blas/
################################################################################ ################################################################################
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Avoid using the implementation that comes with the Accelerate framework # Avoid using the implementation that comes with the Accelerate framework
include(AvoidAccelerate) include(AvoidAccelerate)
else() else()
@ -1466,7 +1328,7 @@ endif()
if(NOT BLAS_FOUND) if(NOT BLAS_FOUND)
message(" The BLAS library has not been found.") message(" The BLAS library has not been found.")
message(" You can try to install it by typing:") message(" You can try to install it by typing:")
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(" 'sudo port install lapack' if you are using Macports, or") message(" 'sudo port install lapack' if you are using Macports, or")
message(" 'brew install lapack' if you are using Homebrew.") message(" 'brew install lapack' if you are using Homebrew.")
else() else()
@ -1485,7 +1347,7 @@ endif()
# Check that LAPACK (Linear Algebra PACKage) is found in the system # Check that LAPACK (Linear Algebra PACKage) is found in the system
# See http://www.netlib.org/lapack/ # See http://www.netlib.org/lapack/
################################################################################ ################################################################################
if(NOT OS_IS_MACOSX) if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
find_package(LAPACK) find_package(LAPACK)
set_package_properties(LAPACK PROPERTIES set_package_properties(LAPACK PROPERTIES
URL "http://www.netlib.org/lapack/" URL "http://www.netlib.org/lapack/"
@ -1550,7 +1412,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO)
############################################# #############################################
# Check if GFORTRAN is found in the system # Check if GFORTRAN is found in the system
############################################# #############################################
if(NOT OS_IS_MACOSX AND NOT MSVC) if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT MSVC)
find_package(GFORTRAN) find_package(GFORTRAN)
set_package_properties(GFORTRAN PROPERTIES set_package_properties(GFORTRAN PROPERTIES
PURPOSE "Required by Armadillo." PURPOSE "Required by Armadillo."
@ -1708,7 +1570,7 @@ if(NOT GNUTLS_OPENSSL_LIBRARY)
message(STATUS " But it was not built with openssl compatibility.") message(STATUS " But it was not built with openssl compatibility.")
endif() endif()
message(STATUS " Looking for OpenSSL instead...") message(STATUS " Looking for OpenSSL instead...")
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) # Trick for Homebrew set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) # Trick for Homebrew
endif() endif()
find_package(OpenSSL) find_package(OpenSSL)
@ -1728,14 +1590,14 @@ if(NOT GNUTLS_OPENSSL_LIBRARY)
else() else()
message(" The GnuTLS library with openssl compatibility enabled has not been found.") message(" The GnuTLS library with openssl compatibility enabled has not been found.")
message(" You can try to install the required libraries by typing:") message(" You can try to install the required libraries by typing:")
if(OS_IS_LINUX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum install openssl-devel") message(" sudo yum install openssl-devel")
else() else()
message(" sudo apt-get install libgnutls28-dev") message(" sudo apt-get install libgnutls28-dev")
endif() endif()
endif() endif()
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(" 'sudo port install gnutls', if you are using Macports, or") message(" 'sudo port install gnutls', if you are using Macports, or")
message(" 'brew install openssl', if you are using Homebrew.") message(" 'brew install openssl', if you are using Homebrew.")
endif() endif()
@ -1776,7 +1638,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
endif() endif()
if(ZLIB_FOUND) if(ZLIB_FOUND)
get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY) get_filename_component(ZLIB_BASE_DIR ${ZLIB_INCLUDE_DIRS} DIRECTORY)
if(OS_IS_LINUX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(NOT EXISTS "/usr/bin/libtoolize") if(NOT EXISTS "/usr/bin/libtoolize")
message(" libtool has not been found.") message(" libtool has not been found.")
message(" You can try to install it by typing:") message(" You can try to install it by typing:")
@ -1829,7 +1691,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR) list(GET HDF5_LIBRARIES 0 HDF5_FIRST_DIR)
get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY) get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY)
get_filename_component(HDF5_BASE_DIR ${HDF5_BASE_DIR2} DIRECTORY) get_filename_component(HDF5_BASE_DIR ${HDF5_BASE_DIR2} DIRECTORY)
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(EXISTS /opt/local/include/hdf5.h) if(EXISTS /opt/local/include/hdf5.h)
set(HDF5_BASE_DIR /opt/local) set(HDF5_BASE_DIR /opt/local)
endif() endif()
@ -1889,12 +1751,12 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS
else() else()
message(STATUS " The hdf5 library has not been found in your system.") message(STATUS " The hdf5 library has not been found in your system.")
message(STATUS " Please try to install it by doing:") message(STATUS " Please try to install it by doing:")
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS " $ sudo port install hdf5") message(STATUS " $ sudo port install hdf5")
message(STATUS " or") message(STATUS " or")
message(STATUS " $ brew install hdf5") message(STATUS " $ brew install hdf5")
endif() endif()
if(OS_IS_LINUX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
message(STATUS " $ sudo apt-get install libhdf5-dev") message(STATUS " $ sudo apt-get install libhdf5-dev")
endif() endif()
message(FATAL_ERROR "*** The hdf5 library is required to build gnss-sdr") message(FATAL_ERROR "*** The hdf5 library is required to build gnss-sdr")
@ -2109,7 +1971,7 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI
) )
endif() endif()
else() else()
if(OS_IS_LINUX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(NOT EXISTS "/usr/bin/libtoolize") if(NOT EXISTS "/usr/bin/libtoolize")
message(" libtool has not been found.") message(" libtool has not been found.")
message(" You can try to install it by typing:") message(" You can try to install it by typing:")
@ -2295,14 +2157,14 @@ else()
message(STATUS " Doxygen has not been found in your system.") message(STATUS " Doxygen has not been found in your system.")
message(STATUS " You can get nice code documentation by using it!") message(STATUS " You can get nice code documentation by using it!")
message(STATUS " Get it from http://www.doxygen.nl/download.html") message(STATUS " Get it from http://www.doxygen.nl/download.html")
if(OS_IS_LINUX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(STATUS " or simply by doing 'sudo yum install doxygen-latex'.") message(STATUS " or simply by doing 'sudo yum install doxygen-latex'.")
else() else()
message(STATUS " or simply by doing 'sudo apt-get install doxygen-latex'.") message(STATUS " or simply by doing 'sudo apt-get install doxygen-latex'.")
endif() endif()
endif() endif()
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message(STATUS " or simply by doing 'sudo port install doxygen +latex'.") message(STATUS " or simply by doing 'sudo port install doxygen +latex'.")
endif() endif()
endif() endif()
@ -2711,7 +2573,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32)
endif() endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(NOT ENABLE_GENERIC_ARCH) if(NOT ENABLE_GENERIC_ARCH)
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_compile_options(-march=native) add_compile_options(-march=native)
else() else()
if(IS_ARM) if(IS_ARM)

View File

@ -304,9 +304,9 @@ $ sudo apt-get install autoconf automake libtool curl make g++ unzip
and then: and then:
~~~~~~ ~~~~~~
$ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.1/protobuf-cpp-3.11.1.tar.gz $ wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.1/protobuf-cpp-3.11.2.tar.gz
$ tar xvfz protobuf-cpp-3.11.1.tar.gz $ tar xvfz protobuf-cpp-3.11.2.tar.gz
$ cd protobuf-3.11.1 $ cd protobuf-3.11.2
$ ./autogen.sh $ ./autogen.sh
$ ./configure $ ./configure
$ make $ make

View File

@ -0,0 +1,99 @@
# Copyright (C) 2020 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_ "(64 bits)")
else()
set(ARCH_ "(32 bits)")
endif()
if(EXISTS "/etc/lsb-release")
execute_process(COMMAND cat /etc/lsb-release
COMMAND grep DISTRIB_ID
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_DISTRIBUTION
RESULT_VARIABLE LINUX_ID_RESULT
)
execute_process(COMMAND cat /etc/lsb-release
COMMAND grep DISTRIB_RELEASE
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_VER
RESULT_VARIABLE LINUX_VER_RESULT
)
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/linuxmint/info")
set(LINUX_DISTRIBUTION "LinuxMint")
execute_process(COMMAND cat /etc/linuxmint/info
COMMAND grep -m1 RELEASE
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_VER
RESULT_VARIABLE LINUX_VER_RESULT
)
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/os-release")
execute_process(COMMAND cat /etc/os-release
COMMAND grep -m1 NAME
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_DISTRIBUTION
RESULT_VARIABLE LINUX_ID_RESULT
)
execute_process(COMMAND cat /etc/os-release
COMMAND grep VERSION_ID
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LINUX_VER
RESULT_VARIABLE LINUX_VER_RESULT
)
if(${LINUX_DISTRIBUTION} MATCHES "Debian")
set(LINUX_DISTRIBUTION "Debian")
file(READ /etc/debian_version LINUX_VER)
endif()
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/redhat-release")
set(LINUX_DISTRIBUTION "Red Hat")
file(READ /etc/redhat-release LINUX_VER)
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
if(EXISTS "/etc/debian_version")
set(LINUX_DISTRIBUTION "Debian")
file(READ /etc/debian_version LINUX_VER)
endif()
endif()
if(NOT LINUX_DISTRIBUTION)
set(LINUX_DISTRIBUTION "Generic")
set(LINUX_VER "Unknown")
endif()

View File

@ -0,0 +1,78 @@
# Copyright (C) 2020 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
execute_process(COMMAND uname -v OUTPUT_VARIABLE DARWIN_VERSION)
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
if(${DARWIN_VERSION} MATCHES "19")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(MACOS_DISTRIBUTION "macOS Catalina 10.15")
endif()
if(${DARWIN_VERSION} MATCHES "18")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(MACOS_DISTRIBUTION "macOS Mojave 10.14")
endif()
if(${DARWIN_VERSION} MATCHES "17")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(MACOS_DISTRIBUTION "macOS High Sierra 10.13")
endif()
if(${DARWIN_VERSION} MATCHES "16")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(MACOS_DISTRIBUTION "macOS Sierra 10.12")
endif()
if(${DARWIN_VERSION} MATCHES "15")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(MACOS_DISTRIBUTION "Mac OS X 10.11 El Capitan")
endif()
if(${DARWIN_VERSION} MATCHES "14")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(MACOS_DISTRIBUTION "Mac OS X 10.10 Yosemite")
endif()
if(${DARWIN_VERSION} MATCHES "13")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION="com.apple.compilers.llvm.clang.1_0")
set(MACOS_DISTRIBUTION "Mac OS X 10.9 Mavericks")
endif()
if(${DARWIN_VERSION} MATCHES "12")
set(MACOS_DISTRIBUTION "Mac OS X 10.8 Mountain Lion")
endif()
if(${DARWIN_VERSION} MATCHES "11")
set(MACOS_DISTRIBUTION "Mac OS X 10.7 Lion")
endif()
if(${DARWIN_VERSION} MATCHES "10")
set(MACOS_DISTRIBUTION "Mac OS X 10.6 Snow Leopard")
endif()
if(NOT MACOS_DISTRIBUTION)
set(MACOS_DISTRIBUTION "MacOS (Unknown version)")
endif()

View File

@ -254,11 +254,11 @@ if(GNURADIO_VERSION)
if(GNURADIO_VERSION VERSION_LESS ${GNSSSDR_GNURADIO_MIN_VERSION}) if(GNURADIO_VERSION VERSION_LESS ${GNSSSDR_GNURADIO_MIN_VERSION})
unset(GNURADIO_RUNTIME_FOUND) unset(GNURADIO_RUNTIME_FOUND)
message(STATUS "The GNU Radio version installed in your system (v${GNURADIO_VERSION}) is too old.") message(STATUS "The GNU Radio version installed in your system (v${GNURADIO_VERSION}) is too old.")
if(OS_IS_LINUX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU")
message("Go to https://github.com/gnuradio/pybombs") message("Go to https://github.com/gnuradio/pybombs")
message("and follow the instructions to install GNU Radio in your system.") message("and follow the instructions to install GNU Radio in your system.")
endif() endif()
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
message("You can install it easily via Macports:") message("You can install it easily via Macports:")
message(" sudo port install gnuradio ") message(" sudo port install gnuradio ")
message("Alternatively, you can use homebrew:") message("Alternatively, you can use homebrew:")

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2019 (see AUTHORS file for a list of contributors) # Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -109,7 +109,7 @@ if(Boost_VERSION_STRING VERSION_GREATER 1.65.99)
endif() endif()
# Fix for Boost Asio < 1.70 # Fix for Boost Asio < 1.70
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0)) if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view}) if(${has_string_view})
target_compile_definitions(pvt_libs target_compile_definitions(pvt_libs

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2019 (see AUTHORS file for a list of contributors) # Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -82,7 +82,7 @@ if(ENABLE_RAW_UDP AND PCAP_FOUND)
endif() endif()
# Fix for Boost Asio < 1.70 # Fix for Boost Asio < 1.70
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0)) if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view}) if(${has_string_view})
target_compile_definitions(signal_source_gr_blocks target_compile_definitions(signal_source_gr_blocks

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2019 (see AUTHORS file for a list of contributors) # Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -118,7 +118,7 @@ if(Boost_VERSION_STRING VERSION_GREATER 1.65.99)
endif() endif()
# Fix for Boost Asio < 1.70 # Fix for Boost Asio < 1.70
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0)) if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view}) if(${has_string_view})
target_compile_definitions(tracking_libs target_compile_definitions(tracking_libs

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2019 (see AUTHORS file for a list of contributors) # Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -69,7 +69,7 @@ endif()
# Fix for Boost Asio < 1.70 # Fix for Boost Asio < 1.70
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0)) if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view}) if(${has_string_view})
target_compile_definitions(core_monitor target_compile_definitions(core_monitor

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2019 (see AUTHORS file for a list of contributors) # Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -161,7 +161,7 @@ if(ENABLE_ARMA_NO_DEBUG)
endif() endif()
# Fix for Boost Asio < 1.70 # Fix for Boost Asio < 1.70
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0)) if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") AND (Boost_VERSION_STRING VERSION_LESS 1.70.0))
if(${has_string_view}) if(${has_string_view})
target_compile_definitions(core_receiver target_compile_definitions(core_receiver

View File

@ -1,4 +1,4 @@
# Copyright (C) 2012-2019 (see AUTHORS file for a list of contributors) # Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
# #
# This file is part of GNSS-SDR. # This file is part of GNSS-SDR.
# #
@ -70,7 +70,7 @@ if(ENABLE_GPERFTOOLS)
endif() endif()
endif() endif()
if(OS_IS_MACOSX) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_link_libraries(gnss-sdr target_link_libraries(gnss-sdr
PUBLIC PUBLIC