Migrated from Make to CMake.

This commit is contained in:
Johannes Findeisen 2026-11-06 19:05:14 +01:00
commit b6ba093000
52 changed files with 1276 additions and 1210 deletions

View file

@ -3,29 +3,32 @@
Source packaging, staged install/uninstall and repeatable builds are testable.
It does not turn the prototype into a production-qualified DAW. The version
remains 0.1.0; no tag, external release or binary publication is created by
`make dist` or `make release`.
`cmake --build build --target dist` or `cmake --build build --target release`.
---
## Build and Package
```sh
make release
make test-install
make test-recovery test-performance
make dist
make test-release
cmake --preset release
cmake --build --preset release --parallel
ctest --preset release
cmake --build build/release --target test-install test-install-layout
cmake --build build/release --target dist test-release
cmake --build build/release --target test-package
```
release builds optimized, warning-enabled C/C++ code, tests and the optional GUI
in BUILD_DIR/release with no debug paths, a source-prefix map, deterministic ar
metadata and FLTK include/define flags rather than distribution-specific LTO
flags. It retains assertions so the test harness actually runs. dist creates
BUILD_DIR/xtc-0.1.0.tar.gz using Python's standard library. It includes only Git
indexed regular files (working-tree contents, including staged new files), plus
a source manifest; stage intended files first and check `git diff --cached`.
Untracked files, ignored build output and .git are excluded. Exported archives
can reproduce themselves without Git using SOURCE_MANIFEST.json.
The release preset builds optimized, warning-enabled C/C++ code, test binaries
and the available GUI in `build/release`, with source/binary prefix maps,
no debug information, deterministic archive metadata and assertions retained.
FLTK discovery takes include/define flags without overriding the project's
optimization settings. `dist` creates `xtc-0.1.0.tar.gz` below the binary
directory using Python's standard library. It includes only Git-indexed regular
files (working-tree contents, including staged new files), plus a source
manifest; stage intended files first and check `git diff --cached`. Untracked
files, ignored build output and .git are excluded. Exported archives reproduce
themselves without Git using SOURCE_MANIFEST.json. The `test-release` tool uses
CMake and CTest in two independent exported trees, without invoking Make.
Archive order, permissions, ownership, gzip filename and timestamps are
normalized. SOURCE_DATE_EPOCH defaults to 0; set an unsigned 32-bit epoch
@ -34,8 +37,8 @@ from a clean checkout and record its commit/hash externally. Do not treat a
dirty-tree archive as an attested release. No artifact is uploaded by these
targets.
test-release unpacks the source into two different temporary paths, runs release
in each, compares libxtc.a/xtc-check/optional xtc SHA-256 values, and repacks
test-release unpacks the source into two different temporary paths, configures
a reproducible Release build and runs CTest in each, compares libxtc.a/xtc-check/optional xtc SHA-256 values, and repacks
each export to compare archive bytes. This verifies reproducibility for the same
host, compiler, flags and dependency versions. It does not promise bit-identical
output across distributions, compilers or library updates.
@ -66,11 +69,11 @@ shared-library extension ABI in this release.
## Local Binary Packaging and Installed Workflow
`make test-package` builds the release, stages installation only in a temporary
`cmake --build build/release --target test-package` uses the selected build and stages installation only in a temporary
DESTDIR, writes a normalized Linux binary/development archive, checks its
SHA-256 sidecar and per-file manifest, relocatable pkg-config paths and headless
commands. Same-host repeated packaging is byte-identical; dependency versions
and toolchain still determine binary compatibility. `make test-install` now
and toolchain still determine binary compatibility. `cmake --build build --target test-install` now
repeats installation to verify repair/upgrade of owned files while preserving an
unrelated sentinel, then compiles both C99 and C++17 installed consumers that
create MIDI, save/reopen and compare nonzero exact rendering. Removal remains
@ -88,21 +91,28 @@ pending.
## Release Workflow
Installation now shares one explicit file inventory with uninstallation.
GNU-style `exec_prefix`, `bindir`, `libdir`, `includedir`, `datarootdir`,
`datadir`, `docdir`, `pkgconfigdir` and the xtc-specific `licensedir`,
`examplesdir`, `desktopdir` can be overridden alongside `PREFIX`/`DESTDIR`.
Paths must be absolute POSIX paths; spaces are supported. Do not include DESTDIR
in a directory variable: staging is applied separately and never embedded in
pkg-config metadata. Staging refuses parent symlinks that escape DESTDIR. Use
exactly the same variables for removal.
Installation shares the existing explicit owned-file inventory with removal.
Use CMake's `CMAKE_INSTALL_PREFIX`, `CMAKE_INSTALL_BINDIR`,
`CMAKE_INSTALL_LIBDIR`, `CMAKE_INSTALL_INCLUDEDIR`, `CMAKE_INSTALL_DATAROOTDIR`
and `CMAKE_INSTALL_DOCDIR`. xtc-specific cache entries are
`XTC_INSTALL_LICENSEDIR`, `XTC_INSTALL_EXAMPLESDIR`, `XTC_INSTALL_DESKTOPDIR`
and `XTC_INSTALL_PKGCONFIGDIR`. Relative directories resolve beneath the prefix;
absolute directories are supported. Spaces work; control characters, quotes,
dollar signs, backslashes and `..` are rejected by the audited layout helper.
`DESTDIR` is a separate staging environment variable. The same cache and prefix
must be used for uninstall; a `cmake --install --prefix` override is temporary.
The internal `XTC_INSTALL_BUILD_DIR` setting lets packaging/test drivers stage
already-built inputs using a temporary configuration without modifying the
caller's cache. SDK products are never in this inventory.
```sh
make BUILD_DIR=build/release-check all test gui
make BUILD_DIR=build/release-check test-install test-install-layout
make PREFIX=/usr DESTDIR=/tmp/xtc-stage libdir=/usr/lib64 install-gui
make PREFIX=/usr DESTDIR=/tmp/xtc-stage libdir=/usr/lib64 uninstall
make test-release test-package
cmake -S . -B build/release-check -DCMAKE_BUILD_TYPE=Release \
-DXTC_REPRODUCIBLE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib64
cmake --build build/release-check --parallel
ctest --test-dir build/release-check --output-on-failure
cmake --build build/release-check --target test-install test-install-layout
DESTDIR=/tmp/xtc-stage cmake --install build/release-check
DESTDIR=/tmp/xtc-stage cmake --build build/release-check --target uninstall
```
Core install includes the static library, public headers, `xtc-check`,
@ -114,7 +124,7 @@ metadata; custom live layouts are tested separately. Existing owned file
symlinks are replaced, not followed; installation is atomic per file, not a
transaction over the entire prefix.
`make dist` now writes a `.sha256` sidecar as well as the normalized source
`cmake --build build --target dist` now writes a `.sha256` sidecar as well as the normalized source
archive. Record that hash, the reviewed commit, version and build/dependency
conditions with release logs. `test-release` verifies the hash, builds/tests two
fresh source exports and compares artifacts and repacks. It validates exported