OnAir

Build from source

Build instructions

You need a C++20 compiler, CMake 3.20 or newer, Rust (cargo and rustc 1.70 or newer; required since 0.2.7, the protocol layers are Rust), pkg-config, FFmpeg, libhackrf, and GLFW for the app. Desktop builds also need Python 3 to embed the bundled Chinese fonts (standard library only). SoapySDR is optional. For a cross build install the Rust target first (rustup target add <triple>); CMake names it when it is missing.

# macOS
brew install cmake rust pkg-config hackrf soapysdr libusb ffmpeg glfw python
# Debian / Ubuntu
sudo apt install build-essential cmake cargo python3 pkg-config libhackrf-dev libsoapysdr-dev libusb-1.0-0-dev \
  libglfw3-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-dev

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DDECT2_BUILD_APP=ON
cmake --build build -j "$(getconf _NPROCESSORS_ONLN)"   # one job per core (a bare -j starts hundreds and can run out of memory)
ctest --test-dir build          # run the test suite

The app is build/dect2. Without a radio, open an IQ recording through the IQ recording file source, or run the command-line receiver on it:

build/dect2cli --file capture.cs8 --rate 10 --format cs8 --play <service id>

SigMF (.sigmf-meta / .sigmf-data) and two-channel WAV IQ files open the same way and describe their own sample rate, centre frequency, format and start offset; --rate, --format and --freq still override.

Tuning for your own CPU. Release programs are built for the baseline 64-bit PC (the hot loops pick AVX2 at run time). A binary you build yourself can use everything your CPU offers:

  • -DDECT2_WIN_AVX2=ON (x86-64 on Windows and Intel Macs): the whole receiver for AVX2 + FMA; refuses to start on older CPUs.
  • -DCMAKE_CXX_FLAGS="-march=native" (GCC or Clang): runs only on CPUs like yours.
  • -DDECT2_PORTABLE=ON (macOS, plain C++ instead of Accelerate) and -DDECT2_NO_SIMD=ON go the other way, for unusual CPUs, and are slower.

Configure with a clean build folder after changing these. Other options in CMakeLists.txt: DECT2_UI_BACKEND (Metal or OpenGL3), DECT2_WITH_SOAPY, DECT2_WITH_RFNM (when librfnm is installed: DEVICES.md).

Windows (10 or 11, 64-bit), step by step:

  1. Install MSYS2 with its default settings, and open MSYS2 UCRT64 (not MINGW64: it has no HackRF and SoapySDR packages).
  2. Update MSYS2 with pacman -Syu (if the window closes, open UCRT64 again and run it a second time).
  3. Install the tools and libraries: ``sh pacman -S --needed git zip mingw-w64-ucrt-x86_64-{gcc,cmake,ninja,python,pkgconf,ffmpeg,glfw,hackrf,soapysdr,libiconv} ` Optional: mingw-w64-ucrt-x86_64-nsis for the setup .exe. (codec2 is built from third_party/codec2` with OnAir and goes into the zip.)
  4. Get the source and build: ``sh git clone https://github.com/adswill/OnAir.git cd OnAir cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECT2_BUILD_APP=ON cmake --build build ``
  5. Run it from the same shell, so Windows finds the DLLs: ./build/dect2.exe. Tests: ctest --test-dir build.
  6. For a folder that runs on any PC, with all DLLs next to OnAir.exe, run tools/package/make_windows.sh: a portable zip in build-windows/, plus a setup .exe if NSIS is installed. From macOS or Linux, tools/package/make_windows_cross.sh builds the same package with a cross-compiler.

To use a HackRF, RTL-SDR or Airspy, install the WinUSB driver once with Zadig.

macOS app and disk image: run tools/package/make_dmg.sh. It targets macOS 15.0 by default (override with MACOSX_DEPLOYMENT_TARGET); every bundled library must support that version, and packaging stops if any executable or library requires a newer macOS.

Project layout

FolderContents
core/The receiver library: demodulators, error correction, transport stream, player, network tuner
app/The graphical application
tools/Command-line receiver and scanner, plus the packaging scripts
tests/Unit tests and benchmarks
packaging/Linux and Windows installer resources, Docker