Update Windows documentation

This commit is contained in:
iFuSiiOnzZ 2018-08-24 16:53:21 +02:00
parent 2616765530
commit 95c35f4cbd
1 changed files with 50 additions and 135 deletions

View File

@ -1,23 +1,19 @@
<h1>How to build CARLA on Windows</h1>
!!! important
Since version 0.9.0 the build system changed, the instructions in this
document are no longer valid. While we work on fixing this, we recommend
either compile Carla on Linux or switch to the `stable` branch. Sorry for
the inconvenience.
---
<h3>Necessary software</h3>
- [Git](https://git-scm.com/downloads)
- [Make](http://gnuwin32.sourceforge.net/downlinks/make-bin-zip.php)
- [Cmake](https://cmake.org/download/)
- [CMake](https://cmake.org/download/)
- [Python3 x64](https://www.python.org/downloads/)
!!! important
Be sure that these programs are added to your path, so you can use them from your command prompt.
Be sure that these programs are added to your environment path, so you can use them from your command prompt.
Also:
- [Unreal Engine](https://www.unrealengine.com/download) (v4.18.x)
- [Visual Studio](https://www.visualstudio.com/downloads/) (2017 preferably)
- [Unreal Engine](https://www.unrealengine.com/download) (v4.19.x)
- [Visual Studio](https://www.visualstudio.com/downloads/) (2017)
<h3>Environment Setup</h3>
In order to build CARLA you must **enable the x64 Visual C++ Toolset**.
@ -27,10 +23,6 @@ You have different options:
- **Recomended:** Use [`Visual Studio x64 Native Tools Command Prompt`](https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs). Just press the `Win` button and search for `x64` (be careful to not **unintentionally open a `x86_x64` prompt**), because the name of this Command Prompt can change depending on the lenguage you have Visual Studio installed.
- [Enable a 64-Bit Visual C++ Toolset on the Command Line](https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx) (the instructions will depend on the version of VS that you have).
!!! note
Take care if you have **Cygwin** installed. This could cause the errors like
`/usr/bin/sh: rd: command not found` While executing `Reuild.bat`.
<h3>Clone the repository</h3>
Go to the path you want to install CARLA and use git to download the project using the following command:
@ -44,146 +36,69 @@ and get in the created folder:
cd carla
```
# Automatic installation
Once you have downloaded the repo you can start with the automatic installation.
This process may take a while, it will download and install the necessary Boost and Protobuf libraries. Expect 20-40 minutes, depending on your hardware and internet connection.
<h3>Download Carla contents</h3>
Depending on the Carla version that you are unsing download one of the links and extract the content to `Unreal\CarlaUE4\Content\Carla`
Script | Use
------------- | ----
`Setup.bat` | Downloads and installs all the external dependencies, automatically calling the scripts in `Util/InstallersWin/`.
`Rebuild.bat` | Builds carlaserver and launch the Unreal project.
| Version | Download URL |
| --- | --- |
| 0.9.0 | https://drive.google.com/open?id=1FtC00CrDb7Kz5StBAwb6vqOGbzZtpROx |
<h3>Installation</h3>
1. After navigate to your carla folder, run:
# Build Carla
---
Setup.bat -j 8 --boost-toolset msvc-14.1
Once you have downloaded the repo and extract the Carla contents you can start with the automatic build. The process may take a while, it will download and install the necessary libraries (Boost, RPCLib and googletest). Expect 20-40 minutes, depending on your hardware and internet connection. If you get any error open a new issue on [GitHub](https://github.com/carla-simulator/carla/issues/) or just ask on the [Windows Discord channel](https://discord.gg/42KJdRj).
`-j n` will try to parallelize the git download and NMake compilation. If not specified, no optimization will be made.
<h3>Build commands</h3>
To see available commands, like which `--boost-toolset` you have to use depending on your Visual Studio version, use:
| Command | Description |
| --- | --- |
| `make launch`| Builds and launches Carla |
| `make launch-only` | Launches Carla Editor |
| `make package` | Builds CARLA and creates a packaged version for distribution. |
| `make docs` | Generate the source code documentation |
| `make clean` | Deletes all the binaries and temporals generated by the build system |
| `make rebuild` | Rebuilds Carla project, dependencies not build |
| `make CarlaUE4Editor` | Builds and launches Carla Editor |
| `make LibCarla` | Builds the client and the server of the Carla API |
| `make PythonAPI` | Generates the Python API for the client |
Setup.bat --help
If you build Carla for the first time or after you clean the project it will probably ask you to build the `UE4Editor-CarlaUE4.dll` and `UE4Editor-Carla.dll` also (as is needed for coocking the content for launch Carla), agree and the project will be opened in the Unreal Engine in a few minutes.
1. When it's done, and if everything went well, `Setup.bat` will provide a link where you can download the assets manually. If you get some errors you can try the **Manual Installation**, open a new issue on [GitHub](https://github.com/carla-simulator/carla/issues/) or just ask on the [Windows Discord channel](https://discord.gg/42KJdRj).
Example of building Carla 0.9.0 for first time:
```cmd
1) git clone https://github.com/carla-simulator/carla.git
1. Unzip these assets into `Unreal/CarlaUE4/Content`. Create it if the folder is not there.
2) Download https://drive.google.com/uc?id=1FtC00CrDb7Kz5StBAwb6vqOGbzZtpROx&export=download
3) Extract to Unreal/CarlaUE4/Content/Carla
1. Now let's compile carlaserver and start the Unreal project. Run:
Rebuild.bat
1. Later on it will ask you to rebuild:
UE4Editor-CarlaUE4.dll
UE4Editor-Carla.dll
Agree and the project will be opened in the Unreal Engine in a few minutes.
# Manual Installation
!!! note
Since version **0.8.3**, it is recomended to follow the automatic installation.
<h3>Download the assets</h3>
Download the assets from the version you need. Take a look at [`Util/ContentVersions.txt`](https://github.com/carla-simulator/carla/blob/master/Util/ContentVersions.txt) and follow the provided instructions to build the download link from the version's hash.
Create the folder `Content` in `Unreal/CarlaUE4/` and unzip the content you just downloaded here.
<h3>Dependencies</h3>
Download and build **for win64**:
- Boost 1.64
- Protobuf 3.3.2
<h3>Building Boost for CARLA</h3>
Follow the official documentation to compile boost.
Put the generated binaries in `Util/Build/boost-install`:
```c
Util
└── Build
└── boost-install
├── boost-1_64
| └── boost
| ├── accumulators
| ├── algorithm
| ├── align
| └── [...] // and all the other libraries
└── lib
├── libboost_date_time-vc141-mt-1_64.lib
└── libboost_system-vc141-mt-1_64.lib
4) make launch
```
<h3>Building Protobuf for CARLA</h3>
<h4>From our batch file</h4>
Just use [this batch](https://gist.github.com/marcgpuig/57946f9b684f64e5f08487089c437ea3) script, it will download and compile a ready-to-use version. Put it in`Util/Build` and just run it.
# Update Carla
---
<h4>Manually</h4>
If something goes wrong, just follow the protobuf [cmake tutorials](https://github.com/google/protobuf/blob/master/cmake/README.md), but add these cmake arguments:
```
-DCMAKE_BUILD_TYPE=Release
-Dprotobuf_BUILD_TESTS=OFF
-DCMAKE_CXX_FLAGS_RELEASE=/MD
-Dprotobuf_MSVC_STATIC_RUNTIME=OFF
```
Put the generated binaries in `Util/Build/protobuf-install`.
<h3>Compiling CARLA server</h3>
With your Visual Studio propmt, navigate into the `carla` folder where you cloned the repo with
Every new release of CARLA we release a new package with the latest changes in the CARLA assets. To download the latest version and recompile CARLA, run:
```cmd
cd carla
```
and use:
```cmd
path\to\carla> make
1) make clean # Deletes all the binaries and temporals generated by the build system
2) git pull # Download the las Carla modifications
3) Download the latest version of assets (if needed)
4) make launch # Build and launch Carla
```
If you have done everything alright, **carla server** must be installed successfully in `Unreal/CarlaUE4/Plugins/Carla/CarlaServer`.
# Possible build errors
---
<h3>Launch Unreal Engine</h3>
Double click `Unreal/CarlaUE4/CarlaUE4.uproject` and it will ask you to rebuild:
If you also have installed other version of Visual Studio or Microsoft Compiler and get any error during the build as C2440 or C2672 this is probably because is not using the 2017 compiler, so try first to uninstall the other ones and rebuild again.
UE4Editor-CarlaUE4.dll
UE4Editor-Carla.dll
Agree.
<h3>Compilation failures</h3>
If there are problems generating the dlls, right click on `CarlaUE4.uproject` and select `Generate Visual Studio project files`, so you can try compiling from the Visual Studio Editor and check the errors.
# Recompiling
<h4>Automatic</h4>
Just run `Rebuild.bat`:
If you would like to keep the other version of Visual Studio edit ```%appdata%\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml``` adding the following lines:
```
path\to\carla> Rebuild
```
<VCProjectFileGenerator>
<Version>VisualStudio2017</Version>
</VCProjectFileGenerator>
<h4>Manual</h4>
You must delete the following folders to **completely rebuild** your project:
```cmd
Unreal/CarlaUE4/Binaries
Unreal/CarlaUE4/Intermediate
Unreal/CarlaUE4/Plugins/Carla/Binaries
Unreal/CarlaUE4/Plugins/Carla/Intermediate
```
Then you can clean the project and compile it again:
```
path\to\carla> make clean & make
```
You can do it more automatically with your prompt in `carla` folder:
```
path\to\carla> rmdir /q /s Unreal/CarlaUE4/Binaries Unreal/CarlaUE4/Intermediate Unreal/CarlaUE4/Saved Unreal/CarlaUE4/Plugins/Carla/Binaries Unreal/CarlaUE4/Plugins/Carla/Intermediate
path\to\carla> make clean
path\to\carla> make
path\to\carla> Unreal/CarlaUE4/CarlaUE4.uproject
<WindowsPlatform>
<Compiler>VisualStudio2017</Compiler>
</WindowsPlatform>
```