-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.ps1
More file actions
50 lines (44 loc) · 1.51 KB
/
build.ps1
File metadata and controls
50 lines (44 loc) · 1.51 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
40
41
42
43
44
45
46
47
48
49
50
#powershell -ExecutionPolicy ByPass -File build.ps1
param(
[string]$libcdoc = $PSScriptRoot,
[string]$platform = "x64",
[string]$build_number = $(if ($null -eq $env:BUILD_NUMBER) {"0"} else {$env:BUILD_NUMBER}),
[string]$git = "git.exe",
[string]$vcpkg = "vcpkg\vcpkg.exe",
[string]$vcpkg_dir = (split-path -parent $vcpkg),
[string]$vcpkg_installed = $libcdoc,
[string]$vcpkg_triplet = "x64-windows",
[string]$vcpkg_installed_platform = "$vcpkg_installed\vcpkg_installed",
[string]$cmake = "cmake.exe",
[string]$generator = "Visual Studio 17 2022",
[switch]$RunTests = $false,
)
if(!(Test-Path -Path $vcpkg)) {
& $git clone https://github.com/microsoft/vcpkg.git $vcpkg_dir
& $vcpkg_dir\bootstrap-vcpkg.bat
}
$cmakeext = @()
if($platform -eq "arm64" -and $env:VSCMD_ARG_HOST_ARCH -ne "arm64") {
$cmakeext += "-DCMAKE_DISABLE_FIND_PACKAGE_Python3=yes"
$RunTests = $false
}
if($RunTests) {
$cmakeext += "-DVCPKG_MANIFEST_FEATURES=tests"
}
$buildpath = "build"
& $cmake --fresh -B $buildpath -S . "-G$generator" $cmakeext `
"--toolchain $vcpkg_dir/scripts/buildsystems/vcpkg.cmake" `
"-DVCPKG_INSTALLED_DIR=$vcpkg_installed_platform" `
"-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
foreach($type in @("Debug", "RelWithDebInfo")) {
"==================="
"Build Configuration: " + $type
"==================="
& $cmake --build $buildpath --config $type
# & $cmake --install $buildpath
}
if($RunTests) {
Push-Location "$libcdoc\$buildpath"
ctest -V -C Debug
Pop-Location
}