Skip to content
Permalink
Browse files

SoapySDR: add variants for python bindings

  • Loading branch information
ddcc authored and michaelld committed Mar 25, 2019
1 parent 91f012a commit c111fd04c8c157b9f94564de322a530ddc773c72
Showing with 75 additions and 0 deletions.
  1. +75 −0 science/SoapySDR/Portfile
@@ -19,3 +19,78 @@ description A fresh and clean vendor neutral and platform independent SD
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

configure.args-append \
-DENABLE_PYTHON=OFF \
-DENABLE_PYTHON3=OFF

# specify the Python dependencies; these are checked for at configure,
# then used for building, but not at runtime.

set pythons2_suffixes {27}
set pythons3_suffixes {36 37}

set pythons_ports {}
foreach s ${pythons2_suffixes} {
lappend pythons_suffixes ${s}
lappend pythons2_ports python${s}
}
foreach s ${pythons3_suffixes} {
lappend pythons_suffixes ${s}
lappend pythons3_ports python${s}
}

proc python_dir {} {
global pythons_suffixes
foreach s ${pythons_suffixes} {
if {[variant_isset python${s}]} {
set p python[string index ${s} 0].[string index ${s} 1]
return [file normalize [exec ${p} -c "import sys; print(sys.prefix)"]/lib/${p}/site-packages]
}
}
error "Python support not enabled."
}

foreach s ${pythons2_suffixes} {
set p python${s}
set v [string index ${s} 0].[string index ${s} 1]
set i [lsearch -exact ${pythons2_ports} ${p}]
set c [lreplace ${pythons2_ports} ${i} ${i}]
variant ${p} description "Build SoapySDR using Python ${v}" conflicts {*}${c} "
# required Python
depends_lib-append \
port:${p}
depends_build-append \
port:swig-python
# specify the Python version to use
configure.args-delete \
-DENABLE_PYTHON=OFF
configure.args-append \
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/${v}/bin/python${v} \
-DPYTHON_CONFIG_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/${v}/bin/python${v}-config \
-DPYTHON_INSTALL_DIR=${frameworks_dir}/Python.framework/Versions/${v}/lib/python${v}/site-packages
"
}

foreach s ${pythons3_suffixes} {
set p python${s}
set v [string index ${s} 0].[string index ${s} 1]
set i [lsearch -exact ${pythons3_ports} ${p}]
set c [lreplace ${pythons3_ports} ${i} ${i}]
variant ${p} description "Build SoapySDR using Python ${v}" conflicts {*}${c} "
# required Python
depends_lib-append \
port:${p}
depends_build-append \
port:swig-python
# specify the Python version to use
configure.args-delete \
-DENABLE_PYTHON3=OFF
configure.args-append \
-DENABLE_PYTHON3=ON \
-DPYTHON3_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/${v}/bin/python${v} \
-DPYTHON3_CONFIG_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/${v}/bin/python${v}-config \
-DPYTHON3_INSTALL_DIR=${frameworks_dir}/Python.framework/Versions/${v}/lib/python${v}/site-packages
"
}

0 comments on commit c111fd0

Please sign in to comment.
You can’t perform that action at this time.