mirror of https://github.com/odrling/Aegisub
meson: generate git_version header in build root rather than within the source tree
fixes an issue where the windows version of the git version update script generated the header in a place where it couldn't be found by the include in version.cpp
This commit is contained in:
parent
18fe7918f3
commit
f039395003
|
@ -11,7 +11,7 @@ else
|
||||||
endif
|
endif
|
||||||
version_inc = include_directories('.')
|
version_inc = include_directories('.')
|
||||||
version_h = custom_target('git_version.h',
|
version_h = custom_target('git_version.h',
|
||||||
command: [version_sh, meson.source_root()],
|
command: [version_sh, meson.current_build_dir()],
|
||||||
build_by_default: true,
|
build_by_default: true,
|
||||||
build_always_stale: true, # has internal check whether target file will be refreshed
|
build_always_stale: true, # has internal check whether target file will be refreshed
|
||||||
output: ['git_version.h', 'git_version.xml'])
|
output: ['git_version.h', 'git_version.xml'])
|
||||||
|
|
|
@ -1,20 +1,32 @@
|
||||||
#!/usr/bin/env powershell
|
#!/usr/bin/env powershell
|
||||||
|
|
||||||
|
param (
|
||||||
|
[Parameter(Position = 0, Mandatory = $false)]
|
||||||
|
[string]$BuildRoot = $null
|
||||||
|
)
|
||||||
|
|
||||||
$lastSvnRevision = 6962
|
$lastSvnRevision = 6962
|
||||||
$lastSvnHash = '16cd907fe7482cb54a7374cd28b8501f138116be'
|
$lastSvnHash = '16cd907fe7482cb54a7374cd28b8501f138116be'
|
||||||
$defineNumberMatch = [regex] '^#define\s+(\w+)\s+(\d+)$'
|
$defineNumberMatch = [regex] '^#define\s+(\w+)\s+(\d+)$'
|
||||||
$defineStringMatch = [regex] "^#define\s+(\w+)\s+[`"']?(.+?)[`"']?$"
|
$defineStringMatch = [regex] "^#define\s+(\w+)\s+[`"']?(.+?)[`"']?$"
|
||||||
$semVerMatch = [regex] 'v?(\d+)\.(\d+).(\d+)(?:-(\w+))?'
|
$semVerMatch = [regex] 'v?(\d+)\.(\d+).(\d+)(?:-(\w+))?'
|
||||||
|
|
||||||
|
|
||||||
$repositoryRootPath = Join-Path $PSScriptRoot .. | Resolve-Path
|
$repositoryRootPath = Join-Path $PSScriptRoot .. | Resolve-Path
|
||||||
if (!(git -C $repositoryRootPath rev-parse --is-inside-work-tree 2>$null)) {
|
if (!(git -C $repositoryRootPath rev-parse --is-inside-work-tree 2>$null)) {
|
||||||
throw "$repositoryRootPath is not a git repository"
|
throw "$repositoryRootPath is not a git repository"
|
||||||
}
|
}
|
||||||
|
|
||||||
$gitVersionHeaderPath = Join-Path $repositoryRootPath 'src' | Join-Path -ChildPath 'include' | Join-Path -ChildPath 'aegisub' `
|
if ($BuildRoot -eq $null -or $BuildRoot.Trim() -eq "") {
|
||||||
| Join-Path -ChildPath 'git_version.h'
|
$BuildRoot = $repositoryRootPath
|
||||||
$gitVersionXmlPath = Join-Path $repositoryRootPath 'packages' | Join-Path -ChildPath 'win_installer' `
|
}
|
||||||
| Join-Path -ChildPath 'git_version.xml'
|
|
||||||
|
# support legacy in-tree builds
|
||||||
|
if ([System.IO.Path]::GetFullPath([System.IO.Path]::Combine((pwd).Path, $BuildRoot)) -eq
|
||||||
|
[System.IO.Path]::GetFullPath([System.IO.Path]::Combine((pwd).Path, $repositoryRootPath))) {
|
||||||
|
$BuildRoot = Join-Path $repositoryRootPath 'build'
|
||||||
|
}
|
||||||
|
$gitVersionHeaderPath = Join-Path $BuildRoot 'git_version.h'
|
||||||
|
$gitVersionXmlPath = Join-Path $repositoryRootPath 'build' | Join-Path -ChildPath 'git_version.xml'
|
||||||
|
|
||||||
$version = @{}
|
$version = @{}
|
||||||
if (Test-Path $gitVersionHeaderPath) {
|
if (Test-Path $gitVersionHeaderPath) {
|
||||||
|
|
Loading…
Reference in New Issue