Files
midi-playlist/tools/opl/build.sh
T

18 lines
737 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# build.sh — fetch and build libADLMIDI, then compile render_opl.
# Idempotent: skips anything already present. Run once per machine.
set -euo pipefail
cd "$(dirname "$0")"
LIBDIR="${OPL_LIBDIR:-/opt/libADLMIDI}"
if [ ! -f "$LIBDIR/build/libADLMIDI.a" ]; then
echo "cloning libADLMIDI..."
git clone --depth 1 -q https://github.com/Wohlstand/libADLMIDI.git "$LIBDIR"
echo "building (a few minutes)..."
cmake -B "$LIBDIR/build" -S "$LIBDIR" -DCMAKE_BUILD_TYPE=Release >/dev/null
cmake --build "$LIBDIR/build" -j"$(nproc)" --target ADLMIDI_static >/dev/null
fi
g++ -O2 -I "$LIBDIR/include" render_opl.cpp "$LIBDIR/build/libADLMIDI.a" \
-o render_opl -lpthread
echo "built: $(pwd)/render_opl"