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