2020-03-02 21:35:50 +08:00
# Build system
2018-07-04 17:59:59 +08:00
2020-03-11 22:42:41 +08:00
* [__Setup__ ](#setup )
* [__LibCarla__ ](#libcarla )
* [__CarlaUE4 and Carla plugin__ ](#carlaue4-and-carla-plugin )
* [__PythonAPI__ ](#pythonapi )
2018-07-04 17:59:59 +08:00
> _This document is a work in progress, only the Linux build system is taken into account here._
2020-03-11 22:42:41 +08:00
The most challenging part of the setup is to compile all the dependencies and modules to be compatible with a) Unreal Engine in the server-side, and b) Python in the client-side.
2018-07-04 17:59:59 +08:00
2020-03-11 22:42:41 +08:00
The goal is to be able to call Unreal Engine's functions from a separate Python process.
2018-07-04 17:59:59 +08:00
2020-05-05 22:33:13 +08:00
![modules ](img/build_modules.jpg )
2018-07-04 17:59:59 +08:00
2020-03-23 22:19:22 +08:00
In Linux, we compile CARLA and all the dependencies with clang-8.0 and C++14 standard. We however link against different runtime C++ libraries depending on where the code going to be used, since all the code that is going to be linked with Unreal Engine needs to be compiled using `libc++` .
2018-07-04 17:59:59 +08:00
2020-03-11 22:42:41 +08:00
---
## Setup
2018-07-04 17:59:59 +08:00
Command
```sh
make setup
```
Get and compile dependencies
2020-03-23 22:19:22 +08:00
* llvm-8 (libc++ and libc++abi)
2018-07-04 17:59:59 +08:00
* rpclib-2.2.1 (twice, with libstdc++ and libc++)
2019-12-16 01:15:36 +08:00
* boost-1.72.0 (headers and boost_python for libstdc++)
2019-04-30 23:13:10 +08:00
* googletest-1.8.1 (with libc++)
2018-07-04 17:59:59 +08:00
2020-03-11 22:42:41 +08:00
---
## LibCarla
2018-07-04 17:59:59 +08:00
Compiled with CMake (minimum version required CMake 3.9).
Command
```sh
make LibCarla
```
Two configurations:
2020-03-11 22:42:41 +08:00
< table class = "defTable" >
< thead >
< th > < / th >
< th > Server< / th >
< th > Client< / th >
< / thead >
< tbody >
< td > < b > Unit tests< b > < / td >
< td > Yes < / td >
< td > No < / td >
< tr >
< td > < b > Requirements< / b > < / td >
< td > rpclib, gtest, boost < / td >
< td > rpclib, boost < / td >
< tr >
< td > < b > std runtime< / b > < / td >
< td > LLVM's < code > libc++< / code > < / td >
< td > Default < code > libstdc++< / code > < / td >
< tr >
< td > < b > Output< / b > < / td >
< td > headers and test exes < / td >
< td > < code > ibcarla_client.a< / code > < / td >
< tr >
< td > < b > Required by< / b > < / td >
< td > Carla plugin < / td >
< td > PythonAPI < / td >
< / tbody >
< / table >
2018-07-04 17:59:59 +08:00
2020-03-02 16:40:34 +08:00
< br >
2020-03-02 21:35:50 +08:00
2020-03-11 22:42:41 +08:00
---
## CarlaUE4 and Carla plugin
2018-07-04 17:59:59 +08:00
2020-03-11 22:42:41 +08:00
Both compiled at the same step with Unreal Engine build tool. They require the `UE4_ROOT` environment variable set.
2018-07-04 17:59:59 +08:00
Command
```sh
make CarlaUE4Editor
```
To launch Unreal Engine's Editor run
```sh
make launch
```
2020-03-11 22:42:41 +08:00
---
## PythonAPI
2018-07-04 17:59:59 +08:00
2020-03-11 22:42:41 +08:00
Compiled using Python's `setuptools` ("setup.py"). Currently requires the following to be installed in the machine: Python, libpython-dev, and
2018-07-04 17:59:59 +08:00
libboost-python-dev; both for Python 2.7 and 3.5.
Command
```sh
make PythonAPI
```
It creates two "egg" packages
2018-11-16 20:29:40 +08:00
* `PythonAPI/dist/carla-X.X.X-py2.7-linux-x86_64.egg`
2020-03-23 22:19:22 +08:00
* `PythonAPI/dist/carla-X.X.X-py3.7-linux-x86_64.egg`
2018-07-04 17:59:59 +08:00
2020-03-11 22:42:41 +08:00
This package can be directly imported into a Python script by adding it to the system path.
2018-07-04 17:59:59 +08:00
```python
#!/usr/bin/env python
import sys
sys.path.append(
2018-11-16 20:29:40 +08:00
'PythonAPI/dist/carla-X.X.X-py%d.%d-linux-x86_64.egg' % (sys.version_info.major,
2018-07-04 17:59:59 +08:00
sys.version_info.minor))
import carla
# ...
```
2020-03-11 22:42:41 +08:00
Alternatively, it can be installed with `easy_install`
2018-07-04 17:59:59 +08:00
```sh
2018-11-16 20:29:40 +08:00
easy_install2 --user --no-deps PythonAPI/dist/carla-X.X.X-py2.7-linux-x86_64.egg
2020-03-23 22:19:22 +08:00
easy_install3 --user --no-deps PythonAPI/dist/carla-X.X.X-py3.7-linux-x86_64.egg
2018-07-04 17:59:59 +08:00
```