meson: append git commit if possible and to non release builds
This commit is contained in:
parent
be5f94e913
commit
05e355d383
24
meson.build
24
meson.build
|
@ -9,13 +9,35 @@ project('lite-xl',
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Project version including git commit if possible
|
||||||
|
#===============================================================================
|
||||||
|
version = meson.project_version()
|
||||||
|
|
||||||
|
if get_option('buildtype') != 'release'
|
||||||
|
git_command = find_program('git', required : false)
|
||||||
|
|
||||||
|
if git_command.found()
|
||||||
|
git_branch = run_command(
|
||||||
|
[git_command, 'branch', '--show-current']
|
||||||
|
).stdout().strip()
|
||||||
|
git_commit = run_command(
|
||||||
|
[git_command, 'rev-parse', git_branch]
|
||||||
|
).stdout().strip()
|
||||||
|
|
||||||
|
if git_commit != ''
|
||||||
|
version += ' (git-' + git_commit.substring(0, 8) + ')'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Configuration
|
# Configuration
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
conf_data.set('PROJECT_BUILD_DIR', meson.current_build_dir())
|
conf_data.set('PROJECT_BUILD_DIR', meson.current_build_dir())
|
||||||
conf_data.set('PROJECT_SOURCE_DIR', meson.current_source_dir())
|
conf_data.set('PROJECT_SOURCE_DIR', meson.current_source_dir())
|
||||||
conf_data.set('PROJECT_VERSION', meson.project_version())
|
conf_data.set('PROJECT_VERSION', version)
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Compiler Settings
|
# Compiler Settings
|
||||||
|
|
Loading…
Reference in New Issue