feat(build-time-versioning): add build_time meson option and C-wide define

Add a build_time meson option (string, default '') sibling to the
existing commit_id option, threaded project-wide via the same
add_project_arguments() call that already defines VERSION_COMMIT_ID --
one call, one mechanism, no new plumbing. No consumer wired yet (later
tasks); a plain meson setup with neither option set still configures
cleanly with both defines resolving to empty string.

Task 1/13 of build-time-versioning (spec: .kiro/specs/build-time-versioning/).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-20 08:29:32 +00:00
parent 12408a384b
commit 4b7cc7867f
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 127 additions and 1 deletions

View file

@ -27,7 +27,8 @@ if get_option('buildtype') == 'debug'
with_debug = true
endif
add_project_arguments('-DVERSION_COMMIT_ID='+get_option('commit_id'), language: 'c')
add_project_arguments(['-DVERSION_COMMIT_ID='+get_option('commit_id'),
'-DVERSION_BUILD_TIME='+get_option('build_time')], language: 'c')
# Programs needed by all components
go_compiler = find_program('go')

View file

@ -1,5 +1,6 @@
option('with_debug', type: 'boolean', value: false, yield: true)
option('commit_id', type: 'string', value:'', yield: true)
option('build_time', type: 'string', value:'', yield: true)
option('component', type: 'combo',
choices: ['all', 'xcecore', 'xcecli'],
value: 'all',