-
-
Notifications
You must be signed in to change notification settings - Fork 127
/
build_openhashtab.ps1
70 lines (59 loc) · 1.98 KB
/
build_openhashtab.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
65
66
67
68
69
70
$VSRoot = (& vswhere -property installationPath);
function Invoke-CmdScript {
param(
[String] $scriptName
)
$cmdLine = """$scriptName"" $args & set"
& $Env:SystemRoot\system32\cmd.exe /c $cmdLine |
Select-String '^([^=]*)=(.*)$' | ForEach-Object {
$varName = $_.Matches[0].Groups[1].Value
$varValue = $_.Matches[0].Groups[2].Value
Set-Item Env:$varName $varValue
}
}
$Env:RC = "llvm-rc";
If (Test-Path "Env:CI_VERSION") {
$CI_VERSION = $Env:CI_VERSION;
$CI_VERSION_MAJOR = $Env:CI_VERSION_MAJOR;
$CI_VERSION_MINOR = $Env:CI_VERSION_MINOR;
$CI_VERSION_PATCH = $Env:CI_VERSION_PATCH;
} Else {
$CI_VERSION = "(unknown)";
$CI_VERSION_MAJOR = 0;
$CI_VERSION_MINOR = 0;
$CI_VERSION_PATCH = 0;
}
$Environment = (Get-ChildItem Env:);
Invoke-CmdScript "$VSRoot\VC\Auxiliary\Build\vcvars64.bat"
cmake `
-G Ninja `
-S . `
-B "cmake-openhashtab-x64" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_C_COMPILER=clang-cl `
-DCMAKE_CXX_COMPILER=clang-cl `
"-DCI_VERSION=$CI_VERSION" `
"-DCI_VERSION_MINOR=$CI_VERSION_MINOR" `
"-DCI_VERSION_MAJOR=$CI_VERSION_MAJOR" `
"-DCI_VERSION_PATCH=$CI_VERSION_PATCH"
cmake --build "cmake-openhashtab-x64"
Remove-Item -Path Env:*
$Environment | ForEach-Object { Set-Item "env:$($_.Name)" $_.Value }
Invoke-CmdScript "$VSRoot\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
$ExtraFlags = "--target=arm64-pc-windows-msvc";
Set-Item Env:CFLAGS $ExtraFlags
Set-Item Env:CXXFLAGS $ExtraFlags
cmake `
-G Ninja `
-S . `
-B "cmake-openhashtab-ARM64" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_C_COMPILER=clang-cl `
-DCMAKE_CXX_COMPILER=clang-cl `
"-DCI_VERSION=$CI_VERSION" `
"-DCI_VERSION_MINOR=$CI_VERSION_MINOR" `
"-DCI_VERSION_MAJOR=$CI_VERSION_MAJOR" `
"-DCI_VERSION_PATCH=$CI_VERSION_PATCH"
cmake --build "cmake-openhashtab-ARM64"
Remove-Item -Path Env:*
$Environment | ForEach-Object { Set-Item "env:$($_.Name)" $_.Value }