@@ -81,12 +81,12 @@ $PROJECT_DIR = "$PWD"
8181$SCRIPT_DIR = " ${PROJECT_DIR} \scripts"
8282
8383# Command-line arguments
84- $AUTOMATE = if ( $Automate.IsPresent ) { $true } else { $false }
8584$BUILD_MODE = " $BuildMode "
8685$CMAKE_GENERATOR = " $CmakeGenerator "
8786$DEBUG_MODE = if ( $SystemDebug.IsPresent ) { $true } else { $false }
8887$UNREAL_ASSET = if ( $UnrealAsset.IsPresent ) { $true } else { $false }
8988$BUILD_DOCS = if ( $BuildDocs.IsPresent ) { $true } else { $false }
89+ $AUTOMATE_MODE = if ( $Automate.IsPresent ) { $true } else { $false }
9090
9191# Dynamic variables
9292$SYSTEM_INFO = Get-ComputerInfo # WARNING: Windows only
@@ -95,7 +95,7 @@ $SYSTEM_ARCHITECTURE = "${env:PROCESSOR_ARCHITECTURE}"
9595$SYSTEM_PLATFORM = Get-Architecture - Info $SYSTEM_INFO
9696$SYSTEM_CPU_MAX = Set-ProcessorCount - Info $SYSTEM_INFO
9797$SYSTEM_OS_VERSION = Get-WindowsVersion - Info $SYSTEM_INFO
98- $VS_INSTANCE = Set-VsInstance - Automate $AUTOMATE
98+ $VS_INSTANCE = Set-VsInstance - Automate $AUTOMATE_MODE
9999$VS_VERSION = Get-VsInstanceVersion - Config $VS_INSTANCE
100100$CMAKE_VERSION = Get-ProgramVersion - Program ' cmake'
101101
@@ -104,31 +104,31 @@ $CMAKE_VERSION = Get-ProgramVersion -Program 'cmake'
104104# ##
105105
106106# Compile AutonomySim.sln, which will also compile MavLinkCom.
107- function Build-Solution {
107+ function Build-AutonomySim {
108108 [OutputType ()]
109109 param (
110110 [Parameter ()]
111111 [String ]
112- $BuildMode = $BUILD_MODE ,
113- [Parameter (Mandatory )]
112+ $BuildMode = " $BUILD_MODE " ,
113+ [Parameter ()]
114114 [String ]
115- $SystemPlatform ,
116- [Parameter (Mandatory )]
115+ $SystemPlatform = " $SYSTEM_PLATFORM " ,
116+ [Parameter ()]
117117 [UInt16 ]
118- $SystemCpuMax ,
118+ $SystemCpuMax = $SYSTEM_CPU_MAX ,
119119 [Parameter ()]
120120 [String []]
121121 $IgnoreErrors = @ ()
122122 )
123- [String ]$IgnoreErrorCodes = if ( $IgnoreErrors.Count -gt 0 ) { ($IgnoreErrors -Join ' ;' ) } else { ' ' }
124- if ( $BuildMode -eq ' Release' ) {
125- Start-Process - FilePath ' msbuild.exe' - ArgumentList " -maxcpucount:${SystemCpuMax} " , " -noerr: ${IgnoreErrorCodes} " ,
126- " /p:Platform=${SystemPlatform} " , " /p:Configuration=Debug" , ' AutonomySim.sln' - Wait - NoNewWindow - ErrorAction Stop
127- Start-Process - FilePath ' msbuild.exe' - ArgumentList " -maxcpucount:${SystemCpuMax} " , " -noerr: ${IgnoreErrorCodes} " ,
128- " /p:Platform=${SystemPlatform} " , " /p:Configuration=Release" , ' AutonomySim.sln' - Wait - NoNewWindow - ErrorAction Stop
123+ [String ]$IgnoreErrorCodes = if ( $IgnoreErrors.Count -gt 0 ) { ' -noerr: ' + ($IgnoreErrors -Join ' ;' ) } else { ' ' }
124+ if ( " $BuildMode " -eq ' Release' ) {
125+ Start-Process - FilePath ' msbuild.exe' - ArgumentList " -maxcpucount:${SystemCpuMax} " , " ${IgnoreErrorCodes} " ,
126+ " /p:Platform=${SystemPlatform} " , ' /p:Configuration=Debug' , ' AutonomySim.sln' - Wait - NoNewWindow - ErrorAction Stop
127+ Start-Process - FilePath ' msbuild.exe' - ArgumentList " -maxcpucount:${SystemCpuMax} " , " ${IgnoreErrorCodes} " ,
128+ " /p:Platform=${SystemPlatform} " , ' /p:Configuration=Release' , ' AutonomySim.sln' - Wait - NoNewWindow - ErrorAction Stop
129129 } else {
130- Start-Process - FilePath ' msbuild.exe' - ArgumentList " -maxcpucount:${SystemCpuMax} " , " -noerr: ${IgnoreErrorCodes} " ,
131- " /p:Platform=${SystemPlatform} " , " /p:Configuration=${BuildMode} " , ' AutonomySim.sln' - Wait - NoNewWindow - ErrorAction Stop
130+ Start-Process - FilePath ' msbuild.exe' - ArgumentList " -maxcpucount:${SystemCpuMax} " , " ${IgnoreErrorCodes} " ,
131+ " /p:Platform=${SystemPlatform} " , " /p:Configuration=${BuildMode} " , ' AutonomySim.sln' - Wait - NoNewWindow - ErrorAction Stop
132132 }
133133 if ( ! $? ) { exit $LastExitCode } # exit on error
134134 return $null
@@ -149,24 +149,24 @@ function Copy-GeneratedBinaries {
149149 )
150150 # Copy binaries and includes for MavLinkCom in deps
151151 New-Item - ItemType Directory - Path (" $MavLinkTargetLib " , " $MavLinkTargetInclude " ) - Force | Out-Null
152- Copy-Item - Path ' .\MavLinkCom\lib' - Destination " $MavLinkTargetLib " - Recurse - Verbose
153- Copy-Item - Path ' .\MavLinkCom\include' - Destination " $MavLinkTargetInclude " - Recurse - Verbose
152+ Copy-Item - Path ' .\MavLinkCom\lib' - Destination " $MavLinkTargetLib " - Recurse
153+ Copy-Item - Path ' .\MavLinkCom\include' - Destination " $MavLinkTargetInclude " - Recurse
154154 # Copy outputs into Unreal/Plugins directory
155155 New-Item - ItemType Directory - Path " $AutonomyLibPluginDir " - Force | Out-Null
156- Copy-Item - Path ' .\AutonomyLib' - Destination " $AutonomyLibPluginDir " - Recurse - Verbose
157- Copy-Item - Path ' .\AutonomySim.props' - Destination " $AutonomyLibPluginDir " - Recurse - Verbose
156+ Copy-Item - Path ' .\AutonomyLib' - Destination " $AutonomyLibPluginDir " - Recurse
157+ Copy-Item - Path ' .\AutonomySim.props' - Destination " $AutonomyLibPluginDir " - Recurse
158158 return $null
159159}
160160
161161function Get-VsUnrealProjectFiles {
162162 [OutputType ()]
163163 param (
164- [Parameter (Mandatory )]
165- [String ]
166- $UnrealEnvDir ,
167164 [Parameter ()]
168165 [String ]
169- $ProjectDir = " $PROJECT_DIR "
166+ $ProjectDir = " $PROJECT_DIR " ,
167+ [Parameter (Mandatory )]
168+ [String ]
169+ $UnrealEnvDir
170170 )
171171 Set-Location " $UnrealEnvDir "
172172 # imports: Test-DirectoryPath, Copy-UnrealEnvItems, Remove-UnrealEnvItems, Invoke-VsUnrealProjectFileGenerator
@@ -188,9 +188,9 @@ function Update-VsUnrealProjectFiles {
188188 $ProjectDir = " $PROJECT_DIR " ,
189189 [Parameter ()]
190190 [String ]
191- $UnrealEnvDir = ' .\Unreal\Environments'
191+ $UnrealEnvBaseDir = ' .\UnrealPlugin \Unreal\Environments'
192192 )
193- $UnrealEnvDirs = (Get-ChildItem - Path " $UnrealEnvDir " - Directory | Select-Object FullName).FullName
193+ $UnrealEnvDirs = (Get-ChildItem - Path " $UnrealEnvBaseDir " - Directory | Select-Object FullName).FullName
194194 foreach ( $d in $UnrealEnvDirs ) {
195195 Get-VsUnrealProjectFiles - UnrealEnvDir " $d " - ProjectDir " $ProjectDir "
196196 }
@@ -220,7 +220,7 @@ if ( $Verbose.IsPresent ) {
220220 Write-Output " Build mode: $BUILD_MODE "
221221 Write-Output ' -----------------------------------------------------------------------------------------'
222222 Write-Output " Debug mode: $DEBUG_MODE "
223- Write-Output " CI/CD mode: $AUTOMATE "
223+ Write-Output " CI/CD mode: $AUTOMATE_MODE "
224224 Write-Output " Build docs: $BUILD_DOCS "
225225 Write-Output ' -----------------------------------------------------------------------------------------'
226226 Write-Output " Windows version: $SYSTEM_OS_VERSION "
@@ -241,7 +241,7 @@ Test-WorkingDirectory
241241Add-Directories - Directories @ (' temp' , ' external' , ' external\rpclib' )
242242
243243# Test Visual Studio version (optionally automated for CI/CD).
244- Test-VsInstanceVersion - Automate $AUTOMATE
244+ Test-VsInstanceVersion - Automate $AUTOMATE_MODE
245245
246246# Test CMake version (downloads and installs CMake).
247247Test-CmakeVersion
@@ -250,13 +250,13 @@ Test-CmakeVersion
250250Test-EigenVersion
251251
252252# Test RpcLib version (downloads and builds rpclib).
253- Test-RpcLibVersion - CmakeGenerator " $CMAKE_GENERATOR "
253+ Test-RpcLibVersion - BuildMode " $BUILD_MODE " - CmakeGenerator " $CMAKE_GENERATOR "
254254
255255# Test high-polycount SUV asset.
256256Test-UnrealAssetVersion - FullPolySuv $UNREAL_ASSET
257257
258258# Compile AutonomySim.sln including MavLinkCom.
259- Build-Solution - BuildMode " $BUILD_MODE " - SystemPlatform " $SYSTEM_PLATFORM " - SystemCpuMax " $SYSTEM_CPU_MAX "
259+ Build-AutonomySim - BuildMode " $BUILD_MODE " - SystemPlatform " $SYSTEM_PLATFORM " - SystemCpuMax " $SYSTEM_CPU_MAX "
260260
261261# Copy binaries and includes for MavLinkCom and Unreal/Plugins.
262262Copy-GeneratedBinaries
0 commit comments