From b56fbdeef0f1d202ed13c85b6f9698fa2b8565a5 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 17 May 2022 18:10:12 +0200 Subject: Avoid running git-version-gen when building with MS VC The toolchain usually used there would typically completely fail to run it. --- meson.build | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 29adbc6..7e7d818 100644 --- a/meson.build +++ b/meson.build @@ -16,16 +16,22 @@ conf.set('SLIRP_MAJOR_VERSION', major_version) conf.set('SLIRP_MINOR_VERSION', minor_version) conf.set('SLIRP_MICRO_VERSION', micro_version) -r = run_command('build-aux/git-version-gen', - '@0@/.tarball-version'.format(meson.current_source_dir()), - check : false) +cc = meson.get_compiler('c') -full_version = r.stdout().strip() -if r.returncode() != 0 or full_version.startswith('UNKNOWN') +if cc.get_argument_syntax() != 'msvc' + r = run_command('build-aux/git-version-gen', + '@0@/.tarball-version'.format(meson.current_source_dir()), + check : false) + + full_version = r.stdout().strip() + if r.returncode() != 0 or full_version.startswith('UNKNOWN') + full_version = meson.project_version() + elif not full_version.startswith(meson.project_version()) + error('meson.build project version @0@ does not match git-describe output @1@' + .format(meson.project_version(), full_version)) + endif +else full_version = meson.project_version() -elif not full_version.startswith(meson.project_version()) - error('meson.build project version @0@ does not match git-describe output @1@' - .format(meson.project_version(), full_version)) endif conf.set_quoted('SLIRP_VERSION_STRING', full_version + get_option('version_suffix')) @@ -55,7 +61,6 @@ host_system = host_machine.system() glib_dep = dependency('glib-2.0') -cc = meson.get_compiler('c') add_project_arguments(cc.get_supported_arguments('-Wmissing-prototypes', '-Wstrict-prototypes', '-Wredundant-decls', '-Wundef', '-Wwrite-strings'), language: 'c', native: false) -- cgit v1.1