-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathqmake.ps1
64 lines (54 loc) · 1.72 KB
/
qmake.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#Set-PSDebug -Off
# Environnement
# -------------
$env = "$PSScriptRoot\env.ps1"
if (-not(Test-Path -Path $env -PathType Leaf)) {
Write-Output "Unable to find qmake.exe. Please verify the env.bat content. env.ps1 file does not exist ! Please copy env.ps1.proto to env.ps1 and set up your environment."
Exit
}
& $env
# vcvarsall.bat
# -------------
$vcvarsall = "$env:VCVARSALL_DIR\vcvarsall.bat"
if (-not(Test-Path -Path $vcvarsall -PathType Leaf)) {
Write-Output "Unable to find qmake.exe. Please verify the env.bat content. Unable to find vcvarsall.bat. Please verify the env.bat content."
Exit
}
cmd.exe /c "call `"$vcvarsall`" $env:BUILD && set > %temp%\vcvars.txt"
Get-Content "$env:temp\vcvars.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "env:\$($matches[1])" $matches[2]
}
}
# qmake.exe
# ---------
$qmake = "$env:QT_DIR\bin\qmake.exe"
if (-not(Test-Path -Path $qmake -PathType Leaf)) {
Write-Output "Unable to find qmake.exe. Please verify the env.bat content."
Exit
}
# date
# ----
$date = (Get-Date -Format "dd/MM/yyyy")
$date_header = "code\SCEP\include\SCEP\Date.h"
Set-Location "$PSScriptRoot"
"#pragma once" > $date_header
"static const char* SCEP_DATE = ""$date"";" >> $date_header
# version
# -------
Set-Location "$PSScriptRoot"
$version_header = "code\SCEP\include\SCEP\Version.h"
"#pragma once" > $version_header
Get-Content VERSION | Foreach-Object {
$var = $_.Split('=')
#New-Variable -Name $var[0] -Value $var[1]
$key = $var[0]
$value = $var[1]
"static constexpr unsigned int $key = $value;" >> code/SCEP/include/SCEP/Version.h
}
# qmake
# -----
Set-Location "$PSScriptRoot\code"
# rm .qmake.stash
& "$env:QT_DIR\bin\qmake.exe" -tp vc -r SCEP.pro
Set-Location "$PSScriptRoot"