SoapySDR: Fix build of dependents using gcc on macOS

Closes: https://trac.macports.org/ticket/66385

And fix configuration with cmake 4.
This commit is contained in:
Ryan Carsten Schmidt
2025-08-29 21:29:35 -05:00
parent a274860c8e
commit f403859a69
4 changed files with 89 additions and 4 deletions
+7 -4
View File
@@ -1,18 +1,17 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup cmake 1.1
PortGroup github 1.0
PortGroup cmake 1.0
github.setup pothosware SoapySDR 0.8.1 soapy-sdr-
revision 1
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
checksums rmd160 c9488967b821f644b46df69c5d37c6888718ae56 \
sha256 cc1dc3878861270fd95f9226f87abe63eff1413f17a778b4236e8cfd016c1faa \
size 131245
revision 0
platforms darwin macosx
categories science
license Boost-1
maintainers gmail.com:gedgy63 {michaelld @michaelld} {ra1nb0w @ra1nb0w} openmaintainer
@@ -20,10 +19,14 @@ maintainers gmail.com:gedgy63 {michaelld @michaelld} {ra1nb0w @ra1nb0w}
description A fresh and clean vendor neutral and platform independent SDR support library
long_description SoapySDR is an open-source generalized C/C++ API and runtime library for interfacing with SDR devices. With SoapySDR, you can instantiate, configure, and stream with an SDR device in a variety of environments. Both osmosdr and uhd devices are available within SoapySDR. In addition, vendors can directly support their hardware using SoapySDR device modules. There are wrappers for both gr-osmosdr, uhd, and gr-uhd to bring an ecosystem of existing applications to SoapySDR devices. And SoapySDR has support for powerful platforms like GNU Radio and Pothos.
homepage https://github.com/pothosware/SoapySDR/wiki
homepage ${github.homepage}/wiki
compiler.cxx_standard 2011
patchfiles cmake_minimum_required.patch \
non-virtual-dtor.patch \
SoapySDRUtil.cmake.patch
configure.args-append \
-DENABLE_PYTHON=OFF \
-DENABLE_PYTHON3=OFF
@@ -0,0 +1,20 @@
Fix build of dependents with gcc when using Apple linker.
Part of:
https://github.com/pothosware/SoapySDR/commit/f8d57652d12f9d212f373a81e493eba1a0b058c5
--- cmake/Modules/SoapySDRUtil.cmake.orig
+++ cmake/Modules/SoapySDRUtil.cmake
@@ -100,7 +100,11 @@ function(SOAPY_SDR_MODULE_UTIL)
if(CMAKE_COMPILER_IS_GNUCXX)
#force a compile-time error when symbols are missing
#otherwise modules will cause a runtime error on load
- target_link_libraries(${MODULE_TARGET} PRIVATE "-Wl,--no-undefined")
+ if(APPLE)
+ target_link_libraries(${MODULE_TARGET} PRIVATE "-Wl,-undefined,error")
+ else()
+ target_link_libraries(${MODULE_TARGET} PRIVATE "-Wl,--no-undefined")
+ endif()
endif()
if (NOT MODULE_DESTINATION)
@@ -0,0 +1,48 @@
Fix configuration with CMake >= 4:
Compatibility with CMake < 3.5 has been removed from CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
The fix for CMakeLists.txt and ExampleDriver/CMakeLists.txt is from:
https://github.com/pothosware/SoapySDR/commit/fbf9f3c328868f46029284716df49095ab7b99a6
python/CMakeLists.txt is not yet fixed upstream; see:
https://github.com/pothosware/SoapySDR/issues/360
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -1,7 +1,7 @@
########################################################################
# Project setup
########################################################################
-cmake_minimum_required(VERSION 3.1.0)
+cmake_minimum_required(VERSION 3.3...3.10)
project(SoapySDR)
enable_language(CXX)
enable_testing()
--- ExampleDriver/CMakeLists.txt.orig
+++ ExampleDriver/CMakeLists.txt
@@ -2,7 +2,7 @@
# Project setup -- only needed if device support is a stand-alone build
# We recommend that the support module be built in-tree with the driver.
########################################################################
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.6...3.10)
project(SoapySDRMyDevice CXX)
enable_testing()
--- python/CMakeLists.txt.orig
+++ python/CMakeLists.txt
@@ -1,7 +1,7 @@
########################################################################
# Project setup
########################################################################
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8...3.10)
project(SoapySDRPython CXX)
enable_testing()
@@ -0,0 +1,14 @@
Only use -Wnon-virtual-dtor with C++:
https://github.com/pothosware/SoapySDR/commit/310d1e3cd1f39162b44ae16e22f232d149ffa220
--- lib/CMakeLists.txt.orig
+++ lib/CMakeLists.txt
@@ -80,7 +80,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
#common warnings to help encourage good coding practices
target_compile_options(SoapySDR PUBLIC -Wall)
target_compile_options(SoapySDR PUBLIC -Wextra)
- target_compile_options(SoapySDR PUBLIC -Wnon-virtual-dtor)
+ target_compile_options(SoapySDR PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wnon-virtual-dtor>)
endif()
if (MSVC)