Enable building using macOS Sonoma

This commit is contained in:
Carles Fernandez 2024-01-01 17:33:15 +01:00
parent 7d6d62dbc6
commit 76f2cc411a
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 42 additions and 19 deletions

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR.
#
# SPDX-FileCopyrightText: 2010-2023 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-FileCopyrightText: 2010-2024 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
################################################################################
@ -911,6 +911,11 @@ if((Boost_VERSION_STRING VERSION_GREATER 1.71) AND (Boost_VERSION_STRING VERSION
endif()
endif()
# Workaround for macOS Sonoma
if((CMAKE_CXX_STANDARD EQUAL 17) AND ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND ("${DARWIN_VERSION}" VERSION_GREATER "22.99")))
add_definitions(-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1)
endif()
# Fix for Boost Asio < 1.70 when using Clang in macOS
if(Boost_VERSION_STRING VERSION_LESS 1.70.0)
# Check if we have std::string_view
@ -1823,7 +1828,7 @@ endif()
# Check that BLAS (Basic Linear Algebra Subprograms) is found in the system
# See https://www.netlib.org/blas/
################################################################################
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND ("${DARWIN_VERSION}" VERSION_LESS "23"))
# Avoid using the implementation that comes with the Accelerate framework
include(AvoidAccelerate)
else()
@ -1870,7 +1875,7 @@ endif()
# Check that LAPACK (Linear Algebra PACKage) is found in the system
# See https://www.netlib.org/lapack/
################################################################################
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
if(NOT((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND ("${DARWIN_VERSION}" VERSION_LESS "23")))
find_package(LAPACK)
set_package_properties(LAPACK PROPERTIES
URL "https://www.netlib.org/lapack/"
@ -1881,13 +1886,15 @@ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
endif()
if(NOT LAPACK_FOUND)
message(" The LAPACK library 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 install lapack-devel")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install lapack-devel")
else()
message(" sudo apt-get install liblapack-dev")
if(LINUX_DISTRIBUTION)
message(" You can try to install it by typing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum install lapack-devel")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
message(" sudo zypper install lapack-devel")
else()
message(" sudo apt-get install liblapack-dev")
endif()
endif()
message(FATAL_ERROR "LAPACK is required to build gnss-sdr")
endif()

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
)
[comment]: # (
SPDX-FileCopyrightText: 2011-2021 Carles Fernandez-Prades <carles.fernandez@cttc.es>
SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades <carles.fernandez@cttc.es>
)
<!-- prettier-ignore-end -->
@ -799,7 +799,7 @@ Of course, you will also need a GPU that
## macOS
GNSS-SDR can be built on macOS (or the former Mac OS X), starting from 10.9
(Mavericks) and including 11 (Big Sur). If you still have not installed
(Mavericks) and including 14 (Sonoma). If you still have not installed
[Xcode](https://developer.apple.com/xcode/ "Xcode"), do it now from the App
Store (it's free). You will also need the Xcode Command Line Tools, which do not
come by default in macOS versions older than Big Sur. If you are using an older
@ -830,12 +830,18 @@ In a terminal, type:
```
$ sudo port selfupdate
$ sudo port upgrade outdated
$ sudo port install armadillo boost cmake gnuradio gnutls lapack libad9361-iio libiio \
matio pkgconfig protobuf3-cpp pugixml google-glog +gflags
$ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml gnutls
$ sudo port install gnuradio +uhd +grc +zeromq
$ sudo port install boost matio libad9361-iio libiio google-glog +gflags
$ sudo port install py311-mako
$ sudo port install doxygen +docs
```
For macOS versions older than Sonoma, you will also need LAPACK:
```
$ sudo port install lapack
```
You also might need to activate a Python installation. The list of installed
versions can be retrieved with:
@ -846,7 +852,7 @@ $ port select --list python
and you can activate a certain version by typing:
```
$ sudo port select --set python python37
$ sudo port select --set python python311
```
### Homebrew
@ -871,13 +877,18 @@ Install the required dependencies:
```
$ brew update && brew upgrade
$ brew install armadillo cmake hdf5 gflags glog gnuradio lapack libmatio log4cpp \
$ brew install armadillo cmake hdf5 gflags glog gnuradio libmatio log4cpp \
openssl pkg-config protobuf pugixml
$ pip3 install mako
$ brew install --cask mactex # when completed, restart Terminal
$ brew install graphviz doxygen
```
For macOS versions older than Sonoma, you will also need LAPACK:
```
$ brew install lapack
```
### Other package managers
GNU Radio and other dependencies can also be installed using other package

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
)
[comment]: # (
SPDX-FileCopyrightText: 2011-2023 Carles Fernandez-Prades <carles.fernandez@cttc.es>
SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades <carles.fernandez@cttc.es>
)
<!-- prettier-ignore-end -->
@ -50,6 +50,7 @@ All notable changes to GNSS-SDR will be documented in this file.
- Fixed undefined behaviour in `volk_gnsssdr` arising from incompatibility
between complex numbers in C and C++.
- Now build system paths are not leaked when cross-compiling.
- Enabled building using macOS Sonoma and `arm64` processor architecture.
### Improvements in Repeatability:

View File

@ -1,7 +1,7 @@
# 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-FileCopyrightText: 2010-2024 C. Fernandez-Prades cfernandez(at)cttc.es
# SPDX-License-Identifier: BSD-3-Clause
@ -408,6 +408,10 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
set(GNSSTK_FLAGS "-DCMAKE_CXX_FLAGS:STRING=-w") # Fix for clang in aarch64
endif()
if(CMAKE_VERSION VERSION_GREATER 3.17.0)
set(GNSSTK_CXX_STANDARD 17)
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND ("${DARWIN_VERSION}" VERSION_GREATER_EQUAL "14"))
set(GNSSTK_CXX_STANDARD 14)
endif()
ExternalProject_Add(gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/SGL-UT/gnsstk
GIT_TAG v${GNSSSDR_GNSSTK_LOCAL_VERSION}
@ -420,7 +424,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA)
-DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install
-DBUILD_EXT=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_STANDARD=${GNSSTK_CXX_STANDARD}
-DCMAKE_CXX_EXTENSIONS=ON
-DCMAKE_C_STANDARD=11
-DCMAKE_C_EXTENSIONS=ON