forked from G-Research/ParquetSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_windows.ps1
More file actions
39 lines (35 loc) · 1.56 KB
/
build_windows.ps1
File metadata and controls
39 lines (35 loc) · 1.56 KB
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
Set-StrictMode -Version 3
$ErrorActionPreference = "Stop"
# Find vcpkg or download it if required
if ($Env:VCPKG_INSTALLATION_ROOT -ne $null) {
$vcpkgDir = $Env:VCPKG_INSTALLATION_ROOT
echo "Using vcpkg at $vcpkgDir from VCPKG_INSTALLATION_ROOT"
} elseif ($Env:VCPKG_ROOT -ne $null) {
$vcpkgDir = $Env:VCPKG_ROOT
echo "Using vcpkg at $vcpkgDir from VCPKG_ROOT"
} else {
$vcpkgDir = "$(pwd)/build/vcpkg"
echo "Using local vcpkg at $vcpkgDir"
if (-not (Test-Path $vcpkgDir)) {
git clone https://github.com/microsoft/vcpkg.git $vcpkgDir
if (-not $?) { throw "git clone failed" }
& $vcpkgDir/bootstrap-vcpkg.bat
if (-not $?) { throw "bootstrap-vcpkg failed" }
}
}
$triplet = "x64-windows-static"
$options = @()
if ($Env:GITHUB_ACTIONS -eq "true") {
$customTripletsDir = "$(pwd)/build/custom-triplets"
New-Item -Path $customTripletsDir -ItemType "directory" -Force > $null
$sourceTripletFile = "$vcpkgDir/triplets/$triplet.cmake"
$customTripletFile = "$customTripletsDir/$triplet.cmake"
Copy-Item -Path $sourceTripletFile -Destination $customTripletFile
Add-Content -Path $customTripletFile -Value "set(VCPKG_BUILD_TYPE release)"
$options += "-D"
$options += "VCPKG_OVERLAY_TRIPLETS=$customTripletsDir"
}
cmake -B build/$triplet -S . -D VCPKG_TARGET_TRIPLET=$triplet -D CMAKE_TOOLCHAIN_FILE=$vcpkgDir/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 17 2022" -A "x64" $options
if (-not $?) { throw "cmake failed" }
msbuild build/$triplet/ParquetSharp.sln -t:ParquetSharpNative:Rebuild -p:Configuration=Release
if (-not $?) { throw "msbuild failed" }