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