Replace Linux build system
This commit is contained in:
parent
3cf91c54f2
commit
0b90c448bf
|
@ -1,31 +1,38 @@
|
|||
Build
|
||||
Dist
|
||||
Doxygen
|
||||
PythonClient/dist
|
||||
Util/Build
|
||||
Install
|
||||
|
||||
*.VC.db
|
||||
*.VC.opendb
|
||||
*.a
|
||||
*.egg-info
|
||||
*.kdev4
|
||||
*.log
|
||||
*.pb.cc
|
||||
*.pb.h
|
||||
*.o
|
||||
*.pid
|
||||
*.pri
|
||||
*.pro
|
||||
*.py[cod]
|
||||
*.sln
|
||||
*.so
|
||||
*.stackdump
|
||||
*.sublime-workspace
|
||||
*.workspace
|
||||
*CodeCompletionFolders.txt
|
||||
*CodeLitePreProcessor.txt
|
||||
.codelite
|
||||
.gdb_history
|
||||
.tags*
|
||||
.vs
|
||||
__pycache__
|
||||
_benchmarks_results
|
||||
_images*
|
||||
_out
|
||||
_out*
|
||||
_site
|
||||
core
|
||||
profiler.csv
|
||||
|
|
17
.travis.yml
17
.travis.yml
|
@ -17,14 +17,15 @@ script:
|
|||
matrix:
|
||||
include:
|
||||
|
||||
- env: TEST="CppCheck"
|
||||
install: true
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- cppcheck
|
||||
script:
|
||||
- cppcheck . -iBuild -i.pb.cc --error-exitcode=1 --enable=warning --inline-suppr --quiet
|
||||
# CppCheck does not support C++17.
|
||||
# - env: TEST="CppCheck"
|
||||
# install: true
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - cppcheck
|
||||
# script:
|
||||
# - cppcheck . -iBuild -i.pb.cc --error-exitcode=1 --enable=warning --inline-suppr --quiet
|
||||
|
||||
- env: TEST="MkDocs"
|
||||
install:
|
||||
|
|
|
@ -1,149 +0,0 @@
|
|||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": ".",
|
||||
"folder_exclude_patterns":
|
||||
[
|
||||
".clang",
|
||||
".codelite",
|
||||
".kdev4",
|
||||
".vs",
|
||||
".vscode",
|
||||
"Binaries",
|
||||
"Build",
|
||||
"DerivedDataCache",
|
||||
"Dist",
|
||||
"Doxygen",
|
||||
"Intermediate",
|
||||
"Saved",
|
||||
"Unreal/CarlaUE4/Content*",
|
||||
"__pycache__",
|
||||
"_site"
|
||||
],
|
||||
"file_exclude_patterns":
|
||||
[
|
||||
"*.VC.db",
|
||||
"*.VC.opendb",
|
||||
"*.kdev4",
|
||||
"*.pri",
|
||||
"*.pro",
|
||||
"*.py[cod]",
|
||||
"*.sln",
|
||||
"*.stackdump",
|
||||
"*.sublime-workspace",
|
||||
"*.uasset",
|
||||
"*.umap",
|
||||
"*.workspace",
|
||||
"*CodeCompletionFolders.txt",
|
||||
"*CodeLitePreProcessor.txt",
|
||||
".tags*",
|
||||
"core"
|
||||
]
|
||||
}
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"ensure_newline_at_eof_on_save": true,
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true,
|
||||
"trim_trailing_white_space_on_save": true
|
||||
},
|
||||
"build_systems":
|
||||
[
|
||||
{
|
||||
"name": "CARLA - Pylint",
|
||||
"working_dir": "${project_path}",
|
||||
"file_regex": "^\\[([^:]*):([0-9]+):?([0-9]+)?\\]:? (.*)$",
|
||||
"shell_cmd": "pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py --msg-template='[{path}:{line:3d}:{column}]: {msg_id} {msg}'"
|
||||
},
|
||||
{
|
||||
"name": "CARLA - CppCheck",
|
||||
"working_dir": "${project_path}",
|
||||
"file_regex": "^\\[([^:]*):([0-9]+):?([0-9]+)?\\]:? (.*)$",
|
||||
"shell_cmd": "cppcheck . -iBuild -i.pb.cc --error-exitcode=0 --enable=warning --quiet"
|
||||
},
|
||||
{
|
||||
"name": "CARLA - Rebuild script",
|
||||
"working_dir": "${project_path}",
|
||||
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "./Rebuild.sh"
|
||||
},
|
||||
"windows":
|
||||
{
|
||||
"shell_cmd": "start Rebuild.bat"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make CarlaUE4",
|
||||
"working_dir": "${project_path}/Unreal/CarlaUE4",
|
||||
"file_regex": "Unreal\\/CarlaUE4\\/([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "make CarlaUE4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make CarlaUE4 ARGS=-clean",
|
||||
"working_dir": "${project_path}/Unreal/CarlaUE4",
|
||||
"file_regex": "Unreal\\/CarlaUE4\\/([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "make CarlaUE4 ARGS=-clean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make CarlaUE4Editor",
|
||||
"working_dir": "${project_path}/Unreal/CarlaUE4",
|
||||
"file_regex": "Unreal\\/CarlaUE4\\/([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "make CarlaUE4Editor"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make CarlaUE4Editor ARGS=-clean",
|
||||
"working_dir": "${project_path}/Unreal/CarlaUE4",
|
||||
"file_regex": "Unreal\\/CarlaUE4\\/([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "make CarlaUE4Editor ARGS=-clean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make CarlaServer",
|
||||
"working_dir": "${project_path}",
|
||||
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "make"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - check CarlaServer",
|
||||
"working_dir": "${project_path}",
|
||||
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "make check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - clean CarlaServer",
|
||||
"working_dir": "${project_path}",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "make clean"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.9.0)
|
||||
project(CARLA)
|
||||
|
||||
include("Build/CMakeLists.txt.in")
|
||||
|
||||
add_subdirectory("LibCarla/cmake")
|
|
@ -0,0 +1,110 @@
|
|||
<h1>Build system</h1>
|
||||
|
||||
> _This document is a work in progress, only the Linux build system is taken into account here._
|
||||
|
||||
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.
|
||||
|
||||
The goal is to be able to call Unreal Engine's functions from a separate Python
|
||||
process.
|
||||
|
||||
![modules](img/modules.png)
|
||||
|
||||
In Linux, we compile CARLA and all the dependencies with clang-5.0 and C++17
|
||||
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++`.
|
||||
|
||||
#### Setup
|
||||
|
||||
Command
|
||||
|
||||
```sh
|
||||
make setup
|
||||
```
|
||||
|
||||
Get and compile dependencies
|
||||
|
||||
* llvm-5.0 (libc++ and libc++abi)
|
||||
* rpclib-2.2.1 (twice, with libstdc++ and libc++)
|
||||
* boost-1.67 (headers only)
|
||||
* googletest-1.8.0 (with libc++)
|
||||
|
||||
#### LibCarla
|
||||
|
||||
Compiled with CMake (minimum version required CMake 3.9).
|
||||
|
||||
Command
|
||||
|
||||
```sh
|
||||
make LibCarla
|
||||
```
|
||||
|
||||
Two configurations:
|
||||
|
||||
| | Server | Client |
|
||||
|-----------------|--------------|-----------|
|
||||
| **Unit tests** | yes | no |
|
||||
| **Requires** | rpclib, gtest, boost | rpclib, boost
|
||||
| **std runtime** | LLVM's `libc++` | Default `libstdc++` |
|
||||
| **Output** | headers and test exes | `libcarla_client.a` |
|
||||
| **Required by** | Carla plugin | PythonAPI |
|
||||
|
||||
#### CarlaUE4 and Carla plugin
|
||||
|
||||
Both compiled at the same step with Unreal Engine 4.19 build tool. They require
|
||||
the `UE4_ROOT` environment variable set.
|
||||
|
||||
Command
|
||||
|
||||
```sh
|
||||
make CarlaUE4Editor
|
||||
```
|
||||
|
||||
To launch Unreal Engine's Editor run
|
||||
|
||||
```sh
|
||||
make launch
|
||||
```
|
||||
|
||||
#### PythonAPI
|
||||
|
||||
Compiled using Python's `setuptools` ("setup.py"). Currently requires the
|
||||
following to be installed in the machine: Python, libpython-dev, and
|
||||
libboost-python-dev; both for Python 2.7 and 3.5.
|
||||
|
||||
Command
|
||||
|
||||
```sh
|
||||
make PythonAPI
|
||||
```
|
||||
|
||||
It creates two "egg" packages
|
||||
|
||||
* `PythonAPI/dist/carla-0.9.0-py2.7-linux-x86_64.egg`
|
||||
* `PythonAPI/dist/carla-0.9.0-py3.5-linux-x86_64.egg`
|
||||
|
||||
This package can be directly imported into a Python script by adding it to the
|
||||
system path
|
||||
|
||||
```python
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
sys.path.append(
|
||||
'PythonAPI/dist/carla-0.9.0-py%d.%d-linux-x86_64.egg' % (sys.version_info.major,
|
||||
sys.version_info.minor))
|
||||
|
||||
import carla
|
||||
|
||||
# ...
|
||||
```
|
||||
|
||||
or installed with `easy_install`
|
||||
|
||||
```sh
|
||||
easy_install2 --user --no-deps PythonAPI/dist/carla-0.9.0-py2.7-linux-x86_64.egg
|
||||
easy_install3 --user --no-deps PythonAPI/dist/carla-0.9.0-py3.5-linux-x86_64.egg
|
||||
```
|
|
@ -5,15 +5,23 @@
|
|||
|
||||
Install the build tools and dependencies
|
||||
|
||||
$ sudo apt-get install build-essential clang-3.9 git cmake ninja-build python3-requests python-dev tzdata sed curl wget unzip autoconf libtool
|
||||
```
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
sudo apt-get install build-essential clang-5.0 lld-5.0 g++-7 ninja-build python python-pip python3 python3-pip libboost-python-dev python-dev tzdata sed curl wget unzip autoconf libtool
|
||||
pip2 install --user setuptools nose2
|
||||
pip3 install --user setuptools nose2
|
||||
```
|
||||
|
||||
To avoid compatibility issues between Unreal Engine and the CARLA dependencies,
|
||||
the best configuration is to compile everything with the same compiler version
|
||||
and C++ runtime library. We use clang 3.9 and LLVM's libc++. You may need to
|
||||
change your default clang version to compile Unreal
|
||||
and C++ runtime library. We use clang 5.0 and LLVM's libc++. We recommend to
|
||||
change your default clang version to compile Unreal Engine and the CARLA
|
||||
dependencies
|
||||
|
||||
$ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-3.9/bin/clang++ 100
|
||||
$ sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-3.9/bin/clang 100
|
||||
```sh
|
||||
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-5.0/bin/clang++ 101
|
||||
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-5.0/bin/clang 101
|
||||
```
|
||||
|
||||
Build Unreal Engine
|
||||
-------------------
|
||||
|
@ -23,13 +31,15 @@ Build Unreal Engine
|
|||
need to add your GitHub username when you sign up at
|
||||
[www.unrealengine.com](https://www.unrealengine.com).
|
||||
|
||||
Download and compile Unreal Engine 4.18. Here we will assume you install it at
|
||||
"~/UnrealEngine_4.18", but you can install it anywhere, just replace the path
|
||||
Download and compile Unreal Engine 4.19. Here we will assume you install it at
|
||||
`~/UnrealEngine_4.19", but you can install it anywhere, just replace the path
|
||||
where necessary.
|
||||
|
||||
$ git clone --depth=1 -b 4.18 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.18
|
||||
$ cd ~/UnrealEngine_4.18
|
||||
$ ./Setup.sh && ./GenerateProjectFiles.sh && make
|
||||
```sh
|
||||
git clone --depth=1 -b 4.19 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.19
|
||||
cd ~/UnrealEngine_4.19
|
||||
./Setup.sh && ./GenerateProjectFiles.sh && make
|
||||
```
|
||||
|
||||
Check Unreal's documentation
|
||||
["Building On Linux"](https://wiki.unrealengine.com/Building_On_Linux) if any of
|
||||
|
@ -41,56 +51,47 @@ Build CARLA
|
|||
Clone or download the project from our
|
||||
[GitHub repository](https://github.com/carla-simulator/carla)
|
||||
|
||||
$ git clone https://github.com/carla-simulator/carla
|
||||
```sh
|
||||
git clone https://github.com/carla-simulator/carla
|
||||
```
|
||||
|
||||
Note that the `master` branch contains the latest fixes and features, for the
|
||||
latest stable code may be best to switch to the latest release tag.
|
||||
|
||||
Run the setup script to download the content and build all dependencies. It
|
||||
takes a while (you can speed up the process by parallelizing the script with the
|
||||
`--jobs=8` flag)
|
||||
Now you need to download the assets package, to do so we provide a handy script
|
||||
that downloads and extracts the latest version (note that the package is >10GB,
|
||||
this step might take some time depending on your connection)
|
||||
|
||||
$ ./Setup.sh
|
||||
```sh
|
||||
./Update.sh
|
||||
```
|
||||
|
||||
Once it's done it should print "Success" if everything went well.
|
||||
For CARLA to find your Unreal Engine's installation folder you need to set the
|
||||
following environment variable
|
||||
|
||||
To build CARLA, use the rebuild script. This script deletes all intermediate
|
||||
files, rebuilds whole CARLA, and launches the editor. Use it too for making a
|
||||
clean rebuild of CARLA
|
||||
```sh
|
||||
export UE4_ROOT=~/UnrealEngine_4.19
|
||||
```
|
||||
|
||||
$ UE4_ROOT=~/UnrealEngine_4.18 ./Rebuild.sh
|
||||
You can also add this variable to your `~/.bashrc` or `~/.profile`.
|
||||
|
||||
It looks at the environment variable `UE4_ROOT` to find the right version of
|
||||
Unreal Engine. You can also add this variable to your "~/.bashrc" or similar.
|
||||
Now that the environment is set up, you can run make to run different commands
|
||||
|
||||
Later, if you need to compile some changes without doing a full rebuild, you can
|
||||
use the Makefile generated in the Unreal project folder
|
||||
|
||||
$ cd Unreal/CarlaUE4
|
||||
$ make CarlaUE4Editor
|
||||
```sh
|
||||
make launch # Compiles CARLA and launches Unreal Engine's Editor.
|
||||
make package # Compiles CARLA and creates a packaged version for distribution.
|
||||
make help # Print all available commands.
|
||||
```
|
||||
|
||||
Updating CARLA
|
||||
--------------
|
||||
|
||||
Every new release of CARLA we release a new package with the latest changes in
|
||||
the CARLA assets. To download the latest version, run the "Update" script
|
||||
the CARLA assets. To download the latest version and recompile CARLA, run
|
||||
|
||||
$ git pull
|
||||
$ ./Update.sh
|
||||
|
||||
Launching the editor
|
||||
--------------------
|
||||
|
||||
To open the editor once the project is already built
|
||||
|
||||
$ cd Unreal/CarlaUE4
|
||||
$ ~/UnrealEngine_4.18/Engine/Binaries/Linux/UE4Editor "$PWD/CarlaUE4.uproject"
|
||||
|
||||
Test (Optional)
|
||||
---------------
|
||||
|
||||
A set of unit tests is available for testing the CarlaServer library (note that
|
||||
these tests launch the python client, they require python3 and protobuf for
|
||||
python3 installed, as well as ports 2000 and 4000 available)
|
||||
|
||||
$ make check
|
||||
```sh
|
||||
make clean
|
||||
git pull
|
||||
./Update.sh
|
||||
make launch
|
||||
```
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
|
@ -41,3 +41,4 @@
|
|||
* [How to add assets](how_to_add_assets.md)
|
||||
* [CARLA design](carla_design.md)
|
||||
* [CarlaServer documentation](carla_server.md)
|
||||
* [Build system](build_system.md)
|
||||
|
|
4
Doxyfile
4
Doxyfile
|
@ -11,7 +11,7 @@ CASE_SENSE_NAMES = YES
|
|||
SORT_BRIEF_DOCS = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_LOGFILE = Doxygen/warnings.log
|
||||
INPUT = Unreal/CarlaUE4/Source Unreal/CarlaUE4/Plugins/Carla/Source Util/CarlaServer/source
|
||||
INPUT = Unreal/CarlaUE4/Source Unreal/CarlaUE4/Plugins/Carla/Source LibCarla/source
|
||||
FILE_PATTERNS = *.cpp *.h *.hpp *.cc
|
||||
RECURSIVE = YES
|
||||
SOURCE_BROWSER = YES
|
||||
|
@ -26,7 +26,7 @@ FORMULA_FONTSIZE = 12
|
|||
GENERATE_LATEX = NO
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
INCLUDE_PATH = Unreal/CarlaUE4/Source Unreal/CarlaUE4/Plugins/Carla/Source Util/CarlaServer/source Util/CarlaServer/include
|
||||
INCLUDE_PATH = Unreal/CarlaUE4/Source Unreal/CarlaUE4/Plugins/Carla/Source LibCarla/source
|
||||
INCLUDE_FILE_PATTERNS = *.h *.hpp
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
|
|
104
Makefile
104
Makefile
|
@ -1,104 +1,6 @@
|
|||
INSTALL_FOLDER=$(CURDIR)/Unreal/CarlaUE4/Plugins/Carla/CarlaServer
|
||||
PYTHON_CLIENT_FOLDER=$(CURDIR)/PythonClient/test
|
||||
BASE_BUILD_FOLDER=$(CURDIR)/Util/Build/carlaserver-build
|
||||
MY_CMAKE_FOLDER=$(CURDIR)/Util/cmake
|
||||
MY_CMAKE_FLAGS=-B"$(BUILD_FOLDER)" -DCMAKE_INSTALL_PREFIX="$(INSTALL_FOLDER)"
|
||||
|
||||
include Util/BuildTools/Vars.mk
|
||||
ifeq ($(OS),Windows_NT)
|
||||
BUILD_RULE=build_windows
|
||||
CLEAN_RULE=clean_windows
|
||||
CALL_CMAKE_RULE=call_cmake_windows
|
||||
PROTOC_COMPILE=cmd.exe /k "cd Util & call Protoc.bat & exit"
|
||||
PROTOC_CLEAN=cmd.exe /k "cd Util & call Protoc.bat --clean & exit"
|
||||
include Util/BuildTools/Windows.mk
|
||||
else
|
||||
BUILD_RULE=build_linux
|
||||
CLEAN_RULE=clean_linux
|
||||
CALL_CMAKE_RULE=call_cmake_linux
|
||||
PROTOC_COMPILE=./Util/Protoc.sh
|
||||
PROTOC_CLEAN=./Util/Protoc.sh --clean
|
||||
include Util/BuildTools/Linux.mk
|
||||
endif
|
||||
|
||||
default: release
|
||||
|
||||
### Build ######################################################################
|
||||
|
||||
debug: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/debug
|
||||
debug: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Debug
|
||||
debug: $(BUILD_RULE)
|
||||
|
||||
release: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/release
|
||||
release: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Release
|
||||
release: $(BUILD_RULE)
|
||||
|
||||
vsproject: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/visualstudio
|
||||
vsproject: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Release
|
||||
vsproject: MY_CMAKE_FLAGS+=-G "Visual Studio 14 2015 Win64"
|
||||
vsproject: call_cmake
|
||||
|
||||
vsproject15: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/visualstudio
|
||||
vsproject15: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Release
|
||||
vsproject15: MY_CMAKE_FLAGS+=-G "Visual Studio 15 2017 Win64"
|
||||
vsproject15: call_cmake
|
||||
|
||||
build_linux: MY_CMAKE_FLAGS+=-G "Ninja"
|
||||
build_linux: call_cmake
|
||||
@cd $(BUILD_FOLDER) && ninja && ninja install
|
||||
|
||||
build_windows: MY_CMAKE_FLAGS+=-G "NMake Makefiles"
|
||||
build_windows: call_cmake
|
||||
@cd $(BUILD_FOLDER) && nmake && nmake install
|
||||
|
||||
call_cmake: protobuf $(CALL_CMAKE_RULE)
|
||||
@cd $(BUILD_FOLDER) && cmake $(MY_CMAKE_FLAGS) "$(MY_CMAKE_FOLDER)"
|
||||
|
||||
protobuf:
|
||||
@$(PROTOC_COMPILE)
|
||||
|
||||
call_cmake_linux:
|
||||
@mkdir -p $(BUILD_FOLDER)
|
||||
|
||||
call_cmake_windows:
|
||||
-@mkdir "$(BUILD_FOLDER)"
|
||||
|
||||
### Docs #######################################################################
|
||||
|
||||
docs: doxygen
|
||||
|
||||
doxygen:
|
||||
@doxygen
|
||||
@echo "Documentation index at ./Doxygen/html/index.html"
|
||||
|
||||
### Clean ######################################################################
|
||||
|
||||
clean: $(CLEAN_RULE)
|
||||
@$(PROTOC_CLEAN)
|
||||
|
||||
clean_linux:
|
||||
@rm -Rf $(BASE_BUILD_FOLDER) $(INSTALL_FOLDER) Doxygen
|
||||
|
||||
clean_windows:
|
||||
-@rd /s /q "$(BASE_BUILD_FOLDER)" "$(INSTALL_FOLDER)" Doxygen
|
||||
|
||||
### Test #######################################################################
|
||||
|
||||
check: debug launch_test_clients run_test_debug kill_test_clients
|
||||
|
||||
check_release: release launch_test_clients run_test_release kill_test_clients
|
||||
|
||||
run_test_debug:
|
||||
@-LD_LIBRARY_PATH=$(INSTALL_FOLDER)/shared $(INSTALL_FOLDER)/bin/test_carlaserverd --gtest_shuffle $(GTEST_ARGS)
|
||||
|
||||
run_test_release:
|
||||
@-LD_LIBRARY_PATH=$(INSTALL_FOLDER)/shared $(INSTALL_FOLDER)/bin/test_carlaserver --gtest_shuffle $(GTEST_ARGS)
|
||||
|
||||
launch_test_clients:
|
||||
@echo "Launch echo client"
|
||||
@python3 $(PYTHON_CLIENT_FOLDER)/test_client.py --echo -v -p 4000 --log echo_client.log & echo $$! > echo_client.pid
|
||||
@echo "Launch carla client"
|
||||
@python3 $(PYTHON_CLIENT_FOLDER)/test_client.py -v -p 2000 --log carla_client.log & echo $$! > carla_client.pid
|
||||
|
||||
kill_test_clients:
|
||||
@echo "Kill echo client"
|
||||
@kill `cat echo_client.pid` && rm echo_client.pid
|
||||
@echo "Kill carla client"
|
||||
@kill `cat carla_client.pid` && rm carla_client.pid
|
||||
|
|
121
Rebuild.sh
121
Rebuild.sh
|
@ -1,121 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# Updates CARLA content.
|
||||
################################################################################
|
||||
|
||||
set -e
|
||||
|
||||
DOC_STRING="Update CARLA content to the latest version, to be run after 'git pull'."
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [--no-editor]"
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
LAUNCH_UE4_EDITOR=true
|
||||
|
||||
OPTS=`getopt -o h --long help,no-editor -n 'parse-options' -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--no-editor )
|
||||
LAUNCH_UE4_EDITOR=false;
|
||||
shift ;;
|
||||
-h | --help )
|
||||
echo "$DOC_STRING"
|
||||
echo "$USAGE_STRING"
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ==============================================================================
|
||||
# -- Set up environment --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
pushd "$SCRIPT_DIR" >/dev/null
|
||||
|
||||
UNREAL_PROJECT_FOLDER=./Unreal/CarlaUE4
|
||||
UE4_INTERMEDIATE_FOLDERS="Binaries Build Intermediate DerivedDataCache"
|
||||
|
||||
function fatal_error {
|
||||
echo -e "\033[0;31mERROR: $1\033[0m"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function log {
|
||||
echo -e "\033[0;33m$1\033[0m"
|
||||
}
|
||||
|
||||
if [ ! -d "${UE4_ROOT}" ]; then
|
||||
fatal_error "UE4_ROOT is not defined, or points to a non-existant directory, please set this environment variable."
|
||||
else
|
||||
echo "Using Unreal Engine at '$UE4_ROOT'"
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Make CarlaServer ----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
log "Making CarlaServer..."
|
||||
make clean && make debug && make release
|
||||
|
||||
# ==============================================================================
|
||||
# -- Clean up intermediate Unreal files ----------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
pushd "$UNREAL_PROJECT_FOLDER" >/dev/null
|
||||
|
||||
pushd "Plugins/Carla" >/dev/null
|
||||
|
||||
log "Cleaning up CARLA Plugin..."
|
||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
log "Cleaning up CARLAUE4..."
|
||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Build and launch Unreal project -------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
pushd "$UNREAL_PROJECT_FOLDER" >/dev/null
|
||||
|
||||
# This command usually fails but normally we can continue anyway.
|
||||
set +e
|
||||
log "Generate Unreal project files..."
|
||||
${UE4_ROOT}/GenerateProjectFiles.sh -project="${PWD}/CarlaUE4.uproject" -game -engine -makefiles
|
||||
set -e
|
||||
|
||||
log "Build CarlaUE4 project..."
|
||||
make CarlaUE4Editor
|
||||
|
||||
if $LAUNCH_UE4_EDITOR ; then
|
||||
log "Launching UE4Editor..."
|
||||
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject"
|
||||
else
|
||||
echo ""
|
||||
echo "****************"
|
||||
echo "*** Success! ***"
|
||||
echo "****************"
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
227
Setup.sh
227
Setup.sh
|
@ -1,227 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
################################################################################
|
||||
# CARLA Setup.sh
|
||||
#
|
||||
# This script sets up the environment and dependencies for compiling CARLA on
|
||||
# Linux.
|
||||
#
|
||||
# 1) Download CARLA Content if necessary.
|
||||
# 2) Download and compile libc++.
|
||||
# 3) Download other third-party libraries and compile them with libc++.
|
||||
#
|
||||
# Thanks to the people at https://github.com/Microsoft/AirSim for providing the
|
||||
# important parts of this script.
|
||||
################################################################################
|
||||
|
||||
set -e
|
||||
|
||||
DOC_STRING="Download and compile CARLA content and dependencies."
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [-s|--skip-download] [--jobs=N]"
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
UPDATE_SCRIPT_FLAGS=
|
||||
NUMBER_OF_ASYNC_JOBS=1
|
||||
|
||||
OPTS=`getopt -o hs --long help,skip-download,jobs:: -n 'parse-options' -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-s | --skip-download )
|
||||
UPDATE_SCRIPT_FLAGS=--skip-download;
|
||||
shift ;;
|
||||
--jobs)
|
||||
case "$2" in
|
||||
"") NUMBER_OF_ASYNC_JOBS=4 ; shift 2 ;;
|
||||
*) NUMBER_OF_ASYNC_JOBS=$2 ; shift 2 ;;
|
||||
esac ;;
|
||||
-h | --help )
|
||||
echo "$DOC_STRING"
|
||||
echo "$USAGE_STRING"
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ==============================================================================
|
||||
# -- Set up environment --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
pushd "$SCRIPT_DIR" >/dev/null
|
||||
|
||||
# Require clang 3.9
|
||||
command -v clang++-3.9 >/dev/null 2>&1 || {
|
||||
echo >&2 "clang 3.9 is required, but it's not installed.";
|
||||
echo >&2 "make sure you build Unreal Engine with clang 3.9 too.";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
mkdir -p Util/Build
|
||||
pushd Util/Build >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get and compile libc++ ----------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
# Get libc++ source
|
||||
if [[ ! -d "llvm-source" ]]; then
|
||||
echo "Retrieving libc++..."
|
||||
git clone --depth=1 -b release_39 https://github.com/llvm-mirror/llvm.git llvm-source
|
||||
git clone --depth=1 -b release_39 https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx
|
||||
git clone --depth=1 -b release_39 https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi
|
||||
else
|
||||
echo "Folder llvm-source already exists, skipping git clone..."
|
||||
fi
|
||||
|
||||
# Build libc++
|
||||
rm -rf llvm-build
|
||||
mkdir -p llvm-build
|
||||
|
||||
pushd llvm-build >/dev/null
|
||||
|
||||
export C_COMPILER=clang-3.9
|
||||
export COMPILER=clang++-3.9
|
||||
|
||||
cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
|
||||
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=OFF \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="../llvm-install" \
|
||||
../llvm-source
|
||||
|
||||
make -j $NUMBER_OF_ASYNC_JOBS cxx
|
||||
|
||||
#install libc++ locally in llvm-install folder
|
||||
make -j $NUMBER_OF_ASYNC_JOBS install-libcxx install-libcxxabi
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get Boost and compile it with libc++ --------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
# Get boost source
|
||||
if [[ ! -d "boost-source" ]]; then
|
||||
echo "Retrieving boost..."
|
||||
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
|
||||
tar -xvzf boost_1_64_0.tar.gz
|
||||
rm boost_1_64_0.tar.gz
|
||||
mv boost_1_64_0 boost-source
|
||||
else
|
||||
echo "Folder boost-source already exists, skipping download..."
|
||||
fi
|
||||
|
||||
pushd boost-source >/dev/null
|
||||
|
||||
BOOST_TOOLSET="clang-3.9"
|
||||
BOOST_CFLAGS="-fPIC -std=c++1y -stdlib=libc++ -I../llvm-install/include/c++/v1"
|
||||
BOOST_LFLAGS="-stdlib=libc++ -L../llvm-install/lib"
|
||||
|
||||
./bootstrap.sh \
|
||||
--with-toolset=clang \
|
||||
--prefix=../boost-install \
|
||||
--with-libraries=system
|
||||
./b2 clean
|
||||
./b2 toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" linkflags="${BOOST_LFLAGS}" --prefix="../boost-install" -j $NUMBER_OF_ASYNC_JOBS stage release
|
||||
./b2 install toolset="${BOOST_TOOLSET}" cxxflags="${BOOST_CFLAGS}" linkflags="${BOOST_LFLAGS}" --prefix="../boost-install" -j $NUMBER_OF_ASYNC_JOBS
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get Protobuf and compile it with libc++ -----------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
# Get protobuf source
|
||||
if [[ ! -d "protobuf-source" ]]; then
|
||||
echo "Retrieving protobuf..."
|
||||
git clone --depth=1 -b v3.3.0 --recurse-submodules https://github.com/google/protobuf.git protobuf-source
|
||||
else
|
||||
echo "Folder protobuf-source already exists, skipping git clone..."
|
||||
fi
|
||||
|
||||
pushd protobuf-source >/dev/null
|
||||
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/../llvm-install/lib/"
|
||||
|
||||
./autogen.sh
|
||||
./configure \
|
||||
CC="clang-3.9" \
|
||||
CXX="clang++-3.9" \
|
||||
CXXFLAGS="-fPIC -stdlib=libc++ -I$PWD/../llvm-install/include/c++/v1" \
|
||||
LDFLAGS="-stdlib=libc++ -L$PWD/../llvm-install/lib/" \
|
||||
--prefix="$PWD/../protobuf-install" \
|
||||
--disable-shared
|
||||
make -j $NUMBER_OF_ASYNC_JOBS
|
||||
make -j $NUMBER_OF_ASYNC_JOBS install
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get GTest and compile it with libc++ --------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
# Get googletest source
|
||||
if [[ ! -d "googletest-source" ]]; then
|
||||
echo "Retrieving googletest..."
|
||||
git clone --depth=1 -b release-1.8.0 https://github.com/google/googletest.git googletest-source
|
||||
else
|
||||
echo "Folder googletest-source already exists, skipping git clone..."
|
||||
fi
|
||||
|
||||
pushd googletest-source >/dev/null
|
||||
|
||||
cmake -H. -B./build \
|
||||
-DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \
|
||||
-DCMAKE_CXX_FLAGS="-stdlib=libc++ -I$PWD/../llvm-install/include/c++/v1 -Wl,-L$PWD/../llvm-install/lib" \
|
||||
-DCMAKE_INSTALL_PREFIX="../googletest-install" \
|
||||
-G "Ninja"
|
||||
|
||||
pushd build >/dev/null
|
||||
ninja
|
||||
ninja install
|
||||
popd >/dev/null
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Other CARLA files ---------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
CARLA_SETTINGS_FILE="./Unreal/CarlaUE4/Config/CarlaSettings.ini"
|
||||
|
||||
if [[ ! -f $CARLA_SETTINGS_FILE ]]; then
|
||||
echo "Copying CarlaSettings.ini..."
|
||||
sed -e 's/UseNetworking=true/UseNetworking=false/' ./Docs/Example.CarlaSettings.ini > $CARLA_SETTINGS_FILE
|
||||
fi
|
||||
|
||||
./Util/Protoc.sh
|
||||
|
||||
# ==============================================================================
|
||||
# -- Update CARLA Content ------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
echo
|
||||
./Update.sh $UPDATE_SCRIPT_FLAGS
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
set +x
|
||||
echo ""
|
||||
echo "****************"
|
||||
echo "*** Success! ***"
|
||||
echo "****************"
|
|
@ -7,6 +7,7 @@ Saved
|
|||
Plugins/Carla/Binaries
|
||||
Plugins/Carla/Build
|
||||
Plugins/Carla/CarlaServer
|
||||
Plugins/Carla/CarlaDependencies
|
||||
Plugins/Carla/Debug
|
||||
Plugins/Carla/DerivedDataCache
|
||||
Plugins/Carla/Intermediate
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"FileVersion": 3,
|
||||
"EngineAssociation": "4.18",
|
||||
"EngineAssociation": "4.19",
|
||||
"Category": "",
|
||||
"Description": "",
|
||||
"Modules": [
|
||||
|
|
|
@ -3,7 +3,7 @@ ProjectID=675BF8694238308FA9368292CC440350
|
|||
ProjectName=CARLA UE4
|
||||
CompanyName=CVC
|
||||
CopyrightNotice="Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB). This work is licensed under the terms of the MIT license. For a copy, see <https://opensource.org/licenses/MIT>."
|
||||
ProjectVersion=0.8.4
|
||||
ProjectVersion=0.9.0
|
||||
|
||||
[/Script/UnrealEd.ProjectPackagingSettings]
|
||||
BuildConfiguration=PPBC_Development
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"FileVersion": 3,
|
||||
"Version": 1,
|
||||
"VersionName": "0.8.4",
|
||||
"VersionName": "0.9.0",
|
||||
"FriendlyName": "CARLA",
|
||||
"Description": "Open-source simulator for autonomous driving research.",
|
||||
"Category": "Science",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnrealBuildTool;
|
||||
|
||||
|
@ -78,17 +79,7 @@ public class Carla : ModuleRules
|
|||
|
||||
private void AddCarlaServerDependency(ReadOnlyTargetRules Target)
|
||||
{
|
||||
string CarlaServerInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaServer"));
|
||||
|
||||
string CarlaServerLib;
|
||||
if (UseDebugLibs(Target))
|
||||
{
|
||||
CarlaServerLib = "carlaserverd";
|
||||
}
|
||||
else
|
||||
{
|
||||
CarlaServerLib = "carlaserver";
|
||||
}
|
||||
string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies"));
|
||||
|
||||
ADelegate GetLibName = (string BaseName) => {
|
||||
if (IsWindows(Target))
|
||||
|
@ -104,23 +95,17 @@ public class Carla : ModuleRules
|
|||
// Link dependencies.
|
||||
if (IsWindows(Target))
|
||||
{
|
||||
// Auto-links boost libraries in folder.
|
||||
PublicLibraryPaths.Add(Path.Combine(CarlaServerInstallPath, "lib"));
|
||||
|
||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("libprotobuf")));
|
||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName(CarlaServerLib)));
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
else
|
||||
{
|
||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("c++abi")));
|
||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("boost_system")));
|
||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName("protobuf")));
|
||||
PublicAdditionalLibraries.Add(Path.Combine(CarlaServerInstallPath, "lib", GetLibName(CarlaServerLib)));
|
||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("c++abi")));
|
||||
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
|
||||
}
|
||||
|
||||
// Include path.
|
||||
string CarlaServerIncludePath = Path.Combine(CarlaServerInstallPath, "include");
|
||||
PublicIncludePaths.Add(CarlaServerIncludePath);
|
||||
PrivateIncludePaths.Add(CarlaServerIncludePath);
|
||||
string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
|
||||
PublicIncludePaths.Add(LibCarlaIncludePath);
|
||||
PrivateIncludePaths.Add(LibCarlaIncludePath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
#include "Carla.h"
|
||||
#include "CarlaEncoder.h"
|
||||
|
||||
|
@ -221,3 +223,5 @@ void FCarlaEncoder::Visit(const UWalkerAgentComponent &Agent)
|
|||
::Encode(Agent.GetBoundingBoxTransform(), Data.bounding_box.transform);
|
||||
::Encode(Agent.GetBoundingBoxExtent() * TO_METERS, Data.bounding_box.extent);
|
||||
}
|
||||
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
#include "Agent/AgentComponentVisitor.h"
|
||||
|
||||
#include "Sensor/SensorDataView.h"
|
||||
|
@ -74,3 +76,5 @@ private:
|
|||
|
||||
carla_agent &Data;
|
||||
};
|
||||
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
|
|
@ -9,12 +9,15 @@
|
|||
|
||||
#include "Server/CarlaEncoder.h"
|
||||
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
# include <carla/carla_server.h>
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
// =============================================================================
|
||||
// -- Static local methods -----------------------------------------------------
|
||||
// =============================================================================
|
||||
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
static FCarlaServer::ErrorCode ParseErrorCode(const uint32 ErrorCode)
|
||||
{
|
||||
if (ErrorCode == CARLA_SERVER_SUCCESS) {
|
||||
|
@ -25,6 +28,7 @@ static FCarlaServer::ErrorCode ParseErrorCode(const uint32 ErrorCode)
|
|||
return FCarlaServer::Error;
|
||||
}
|
||||
}
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
static int32 GetTimeOut(uint32 TimeOut, const bool bBlocking)
|
||||
{
|
||||
|
@ -38,7 +42,12 @@ static int32 GetTimeOut(uint32 TimeOut, const bool bBlocking)
|
|||
FCarlaServer::FCarlaServer(const uint32 InWorldPort, const uint32 InTimeOut) :
|
||||
WorldPort(InWorldPort),
|
||||
TimeOut(InTimeOut),
|
||||
Server(carla_make_server()) {
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
Server(carla_make_server())
|
||||
#else
|
||||
Server(nullptr)
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
{
|
||||
check(Server != nullptr);
|
||||
}
|
||||
|
||||
|
@ -47,17 +56,26 @@ FCarlaServer::~FCarlaServer()
|
|||
#ifdef CARLA_SERVER_EXTRA_LOG
|
||||
UE_LOG(LogCarlaServer, Warning, TEXT("Destroying CarlaServer"));
|
||||
#endif // CARLA_SERVER_EXTRA_LOG
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
carla_free_server(Server);
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::Connect()
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
UE_LOG(LogCarlaServer, Log, TEXT("Waiting for the client to connect..."));
|
||||
return ParseErrorCode(carla_server_connect(Server, WorldPort, TimeOut));
|
||||
#else
|
||||
UE_LOG(LogCarlaServer, Error, TEXT("CarlaServer no longer supported!!"));
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::ReadNewEpisode(FString &IniFile, const bool bBlocking)
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
carla_request_new_episode values;
|
||||
auto ec = ParseErrorCode(carla_read_request_new_episode(Server, values, GetTimeOut(TimeOut, bBlocking)));
|
||||
if (Success == ec) {
|
||||
|
@ -68,6 +86,10 @@ FCarlaServer::ErrorCode FCarlaServer::ReadNewEpisode(FString &IniFile, const boo
|
|||
#endif // CARLA_SERVER_EXTRA_LOG
|
||||
}
|
||||
return ec;
|
||||
|
||||
#else
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::SendSceneDescription(
|
||||
|
@ -76,6 +98,8 @@ FCarlaServer::ErrorCode FCarlaServer::SendSceneDescription(
|
|||
const TArray<USensorDescription *> &SensorDescriptions,
|
||||
const bool bBlocking)
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
carla_scene_description scene;
|
||||
// Encode map name.
|
||||
const auto MapNameBuffer = FCarlaEncoder::Encode(MapName);
|
||||
|
@ -95,10 +119,16 @@ FCarlaServer::ErrorCode FCarlaServer::SendSceneDescription(
|
|||
UE_LOG(LogCarlaServer, Log, TEXT("Sending %d available start positions"), scene.number_of_player_start_spots);
|
||||
UE_LOG(LogCarlaServer, Log, TEXT("Sending %d sensor descriptions"), scene.number_of_sensors);
|
||||
return ParseErrorCode(carla_write_scene_description(Server, scene, GetTimeOut(TimeOut, bBlocking)));
|
||||
|
||||
#else
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::ReadEpisodeStart(uint32 &StartPositionIndex, const bool bBlocking)
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
carla_episode_start values;
|
||||
auto ec = ParseErrorCode(carla_read_episode_start(Server, values, GetTimeOut(TimeOut, bBlocking)));
|
||||
if (Success == ec) {
|
||||
|
@ -106,17 +136,29 @@ FCarlaServer::ErrorCode FCarlaServer::ReadEpisodeStart(uint32 &StartPositionInde
|
|||
UE_LOG(LogCarlaServer, Log, TEXT("Episode start received: { StartIndex = %d }"), StartPositionIndex);
|
||||
}
|
||||
return ec;
|
||||
|
||||
#else
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::SendEpisodeReady(const bool bBlocking)
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
UE_LOG(LogCarlaServer, Log, TEXT("Ready to play, notifying client"));
|
||||
const carla_episode_ready values = {true};
|
||||
return ParseErrorCode(carla_write_episode_ready(Server, values, GetTimeOut(TimeOut, bBlocking)));
|
||||
|
||||
#else
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::ReadControl(FVehicleControl &Control, const bool bBlocking)
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
carla_control values;
|
||||
auto ec = ParseErrorCode(carla_read_control(Server, values, GetTimeOut(TimeOut, bBlocking)));
|
||||
if (Success == ec) {
|
||||
|
@ -137,13 +179,23 @@ FCarlaServer::ErrorCode FCarlaServer::ReadControl(FVehicleControl &Control, cons
|
|||
UE_LOG(LogCarlaServer, Warning, TEXT("No control received from the client this frame!"));
|
||||
}
|
||||
return ec;
|
||||
|
||||
#else
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::SendSensorData(const FSensorDataView &Data)
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
carla_sensor_data values;
|
||||
FCarlaEncoder::Encode(Data, values);
|
||||
return ParseErrorCode(carla_write_sensor_data(Server, values));
|
||||
|
||||
#else
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
||||
FCarlaServer::ErrorCode FCarlaServer::SendMeasurements(
|
||||
|
@ -151,6 +203,8 @@ FCarlaServer::ErrorCode FCarlaServer::SendMeasurements(
|
|||
const TArray<const UAgentComponent *> &Agents,
|
||||
const bool bSendNonPlayerAgentsInfo)
|
||||
{
|
||||
#ifdef CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
|
||||
// Encode measurements.
|
||||
carla_measurements values;
|
||||
FCarlaEncoder::Encode(PlayerState, values);
|
||||
|
@ -166,4 +220,8 @@ FCarlaServer::ErrorCode FCarlaServer::SendMeasurements(
|
|||
UE_LOG(LogCarlaServer, Log, TEXT("Sending data of %d agents"), values.number_of_non_player_agents);
|
||||
#endif // CARLA_SERVER_EXTRA_LOG
|
||||
return ParseErrorCode(carla_write_measurements(Server, values));
|
||||
|
||||
#else
|
||||
return ErrorCode::Error;
|
||||
#endif // CARLA_COMPILE_CARLASERVER_LEGACY
|
||||
}
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#include "Carla.h"
|
||||
#include "Server.h"
|
||||
|
||||
#include <compiler/disable-ue4-macros.h>
|
||||
#include <carla/Version.h>
|
||||
#include <carla/rpc/Actor.h>
|
||||
#include <carla/rpc/ActorBlueprint.h>
|
||||
#include <carla/rpc/Server.h>
|
||||
#include <carla/rpc/Transform.h>
|
||||
#include <carla/rpc/VehicleControl.h>
|
||||
#include <compiler/enable-ue4-macros.h>
|
||||
|
||||
static FVehicleControl MakeControl(const carla::rpc::VehicleControl &cControl)
|
||||
{
|
||||
FVehicleControl Control;
|
||||
Control.Throttle = cControl.throttle;
|
||||
Control.Steer = cControl.steer;
|
||||
Control.Brake = cControl.brake;
|
||||
Control.bHandBrake = cControl.hand_brake;
|
||||
Control.bReverse = cControl.reverse;
|
||||
return Control;
|
||||
}
|
||||
|
||||
class FRPCServer::Pimpl
|
||||
{
|
||||
public:
|
||||
Pimpl(uint16_t port) : Server(port) {}
|
||||
carla::rpc::Server Server;
|
||||
};
|
||||
|
||||
FRPCServer::FRPCServer() : _Pimpl(nullptr) {}
|
||||
|
||||
FRPCServer::~FRPCServer() {}
|
||||
|
||||
void FRPCServer::Initialize(AServer &Server, uint16_t Port)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("Initializing rpc-server at port %d"), Port);
|
||||
|
||||
_Pimpl = std::make_unique<Pimpl>(Port);
|
||||
|
||||
namespace cr = carla::rpc;
|
||||
|
||||
auto &srv = _Pimpl->Server;
|
||||
|
||||
srv.BindAsync("ping", []() { return true; });
|
||||
|
||||
srv.BindAsync("version", []() { return std::string(carla::version()); });
|
||||
|
||||
srv.BindAsync("get_blueprints", []() {
|
||||
return std::vector<cr::ActorBlueprint>{
|
||||
cr::ActorBlueprint{"vehicle.mustang.red"},
|
||||
cr::ActorBlueprint{"vehicle.mustang.also_red"},
|
||||
cr::ActorBlueprint{"vehicle.mustang.still_red"}
|
||||
};
|
||||
});
|
||||
|
||||
srv.BindSync("spawn_actor", [&](
|
||||
const cr::ActorBlueprint &blueprint,
|
||||
const cr::Transform &transform) {
|
||||
auto id = Server.SpawnAgent(transform);
|
||||
return cr::Actor{static_cast<cr::Actor::id_type>(id), blueprint};
|
||||
});
|
||||
|
||||
srv.BindSync("apply_control_to_actor", [&](
|
||||
const cr::Actor &actor,
|
||||
const cr::VehicleControl &control) {
|
||||
Server.ApplyControl(actor.id, MakeControl(control));
|
||||
});
|
||||
}
|
||||
|
||||
void FRPCServer::Run()
|
||||
{
|
||||
_Pimpl->Server.AsyncRun(4);
|
||||
}
|
||||
|
||||
void FRPCServer::RunSome()
|
||||
{
|
||||
using namespace std::chrono_literals;
|
||||
_Pimpl->Server.SyncRunFor(20ms);
|
||||
}
|
||||
|
||||
void FRPCServer::Stop()
|
||||
{
|
||||
_Pimpl->Server.Stop();
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class AServer;
|
||||
|
||||
class FRPCServer
|
||||
{
|
||||
public:
|
||||
|
||||
FRPCServer();
|
||||
|
||||
~FRPCServer();
|
||||
|
||||
void Initialize(AServer &Server, uint16_t Port = 8080u);
|
||||
|
||||
void Run();
|
||||
|
||||
void RunSome();
|
||||
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
|
||||
class Pimpl;
|
||||
std::unique_ptr<Pimpl> _Pimpl;
|
||||
};
|
|
@ -0,0 +1,72 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#include "Carla.h"
|
||||
#include "Server.h"
|
||||
|
||||
|
||||
// Sets default values
|
||||
AServer::AServer()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AServer::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
_Server.Initialize(*this);
|
||||
_Server.Run();
|
||||
}
|
||||
|
||||
void AServer::EndPlay(EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
_Server.Stop();
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AServer::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
_Server.RunSome();
|
||||
}
|
||||
|
||||
int32 AServer::SpawnAgent(const FTransform &Transform)
|
||||
{
|
||||
check(IsInGameThread());
|
||||
UE_LOG(LogTemp, Warning, TEXT("Spawning vehicle at %s"), *Transform.ToString());
|
||||
|
||||
static int32 COUNT = 0u;
|
||||
++COUNT;
|
||||
|
||||
ACarlaWheeledVehicle *Vehicle;
|
||||
SpawnVehicle(Transform, Vehicle);
|
||||
if ((Vehicle != nullptr) && !Vehicle->IsPendingKill())
|
||||
{
|
||||
// Vehicle->AIControllerClass = AWheeledVehicleAIController::StaticClass();
|
||||
Vehicle->SpawnDefaultController();
|
||||
_Agents.Add(COUNT, Vehicle);
|
||||
return COUNT;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool AServer::ApplyControl(int32 AgentId, const FVehicleControl &Control)
|
||||
{
|
||||
UE_LOG(LogTemp, Log, TEXT("Applying control to vehicle %d: throttle = %f, steer = %f"), AgentId, Control.Throttle, Control.Steer);
|
||||
if (!_Agents.Contains(AgentId))
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("Vehicle %d does not exist!"), AgentId);
|
||||
return false;
|
||||
}
|
||||
auto *Vehicle = _Agents[AgentId];
|
||||
Vehicle->ApplyVehicleControl(Control);
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||
// de Barcelona (UAB).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Vehicle/CarlaWheeledVehicle.h"
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "RPCServer.h"
|
||||
#include "Vehicle/VehicleControl.h"
|
||||
#include <future>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include "Server.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class CARLA_API AServer : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AServer();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
virtual void EndPlay(EEndPlayReason::Type EndPlayReason) override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
int32 SpawnAgent(const FTransform &Transform);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool ApplyControl(int32 AgentId, const FVehicleControl &Control);
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void SpawnVehicle(const FTransform &SpawnTransform, ACarlaWheeledVehicle *&SpawnedCharacter);
|
||||
|
||||
private:
|
||||
|
||||
FRPCServer _Server;
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
TMap<uint32, ACarlaWheeledVehicle *> _Agents;
|
||||
};
|
|
@ -163,7 +163,6 @@ AWalkerAIController::AWalkerAIController(const FObjectInitializer& ObjectInitial
|
|||
TimeInState=0.0f;
|
||||
}
|
||||
|
||||
|
||||
void AWalkerAIController::Possess(APawn *aPawn)
|
||||
{
|
||||
Super::Possess(aPawn);
|
||||
|
@ -221,13 +220,12 @@ void AWalkerAIController::OnMoveCompleted(
|
|||
#ifdef CARLA_AI_WALKERS_EXTRA_LOG
|
||||
UE_LOG(LogCarla, Log, TEXT("Walker %s completed move at (%s)"),
|
||||
*GetPawn()->GetName(),
|
||||
*GetPawn()->GetActorLocation().ToString())
|
||||
;
|
||||
*GetPawn()->GetActorLocation().ToString());
|
||||
#endif // CARLA_AI_WALKERS_EXTRA_LOG
|
||||
ChangeStatus(EWalkerStatus::MoveCompleted);
|
||||
}
|
||||
|
||||
void AWalkerAIController::SenseActors(TArray<AActor *> Actors)
|
||||
void AWalkerAIController::SenseActors(const TArray<AActor *> &Actors)
|
||||
{
|
||||
const auto *aPawn = GetPawn();
|
||||
if ((Status == EWalkerStatus::Moving) &&
|
||||
|
|
|
@ -40,11 +40,12 @@ public:
|
|||
const FAIMoveRequest& MoveRequest,
|
||||
FNavPathSharedPtr* OutPath = nullptr) override;
|
||||
|
||||
virtual void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult &Result) override;
|
||||
|
||||
virtual void OnMoveCompleted(
|
||||
FAIRequestID RequestID,
|
||||
const FPathFollowingResult &Result) override;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SenseActors(TArray<AActor *> Actors);
|
||||
void SenseActors(const TArray<AActor *> &Actors);
|
||||
|
||||
EWalkerStatus GetWalkerStatus() const
|
||||
{
|
||||
|
@ -58,19 +59,27 @@ public:
|
|||
float GetTimeInState() const { return TimeInState; }
|
||||
|
||||
private:
|
||||
|
||||
void ChangeStatus(EWalkerStatus status);
|
||||
|
||||
void TryResumeMovement();
|
||||
|
||||
void TryPauseMovement(bool bItWasRunOver = false);
|
||||
|
||||
UFUNCTION()
|
||||
void OnPawnTookDamage(AActor *DamagedActor, float Damage, const UDamageType *DamageType, AController *InstigatedBy, AActor *DamageCauser);
|
||||
void OnPawnTookDamage(
|
||||
AActor *DamagedActor,
|
||||
float Damage,
|
||||
const UDamageType *DamageType,
|
||||
AController *InstigatedBy,
|
||||
AActor *DamageCauser);
|
||||
|
||||
UPROPERTY(Category = "Walker AI Controller", VisibleAnywhere)
|
||||
UAISenseConfig_Sight *SightConfiguration;
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
EWalkerStatus Status = EWalkerStatus::Unknown;
|
||||
|
||||
/** Continous time in the same EWalkerStatus */
|
||||
float TimeInState=0.0f;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
#! /bin/bash
|
||||
|
||||
# ==============================================================================
|
||||
# -- Set up environment --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
if [ ! -d "${UE4_ROOT}" ]; then
|
||||
fatal_error "UE4_ROOT is not defined, or points to a non-existant directory, please set this environment variable."
|
||||
else
|
||||
log "Using Unreal Engine at '$UE4_ROOT'"
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
DOC_STRING="Build and launch CarlaUE4."
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [--build] [--rebuild] [--launch] [--clean] [--hard-clean]"
|
||||
|
||||
REMOVE_INTERMEDIATE=false
|
||||
HARD_CLEAN=false
|
||||
BUILD_CARLAUE4=false
|
||||
LAUNCH_UE4_EDITOR=false
|
||||
|
||||
OPTS=`getopt -o h --long help,build,rebuild,launch,clean,hard-clean -n 'parse-options' -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--build )
|
||||
BUILD_CARLAUE4=true;
|
||||
shift ;;
|
||||
--rebuild )
|
||||
REMOVE_INTERMEDIATE=true;
|
||||
BUILD_CARLAUE4=true;
|
||||
shift ;;
|
||||
--launch )
|
||||
LAUNCH_UE4_EDITOR=true;
|
||||
shift ;;
|
||||
--clean )
|
||||
REMOVE_INTERMEDIATE=true;
|
||||
shift ;;
|
||||
--hard-clean )
|
||||
REMOVE_INTERMEDIATE=true;
|
||||
HARD_CLEAN=true;
|
||||
shift ;;
|
||||
-h | --help )
|
||||
echo "$DOC_STRING"
|
||||
echo "$USAGE_STRING"
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_CARLAUE4} || ${LAUNCH_UE4_EDITOR}; }; then
|
||||
fatal_error "Nothing selected to be done."
|
||||
fi
|
||||
|
||||
pushd "${CARLAUE4_ROOT_FOLDER}" >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Clean CarlaUE4 ------------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${REMOVE_INTERMEDIATE} ; then
|
||||
|
||||
log "Cleaning intermediate files and folders."
|
||||
|
||||
UE4_INTERMEDIATE_FOLDERS="Binaries Build Intermediate DerivedDataCache"
|
||||
|
||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||
|
||||
pushd "${CARLAUE4_PLUGIN_ROOT_FOLDER}" >/dev/null
|
||||
|
||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
fi
|
||||
|
||||
if ${HARD_CLEAN} ; then
|
||||
|
||||
if [ ! -f Makefile ]; then
|
||||
fatal_error "The project wasn't built before!"
|
||||
fi
|
||||
|
||||
log "Doing a \"hard\" clean of the Unreal Engine project."
|
||||
|
||||
make CarlaUE4Editor ARGS=-clean
|
||||
|
||||
fi
|
||||
|
||||
if ${REMOVE_INTERMEDIATE} ; then
|
||||
|
||||
rm -f Makefile
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Build CarlaUE4 ------------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${BUILD_CARLAUE4} ; then
|
||||
|
||||
if [ ! -f Makefile ]; then
|
||||
|
||||
# This command fails sometimes but normally we can continue anyway.
|
||||
set +e
|
||||
log "Generate Unreal project files."
|
||||
${UE4_ROOT}/GenerateProjectFiles.sh -project="${PWD}/CarlaUE4.uproject" -game -engine -makefiles
|
||||
set -e
|
||||
|
||||
fi
|
||||
|
||||
log "Build CarlaUE4 project."
|
||||
make CarlaUE4Editor
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Launch UE4Editor ----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${LAUNCH_UE4_EDITOR} ; then
|
||||
|
||||
log "Launching UE4Editor..."
|
||||
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject"
|
||||
|
||||
else
|
||||
|
||||
log "Success!"
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
|
@ -0,0 +1,131 @@
|
|||
#! /bin/bash
|
||||
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
DOC_STRING="Build LibCarla."
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [--rebuild] [--server] [--client] [--clean]"
|
||||
|
||||
REMOVE_INTERMEDIATE=false
|
||||
BUILD_SERVER=false
|
||||
BUILD_CLIENT=false
|
||||
|
||||
OPTS=`getopt -o h --long help,rebuild,server,client,clean -n 'parse-options' -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--rebuild )
|
||||
REMOVE_INTERMEDIATE=true;
|
||||
BUILD_SERVER=true;
|
||||
BUILD_CLIENT=true;
|
||||
shift ;;
|
||||
--server )
|
||||
BUILD_SERVER=true;
|
||||
shift ;;
|
||||
--client )
|
||||
BUILD_CLIENT=true;
|
||||
shift ;;
|
||||
--clean )
|
||||
REMOVE_INTERMEDIATE=true;
|
||||
shift ;;
|
||||
-h | --help )
|
||||
echo "$DOC_STRING"
|
||||
echo "$USAGE_STRING"
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_SERVER} || ${BUILD_CLIENT}; }; then
|
||||
fatal_error "Nothing selected to be done."
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Clean intermediate files --------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${REMOVE_INTERMEDIATE} ; then
|
||||
|
||||
log "Cleaning intermediate files and folders."
|
||||
|
||||
rm -Rf ${LIBCARLA_BUILD_SERVER_FOLDER} ${LIBCARLA_BUILD_CLIENT_FOLDER}
|
||||
rm -Rf ${LIBCARLA_INSTALL_SERVER_FOLDER} ${LIBCARLA_INSTALL_CLIENT_FOLDER}
|
||||
rm -f ${LIBCARLA_ROOT_FOLDER}/source/carla/Version.h
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Build Server configuration ------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${BUILD_SERVER} ; then
|
||||
|
||||
log "Building LibCarla \"Server\" configuration."
|
||||
|
||||
mkdir -p ${LIBCARLA_BUILD_SERVER_FOLDER}
|
||||
pushd "${LIBCARLA_BUILD_SERVER_FOLDER}" >/dev/null
|
||||
|
||||
if [ ! -f "build.ninja" ]; then
|
||||
|
||||
cmake \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=Server \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${LIBCPP_TOOLCHAIN_FILE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_SERVER_FOLDER} \
|
||||
${CARLA_ROOT_FOLDER}
|
||||
|
||||
fi
|
||||
|
||||
ninja
|
||||
|
||||
ninja install | grep -v "Up-to-date:"
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Build Client configuration ------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${BUILD_CLIENT} ; then
|
||||
|
||||
log "Building LibCarla \"Client\" configuration."
|
||||
|
||||
mkdir -p ${LIBCARLA_BUILD_CLIENT_FOLDER}
|
||||
pushd "${LIBCARLA_BUILD_CLIENT_FOLDER}" >/dev/null
|
||||
|
||||
if [ ! -f "build.ninja" ]; then
|
||||
|
||||
cmake \
|
||||
-G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=Client \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${LIBSTDCPP_TOOLCHAIN_FILE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_CLIENT_FOLDER} \
|
||||
${CARLA_ROOT_FOLDER}
|
||||
|
||||
fi
|
||||
|
||||
ninja
|
||||
|
||||
ninja install | grep -v "Up-to-date:"
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
log "Success!"
|
|
@ -0,0 +1,99 @@
|
|||
#! /bin/bash
|
||||
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
export CC=clang-5.0
|
||||
export CXX=clang++-5.0
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
DOC_STRING="Build and package CARLA Python API."
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [--rebuild] [--py2] [--py3] [--clean]"
|
||||
|
||||
REMOVE_INTERMEDIATE=false
|
||||
BUILD_FOR_PYTHON2=false
|
||||
BUILD_FOR_PYTHON3=false
|
||||
|
||||
OPTS=`getopt -o h --long help,rebuild,py2,py3,clean -n 'parse-options' -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--rebuild )
|
||||
REMOVE_INTERMEDIATE=true;
|
||||
BUILD_FOR_PYTHON2=true;
|
||||
BUILD_FOR_PYTHON3=true;
|
||||
shift ;;
|
||||
--py2 )
|
||||
BUILD_FOR_PYTHON2=true;
|
||||
shift ;;
|
||||
--py3 )
|
||||
BUILD_FOR_PYTHON3=true;
|
||||
shift ;;
|
||||
--clean )
|
||||
REMOVE_INTERMEDIATE=true;
|
||||
shift ;;
|
||||
-h | --help )
|
||||
echo "$DOC_STRING"
|
||||
echo "$USAGE_STRING"
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_FOR_PYTHON2} || ${BUILD_FOR_PYTHON3}; }; then
|
||||
fatal_error "Nothing selected to be done."
|
||||
fi
|
||||
|
||||
pushd "${CARLA_PYTHONAPI_ROOT_FOLDER}" >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Clean intermediate files --------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${REMOVE_INTERMEDIATE} ; then
|
||||
|
||||
log "Cleaning intermediate files and folders."
|
||||
|
||||
rm -Rf build dist carla.egg-info source/carla.egg-info
|
||||
|
||||
find source -name "*.so" -delete
|
||||
find source -name "__pycache__" -type d -exec rm -r "{}" \;
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Build API -----------------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${BUILD_FOR_PYTHON2} ; then
|
||||
|
||||
log "Building Python API for Python 2."
|
||||
|
||||
/usr/bin/env python2 setup.py bdist_egg
|
||||
|
||||
fi
|
||||
|
||||
if ${BUILD_FOR_PYTHON3} ; then
|
||||
|
||||
log "Building Python API for Python 3."
|
||||
|
||||
/usr/bin/env python3 setup.py bdist_egg
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
log "Success!"
|
|
@ -0,0 +1,131 @@
|
|||
#! /bin/bash
|
||||
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
DOC_STRING="Run unit tests."
|
||||
|
||||
USAGE_STRING=$(cat <<- END
|
||||
Usage: $0 [-h|--help] [--gdb] [--gtest_args=ARGS]
|
||||
|
||||
Then either ran all the tests
|
||||
|
||||
[--all]
|
||||
|
||||
Or choose one or more of the following
|
||||
|
||||
[--libcarla-release] [--libcarla-debug]
|
||||
[--python-api-2] [--python-api-3]
|
||||
[--benchmark]
|
||||
END
|
||||
)
|
||||
|
||||
GDB=
|
||||
GTEST_ARGS=
|
||||
LIBCARLA_RELEASE=false
|
||||
LIBCARLA_DEBUG=false
|
||||
PYTHON_API_2=false
|
||||
PYTHON_API_3=false
|
||||
|
||||
OPTS=`getopt -o h --long help,gdb,gtest_args:,all,libcarla-release,libcarla-debug,python-api-2,python-api-3,benchmark -n 'parse-options' -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--gdb )
|
||||
GDB="gdb --args";
|
||||
shift ;;
|
||||
--gtest_args )
|
||||
GTEST_ARGS="$2";
|
||||
shift ;;
|
||||
--all )
|
||||
LIBCARLA_RELEASE=true;
|
||||
LIBCARLA_DEBUG=true;
|
||||
PYTHON_API_2=true;
|
||||
PYTHON_API_3=true;
|
||||
shift ;;
|
||||
--libcarla-release )
|
||||
LIBCARLA_RELEASE=true;
|
||||
shift ;;
|
||||
--libcarla-debug )
|
||||
LIBCARLA_DEBUG=true;
|
||||
shift ;;
|
||||
--python-api-2 )
|
||||
PYTHON_API_2=true;
|
||||
shift ;;
|
||||
--python-api-3 )
|
||||
PYTHON_API_3=true;
|
||||
shift ;;
|
||||
--benchmark )
|
||||
LIBCARLA_RELEASE=true;
|
||||
GTEST_ARGS="--gtest_filter=benchmark*";
|
||||
shift ;;
|
||||
-h | --help )
|
||||
echo "$DOC_STRING"
|
||||
echo -e "$USAGE_STRING"
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! { ${LIBCARLA_RELEASE} || ${LIBCARLA_DEBUG} || ${PYTHON_API_2} || ${PYTHON_API_3}; }; then
|
||||
fatal_error "Nothing selected to be done."
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Run LibCarla tests --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if ${LIBCARLA_DEBUG} ; then
|
||||
|
||||
log "Running LibCarla unit tests debug."
|
||||
|
||||
LD_LIBRARY_PATH=${LIBCARLA_INSTALL_SERVER_FOLDER}/lib ${GDB} ${LIBCARLA_INSTALL_SERVER_FOLDER}/test/libcarla_test_debug ${GTEST_ARGS}
|
||||
|
||||
fi
|
||||
|
||||
if ${LIBCARLA_RELEASE} ; then
|
||||
|
||||
log "Running LibCarla unit tests release."
|
||||
|
||||
LD_LIBRARY_PATH=${LIBCARLA_INSTALL_SERVER_FOLDER}/lib ${GDB} ${LIBCARLA_INSTALL_SERVER_FOLDER}/test/libcarla_test_release ${GTEST_ARGS}
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Run Python API tests ------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
pushd "${CARLA_PYTHONAPI_ROOT_FOLDER}/test" >/dev/null
|
||||
|
||||
if ${PYTHON_API_2} ; then
|
||||
|
||||
log "Running Python API for Python 2 unit tests."
|
||||
|
||||
/usr/bin/env python2 -m nose2
|
||||
|
||||
fi
|
||||
|
||||
if ${PYTHON_API_3} ; then
|
||||
|
||||
log "Running Python API for Python 3 unit tests."
|
||||
|
||||
/usr/bin/env python3 -m nose2
|
||||
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
log "Success!"
|
|
@ -0,0 +1,47 @@
|
|||
#! /bin/bash
|
||||
|
||||
# Sets the environment for other shell scripts.
|
||||
|
||||
set -e
|
||||
|
||||
CURDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
|
||||
source $(dirname "$0")/Vars.mk
|
||||
unset CURDIR
|
||||
|
||||
if [ -n "${CARLA_BUILD_NO_COLOR}" ]; then
|
||||
|
||||
function log {
|
||||
echo "`basename "$0"`: $1"
|
||||
}
|
||||
|
||||
function fatal_error {
|
||||
echo -e >&2 "`basename "$0"`: ERROR: $1"
|
||||
exit 2
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
function log {
|
||||
echo -e "\033[1;35m`basename "$0"`: $1\033[0m"
|
||||
}
|
||||
|
||||
function fatal_error {
|
||||
echo -e >&2 "\033[0;31m`basename "$0"`: ERROR: $1\033[0m"
|
||||
exit 2
|
||||
}
|
||||
|
||||
fi
|
||||
|
||||
function get_carla_version {
|
||||
git describe --tags --dirty --always
|
||||
}
|
||||
|
||||
function copy_if_changed {
|
||||
mkdir -p $(dirname $2)
|
||||
rsync -cI --out-format="%n" $1 $2
|
||||
}
|
||||
|
||||
function move_if_changed {
|
||||
copy_if_changed $1 $2
|
||||
rm -f $1
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
ARGS=--all
|
||||
|
||||
default: help
|
||||
|
||||
help:
|
||||
@less ${CARLA_BUILD_TOOLS_FOLDER}/Linux.mk.help
|
||||
|
||||
launch: LibCarla
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --build --launch
|
||||
|
||||
launch-only:
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --launch
|
||||
|
||||
package: CarlaUE4Editor PythonAPI
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/Package.sh
|
||||
|
||||
docs:
|
||||
@doxygen
|
||||
@echo "Documentation index at ./Doxygen/html/index.html"
|
||||
|
||||
clean:
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --clean
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --clean
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --clean
|
||||
|
||||
rebuild: setup
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --rebuild
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --rebuild
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --rebuild
|
||||
|
||||
hard-clean: clean
|
||||
@rm -Rf ${CARLA_BUILD_FOLDER}
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --hard-clean
|
||||
|
||||
check: PythonAPI
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh $(ARGS)
|
||||
|
||||
benchmark: LibCarla
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/Check.sh --benchmark
|
||||
@cat profiler.csv
|
||||
|
||||
CarlaUE4Editor: LibCarla
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildCarlaUE4.sh --build
|
||||
|
||||
.PHONY: PythonAPI
|
||||
PythonAPI: LibCarla
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildPythonAPI.sh --py2 --py3
|
||||
|
||||
.PHONY: LibCarla
|
||||
LibCarla: setup
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/BuildLibCarla.sh --server --client
|
||||
|
||||
setup:
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/Setup.sh
|
||||
|
||||
pretty:
|
||||
@${CARLA_BUILD_TOOLS_FOLDER}/Prettify.sh $(ARGS)
|
|
@ -0,0 +1,77 @@
|
|||
Welcome to CARLA Simulator!
|
||||
===========================
|
||||
|
||||
This Makefile will help you building the different CARLA utilities.
|
||||
|
||||
Use the following commands:
|
||||
|
||||
help:
|
||||
|
||||
Display this help message.
|
||||
|
||||
launch:
|
||||
|
||||
Compile CarlaUE4 project and launch it in Unreal Engine's Editor.
|
||||
|
||||
launch-only:
|
||||
|
||||
Launch CarlaUE4 project in Unreal Engine's Editor, but skip building
|
||||
step (assume the project is already built).
|
||||
|
||||
package:
|
||||
|
||||
Makes a packaged version of CARLA ready for distribution.
|
||||
|
||||
docs:
|
||||
|
||||
Build CARLA Doxygen documentation.
|
||||
|
||||
clean:
|
||||
|
||||
Remove intermediate build files.
|
||||
|
||||
rebuild:
|
||||
|
||||
Remove intermediate build files and rebuild the whole project.
|
||||
|
||||
hard-clean:
|
||||
|
||||
Remove intermediate build files and dependencies, and force a
|
||||
recompilation of Unreal Engine's pre-compiled headers. Useful for
|
||||
fixing "version.h has been modified since the precompiled header"
|
||||
errors. Beware, recompilation takes a long time!
|
||||
|
||||
|
||||
There are also some lower level commands for building individual modules helpful
|
||||
for developers:
|
||||
|
||||
check:
|
||||
|
||||
Run unit test suites for LibCarla and PythonAPI.
|
||||
|
||||
benchmark:
|
||||
|
||||
Run the benchmark tests for LibCarla.
|
||||
|
||||
CarlaUE4Editor:
|
||||
|
||||
Build CarlaUE4 project, but do not launch the editor.
|
||||
|
||||
PythonAPI:
|
||||
|
||||
Build and package the Python API module for Python 2 and 3.
|
||||
|
||||
LibCarla:
|
||||
|
||||
Build the LibCarla library, both "Server" and "Client" configurations.
|
||||
|
||||
setup:
|
||||
|
||||
Run the setup step only.
|
||||
|
||||
pretty:
|
||||
|
||||
Prettify code files. Run uncrustify on C++ files or AutoPEP8 on Python
|
||||
files. To prettify a single file, use: make pretty ARGS=-f/path/to/file.
|
||||
|
||||
|
|
@ -1,20 +1,15 @@
|
|||
#! /bin/bash
|
||||
|
||||
################################################################################
|
||||
# Packages a CARLA build.
|
||||
################################################################################
|
||||
|
||||
set -e
|
||||
|
||||
DOC_STRING="Makes a packaged version of CARLA for distribution.
|
||||
Please make sure to run Rebuild.sh before!"
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [--no-packaging] [--no-zip] [--clean-intermediate]"
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
DOC_STRING="Makes a packaged version of CARLA for distribution."
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [--no-packaging] [--no-zip] [--clean-intermediate]"
|
||||
|
||||
DO_PACKAGE=true
|
||||
DO_COPY_FILES=true
|
||||
DO_TARBALL=true
|
||||
|
@ -47,39 +42,21 @@ while true; do
|
|||
esac
|
||||
done
|
||||
|
||||
# ==============================================================================
|
||||
# -- Set up environment --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
pushd "$SCRIPT_DIR" >/dev/null
|
||||
|
||||
REPOSITORY_TAG=`git describe --tags --dirty --always`
|
||||
|
||||
echo "Packaging version '$REPOSITORY_TAG'."
|
||||
|
||||
UNREAL_PROJECT_FOLDER=${PWD}/Unreal/CarlaUE4
|
||||
DIST_FOLDER=${PWD}/Dist
|
||||
BUILD_FOLDER=${DIST_FOLDER}/${REPOSITORY_TAG}
|
||||
|
||||
function fatal_error {
|
||||
echo -e "\033[0;31mERROR: $1\033[0m"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function log {
|
||||
echo -e "\033[0;33m$1\033[0m"
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# -- Package project -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
REPOSITORY_TAG=$(get_carla_version)
|
||||
|
||||
BUILD_FOLDER=${CARLA_DIST_FOLDER}/${REPOSITORY_TAG}
|
||||
|
||||
log "Packaging version '$REPOSITORY_TAG'."
|
||||
|
||||
if $DO_PACKAGE ; then
|
||||
|
||||
pushd "$UNREAL_PROJECT_FOLDER" >/dev/null
|
||||
pushd "${CARLAUE4_ROOT_FOLDER}" >/dev/null
|
||||
|
||||
log "Packaging the project..."
|
||||
log "Packaging the project."
|
||||
|
||||
if [ ! -d "${UE4_ROOT}" ]; then
|
||||
fatal_error "UE4_ROOT is not defined, or points to a non-existant directory, please set this environment variable."
|
||||
|
@ -105,34 +82,25 @@ if [[ ! -d ${BUILD_FOLDER}/LinuxNoEditor ]] ; then
|
|||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Copy files (Python server, README, etc) -----------------------------------
|
||||
# -- Copy files (Python API, README, etc) --------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if $DO_COPY_FILES ; then
|
||||
|
||||
DESTINATION=${BUILD_FOLDER}/LinuxNoEditor
|
||||
|
||||
log "Copying extra files..."
|
||||
log "Adding extra files to package."
|
||||
|
||||
cp -v ./LICENSE ${DESTINATION}/LICENSE
|
||||
cp -v ./CHANGELOG.md ${DESTINATION}/CHANGELOG
|
||||
cp -v ./Docs/release_readme.md ${DESTINATION}/README
|
||||
cp -v ./Docs/Example.CarlaSettings.ini ${DESTINATION}/Example.CarlaSettings.ini
|
||||
cp -v ./Util/Docker/Release.Dockerfile ${DESTINATION}/Dockerfile
|
||||
pushd ${CARLA_ROOT_FOLDER} >/dev/null
|
||||
|
||||
rsync -vhr --delete --delete-excluded \
|
||||
--exclude "*.egg-info" \
|
||||
--exclude "*.log" \
|
||||
--exclude "*.pyc" \
|
||||
--exclude ".*" \
|
||||
--exclude ".tags*" \
|
||||
--exclude "__pycache__" \
|
||||
--exclude "_benchmarks_results*" \
|
||||
--exclude "_images*" \
|
||||
--exclude "_out*" \
|
||||
PythonClient/ ${DESTINATION}/PythonClient
|
||||
copy_if_changed "./LICENSE" "${DESTINATION}/LICENSE"
|
||||
copy_if_changed "./CHANGELOG.md" "${DESTINATION}/CHANGELOG"
|
||||
copy_if_changed "./Docs/release_readme.md" "${DESTINATION}/README"
|
||||
copy_if_changed "./Docs/Example.CarlaSettings.ini" "${DESTINATION}/Example.CarlaSettings.ini"
|
||||
copy_if_changed "./Util/Docker/Release.Dockerfile" "${DESTINATION}/Dockerfile"
|
||||
copy_if_changed "./PythonAPI/dist/*.egg" "${DESTINATION}/PythonAPI"
|
||||
|
||||
echo
|
||||
popd >/dev/null
|
||||
|
||||
fi
|
||||
|
||||
|
@ -142,12 +110,12 @@ fi
|
|||
|
||||
if $DO_TARBALL ; then
|
||||
|
||||
DESTINATION=${DIST_FOLDER}/CARLA_${REPOSITORY_TAG}.tar.gz
|
||||
DESTINATION=${CARLA_DIST_FOLDER}/CARLA_${REPOSITORY_TAG}.tar.gz
|
||||
SOURCE=${BUILD_FOLDER}/LinuxNoEditor
|
||||
|
||||
pushd "$SOURCE" >/dev/null
|
||||
pushd "${SOURCE}" >/dev/null
|
||||
|
||||
log "Packaging build..."
|
||||
log "Packaging build."
|
||||
|
||||
rm -f ./Manifest_NonUFSFiles_Linux.txt
|
||||
rm -Rf ./CarlaUE4/Saved
|
||||
|
@ -165,7 +133,7 @@ fi
|
|||
|
||||
if $DO_CLEAN_INTERMEDIATE ; then
|
||||
|
||||
log "Removing intermediate build..."
|
||||
log "Removing intermediate build."
|
||||
|
||||
rm -Rf ${BUILD_FOLDER}
|
||||
|
||||
|
@ -176,16 +144,10 @@ fi
|
|||
# ==============================================================================
|
||||
|
||||
if $DO_TARBALL ; then
|
||||
FINAL_PACKAGE=Dist/CARLA_${REPOSITORY_TAG}.tar.gz
|
||||
FINAL_PACKAGE=${CARLA_DIST_FOLDER}/CARLA_${REPOSITORY_TAG}.tar.gz
|
||||
else
|
||||
FINAL_PACKAGE=Dist/${REPOSITORY_TAG}
|
||||
FINAL_PACKAGE=${BUILD_FOLDER}
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Packaged version created at ${FINAL_PACKAGE}"
|
||||
echo
|
||||
echo "****************"
|
||||
echo "*** Success! ***"
|
||||
echo "****************"
|
||||
|
||||
popd >/dev/null
|
||||
log "Packaged version created at ${FINAL_PACKAGE}"
|
||||
log "Success!"
|
|
@ -0,0 +1,137 @@
|
|||
#! /bin/bash
|
||||
|
||||
# ==============================================================================
|
||||
# -- Set up environment --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
DOC_STRING="Prettify code files."
|
||||
|
||||
USAGE_STRING="Usage: $0 [-h|--help] [--all] [-f path|--file=path]"
|
||||
|
||||
PRETTIFY_ALL=false
|
||||
PRETTIFY_FILE=false
|
||||
|
||||
OPTS=`getopt -o hf: --long help,all,file: -n 'parse-options' -- "$@"`
|
||||
|
||||
if [ $? != 0 ] ; then echo "$USAGE_STRING" ; exit 2 ; fi
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--all )
|
||||
PRETTIFY_ALL=true;
|
||||
shift ;;
|
||||
-f | --file )
|
||||
PRETTIFY_FILE="$2";
|
||||
shift ;;
|
||||
-h | --help )
|
||||
echo "$DOC_STRING"
|
||||
echo "$USAGE_STRING"
|
||||
exit 1
|
||||
;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! { ${PRETTIFY_ALL} || [ -n "${PRETTIFY_FILE}" ]; } ; then
|
||||
fatal_error "Nothing selected to be done."
|
||||
fi
|
||||
|
||||
if ${PRETTIFY_ALL} ; then
|
||||
PRETTIFY_FILE=false
|
||||
elif [[ ! -f ${PRETTIFY_FILE} ]] ; then
|
||||
pwd
|
||||
fatal_error "\"${PRETTIFY_FILE}\" no such file."
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get latest version of uncrustify ------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
mkdir -p ${CARLA_BUILD_FOLDER}
|
||||
pushd ${CARLA_BUILD_FOLDER} >/dev/null
|
||||
|
||||
UNCRUSTIFY_BASENAME=uncrustify-0.67
|
||||
|
||||
UNCRUSTIFY=${PWD}/${UNCRUSTIFY_BASENAME}-install/bin/uncrustify
|
||||
|
||||
if [[ -d "${UNCRUSTIFY_BASENAME}-install" ]] ; then
|
||||
log "${UNCRUSTIFY_BASENAME} already installed."
|
||||
else
|
||||
rm -Rf ${UNCRUSTIFY_BASENAME}-source ${UNCRUSTIFY_BASENAME}-build
|
||||
|
||||
log "Retrieving Uncrustify."
|
||||
|
||||
git clone --depth=1 -b uncrustify-0.67 https://github.com/uncrustify/uncrustify.git ${UNCRUSTIFY_BASENAME}-source
|
||||
|
||||
log "Building Uncrustify."
|
||||
|
||||
mkdir -p ${UNCRUSTIFY_BASENAME}-build
|
||||
|
||||
pushd ${UNCRUSTIFY_BASENAME}-build >/dev/null
|
||||
|
||||
cmake -G "Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="../${UNCRUSTIFY_BASENAME}-install" \
|
||||
../${UNCRUSTIFY_BASENAME}-source
|
||||
|
||||
ninja
|
||||
|
||||
ninja install
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
rm -Rf ${UNCRUSTIFY_BASENAME}-source ${UNCRUSTIFY_BASENAME}-build
|
||||
|
||||
fi
|
||||
|
||||
command -v ${UNCRUSTIFY} >/dev/null 2>&1 || {
|
||||
fatal_error "Failed to install Uncrustify!";
|
||||
}
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
command -v autopep8 >/dev/null 2>&1 || {
|
||||
log "Installing autopep8 for this user."
|
||||
pip3 install --user autopep8
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# -- Run uncrustify and/or autopep8 --------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
UNCRUSTIFY_CONFIG=${CARLA_BUILD_TOOLS_FOLDER}/uncrustify.cfg
|
||||
UNCRUSTIFY_COMMAND="${UNCRUSTIFY} -c ${UNCRUSTIFY_CONFIG} --no-backup --replace"
|
||||
|
||||
AUTOPEP8_COMMAND="autopep8 --jobs 0 --in-place -a"
|
||||
|
||||
if ${PRETTIFY_ALL} ; then
|
||||
|
||||
find ${CARLA_ROOT_FOLDER} -iregex '.*\.\(py\)$' -exec ${AUTOPEP8_COMMAND} {} +
|
||||
# find ${LIBCARLA_ROOT_FOLDER} -iregex '.*\.\(h\|cpp\)$' -exec ${UNCRUSTIFY_COMMAND} {} \;
|
||||
|
||||
elif [[ -f ${PRETTIFY_FILE} ]] ; then
|
||||
|
||||
if [[ ${PRETTIFY_FILE} == *.py ]] ; then
|
||||
log "autopep8 ${PRETTIFY_FILE}"
|
||||
${AUTOPEP8_COMMAND} ${PRETTIFY_FILE}
|
||||
else
|
||||
log "uncrustify ${PRETTIFY_FILE}"
|
||||
${UNCRUSTIFY_COMMAND} ${PRETTIFY_FILE}
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
log "Success!"
|
|
@ -0,0 +1,267 @@
|
|||
#! /bin/bash
|
||||
|
||||
# ==============================================================================
|
||||
# -- Set up environment --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
command -v /usr/bin/clang++-5.0 >/dev/null 2>&1 || {
|
||||
echo >&2 "clang 5.0 is required, but it's not installed.";
|
||||
echo >&2 "make sure you build Unreal Engine with clang 5.0 too.";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
export CC=/usr/bin/clang-5.0
|
||||
export CXX=/usr/bin/clang++-5.0
|
||||
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
mkdir -p ${CARLA_BUILD_FOLDER}
|
||||
pushd ${CARLA_BUILD_FOLDER} >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get and compile libc++ ----------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
LLVM_BASENAME=llvm-5.0
|
||||
|
||||
LLVM_INCLUDE=${PWD}/${LLVM_BASENAME}-install/include/c++/v1
|
||||
LLVM_LIBPATH=${PWD}/${LLVM_BASENAME}-install/lib
|
||||
|
||||
if [[ -d "${LLVM_BASENAME}-install" ]] ; then
|
||||
log "${LLVM_BASENAME} already installed."
|
||||
else
|
||||
rm -Rf ${LLVM_BASENAME}-source ${LLVM_BASENAME}-build
|
||||
|
||||
log "Retrieving libc++."
|
||||
|
||||
git clone --depth=1 -b release_50 https://github.com/llvm-mirror/llvm.git ${LLVM_BASENAME}-source
|
||||
git clone --depth=1 -b release_50 https://github.com/llvm-mirror/libcxx.git ${LLVM_BASENAME}-source/projects/libcxx
|
||||
git clone --depth=1 -b release_50 https://github.com/llvm-mirror/libcxxabi.git ${LLVM_BASENAME}-source/projects/libcxxabi
|
||||
|
||||
log "Compiling libc++."
|
||||
|
||||
mkdir -p ${LLVM_BASENAME}-build
|
||||
|
||||
pushd ${LLVM_BASENAME}-build >/dev/null
|
||||
|
||||
cmake -G "Ninja" \
|
||||
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=OFF \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="../${LLVM_BASENAME}-install" \
|
||||
../${LLVM_BASENAME}-source
|
||||
|
||||
ninja cxx
|
||||
|
||||
ninja install-libcxx
|
||||
|
||||
ninja install-libcxxabi
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# Workaround, it seems LLVM 5.0 does not install these files.
|
||||
cp -v ${LLVM_BASENAME}-build/include/c++/v1/cxxabi.h ${LLVM_INCLUDE}
|
||||
cp -v ${LLVM_BASENAME}-build/include/c++/v1/__cxxabi_config.h ${LLVM_INCLUDE}
|
||||
|
||||
rm -Rf ${LLVM_BASENAME}-source ${LLVM_BASENAME}-build
|
||||
|
||||
fi
|
||||
|
||||
unset LLVM_BASENAME
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get boost includes --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
BOOST_BASENAME=boost-1.67.0
|
||||
|
||||
BOOST_INCLUDE=${PWD}/${BOOST_BASENAME}-install/include
|
||||
|
||||
if [[ -d "${BOOST_BASENAME}-install" ]] ; then
|
||||
log "${BOOST_BASENAME} already installed."
|
||||
else
|
||||
|
||||
log "Retrieving boost."
|
||||
wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
|
||||
log "Extracting boost."
|
||||
tar -xzf boost_1_67_0.tar.gz
|
||||
rm boost_1_67_0.tar.gz
|
||||
mkdir -p ${BOOST_BASENAME}-install/include
|
||||
mv boost_1_67_0/boost ${BOOST_BASENAME}-install/include/
|
||||
rm -Rf boost_1_67_0
|
||||
|
||||
fi
|
||||
|
||||
unset BOOST_BASENAME
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get rpclib and compile it with libc++ and libstdc++ -----------------------
|
||||
# ==============================================================================
|
||||
|
||||
RPCLIB_BASENAME=rpclib-2.2.1
|
||||
|
||||
RPCLIB_LIBCXX_INCLUDE=${PWD}/${RPCLIB_BASENAME}-libcxx-install/include
|
||||
RPCLIB_LIBCXX_LIBPATH=${PWD}/${RPCLIB_BASENAME}-libcxx-install/lib
|
||||
RPCLIB_LIBSTDCXX_INCLUDE=${PWD}/${RPCLIB_BASENAME}-libstdcxx-install/include
|
||||
RPCLIB_LIBSTDCXX_LIBPATH=${PWD}/${RPCLIB_BASENAME}-libstdcxx-install/lib
|
||||
|
||||
if [[ -d "${RPCLIB_BASENAME}-libcxx-install" && -d "${RPCLIB_BASENAME}-libstdcxx-install" ]] ; then
|
||||
log "${RPCLIB_BASENAME} already installed."
|
||||
else
|
||||
rm -Rf \
|
||||
${RPCLIB_BASENAME}-source \
|
||||
${RPCLIB_BASENAME}-libcxx-build ${RPCLIB_BASENAME}-libstdcxx-build \
|
||||
${RPCLIB_BASENAME}-libcxx-install ${RPCLIB_BASENAME}-libstdcxx-install
|
||||
|
||||
log "Retrieving rpclib."
|
||||
|
||||
git clone --depth=1 -b v2.2.1 https://github.com/rpclib/rpclib.git ${RPCLIB_BASENAME}-source
|
||||
|
||||
log "Building rpclib with libc++."
|
||||
|
||||
mkdir -p ${RPCLIB_BASENAME}-libcxx-build
|
||||
|
||||
pushd ${RPCLIB_BASENAME}-libcxx-build >/dev/null
|
||||
|
||||
cmake -G "Ninja" \
|
||||
-DCMAKE_CXX_FLAGS="-fPIC -std=c++17 -stdlib=libc++ -I${LLVM_INCLUDE} -Wl,-L${LLVM_LIBPATH}" \
|
||||
-DCMAKE_INSTALL_PREFIX="../${RPCLIB_BASENAME}-libcxx-install" \
|
||||
../${RPCLIB_BASENAME}-source
|
||||
|
||||
ninja
|
||||
|
||||
ninja install
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
log "Building rpclib with libstdc++."
|
||||
|
||||
mkdir -p ${RPCLIB_BASENAME}-libstdcxx-build
|
||||
|
||||
pushd ${RPCLIB_BASENAME}-libstdcxx-build >/dev/null
|
||||
|
||||
cmake -G "Ninja" \
|
||||
-DCMAKE_CXX_FLAGS="-fPIC -std=c++17" \
|
||||
-DCMAKE_INSTALL_PREFIX="../${RPCLIB_BASENAME}-libstdcxx-install" \
|
||||
../${RPCLIB_BASENAME}-source
|
||||
|
||||
ninja
|
||||
|
||||
ninja install
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
rm -Rf ${RPCLIB_BASENAME}-source ${RPCLIB_BASENAME}-libcxx-build ${RPCLIB_BASENAME}-libstdcxx-build
|
||||
|
||||
fi
|
||||
|
||||
unset RPCLIB_BASENAME
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get GTest and compile it with libc++ --------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
GTEST_BASENAME=googletest-1.8.0
|
||||
|
||||
GTEST_INCLUDE=${PWD}/${GTEST_BASENAME}-install/include
|
||||
GTEST_LIBPATH=${PWD}/${GTEST_BASENAME}-install/lib
|
||||
|
||||
if [[ -d "${GTEST_BASENAME}-install" ]] ; then
|
||||
log "${GTEST_BASENAME} already installed."
|
||||
else
|
||||
rm -Rf ${GTEST_BASENAME}-source ${GTEST_BASENAME}-build
|
||||
|
||||
log "Retrieving Google Test."
|
||||
|
||||
git clone --depth=1 -b release-1.8.0 https://github.com/google/googletest.git ${GTEST_BASENAME}-source
|
||||
|
||||
log "Building Google Test."
|
||||
|
||||
mkdir -p ${GTEST_BASENAME}-build
|
||||
|
||||
pushd ${GTEST_BASENAME}-build >/dev/null
|
||||
|
||||
cmake -G "Ninja" \
|
||||
-DCMAKE_CXX_FLAGS="-std=c++17 -stdlib=libc++ -I${LLVM_INCLUDE} -Wl,-L${LLVM_LIBPATH}" \
|
||||
-DCMAKE_INSTALL_PREFIX="../${GTEST_BASENAME}-install" \
|
||||
../${GTEST_BASENAME}-source
|
||||
|
||||
ninja
|
||||
|
||||
ninja install
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
rm -Rf ${GTEST_BASENAME}-source ${GTEST_BASENAME}-build
|
||||
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Generate CMake toolchains and config --------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
log "Generating CMake configuration files."
|
||||
|
||||
# -- LIBSTDCPP_TOOLCHAIN_FILE --------------------------------------------------
|
||||
|
||||
cat >${LIBSTDCPP_TOOLCHAIN_FILE}.gen <<EOL
|
||||
# Automatically generated by `basename "$0"`
|
||||
|
||||
set(CMAKE_C_COMPILER ${CC})
|
||||
set(CMAKE_CXX_COMPILER ${CXX})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -std=c++17 -pthread -fPIC" CACHE STRING "" FORCE)
|
||||
# set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra" CACHE STRING "" FORCE)
|
||||
EOL
|
||||
|
||||
# -- LIBCPP_TOOLCHAIN_FILE -----------------------------------------------------
|
||||
|
||||
# We can reuse the previous toolchain.
|
||||
cp ${LIBSTDCPP_TOOLCHAIN_FILE}.gen ${LIBCPP_TOOLCHAIN_FILE}.gen
|
||||
|
||||
cat >>${LIBCPP_TOOLCHAIN_FILE}.gen <<EOL
|
||||
|
||||
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -stdlib=libc++" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -I${LLVM_INCLUDE}" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_LINK_FLAGS "\${CMAKE_CXX_LINK_FLAGS} -L${LLVM_LIBPATH}" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_LINK_FLAGS "\${CMAKE_CXX_LINK_FLAGS} -lc++ -lc++abi" CACHE STRING "" FORCE)
|
||||
EOL
|
||||
|
||||
# -- CMAKE_CONFIG_FILE ---------------------------------------------------------
|
||||
|
||||
cat >${CMAKE_CONFIG_FILE}.gen <<EOL
|
||||
# Automatically generated by `basename "$0"`
|
||||
|
||||
set(CARLA_VERSION $(get_carla_version))
|
||||
|
||||
add_definitions(-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
|
||||
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
|
||||
|
||||
set(BOOST_INCLUDE_PATH "${BOOST_INCLUDE}")
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Server")
|
||||
# Here libraries linking libc++.
|
||||
set(LLVM_INCLUDE_PATH "${LLVM_INCLUDE}")
|
||||
set(LLVM_LIB_PATH "${LLVM_LIBPATH}")
|
||||
set(GTEST_INCLUDE_PATH "${GTEST_INCLUDE}")
|
||||
set(GTEST_LIB_PATH "${GTEST_LIBPATH}")
|
||||
set(RPCLIB_INCLUDE_PATH "${RPCLIB_LIBCXX_INCLUDE}")
|
||||
set(RPCLIB_LIB_PATH "${RPCLIB_LIBCXX_LIBPATH}")
|
||||
elseif (CMAKE_BUILD_TYPE STREQUAL "Client")
|
||||
# Here libraries linking libstdc++.
|
||||
set(RPCLIB_INCLUDE_PATH "${RPCLIB_LIBSTDCXX_INCLUDE}")
|
||||
set(RPCLIB_LIB_PATH "${RPCLIB_LIBSTDCXX_LIBPATH}")
|
||||
endif ()
|
||||
EOL
|
||||
|
||||
# -- Move files ----------------------------------------------------------------
|
||||
|
||||
move_if_changed "${LIBSTDCPP_TOOLCHAIN_FILE}.gen" "${LIBSTDCPP_TOOLCHAIN_FILE}"
|
||||
move_if_changed "${LIBCPP_TOOLCHAIN_FILE}.gen" "${LIBCPP_TOOLCHAIN_FILE}"
|
||||
move_if_changed "${CMAKE_CONFIG_FILE}.gen" "${CMAKE_CONFIG_FILE}"
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
log "Success!"
|
|
@ -0,0 +1,22 @@
|
|||
# Here CURDIR is assumed to be the root folder of the project.
|
||||
|
||||
CARLA_ROOT_FOLDER=${CURDIR}
|
||||
CARLA_BUILD_FOLDER=${CURDIR}/Build
|
||||
CARLA_DIST_FOLDER=${CURDIR}/Dist
|
||||
CARLA_BUILD_TOOLS_FOLDER=${CURDIR}/Util/BuildTools
|
||||
|
||||
CARLAUE4_ROOT_FOLDER=${CURDIR}/Unreal/CarlaUE4
|
||||
CARLAUE4_PLUGIN_ROOT_FOLDER=${CURDIR}/Unreal/CarlaUE4/Plugins/Carla
|
||||
CARLA_PYTHONAPI_ROOT_FOLDER=${CURDIR}/PythonAPI
|
||||
|
||||
LIBCARLA_ROOT_FOLDER=${CURDIR}/LibCarla
|
||||
LIBCARLA_BUILD_SERVER_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-server-build
|
||||
LIBCARLA_BUILD_CLIENT_FOLDER=${CARLA_BUILD_FOLDER}/libcarla-client-build
|
||||
LIBCARLA_INSTALL_SERVER_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
|
||||
LIBCARLA_INSTALL_CLIENT_FOLDER=${CARLA_PYTHONAPI_ROOT_FOLDER}/dependencies
|
||||
|
||||
CARLAUE4_PLUGIN_DEPS_FOLDER=${CARLAUE4_PLUGIN_ROOT_FOLDER}/CarlaDependencies
|
||||
|
||||
LIBSTDCPP_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/LibStdCppToolChain.cmake
|
||||
LIBCPP_TOOLCHAIN_FILE=${CARLA_BUILD_FOLDER}/LibCppToolChain.cmake
|
||||
CMAKE_CONFIG_FILE=${CARLA_BUILD_FOLDER}/CMakeLists.txt.in
|
|
@ -0,0 +1,2 @@
|
|||
default:
|
||||
@echo "Not implemented!"
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,138 @@
|
|||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": "..",
|
||||
"file_exclude_patterns":
|
||||
[
|
||||
"*.VC.db",
|
||||
"*.VC.opendb",
|
||||
"*.gdb_history",
|
||||
"*.kdev4",
|
||||
"*.pri",
|
||||
"*.pro",
|
||||
"*.py[cod]",
|
||||
"*.sln",
|
||||
"*.stackdump",
|
||||
"*.sublime-workspace",
|
||||
"*.uasset",
|
||||
"*.umap",
|
||||
"*.workspace",
|
||||
"*CodeCompletionFolders.txt",
|
||||
"*CodeLitePreProcessor.txt",
|
||||
".tags*",
|
||||
"core"
|
||||
],
|
||||
"folder_exclude_patterns":
|
||||
[
|
||||
".clang",
|
||||
".codelite",
|
||||
".kdev4",
|
||||
".vs",
|
||||
".vscode",
|
||||
"Binaries",
|
||||
"DerivedDataCache",
|
||||
"Dist",
|
||||
"Doxygen",
|
||||
"Intermediate",
|
||||
"PythonAPI/build",
|
||||
"PythonAPI/dependencies",
|
||||
"PythonAPI/dist",
|
||||
"Saved",
|
||||
"Unreal/CarlaUE4/Content*",
|
||||
"Unreal/CarlaUE4/Plugins/Carla/CarlaDependencies",
|
||||
"__pycache__",
|
||||
"_site"
|
||||
],
|
||||
}
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"ensure_newline_at_eof_on_save": true,
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true,
|
||||
"trim_trailing_white_space_on_save": true
|
||||
},
|
||||
"build_systems":
|
||||
[
|
||||
{
|
||||
"name": "CARLA - make CarlaUE4Editor",
|
||||
"working_dir": "${project_path}/..",
|
||||
"file_regex": "(Unreal\\/CarlaUE4\\/[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "CARLA_BUILD_NO_COLOR=true make CarlaUE4Editor"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make LibCarla",
|
||||
"working_dir": "${project_path}/..",
|
||||
"file_regex": "^../../([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "CARLA_BUILD_NO_COLOR=true make LibCarla"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make PythonAPI",
|
||||
"working_dir": "${project_path}/..",
|
||||
"file_regex": "^../../([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "CARLA_BUILD_NO_COLOR=true make PythonAPI"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make check",
|
||||
"working_dir": "${project_path}/..",
|
||||
"file_regex": "^../../([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "CARLA_BUILD_NO_COLOR=true make check"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make check LibCarla",
|
||||
"working_dir": "${project_path}/..",
|
||||
"file_regex": "^../../([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "CARLA_BUILD_NO_COLOR=true make check ARGS=\"--carlalib-debug\""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make check LibCarla (launch GDB)",
|
||||
"working_dir": "${project_path}/..",
|
||||
"file_regex": "^../../([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "gnome-terminal --maximize -e 'make check ARGS=\"--gdb --carlalib-debug\"'"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - make clean",
|
||||
"working_dir": "${project_path}/..",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "CARLA_BUILD_NO_COLOR=true make clean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CARLA - Prettify this file",
|
||||
"working_dir": "${project_path}/..",
|
||||
"file_regex": "^([^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||||
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
|
||||
"linux":
|
||||
{
|
||||
"shell_cmd": "CARLA_BUILD_NO_COLOR=true make pretty ARGS=-f${file}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -35,6 +35,7 @@ pages:
|
|||
- 'How to add assets': 'how_to_add_assets.md'
|
||||
- 'CARLA design': 'carla_design.md'
|
||||
- 'CarlaServer documentation': 'carla_server.md'
|
||||
- 'Build system': 'build_system.md'
|
||||
- Appendix:
|
||||
- 'Driving Benchmark Sample Results Town01': 'benchmark_basic_results_town01.md'
|
||||
- 'Driving Benchmark Sample Results Town02': 'benchmark_basic_results_town02.md'
|
||||
|
|
Loading…
Reference in New Issue