forked from namazso/OpenHashTab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_algorithms.ps1
44 lines (39 loc) · 1.34 KB
/
build_algorithms.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
$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
}
}
$Environment = (Get-ChildItem Env:);
"SSE2", "AVX", "AVX2", "AVX512", "ARM64" | ForEach-Object {
$ExtraFlags = "";
If ($_ -eq "ARM64") {
Invoke-CmdScript "$VSRoot\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
$ExtraFlags = "--target=arm64-pc-windows-msvc";
} Else {
Invoke-CmdScript "$VSRoot\VC\Auxiliary\Build\vcvars64.bat"
}
Set-Item Env:CFLAGS $ExtraFlags
Set-Item Env:CXXFLAGS $ExtraFlags
mkdir -ErrorAction Ignore "cmake-algorithms-$_"
cmake `
-G Ninja `
-S Algorithms `
-B "cmake-algorithms-$_" `
--install-prefix ((Get-Item AlgorithmsDlls).FullName) `
"-DOHT_FLAVOR=$_" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_C_COMPILER=clang-cl `
-DCMAKE_CXX_COMPILER=clang-cl
cmake --build "cmake-algorithms-$_"
cmake --install "cmake-algorithms-$_"
Remove-Item -Path Env:*
$Environment | ForEach-Object { Set-Item "env:$($_.Name)" $_.Value }
}