PyRunner/script/Build.ps1

41 lines
1.6 KiB
PowerShell
Raw Normal View History

2024-06-07 20:41:20 +03:00
# ====== Build Python ==========
Set-Location $PSScriptRoot\..\src\vbatopy
Write-Information 'Prepare Python environemnt...'
$packageName = 'vbatopy'
$output = "$PSScriptRoot\..\output"
$python = '.\venv\Scripts\python.exe'
if (-not (Test-Path -Path $python -PathType Leaf)) {
& 'python' -m venv .\venv
& $python -m pip install -r requirements.txt
& $python -m pip install -r requirements-build.txt
}
if (Test-Path -Path $output\$packageName) {
Remove-Item $output\$packageName -Recurse -Force
}
& $python -m build --outdir=$output\$packageName
# ======= Build CPP ===========
Set-Location $PSScriptRoot\..\src\vbatopydll
Write-Information 'Building cpp libraries...'
$solution = 'vbatopy.sln'
# TODO: find MSBuild instead - Implement in ConceptDeploy
$msbuild32 = 'C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\amd64\MSBuild.exe'
$msbuild64 = 'C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe'
if (-not (Test-Path -Path $msbuild32 -PathType Leaf) -or -not (Test-Path -Path $msbuild64 -PathType Leaf)) {
Write-Error "Missing MSBuild, please correct MSBuild path in $MyInvocation.MyCommand.Name"
Exit 1
}
& $msbuild32 @($solution, '/target:Clean', '/target:Build', '/property:Configuration=Release', '/property:Platform=Win32') | Write-Verbose
if ($LASTEXITCODE -ne 0) {
Write-Error 'Failed to build x86 dll...'
}
& $msbuild64 @($solution, '/target:Clean', '/target:Build', '/property:Configuration=Release', '/property:Platform=x64') | Write-Verbose
if ($LASTEXITCODE -ne 0) {
Write-Error 'Failed to build x64 dll...'
}