mirror of
https://github.com/sshlien/abcmidi.git
synced 2026-05-30 20:09:29 +00:00
* Add configuration for CMake build system alongside autoconf - Add a modern CMake build system (`CMakeLists.txt`, `CMakePresets.json`) that coexists with the legacy autoconf/Makefile build - Shared source files (`midifile.c`, `parseabc.c`, `music_utils.c`, `parser2.c`) are compiled once via OBJECT libraries and linked into the 8 binaries - Three presets: `default` (Release), `debug`, `sanitize` (ASan + UBSan) - Generates `compile_commands.json` for clangd/LSP editor support - Install rules match the legacy Makefile (binaries, doc files, man pages) - Pinned to `-std=gnu89` because the codebase mixes K&R `()` and ANSI typed prototypes — in C23/gnu23 (GCC 15+ default), `()` means `(void)`, making these a hard error. Note: **the existing autoconf build is also broken with GCC 15** for the same reason ```sh cmake --preset debug cmake --build --preset debug cmake --install build/debug --prefix /usr/local Documentation - README.md: added Building section with both autoconf and CMake instructions - doc/readme.txt: added build instructions in the existing preamble - doc/CHANGES: added changelog entry Test plan - All 3 presets configure and build with GCC 15 - Smoke test: abc2midi samples/coleraine.abc produces valid MIDI through mftext - Sanitizer build (--preset sanitize) runs clean on sample files - Install layout verified: 8 binaries, 10 doc files, 8 man pages in correct paths - Build on macOS (untested, should work with AppleClang) * Implement basic testing infrastructure The CMake build includes a test suite covering all 8 programs: - **Smoke tests** verify each binary runs cleanly with `-ver`. - **Golden-file tests** run each program on a sample input and compare the (normalized) output to a checked-in reference. Binary MIDI outputs are piped through `mftext` to produce diffable text. Volatile lines (version banners, dates, temporary paths) are stripped before comparison. ```sh ctest --preset debug ctest --preset debug -L golden ctest --preset debug -L smoke ``` To regenerate the golden files after an intentional behavioural change, review the diff, then commit: ```sh cmake --build build/debug --target update-golden git diff tests/golden/ ``` * Factorize more the test CMake code
55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
X:8
|
|
%%MIDI channel 1
|
|
%%MIDI chordprog 3
|
|
%%MIDI bassprog 3
|
|
%%MIDI program 26
|
|
%%MIDI beat 110 100 90 4
|
|
%%MIDI ratio 2 1
|
|
%%MIDI chordvol 64
|
|
%%MIDI bassvol 65
|
|
%%MIDI transpose 0
|
|
%%MIDI gracedivider 4
|
|
Q:1/4=142
|
|
T:Coleraine
|
|
B:Kerr's Violin IV
|
|
Z:John Chambers <jc@eddie.mit.edu> http://eddie.mit.edu/~jc/music/
|
|
R:jig
|
|
M:6/8
|
|
L:1/8
|
|
K:Am
|
|
%%MIDI drum d2z2ddd2d2d2 65 66 66 50 66 66 90 70 70 90 70 70
|
|
%%MIDI drumon
|
|
V:1
|
|
%%MIDI program 72
|
|
%%MIDI control 7 115
|
|
%%MIDI control 10 67
|
|
%%MIDI beat 110 100 90 4
|
|
|: "E7"E
|
|
%Error : Bar 1 is 1/8 not 6/8
|
|
| "Am"E>AA ABc | "E7"B>ee e2d | "Am"c>AA ABc | "E7"B^GE E2E | \
|
|
| "Am"E>AA ABc | "E7"B>ee e2d | "Am"c>BA "E7"B^GE | "Am"A3- A2 :|
|
|
|: "G7"B | "C"c2c cdc | "G"Bdg "(E)"g2^g | "Am"a>ed cBA | "E7"^GBG E^FG | \
|
|
| "Am"A^GA "E7"BAB | "Am"cde "Dm"fed | "Am"c>BA "E7"B^GE | "Am"A3- A2 :|
|
|
V:drum
|
|
M:6/8
|
|
L:1/16
|
|
%%MIDI channel 10
|
|
|: z2|G,,3A,,G,,2 A,,G,,A,,2A,,2 |
|
|
G,,3A,,G,,2 A,,2G,,A,,G,,2 |
|
|
G,,3A,,G,,2 A,,G,,A,,2A,,2 |
|
|
G,,3A,,G,,2 A,,2G,,A,,G,,2 |
|
|
G,,3A,,G,,2 A,,G,,A,,2A,,2 |
|
|
G,,3A,,G,,2 A,,2G,,A,,G,,2 |
|
|
G,,3A,,G,,2 A,,G,,A,,2A,,2 |
|
|
G,,3A,,G,,2 A,,2G,,A,, :|
|
|
%
|
|
|:z2| G,,3A,,G,,2 A,,G,,A,,2A,,2 |
|
|
G,,3A,,G,,2 A,,2G,,A,,G,,2 |
|
|
G,,3A,,G,,2 A,,G,,A,,2A,,2 |
|
|
G,,3A,,G,,2 A,,2G,,A,,G,,2 |
|
|
G,,2G,,2G,,2 z6 |
|
|
G,,2G,,2G,,2 z6 |
|
|
G,,2G,,2G,,2 z6 |
|
|
G,,6 z4 :|
|
|
|