Skip to content

Commit 7f307be

Browse files
author
Lauris Kaplinski
committed
Reverse
1 parent c6aff71 commit 7f307be

File tree

1 file changed

+23
-60
lines changed

1 file changed

+23
-60
lines changed

build.ps1

Lines changed: 23 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,50 @@
11
#powershell -ExecutionPolicy ByPass -File build.ps1
22
param(
33
[string]$libcdoc = $PSScriptRoot,
4-
[string]$platform = $env:PLATFORM,
4+
[string]$platform = "x64",
55
[string]$build_number = $(if ($null -eq $env:BUILD_NUMBER) {"0"} else {$env:BUILD_NUMBER}),
6-
[string]$msiversion = "1.0.0.$build_number",
7-
[string]$msi_name = "libcdoc-$msiversion$env:VER_SUFFIX.$platform.msi",
86
[string]$git = "git.exe",
97
[string]$vcpkg = "vcpkg\vcpkg.exe",
108
[string]$vcpkg_dir = (split-path -parent $vcpkg),
119
[string]$vcpkg_installed = $libcdoc,
12-
[string]$vcpkg_installed_platform = "$vcpkg_installed\vcpkg_installed_$platform",
13-
[string]$vcpkg_triplet = "$platform-windows",
10+
[string]$vcpkg_triplet = "x64-windows",
11+
[string]$vcpkg_installed_platform = "$vcpkg_installed\vcpkg_installed",
1412
[string]$cmake = "cmake.exe",
15-
[string]$generator = "NMake Makefiles",
16-
[switch]$run_tests = $false,
17-
[string]$swig = $null,
18-
[string]$doxygen = $null,
19-
[string]$python = $null
13+
[string]$generator = "Visual Studio 17 2022",
14+
[switch]$RunTests = $false,
2015
)
2116

22-
Try {
23-
& wix > $null
24-
}
25-
Catch {
26-
& dotnet tool install -g --version 6.0.2 wix
27-
& wix extension add -g WixToolset.UI.wixext/6.0.2
28-
}
29-
3017
if(!(Test-Path -Path $vcpkg)) {
3118
& $git clone https://github.com/microsoft/vcpkg.git $vcpkg_dir
3219
& $vcpkg_dir\bootstrap-vcpkg.bat
3320
}
3421

3522
$cmakeext = @()
36-
$wixext = @()
37-
$target = @("all")
38-
if($swig) {
39-
$cmakeext += "-DSWIG_EXECUTABLE=$swig"
40-
$wixext += "-d", "swig=$swig"
41-
}
42-
if($doxygen) {
43-
$cmakeext += "-DDOXYGEN_EXECUTABLE=$doxygen"
44-
}
4523
if($platform -eq "arm64" -and $env:VSCMD_ARG_HOST_ARCH -ne "arm64") {
46-
$run_tests = $false
24+
$cmakeext += "-DCMAKE_DISABLE_FIND_PACKAGE_Python3=yes"
25+
$RunTests = $false
4726
}
48-
if($run_tests) {
27+
if($RunTests) {
4928
$cmakeext += "-DVCPKG_MANIFEST_FEATURES=tests"
50-
$target += "check"
51-
}
52-
if($python) {
53-
$cmakeext += "-DPython3_ROOT_DIR=$python/$platform"
54-
$wixext += "-d", "python=1"
5529
}
5630

57-
foreach($type in @("Debug", "RelWithDebInfo")) {
58-
"==================="
59-
"Build Configuration: " + $type
60-
"==================="
61-
$buildpath = $platform+$type
62-
& $cmake --fresh -B $buildpath -S . "-G$generator" $cmakeext `
63-
"-DCMAKE_BUILD_TYPE=$type" `
64-
"-DCMAKE_INSTALL_PREFIX=$platform" `
65-
"-DCMAKE_INSTALL_BINDIR=." `
66-
"-DCMAKE_INSTALL_LIBDIR=." `
67-
"-DCMAKE_TOOLCHAIN_FILE=$vcpkg_dir/scripts/buildsystems/vcpkg.cmake" `
31+
$buildpath = "build"
32+
33+
& $cmake --fresh -B $buildpath -S . "-G$generator" $cmakeext `
34+
"--toolchain $vcpkg_dir/scripts/buildsystems/vcpkg.cmake" `
6835
"-DVCPKG_INSTALLED_DIR=$vcpkg_installed_platform" `
6936
"-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
70-
& $cmake --build $buildpath --target $target
71-
& $cmake --install $buildpath
72-
}
7337

74-
$docLocation = "$(Get-Location)/$platform/share/doc/libcdoc"
75-
if (Test-Path -Path $docLocation -PathType Container) {
76-
$wixext += "-d", "docLocation=$docLocation"
38+
foreach($type in @("Debug", "RelWithDebInfo")) {
39+
"==================="
40+
"Build Configuration: " + $type
41+
"==================="
42+
& $cmake --build $buildpath --config $type
43+
# & $cmake --install $buildpath
7744
}
7845

79-
& wix build -nologo -arch $platform -out $msi_name $wixext `
80-
-ext WixToolset.UI.wixext `
81-
-bv "WixUIBannerBmp=$libcdoc/banner.bmp" `
82-
-bv "WixUIDialogBmp=$libcdoc/dlgbmp.bmp" `
83-
-d "ICON=$libcdoc/ID.ico" `
84-
-d "vcpkg=$vcpkg_installed_platform/$vcpkg_triplet" `
85-
-d "libcdoc=$(Get-Location)/$platform" `
86-
$libcdoc\libcdoc.wxs
87-
46+
if($RunTests) {
47+
Push-Location "$libcdoc\$buildpath"
48+
ctest -V -C Debug
49+
Pop-Location
50+
}

0 commit comments

Comments
 (0)