Building the tip without mercurial now allows for manually setting a version with the version option

This commit is contained in:
Scoopta 2019-12-30 18:35:26 -08:00
parent 0498174d35
commit 0a9e0b2420
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,4 @@
project('wofi', 'c', version : run_command('hg', 'identify').stdout().strip(), default_options : ['buildtype=release', 'warning_level=2'])
project('wofi', 'c', default_options : ['buildtype=release', 'warning_level=2'])
cc = meson.get_compiler('c')
inc = include_directories('inc')
@ -8,7 +8,15 @@ threads = dependency('threads')
wayland = dependency('wayland-client')
dl = cc.find_library('dl')
add_project_arguments('-D_GNU_SOURCE', '-DVERSION="' + meson.project_version() + '"', language : 'c')
hg = find_program('hg', native : true, required : false)
version = get_option('version')
if hg.found()
version = run_command(hg, 'identify').stdout().strip()
endif
add_project_arguments('-D_GNU_SOURCE', '-DVERSION="' + version + '"', language : 'c')
add_project_link_arguments('-rdynamic', language : 'c')
executable(meson.project_name(),

1
meson_options.txt Normal file
View File

@ -0,0 +1 @@
option('version', type : 'string', value : 'hg', description : 'The version to use if mercurial cannot be found')