Improve git sha1 detection
This commit is contained in:
parent
831b958f39
commit
2b8395de69
1 changed files with 17 additions and 6 deletions
23
meson.build
23
meson.build
|
@ -9,6 +9,7 @@ if get_option('buildtype').startswith('debug')
|
|||
is_debug_build = 1
|
||||
endif
|
||||
|
||||
git_prog = find_program('git', required: false)
|
||||
cpp = meson.get_compiler('cpp')
|
||||
|
||||
conf = configuration_data()
|
||||
|
@ -26,12 +27,22 @@ project_config_file = configure_file(
|
|||
output: 'config.h',
|
||||
configuration: conf
|
||||
)
|
||||
gitrev_config_file = vcs_tag(
|
||||
command: ['git', 'rev-parse', 'HEAD'],
|
||||
input: 'src/git_version.h.in',
|
||||
output: 'git_version.h',
|
||||
fallback: 'n/a'
|
||||
)
|
||||
if git_prog.found()
|
||||
gitrev_config_file = vcs_tag(
|
||||
command: [git_prog.path(), 'rev-parse', 'HEAD'],
|
||||
input: 'src/git_version.h.in',
|
||||
output: 'git_version.h',
|
||||
fallback: ''
|
||||
)
|
||||
else
|
||||
conf = configuration_data()
|
||||
conf.set('VCS_TAG', '')
|
||||
gitrev_config_file = configure_file(
|
||||
input: 'src/git_version.h.in',
|
||||
output: 'git_version.h',
|
||||
configuration: conf
|
||||
)
|
||||
endif
|
||||
app_config_model = files('src/app_config.h.in')
|
||||
|
||||
cxxopts_incl = include_directories('subprojects/cxxopts/include', '.')
|
||||
|
|
Loading…
Add table
Reference in a new issue