Skip to content

Commit

Permalink
windows test build
Browse files Browse the repository at this point in the history
  • Loading branch information
admercs committed Feb 24, 2024
1 parent cf06d0d commit 66c2f2a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 55 deletions.
56 changes: 28 additions & 28 deletions scripts/cmd/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ set CPU_COUNT_MAX=12
set PLATFORM=x64

REM // Check command line arguments
set fullPolyCar=""
set buildMode=""
set fullPolyCar=
set buildMode=

REM // Check Visual Studio version
if %VisualStudioVersion% == "" (
if %VisualStudioVersion% EQU "" (
echo.
echo "ERROR: command must be run from VS2022 Developer Command Prompt or Developer PowerShell."
goto :buildfailed_nomsg
)

if %VisualStudioVersion% lss 17.0 (
if %VisualStudioVersion% LSS 17.0 (
echo.
echo "AutonomySim supports up to Unreal Engine 5.3 and Visual Studio 2022."
echo "Here are few easy steps to perform the upgrade:"
Expand All @@ -31,27 +31,27 @@ if %VisualStudioVersion% lss 17.0 (
)

REM //---------- Parse arguments ----------
if %1 == "" goto :noargs
if %1 == --full-poly-car set "fullPolyCar=y"
if %1 == --Debug set "buildMode=Debug"
if %1 == --Release set "buildMode=Release"
if %1 == --RelWithDebInfo set "buildMode=RelWithDebInfo"
if %1 EQU "" goto :noargs
if %1 EQU --full-poly-car set "fullPolyCar=y"
if %1 EQU --Debug set "buildMode=Debug"
if %1 EQU --Release set "buildMode=Release"
if %1 EQU --RelWithDebInfo set "buildMode=RelWithDebInfo"

if %2 == "" goto :noargs
if %2 == --Debug set "buildMode=Debug"
if %2 == --Release set "buildMode=Release"
if %2 == --RelWithDebInfo set "buildMode=RelWithDebInfo"
if %2 EQU "" goto :noargs
if %2 EQU --Debug set "buildMode=Debug"
if %2 EQU --Release set "buildMode=Release"
if %2 EQU --RelWithDebInfo set "buildMode=RelWithDebInfo"

:noargs
set powershell=powershell
where powershell > nul 2>&1
if %ERRORLEVEL% == 1 goto :pwsh
if %ERRORLEVEL% EQU 1 goto :pwsh
echo "Found `powershell` command." && goto :start

:pwsh
set powershell=pwsh
where pwsh > nul 2>&1
if %ERRORLEVEL% == 1 goto :nopwsh
if %ERRORLEVEL% EQU 1 goto :nopwsh
set PWSHV7=1
echo "Found `pwsh` command." && goto :start

Expand All @@ -78,9 +78,9 @@ echo.

REM //---------- Check cmake version ----------
call scripts\cmd\check_cmake.cmd
if %ERRORLEVEL% == 1 (
if %ERRORLEVEL% EQU 1 (
call scripts\cmd\check_cmake.cmd
if %ERRORLEVEL% == 1 (
if %ERRORLEVEL% EQU 1 (
echo.
echo "ERROR: CMake not installed correctly."
goto :buildfailed
Expand All @@ -103,7 +103,7 @@ if not exist external\rpclib\rpclib-%RPCLIB_VERSION% (
echo.

@echo on
if %PWSHV7% == "" (
if %PWSHV7% EQU "" (
%powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile tmp\rpclib.zip }"
) else (
%powershell% -command "iwr https://github.com/rpclib/rpclib/archive/v2.3.0.zip -OutFile tmp\rpclib.zip"
Expand All @@ -130,14 +130,14 @@ cd external\rpclib\rpclib-%RPCLIB_VERSION%\build

cmake -G"Visual Studio 17 2022" ..

if %buildMode% == "" (
if %buildMode% EQU "" (
cmake --build .
cmake --build . --config Release
) else (
cmake --build . --config %buildMode%
)

if %ERRORLEVEL% == 1 goto :buildfailed
if %ERRORLEVEL% EQU 1 goto :buildfailed
cd %PROJECT_DIR%
echo "Current directory: %PROJECT_DIR%"

Expand All @@ -148,7 +148,7 @@ set RPCLIB_TARGET_INCLUDE=AutonomyLib\deps\rpclib\include
if not exist %RPCLIB_TARGET_INCLUDE% mkdir %RPCLIB_TARGET_INCLUDE%
robocopy /MIR external\rpclib\rpclib-%RPCLIB_VERSION%\include %RPCLIB_TARGET_INCLUDE%

if %buildMode% == "" (
if %buildMode% EQU "" (
robocopy /MIR external\rpclib\rpclib-%RPCLIB_VERSION%\build\Debug %RPCLIB_TARGET_LIB%\Debug
robocopy /MIR external\rpclib\rpclib-%RPCLIB_VERSION%\build\Release %RPCLIB_TARGET_LIB%\Release
) else (
Expand All @@ -158,7 +158,7 @@ if %buildMode% == "" (
REM //---------- Get High-polycount Car Model ------------
if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv mkdir Unreal\Plugins\AutonomySim\Content\VehicleAdv
if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv\SUV\v1.2.0 (
if %fullPolyCar% == y or %fullPolyCar% == yes (
if %fullPolyCar% EQU y or %fullPolyCar% EQU yes (
REM //leave some blank lines because %powershell% shows download banner at top of console
echo.
echo "-----------------------------------------------------------------------------------------"
Expand All @@ -172,7 +172,7 @@ if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv\SUV\v1.2.0 (
@echo on
REM %powershell% -command "& { Start-BitsTransfer -Source https://github.com/nervosys/AutonomySim/releases/download/v1.2.0/car_assets.zip -Destination tmp\suv_download\car_assets.zip }"
REM %powershell% -command "& { (New-Object System.Net.WebClient).DownloadFile('https://github.com/nervosys/AutonomySim/releases/download/v1.2.0/car_assets.zip', tmp\suv_download\car_assets.zip) }"
if %PWSHV7% == "" (
if %PWSHV7% EQU "" (
%powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://github.com/nervosys/AutonomySim/releases/download/v2.0.0-beta.0/car_assets.zip -OutFile tmp\suv_download\car_assets.zip }"
) else (
%powershell% -command "iwr https://github.com/nervosys/AutonomySim/releases/download/v2.0.0-beta.0/car_assets.zip -OutFile tmp\suv_download\car_assets.zip"
Expand All @@ -195,7 +195,7 @@ if not exist Unreal\Plugins\AutonomySim\Content\VehicleAdv\SUV\v1.2.0 (
REM //---------- Get Eigen library ----------
if not exist AutonomyLib\deps mkdir AutonomyLib\deps
if not exist AutonomyLib\deps\eigen3 (
if %PWSHV7% == "" (
if %PWSHV7% EQU "" (
%powershell% -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile tmp\eigen3.zip }"
) else (
%powershell% -command "iwr https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip -OutFile tmp\eigen3.zip"
Expand All @@ -211,14 +211,14 @@ if not exist AutonomyLib\deps\eigen3 (
if not exist AutonomyLib\deps\eigen3 goto :buildfailed

REM //---------- We now have all dependencies to compile AutonomySim.sln, which will also compile MavLinkCom ----------
if %buildMode% == "" (
if %buildMode% EQU "" (
msbuild -maxcpucount:%CPU_COUNT_MAX% /p:Platform=%PLATFORM% /p:Configuration=Debug AutonomySim.sln
if %ERRORLEVEL% == 1 goto :buildfailed
if %ERRORLEVEL% EQU 1 goto :buildfailed
msbuild -maxcpucount:%CPU_COUNT_MAX% /p:Platform=%PLATFORM% /p:Configuration=Release AutonomySim.sln
if %ERRORLEVEL% == 1 goto :buildfailed
if %ERRORLEVEL% EQU 1 goto :buildfailed
) else (
msbuild -maxcpucount:%CPU_COUNT_MAX% /p:Platform=%PLATFORM% /p:Configuration=%buildMode% AutonomySim.sln
if %ERRORLEVEL% == 1 goto :buildfailed
if %ERRORLEVEL% EQU 1 goto :buildfailed
)

REM //---------- Copy binaries and includes for MavLinkCom in deps ----------
Expand Down
20 changes: 10 additions & 10 deletions scripts/cmd/build_all_ue_projects.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ REM path for UE toolset
set ToolPath=%5

REM set defaults if ars are not supplied
if %UnrealProjsPath% == "" set "UnrealProjsPath=D:\vso\msresearch\Theseus"
if %AutonomySimPath% == "" set "AutonomySimPath=C:\GitHubSrc\AutonomySim"
if %OutputPath% == "" set "OutputPath=%ROOT_DIR%build"
if %RebuildAutonomySim% == "" set "RebuildAutonomySim=true"
if %UnrealProjsPath% EQU "" set "UnrealProjsPath=D:\vso\msresearch\Theseus"
if %AutonomySimPath% EQU "" set "AutonomySimPath=C:\GitHubSrc\AutonomySim"
if %OutputPath% EQU "" set "OutputPath=%ROOT_DIR%build"
if %RebuildAutonomySim% EQU "" set "RebuildAutonomySim=true"

REM re-build AutonomySim
if %RebuildAutonomySim% == true (
if %RebuildAutonomySim% EQU true (
cd /D %AutonomySimPath%
call clean
call build
if %ERRORLEVEL% == 1 goto :failed
if %ERRORLEVEL% EQU 1 goto :failed
cd /D %ROOT_DIR%
)

Expand Down Expand Up @@ -55,15 +55,15 @@ if %~2 == "" (
) else (
cd /D %UnrealProjsPath%\%~2
)
if %ERRORLEVEL% == 1 goto :failed
if %ERRORLEVEL% EQU 1 goto :failed

robocopy %AutonomySimPath%\Unreal\Environments\Blocks . *.cmd /njh /njs /ndl /np

call update_from_git.cmd %AutonomySimPath%
if %ERRORLEVEL% == 1 goto :failed
if %ERRORLEVEL% EQU 1 goto :failed

call package.cmd %OutputPath% %ToolPath% %~3
if %ERRORLEVEL% == 1 goto :failed
if %ERRORLEVEL% EQU 1 goto :failed

goto :done

Expand All @@ -73,4 +73,4 @@ exit /b 1

:done
cd %ROOT_DIR%
if %1 == "" pause
if %1 EQU "" pause
2 changes: 1 addition & 1 deletion scripts/cmd/build_docs.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ REM )

cd /d %BUILD_DIR%

if %1 == no_serve goto :PromptYN
if %1 EQU no_serve goto :PromptYN
mkdocs serve

:PromptYN
Expand Down
15 changes: 6 additions & 9 deletions scripts/cmd/check_cmake.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ setlocal

REM set ROOT_DIR=%~dp0
set cmake_minversion_majmin=3.14
set cmake_version=""
set cmake_version=

where /q cmake
if %ERRORLEVEL% EQU 0 (
for /F tokens=3 %%a in ('cmake --version ^| find cmake version') do set cmake_version=%%a
if %cmake_version% == "" (
if %cmake_version% EQU "" (
echo "Unable to get version of cmake." >&2
exit /b 2
)
Expand All @@ -19,11 +19,11 @@ if %ERRORLEVEL% EQU 0 (
goto :download_install
)

set cmake_ver_major=""
set cmake_ver_minor=""
set cmake_ver_major=
set cmake_ver_minor=
for /F tokens=1,2 delims=. %%a in (%cmake_version%) do (
set cmake_ver_major=%%a
set cmake_ver_minor=%%b
set "cmake_ver_major=%%a"
set "cmake_ver_minor=%%b"
)
set cmake_ver_minmaj=%cmake_ver_major:~-4%.%cmake_ver_minor:~-4%
if %cmake_ver_minmaj% LSS %cmake_minversion_majmin% (
Expand All @@ -37,13 +37,10 @@ exit /b 0

:download_install
set /p choice="Press any key to download and install cmake (make sure to add it in path in install options)"

if not exist %temp%\cmake-3.14.7-win64-x64.msi (
@echo on
powershell -command "& { iwr https://cmake.org/files/v3.14/cmake-3.14.7-win64-x64.msi -OutFile %temp%\cmake-3.14.7-win64-x64.msi }"
@echo off
)

msiexec.exe /i %temp%\cmake-3.14.7-win64-x64.msi

exit /b 1
4 changes: 2 additions & 2 deletions scripts/cmd/clean.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ rd /s/q AutonomyLib\deps\rpclib
rd /s/q external\rpclib\build

msbuild /p:Platform=x64 /p:Configuration=Debug AutonomySim.sln /t:Clean
if %ERRORLEVEL% == 1 goto :buildfailed
if %ERRORLEVEL% EQU 1 goto :buildfailed
msbuild /p:Platform=x64 /p:Configuration=Release AutonomySim.sln /t:Clean
if %ERRORLEVEL% == 1 goto :buildfailed
if %ERRORLEVEL% EQU 1 goto :buildfailed
goto :eof

:buildfailed
Expand Down
5 changes: 2 additions & 3 deletions scripts/cmd/gitcommitall.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ REM root folder for repos
set RepoRoot=%1
set CommitMessage=%2

if %CommitMessage% == "" (
if %CommitMessage% EQU "" (
echo "CommitMessage needs to be provided"
goto :failed
)
Expand Down Expand Up @@ -49,7 +49,6 @@ for %%x in (
git push
cd ..
)

goto :done

:failed
Expand All @@ -60,4 +59,4 @@ exit /b 1

:done
cd %ROOT_DIR%
if %1 == "" pause
if %1 EQU "" pause
4 changes: 2 additions & 2 deletions scripts/cmd/template.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ set ROOT_DIR=%cd%
REM pushd %~dp0

:success
@echo "Task completed."
echo "Task completed."
goto :end

:failed
@echo "Task has failed."
echo "Task has failed."
goto :end

:end
Expand Down

0 comments on commit 66c2f2a

Please sign in to comment.