fix: check git root
parent
2585360a3e
commit
49ae944d65
13
meson.build
13
meson.build
|
@ -32,10 +32,15 @@ git = find_program('git', native: true, required: false)
|
|||
if not git.found()
|
||||
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
|
||||
else
|
||||
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
|
||||
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
|
||||
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
|
||||
add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp')
|
||||
git_path = run_command([git.path(), 'rev-parse', '--show-toplevel']).stdout().strip()
|
||||
if meson.source_root() == git_path
|
||||
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
|
||||
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
|
||||
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
|
||||
add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp')
|
||||
else
|
||||
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
|
||||
endif
|
||||
endif
|
||||
|
||||
if not compiler.has_header('filesystem')
|
||||
|
|
Loading…
Reference in New Issue