Simplify UWP build script.

This commit is contained in:
levlam 2021-05-11 03:24:47 +03:00
parent 32fe6456e6
commit 445183e52c

View File

@ -14,6 +14,11 @@ $arch_list = @( "x86", "x64", "ARM" )
if ($arch) { if ($arch) {
$arch_list = @(, $arch) $arch_list = @(, $arch)
} }
$config_list = @( "Debug", "Release" )
if ($release_only) {
$config_list = @(, "RelWithDebInfo")
}
$targets = @{ Debug = "Debug"; Release = "Retail"; RelWithDebInfo = "CommonConfiguration"}
$td_root = Resolve-Path "../.." $td_root = Resolve-Path "../.."
@ -48,7 +53,7 @@ function config {
New-Item -ItemType Directory -Force -Path build-uwp New-Item -ItemType Directory -Force -Path build-uwp
cd build-uwp cd build-uwp
ForEach($arch in $arch_list) { ForEach ($arch in $arch_list) {
echo "Config Arch = [$arch]" echo "Config Arch = [$arch]"
New-Item -ItemType Directory -Force -Path $arch New-Item -ItemType Directory -Force -Path $arch
cd $arch cd $arch
@ -67,30 +72,17 @@ function config {
function build { function build {
cd build-uwp cd build-uwp
ForEach($arch in $arch_list) { ForEach ($arch in $arch_list) {
echo "Build Arch = [$arch]" echo "Build Arch = [$arch]"
cd $arch cd $arch
if ($release_only) { ForEach ($config in $config_list) {
cmake --build . --config RelWithDebInfo --target tddotnet cmake --build . --config $config --target tddotnet
} else {
cmake --build . --config Release --target tddotnet
cmake --build . --config Debug --target tddotnet
} }
cd .. cd ..
} }
cd .. cd ..
} }
function export-architecture($arch, $config, $target) {
New-Item -ItemType Directory -Force -Path vsix/DesignTime/${target}/${arch}
New-Item -ItemType Directory -Force -Path vsix/Redist/${target}/${arch}
New-Item -ItemType Directory -Force -Path vsix/References/${target}/${arch}
cp ${arch}/${config}/* -include "SSLEAY*","LIBEAY*","libcrypto*","libssl*","zlib*" vsix/Redist/${target}/${arch}/
cp ${arch}/${config}/* -filter "Telegram.Td.*" -include "*.lib" vsix/DesignTime/${target}/${arch}/
cp ${arch}/${config}/* -filter "Telegram.Td.*" -include "*.pdb","*.dll" vsix/Redist/${target}/${arch}/
}
function export { function export {
cd build-uwp cd build-uwp
Remove-Item vsix -Force -Recurse -ErrorAction SilentlyContinue Remove-Item vsix -Force -Recurse -ErrorAction SilentlyContinue
@ -100,16 +92,18 @@ function export {
cp '../`[Content_Types`].xml' vsix cp '../`[Content_Types`].xml' vsix
cp ../LICENSE_1_0.txt vsix cp ../LICENSE_1_0.txt vsix
ForEach($arch in $arch_list) { ForEach ($arch in $arch_list) {
if ($release_only) { New-Item -ItemType Directory -Force -Path vsix/References/CommonConfiguration/${arch}
New-Item -ItemType Directory -Force -Path vsix/References/CommonConfiguration/${arch} ForEach ($config in $config_list) {
export-architecture -arch $arch -config "RelWithDebInfo" -target "CommonConfiguration" $target = $targets[$config]
cp ${arch}/RelWithDebInfo/* -filter "Telegram.Td.*" -include "*.pri","*.winmd","*.xml" vsix/References/CommonConfiguration/${arch}/
} else { New-Item -ItemType Directory -Force -Path vsix/DesignTime/${target}/${arch}
New-Item -ItemType Directory -Force -Path vsix/References/CommonConfiguration/${arch} cp ${arch}/${config}/Telegram.Td.lib vsix/DesignTime/${target}/${arch}/
export-architecture -arch $arch -config "Debug" -target "Debug"
export-architecture -arch $arch -config "Release" -target "Retail" New-Item -ItemType Directory -Force -Path vsix/Redist/${target}/${arch}
cp ${arch}/Release/* -filter "Telegram.Td.*" -include "*.pri","*.winmd","*.xml" vsix/References/CommonConfiguration/${arch}/ cp ${arch}/${config}/* -include "SSLEAY*","LIBEAY*","libcrypto*","libssl*","zlib*","Telegram.Td.pdb","Telegram.Td.dll" vsix/Redist/${target}/${arch}/
cp ${arch}/${config}/* -include "Telegram.Td.pri","Telegram.Td.winmd","Telegram.Td.xml" vsix/References/CommonConfiguration/${arch}/
} }
} }