Files
abcmidi/README.md
Ronan Keryell c94cbbc062 Add configuration for CMake build system alongside autoconf (#17)
- 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)

Co-authored-by: Seymour Shlien <fy733@ncf.ca>
2026-04-22 07:52:10 -04:00

62 lines
2.7 KiB
Markdown

### abcMIDI package
abcMIDI is a package of programs written in C for handling [abc music notation](http://abcnotation.com/) files. The software was created by James Allwright in the early 1990 and presently maintained by Seymour Shlien. It initially included the following programs:
1. abc2midi for converting an abc file to a midi file,
2. abc2abc for transposing abc notation to another key signature,
3. midi2abc for creating an abc file from a midi file,
4. yaps for producing a PostScript file displaying the abc file in common music notation and,
5. mftext for creating a text representation of a midi file.
Seymour added two more programs:
1. abcmatch for finding common elements in a collection of abc tunes and,
2. midicopy for copying parts of a midi file to a new midi file.
Yaps has been superceded by [Jef Moine](http://moinejf.free.fr/) abcm2ps and abc2svg programs. Midi2abc has been expanded to include mftext and various other features for supporting the [runabc](https://ifdo.ca/~seymour/runabc/top.html) application. Abc2midi has numerous new features that are described in its own web page [abc2midi guide](https://abcmidi.sourceforge.io).
Components of the abcMIDI package are parts of numerous applications for creating and editing abc files. Compilations of these components for various operating systems can be found on [The ABC Plus Project](http://abcplus.sourceforge.net/) web page.
The latest version of the abcMIDI package supported by James Allwright can be found can be found [here](http://abc.sourceforge.net/abcMIDI/original/). More recent versions can be found on [sourceforge](https://sourceforge.net/projects/abc/) and on the [runabc](https://ifdo.ca/~seymour/runabc/top.html) web page.
### Building
#### Autoconf (legacy)
The traditional build uses autoconf:
```sh
./configure
make
sudo make install
```
#### CMake (modern)
A CMake build system is available alongside the legacy one, with
[presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html)
for common configurations:
```sh
# Configure and build (pick a preset: default, debug, sanitize)
cmake --preset default
cmake --build --preset default
# Install
cmake --install build/default
```
Available presets:
| Preset | Build type | Description |
|------------|------------|----------------------------------------------|
| `default` | Release | Optimized build |
| `debug` | Debug | Debug symbols, no optimization |
| `sanitize` | Debug | Debug + AddressSanitizer + UndefinedBehaviorSanitizer |
The CMake build generates `compile_commands.json` for use with
clangd and other LSP-based editors.