feat(version): single-source semver, ext-state stamp, show-version action

Version "0.9.01" sourced once from CMake via configure_file'd header; pure
app_version module (parse/compare/classify) with CTest. Stamp rides the persist
save seam under "reasampler"/"version"; absent stamp reads as pre-versioning.
On-demand "show version" action, no startup print.
This commit is contained in:
2026-07-26 15:16:55 -04:00
parent 791a9c60eb
commit f6dddbf5a3
8 changed files with 409 additions and 2 deletions
+40 -2
View File
@@ -1,10 +1,30 @@
cmake_minimum_required(VERSION 3.19)
project(reaper_reasampler LANGUAGES CXX)
# ---------------------------------------------------------------------------
# Version — SINGLE SOURCE OF TRUTH (Phase V, V1). Edit REASAMPLER_VERSION here and
# nowhere else: it flows to the binary constant, the ext-state writing-version stamp,
# and the "show version" action via a configure_file'd header (below). The string is
# authoritative verbatim — leading zero preserved (Daniel-fixed: exactly "0.9.01",
# two-digit zero-padded patch). We deliberately do NOT reconstruct the display string
# from project(VERSION)'s numeric components, since CMake may normalize a numeric patch
# field; the string variable is what renders. project(VERSION ...) is still set (with a
# normalized 0.9.1 triple) for CMake hygiene / any downstream numeric use, but it is NOT
# the rendered source of truth.
set(REASAMPLER_VERSION "0.9.01")
project(reaper_reasampler VERSION 0.9.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Generate version_generated.h from the one REASAMPLER_VERSION variable. Regenerated at
# configure time whenever the variable changes; the exact string is substituted verbatim.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/version_generated.h.in
${CMAKE_CURRENT_BINARY_DIR}/generated/version_generated.h
@ONLY)
# ---------------------------------------------------------------------------
# Vendored dependencies — add as git submodules (see README):
# git submodule add https://github.com/justinfrankel/reaper-sdk vendor/reaper-sdk
@@ -195,6 +215,19 @@ add_library(wav_trim STATIC src/wav_trim.cpp)
target_include_directories(wav_trim PUBLIC src)
target_link_libraries(wav_trim PUBLIC peaks)
# ---------------------------------------------------------------------------
# 2i) Pure app_version library — NO REAPER, NO SWELL. The Phase V (V1) version-identity
# core: re-exports the ONE CMake-sourced version string (via the configure_file'd
# version_generated.h) and owns the pure parse/compare/classify logic — the semver
# ordering a within-channel forward migration needs, and the three-way writing-version
# classification (PreVersioning / Unknown / Stamped) persist reads back from ext state.
# Split out so the exact-string fidelity + parse/compare are unit-tested outside the
# DAW; the ext-state write/read (persist) and the show-version action (main) are shell.
# Depends on the generated header in the build tree (PUBLIC so every consumer sees it).
# ---------------------------------------------------------------------------
add_library(app_version STATIC src/app_version.cpp)
target_include_directories(app_version PUBLIC src ${CMAKE_CURRENT_BINARY_DIR}/generated)
# ---------------------------------------------------------------------------
# 3) Standalone tests for the pure modules (run without launching REAPER).
# ---------------------------------------------------------------------------
@@ -267,6 +300,10 @@ add_executable(owned_manifest_tests tests/test_owned_manifest.cpp)
target_link_libraries(owned_manifest_tests PRIVATE owned_manifest)
add_test(NAME owned_manifest_tests COMMAND owned_manifest_tests)
add_executable(app_version_tests tests/test_app_version.cpp)
target_link_libraries(app_version_tests PRIVATE app_version)
add_test(NAME app_version_tests COMMAND app_version_tests)
# ---------------------------------------------------------------------------
# 4) The REAPER extension — a loadable module (dlopen'd by REAPER, not linked).
# ---------------------------------------------------------------------------
@@ -303,8 +340,9 @@ add_library(reaper_reasampler MODULE
src/actions.cpp
src/bank_book.cpp
src/owned_manifest.cpp
src/app_version.cpp
)
target_link_libraries(reaper_reasampler PRIVATE bank_model capture_paths peaks bank_grid mode_switch tab_strip view_mode_model insert_plan render_settings tail_control realtime_record bank_book wav_trim owned_manifest)
target_link_libraries(reaper_reasampler PRIVATE bank_model capture_paths peaks bank_grid mode_switch tab_strip view_mode_model insert_plan render_settings tail_control realtime_record bank_book wav_trim owned_manifest app_version)
target_include_directories(reaper_reasampler PRIVATE ${SDK_INC} ${WDL_INC})
set_target_properties(reaper_reasampler PROPERTIES PREFIX "" OUTPUT_NAME "reaper_reasampler")