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. # GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR. # 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 # 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()
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 # Fix for Boost Asio < 1.70 when using Clang in macOS
if(Boost_VERSION_STRING VERSION_LESS 1.70.0) if(Boost_VERSION_STRING VERSION_LESS 1.70.0)
# Check if we have std::string_view # Check if we have std::string_view
@ -1823,7 +1828,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 https://www.netlib.org/blas/ # 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 # Avoid using the implementation that comes with the Accelerate framework
include(AvoidAccelerate) include(AvoidAccelerate)
else() else()
@ -1870,7 +1875,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 https://www.netlib.org/lapack/ # 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) find_package(LAPACK)
set_package_properties(LAPACK PROPERTIES set_package_properties(LAPACK PROPERTIES
URL "https://www.netlib.org/lapack/" URL "https://www.netlib.org/lapack/"
@ -1881,13 +1886,15 @@ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
endif() endif()
if(NOT LAPACK_FOUND) if(NOT LAPACK_FOUND)
message(" The LAPACK library has not been found.") message(" The LAPACK library has not been found.")
message(" You can try to install it by typing:") if(LINUX_DISTRIBUTION)
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(" You can try to install it by typing:")
message(" sudo yum install lapack-devel") if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo yum install lapack-devel")
message(" sudo zypper install lapack-devel") elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE")
else() message(" sudo zypper install lapack-devel")
message(" sudo apt-get install liblapack-dev") else()
message(" sudo apt-get install liblapack-dev")
endif()
endif() endif()
message(FATAL_ERROR "LAPACK is required to build gnss-sdr") message(FATAL_ERROR "LAPACK is required to build gnss-sdr")
endif() endif()

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
) )
[comment]: # ( [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 --> <!-- prettier-ignore-end -->
@ -799,7 +799,7 @@ Of course, you will also need a GPU that
## macOS ## macOS
GNSS-SDR can be built on macOS (or the former Mac OS X), starting from 10.9 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 [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 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 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 selfupdate
$ sudo port upgrade outdated $ sudo port upgrade outdated
$ sudo port install armadillo boost cmake gnuradio gnutls lapack libad9361-iio libiio \ $ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml gnutls
matio pkgconfig protobuf3-cpp pugixml google-glog +gflags $ 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 py311-mako
$ sudo port install doxygen +docs $ 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 You also might need to activate a Python installation. The list of installed
versions can be retrieved with: versions can be retrieved with:
@ -846,7 +852,7 @@ $ port select --list python
and you can activate a certain version by typing: and you can activate a certain version by typing:
``` ```
$ sudo port select --set python python37 $ sudo port select --set python python311
``` ```
### Homebrew ### Homebrew
@ -871,13 +877,18 @@ Install the required dependencies:
``` ```
$ brew update && brew upgrade $ 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 openssl pkg-config protobuf pugixml
$ pip3 install mako $ pip3 install mako
$ brew install --cask mactex # when completed, restart Terminal $ brew install --cask mactex # when completed, restart Terminal
$ brew install graphviz doxygen $ brew install graphviz doxygen
``` ```
For macOS versions older than Sonoma, you will also need LAPACK:
```
$ brew install lapack
```
### Other package managers ### Other package managers
GNU Radio and other dependencies can also be installed using other package 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]: # ( [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 --> <!-- 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 - Fixed undefined behaviour in `volk_gnsssdr` arising from incompatibility
between complex numbers in C and C++. between complex numbers in C and C++.
- Now build system paths are not leaked when cross-compiling. - Now build system paths are not leaked when cross-compiling.
- Enabled building using macOS Sonoma and `arm64` processor architecture.
### Improvements in Repeatability: ### Improvements in Repeatability:

View File

@ -1,7 +1,7 @@
# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
# This file is part of GNSS-SDR. # 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 # 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 set(GNSSTK_FLAGS "-DCMAKE_CXX_FLAGS:STRING=-w") # Fix for clang in aarch64
endif() endif()
if(CMAKE_VERSION VERSION_GREATER 3.17.0) 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} ExternalProject_Add(gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}
GIT_REPOSITORY https://github.com/SGL-UT/gnsstk GIT_REPOSITORY https://github.com/SGL-UT/gnsstk
GIT_TAG v${GNSSSDR_GNSSTK_LOCAL_VERSION} 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 -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/install
-DBUILD_EXT=ON -DBUILD_EXT=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD=${GNSSTK_CXX_STANDARD}
-DCMAKE_CXX_EXTENSIONS=ON -DCMAKE_CXX_EXTENSIONS=ON
-DCMAKE_C_STANDARD=11 -DCMAKE_C_STANDARD=11
-DCMAKE_C_EXTENSIONS=ON -DCMAKE_C_EXTENSIONS=ON