From 5013f506ef55e12e4251a86af8dfa1754f636367 Mon Sep 17 00:00:00 2001 From: admercs Date: Tue, 20 Feb 2024 15:13:01 -0800 Subject: [PATCH] update windows build --- .github/workflows/test_windows.yml | 2 +- scripts/build.ps1 | 48 +++++++++++++++--------------- scripts/setup.sh | 8 ++--- scripts/test_rpclib.psm1 | 20 ++++++------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index ef6215ef..1245a332 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -37,4 +37,4 @@ jobs: run: | # Set-PSDebug -Trace 1 $CMAKE_GENERATOR_PLATFORM = "Visual Studio 17 2022" - ./scripts/build.ps1 -BuildMode "Release" -Deploy + ./scripts/build.ps1 -BuildMode "Release" -IntegrateDeploy diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 9d285424..bb8d6a72 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -38,7 +38,7 @@ param( $SystemDebug = $false, [Parameter(HelpMessage = 'Enable for CI/CD mode (e.g., GitHub Actions).')] [Switch] - $Deploy = $false + $IntegrateDeploy = $false ) ### @@ -74,9 +74,9 @@ $SCRIPT_DIR = "$PROJECT_DIR\scripts" # Command-line arguments $BUILD_MODE = "$BuildMode" $BUILD_DOCS = if ($BuildDocs) { $true } else { $false } -$HIGH_POLYCOUNT_SUV = if ($HighPolycountSuv) { $true } else { $false } $DEBUG_MODE = if ($SystemDebug) { $true } else { $false } -$CI_CD_MODE = if ($Deploy -eq $true) { $true } else { $false } +$ASSET_SUV_GET = if ($HighPolycountSuv) { $true } else { $false } +$CI_CD_MODE = if ($IntegrateDeploy -eq $true) { $true } else { $false } # Dynamic variables $SYSTEM_INFO = Get-ComputerInfo # Windows only @@ -174,45 +174,45 @@ Write-Output '' Write-Output '-----------------------------------------------------------------------------------------' Write-Output ' Parameters' Write-Output '-----------------------------------------------------------------------------------------' -Write-Output " Project directory: $PROJECT_DIR" -Write-Output " Script directory: $SCRIPT_DIR" +Write-Output " Project directory: $PROJECT_DIR" +Write-Output " Script directory: $SCRIPT_DIR" Write-Output '-----------------------------------------------------------------------------------------' -Write-Output " Processor: $SYSTEM_PROCESSOR" -Write-Output " Architecture: $SYSTEM_ARCHITECTURE" -Write-Output " Platform: $SYSTEM_PLATFORM" -Write-Output " CPU count max: $SYSTEM_CPU_MAX" -Write-Output " Build mode: $BUILD_MODE" +Write-Output " Processor: $SYSTEM_PROCESSOR" +Write-Output " Architecture: $SYSTEM_ARCHITECTURE" +Write-Output " Platform: $SYSTEM_PLATFORM" +Write-Output " CPU count max: $SYSTEM_CPU_MAX" +Write-Output " Build mode: $BUILD_MODE" Write-Output '-----------------------------------------------------------------------------------------' -Write-Output " Debug mode: $DEBUG_MODE" -Write-Output " CI/CD mode: $CI_CD_MODE" +Write-Output " Debug mode: $DEBUG_MODE" +Write-Output " CI/CD mode: $CI_CD_MODE" Write-Output '-----------------------------------------------------------------------------------------' -Write-Output " Windows version: $SYSTEM_OS_VERSION" -Write-Output " Visual Studio version: $VS_VERSION" -Write-Output " CMake version: $CMAKE_VERSION" -Write-Output " RPClib version: $RPCLIB_VERSION" -Write-Output " Eigen version: $EIGEN_VERSION" -Write-Output " SUV asset version: $ASSET_SUV_VERSION" -Write-Output " High-polycount SUV: $HIGH_POLYCOUNT_SUV" +Write-Output " Windows version: $SYSTEM_OS_VERSION" +Write-Output " Visual Studio version: $VS_VERSION" +Write-Output " CMake version: $CMAKE_VERSION" +Write-Output " RPClib version: $RPCLIB_VERSION" +Write-Output " Eigen version: $EIGEN_VERSION" +Write-Output " High-polycount SUV version: $ASSET_SUV_VERSION" +Write-Output " High-polycount SUV: $ASSET_SUV_GET" Write-Output '-----------------------------------------------------------------------------------------' Write-Output '' # Ensure script is run from `AutonomySim` project directory Test-WorkingDirectory -# Test Visual Studio version +# Test Visual Studio version (optionally automated for CI/CD) Test-VisualStudioVersion -Automate $CI_CD_MODE -# Test CMake version +# Test CMake version (downloads and installs CMake) Test-CmakeVersion -# Create temporary build directories if they do not exist +# Create temporary directories if they do not exist Add-Directories -Directories @('temp', 'external', 'external\rpclib') -# Test RPClib version +# Test RpcLib version (downloads and builds rpclib) Test-RpcLibVersion # Test high-polycount SUV asset -Test-AssetSuvVersion -HighPolycountSuv $HIGH_POLYCOUNT_SUV +Test-AssetSuvVersion -HighPolycountSuv $ASSET_SUV_GET # Test Eigen library version Test-EigenVersion diff --git a/scripts/setup.sh b/scripts/setup.sh index 3ebb86dd..1b9f6ac7 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -137,9 +137,9 @@ else make \ cmake else - # if CMake binary not found, build it from source + # If CMake binary not found, build it from source if [ ! -d "cmake_build/bin" ]; then - echo "Downloading cmake..." + echo "Downloading CMake..." wget https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz -O cmake.tar.gz tar -xzf cmake.tar.gz rm cmake.tar.gz @@ -156,14 +156,14 @@ else fi fi -# Download and unpack rpclib. +# Download and unpack RPCLib. if [ ! -d "external/rpclib/rpclib-2.3.0" ]; then # remove previous versions and create empty directory rm -rf "external/rpclib" mkdir -p "external/rpclib" echo '' echo '-----------------------------------------------------------------------------------------' - echo ' Downloading rpclib...' + echo ' Downloading RPCLib...' echo '-----------------------------------------------------------------------------------------' wget https://github.com/rpclib/rpclib/archive/v2.3.0.zip unzip -q v2.3.0.zip -d external/rpclib diff --git a/scripts/test_rpclib.psm1 b/scripts/test_rpclib.psm1 index 467c3b1a..ed1172f4 100644 --- a/scripts/test_rpclib.psm1 +++ b/scripts/test_rpclib.psm1 @@ -43,7 +43,7 @@ Import-Module "${PWD}\scripts\utils.psm1" # imports: Add-Directori function Get-RpcLib { Write-Output '' Write-Output '-----------------------------------------------------------------------------------------' - Write-Output " Downloading rpclib version $RPCLIB_VERSION" + Write-Output " Downloading rpclib version ${RPCLIB_VERSION}..." Write-Output '-----------------------------------------------------------------------------------------' Write-Output '' @@ -65,7 +65,7 @@ function Get-RpcLib { function Build-RpcLib { Write-Output '' Write-Output '-----------------------------------------------------------------------------------------' - Write-Output " Building rpclib version $RPCLIB_VERSION with Cmake version $CMAKE_VERSION" + Write-Output " Building rpclib version ${RPCLIB_VERSION} with CMake version ${CMAKE_VERSION}..." Write-Output '-----------------------------------------------------------------------------------------' Write-Output '' @@ -73,13 +73,13 @@ function Build-RpcLib { Set-Location "${RPCLIB_PATH}\build" Write-Output "Current directory: ${RPCLIB_PATH}\build" - Start-Process -FilePath 'cmake.exe' -ArgumentList "-G $VS_GENERATOR", '..' -Wait -NoNewWindow + Start-Process -FilePath 'cmake.exe' -ArgumentList "-G ${VS_GENERATOR}", '..' -Wait -NoNewWindow if ( $BUILD_MODE -eq 'Release' ) { Start-Process -FilePath 'cmake.exe' -ArgumentList '--build', '.' -Wait -NoNewWindow Start-Process -FilePath 'cmake.exe' -ArgumentList '--build', '.', '--config Release' -Wait -NoNewWindow } else { - Start-Process -FilePath 'cmake.exe' -ArgumentList '--build', '.', "--config $BUILD_MODE" -Wait -NoNewWindow + Start-Process -FilePath 'cmake.exe' -ArgumentList '--build', '.', "--config ${BUILD_MODE}" -Wait -NoNewWindow } if (!$?) { exit $LASTEXITCODE } # exit on error @@ -93,13 +93,13 @@ function Build-RpcLib { [System.IO.Directory]::CreateDirectory($RPCLIB_TARGET_INCLUDE) # copy directories robustly - Copy-Item -Path "$RPCLIB_PATH\include" -Destination "$RPCLIB_TARGET_INCLUDE" + Copy-Item -Path "${RPCLIB_PATH}\include" -Destination "${RPCLIB_TARGET_INCLUDE}" if ( $BUILD_MODE -eq 'Release' ) { - Copy-Item -Path "$RPCLIB_PATH\build\Debug" -Destination "$RPCLIB_TARGET_LIB\Debug" - Copy-Item -Path "$RPCLIB_PATH\build\Release" -Destination "$RPCLIB_TARGET_LIB\Release" + Copy-Item -Path "${RPCLIB_PATH}\build\Debug" -Destination "${RPCLIB_TARGET_LIB}\Debug" + Copy-Item -Path "${RPCLIB_PATH}\build\Release" -Destination "${RPCLIB_TARGET_LIB}\Release" } else { - Copy-Item -Path "$RPCLIB_PATH\build\$BUILD_MODE" -Destination "$RPCLIB_TARGET_LIB\$BUILD_MODE" + Copy-Item -Path "${RPCLIB_PATH}\build\${BUILD_MODE}" -Destination "${RPCLIB_TARGET_LIB}\$BUILD_MODE" } } @@ -113,11 +113,11 @@ function Test-RpcLibVersion { # Fail if rpclib version path not found if ( -not (Test-Path -LiteralPath "$RPCLIB_PATH") ) { Write-Error 'Error: Download and build of rpclib failed. Stopping build.' -ErrorAction SilentlyContinue - Invoke-Fail -ErrorMessage "Error: Failed to download and build RCPLib." + Invoke-Fail -ErrorMessage "Error: Failed to download and build rpclib." } } else { - Write-Output "Existing installation of rpclib version $RPCLIB_VERSION found." + Write-Output "Existing installation of rpclib version ${RPCLIB_VERSION} found." } }