From 2b8395de697ff342679cdb1e84e3e8e3e5390e68 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 21 Mar 2020 11:53:04 +0100 Subject: [PATCH] Improve git sha1 detection --- meson.build | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 6ec5a5c..565b0a1 100644 --- a/meson.build +++ b/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', '.')