|
1 |
| -SETLOCAL EnableDelayedExpansion |
2 |
| - |
3 |
| -echo Starting Content Download... |
4 |
| -if not exist "Unreal\CarlaUnreal\Content" mkdir Unreal\CarlaUnreal\Content |
5 |
| -start cmd /c git -C Unreal/CarlaUnreal/Content clone -b ue5-dev https://bitbucket.org/carla-simulator/carla-content.git Carla |
6 |
| - |
7 |
| - |
8 |
| -echo Installing Visual Studio 2022... |
9 |
| -curl -L -O https://aka.ms/vs/17/release/vs_community.exe || exit /b |
10 |
| -rem See: https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community?view=vs-2022&preserve-view=true |
11 |
| -vs_Community.exe --add ^ |
12 |
| - Microsoft.VisualStudio.Workload.NativeDesktop ^ |
13 |
| - Microsoft.VisualStudio.Workload.NativeGame ^ |
14 |
| - Microsoft.VisualStudio.Workload.ManagedDesktop ^ |
15 |
| - Microsoft.VisualStudio.Component.Windows10SDK.18362 ^ |
16 |
| - Microsoft.VisualStudio.Component.VC.CMake.Project ^ |
17 |
| - Microsoft.Net.ComponentGroup.4.8.1.DeveloperTools ^ |
18 |
| - Microsoft.VisualStudio.Component.VC.Llvm.Clang ^ |
19 |
| - Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ^ |
20 |
| - Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang ^ |
21 |
| - Microsoft.VisualStudio.Component.VC.14.36.17.6.x86.x64 ^ |
22 |
| - --removeProductLang Es-es ^ |
23 |
| - --addProductLang En-us ^ |
24 |
| - --installWhileDownloading ^ |
25 |
| - --passive ^ |
26 |
| - --wait |
27 |
| -del vs_community.exe |
28 |
| -echo Visual Studion 2022 Installed!!! |
| 1 | +@echo off |
| 2 | +setlocal EnableDelayedExpansion |
| 3 | + |
| 4 | +set SKIP_PREREQUISITES=false |
| 5 | +set LAUNCH=false |
| 6 | +set INTERACTIVE=false |
| 7 | + |
| 8 | +if not "%*"=="" ( |
| 9 | + for %%x in ("%*") do ( |
| 10 | + if "%%~x"=="--interactive" ( |
| 11 | + set INTERACTIVE=true |
| 12 | + ) else if "%%~x"=="-i" ( |
| 13 | + set INTERACTIVE=true |
| 14 | + ) else if "%%~x"=="--skip-prerequisites" ( |
| 15 | + set SKIP_PREREQUISITES=true |
| 16 | + ) else if "%%~x"=="-p" ( |
| 17 | + set SKIP_PREREQUISITES=true |
| 18 | + ) else if "%%~x"=="--launch" ( |
| 19 | + set LAUNCH=true |
| 20 | + ) else if "%%~x"=="-l" ( |
| 21 | + set LAUNCH=true |
| 22 | + ) else ( |
| 23 | + echo Unknown argument "%%~x" |
| 24 | + ) |
| 25 | + ) |
| 26 | +) |
29 | 27 |
|
| 28 | +rem -- PREREQUISITES INSTALL STEP -- |
30 | 29 |
|
31 |
| -ninja --version 2>NUL |
32 |
| -if errorlevel 1 ( |
33 |
| - echo Found Ninja - FAIL |
34 |
| - echo Installing Ninja 1.11.1... |
35 |
| - echo Installing Ninja... |
36 |
| - curl -L -o %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\ninja-win.zip https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip || exit /b |
37 |
| - powershell -command "Expand-Archive $env:USERPROFILE\AppData\Local\Microsoft\WindowsApps\ninja-win.zip $env:USERPROFILE\AppData\Local\Microsoft\WindowsApps\ninja-win" || exit /b |
38 |
| - move %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\ninja-win\ninja.exe %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\ninja.exe || exit /b |
39 |
| - rmdir /s /q %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\ninja-win |
40 |
| - del /f %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\ninja-win.zip |
41 |
| - echo Ninja Installed!!! |
| 30 | +if %SKIP_PREREQUISITES%==false ( |
| 31 | + echo Installing prerequisites... |
| 32 | + call Util/SetupUtils/InstallPrerequisites.bat || exit /b |
42 | 33 | ) else (
|
43 |
| - echo Found Ninja - OK |
44 |
| - ninja --version |
| 34 | + echo Skipping prerequisites install step. |
45 | 35 | )
|
46 | 36 |
|
47 |
| - |
48 |
| -python --version 2>NUL |
49 |
| -if errorlevel 1 ( |
50 |
| - echo Found Python - FAIL |
51 |
| - echo Installing Python 3.8.10... |
52 |
| - curl -L -O https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe || exit /b |
53 |
| - python-3.8.10-amd64.exe /passive PrependPath=1 || exit /b |
54 |
| - del python-3.8.10-amd64.exe |
55 |
| - set "PATH=%LocalAppData%\Programs\Python\Python38\Scripts\;%LocalAppData%\Programs\Python\Python38\;%PATH%" |
56 |
| - echo Python 3.8.10 installed!!! |
| 37 | +rem -- CLONE CONTENT -- |
| 38 | +if exist "%cd%\Unreal\CarlaUnreal\Content" ( |
| 39 | + echo Found CARLA content. |
57 | 40 | ) else (
|
58 |
| - echo Found Python - OK |
59 |
| - python --version |
| 41 | + echo Could not find CARLA content. Downloading... |
| 42 | + mkdir %cd%\Unreal\CarlaUnreal\Content |
| 43 | + git ^ |
| 44 | + -C %cd%\Unreal\CarlaUnreal\Content ^ |
| 45 | + clone ^ |
| 46 | + -b ue5-dev ^ |
| 47 | + https://bitbucket.org/carla-simulator/carla-content.git ^ |
| 48 | + Carla ^ |
| 49 | + || exit /b |
60 | 50 | )
|
61 | 51 |
|
| 52 | +rem Activate VS terminal development environment: |
| 53 | +if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" ( |
| 54 | + echo Activating "x64 Native Tools Command Prompt" terminal environment. |
| 55 | + call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" || exit /b |
| 56 | +) else ( |
| 57 | + echo Could not find vcvarsall.bat, aborting setup... |
| 58 | + exit 1 |
| 59 | +) |
62 | 60 |
|
63 |
| -echo Installing Python Packages... |
64 |
| -python -m pip install --upgrade pip || exit /b |
65 |
| -python -m pip install -r requirements.txt || exit /b |
66 |
| -echo Python Packages Installed... |
67 |
| - |
68 |
| - |
69 |
| -echo Switching to x64 Native Tools Command Prompt for VS 2022 command line... |
70 |
| -call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" |
71 |
| - |
72 |
| - |
| 61 | +rem -- DOWNLOAD + BUILD UNREAL ENGINE -- |
73 | 62 | if exist "%CARLA_UNREAL_ENGINE_PATH%" (
|
74 |
| - echo Found UnrealEngine5 %CARLA_UNREAL_ENGINE_PATH% - OK |
| 63 | + echo Found Unreal Engine 5 at "%CARLA_UNREAL_ENGINE_PATH%". |
75 | 64 | ) else if exist ..\UnrealEngine5_carla (
|
76 |
| - echo Found UnrealEngine5 ..\UnrealEngine5_carla - OK |
77 |
| - pushd .. |
78 |
| - pushd UnrealEngine5_carla |
79 |
| - set CARLA_UNREAL_ENGINE_PATH=!cd! |
80 |
| - setx CARLA_UNREAL_ENGINE_PATH !cd! |
81 |
| - popd |
82 |
| - popd |
| 65 | + echo Found CARLA Unreal Engine at %cd%/UnrealEngine5_carla. Assuming already built... |
83 | 66 | ) else (
|
84 |
| - echo Found UnrealEngine5 $CARLA_UNREAL_ENGINE_PATH - FAIL |
| 67 | + echo Could not find CARLA Unreal Engine, downloading... |
85 | 68 | pushd ..
|
86 |
| - echo Cloning CARLA Unreal Engine 5... |
87 |
| - git clone -b ue5-dev-carla https://github.com/CarlaUnreal/UnrealEngine.git UnrealEngine5_carla || exit /b |
| 69 | + git clone ^ |
| 70 | + -b ue5-dev-carla ^ |
| 71 | + https://github.com/CarlaUnreal/UnrealEngine.git ^ |
| 72 | + UnrealEngine5_carla || exit /b |
88 | 73 | pushd UnrealEngine5_carla
|
89 | 74 | set CARLA_UNREAL_ENGINE_PATH=!cd!
|
90 | 75 | setx CARLA_UNREAL_ENGINE_PATH !cd!
|
| 76 | + echo Running Unreal Engine pre-build steps... |
| 77 | + call Setup.bat || exit /b |
| 78 | + call GenerateProjectFiles.bat || exit /b |
| 79 | + echo Building Unreal Engine 5... |
| 80 | + msbuild ^ |
| 81 | + Engine\Intermediate\ProjectFiles\UE5.vcxproj ^ |
| 82 | + /property:Configuration="Development_Editor" ^ |
| 83 | + /property:Platform="x64" || exit /b |
91 | 84 | popd
|
92 | 85 | popd
|
93 | 86 | )
|
94 |
| -pushd .. |
95 |
| -pushd %CARLA_UNREAL_ENGINE_PATH% |
96 |
| -echo Setup CARLA Unreal Engine 5... |
97 |
| -call Setup.bat || exit /b |
98 |
| -echo GenerateProjectFiles CARLA Unreal Engine 5... |
99 |
| -call GenerateProjectFiles.bat || exit /b |
100 |
| -echo Opening Visual Studio 2022... |
101 |
| -msbuild Engine\Intermediate\ProjectFiles\UE5.vcxproj /property:Configuration="Development_Editor" /property:Platform="x64" || exit /b |
102 |
| -popd |
103 |
| -popd |
104 |
| - |
105 |
| -echo Configuring CARLA... |
106 |
| -call cmake -G Ninja -S . -B Build -DCMAKE_BUILD_TYPE=Release -DBUILD_CARLA_UNREAL=ON -DCARLA_UNREAL_ENGINE_PATH=%CARLA_UNREAL_ENGINE_PATH% || exit /b |
107 |
| - |
108 |
| -echo Buiding CARLA... |
109 |
| -call cmake --build Build || exit /b |
110 | 87 |
|
111 |
| -echo Installing PythonAPI... |
112 |
| -cmake --build Build --target carla-python-api-install |
113 |
| - |
114 |
| -echo Build Succesfull :) |
115 |
| -echo Launching Unreal Editor with CARLA... |
116 |
| -call cmake --build Build --target launch || exit /b |
| 88 | +rem -- BUILD CARLA -- |
| 89 | +echo Configuring the CARLA CMake project... |
| 90 | +cmake ^ |
| 91 | + -G Ninja ^ |
| 92 | + -S . ^ |
| 93 | + -B Build ^ |
| 94 | + -DCMAKE_BUILD_TYPE=Release ^ |
| 95 | + -DCARLA_UNREAL_ENGINE_PATH=%CARLA_UNREAL_ENGINE_PATH% || exit /b |
| 96 | +echo Building CARLA... |
| 97 | +cmake --build Build || exit /b |
| 98 | +echo Installing Python API... |
| 99 | +cmake --build Build --target carla-python-api-install || exit /b |
| 100 | +echo CARLA Python API build+install succeeded. |
| 101 | + |
| 102 | +rem -- POST-BUILD STEPS -- |
| 103 | + |
| 104 | +if %LAUNCH%==true ( |
| 105 | + echo Launching Carla Unreal Editor... |
| 106 | + cmake --build Build --target launch || exit /b |
| 107 | +) |
0 commit comments