Updated build script to keep build output

This commit is contained in:
Elad Solomon 2021-07-20 18:51:29 +03:00 committed by Tomer Lev
parent fde3a6b73f
commit 235ec2565f
2 changed files with 17 additions and 4 deletions

View file

@ -5,7 +5,9 @@ param(
) )
$SourceDirectory = (Convert-Path "$PSScriptRoot/../").Replace("\", "/") $SourceDirectory = (Convert-Path "$PSScriptRoot/../").Replace("\", "/")
$WorkingDirectory = $pwd.Path $WorkingDirectory = "$pwd"
$BuildOutputDirectory = "$SourceDirectory/out/build/x64/$BuildType"
$InstallDirectory = "$SourceDirectory/out/install/x64/$BuildType"
$commands = @() $commands = @()
if (!(Get-Command cl)) { if (!(Get-Command cl)) {
@ -18,7 +20,7 @@ cmake.exe
-S "$SourceDirectory" -S "$SourceDirectory"
-B "$WorkingDirectory" -B "$WorkingDirectory"
-DCMAKE_BUILD_TYPE:STRING=$BuildType -DCMAKE_BUILD_TYPE:STRING=$BuildType
-DCMAKE_INSTALL_PREFIX:PATH="$SourceDirectory/out/install/$BuildType" -DCMAKE_INSTALL_PREFIX:PATH="$InstallDirectory"
-DDISABLE_PYTHON_BINDINGS=1 ` -DDISABLE_PYTHON_BINDINGS=1 `
2>&1 2>&1
"@.Replace("`r`n", "") "@.Replace("`r`n", "")
@ -30,4 +32,14 @@ cmake.exe --build $WorkingDirectory --config $BuildType
$commands += @" $commands += @"
cmake.exe --install $WorkingDirectory cmake.exe --install $WorkingDirectory
"@ "@
cmd /c ($commands -join " && ") cmd /c ($commands -join " && ")
Write-Host "Copying build output to $BuildOutputDirectory..."
mkdir $BuildOutputDirectory -Force | Out-Null
Get-ChildItem $WorkingDirectory -Recurse -Attributes !ReparsePoint | foreach {
$path = $_.FullName.Replace("$pwd", $BuildOutputDirectory)
$parent = Split-Path -Parent $path
mkdir $parent -Force | Out-Null
Copy-Item $_.FullName -Destination $path -Force
}
Write-Host "Done."

View file

@ -42,6 +42,7 @@ RUN choco install python -y
# Can't install a proper msys2 because it caused console hanging in the container during docker build. # Can't install a proper msys2 because it caused console hanging in the container during docker build.
RUN choco install msysgit -y RUN choco install msysgit -y
RUN choco install sed -y RUN choco install sed -y
RUN choco install powershell-core -y
# Set working environment. # Set working environment.
RUN setx /M PATH "%PATH%;C:\\Program Files\\Git\\bin" RUN setx /M PATH "%PATH%;C:\\Program Files\\Git\\bin"
@ -53,4 +54,4 @@ ADD default C:\Users\ContainerAdministrator\.conan\profiles\default
# Define the entry point for the docker container. # Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell. # This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Unrestricted"] ENTRYPOINT ["C:\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&", "pwsh.exe", "-NoLogo", "-ExecutionPolicy", "Unrestricted"]