better version handling

This commit is contained in:
2026-07-21 23:59:31 +02:00
parent c693e892d0
commit 7b74e69759
3 changed files with 14 additions and 21 deletions

View File

@@ -24,25 +24,22 @@ srcs = [
cc = meson.get_compiler('c')
git = find_program('git', required : false)
git = find_program('git')
git_hash = run_command(git, 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
git_commits = run_command(git, 'rev-list', '--count', 'HEAD', check: false).stdout().strip()
if git.found()
git_hash = run_command(git, 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
git_commits = run_command(git, 'rev-list', '--count', 'HEAD', check: false).stdout().strip()
else
git_hash = 'unknown'
git_commits = '0'
endif
add_project_arguments(
'-DGIT_HASH="' + git_hash + '"',
'-DGIT_COMMITS="' + git_commits + '"',
language: 'c'
version_h = configure_file(
input : 'include/version.h.in',
output : 'version.h',
configuration : {
'GIT_HASH' : git_hash,
'GIT_COMMITS' : git_commits,
}
)
executable(
'linuxSmartie',
srcs,
srcs + [version_h],
include_directories : include_directories('include'),
dependencies : [
dependency('libusb-1.0', required : true),