2017-10-25 01:46:58 +08:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2017-10-25 23:26:31 +08:00
|
|
|
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"
|
2017-10-25 01:46:58 +08:00
|
|
|
|
|
|
|
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."
|
|
|
|
fi
|
|
|
|
|
2017-10-25 23:26:31 +08:00
|
|
|
# ==============================================================================
|
|
|
|
# -- 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
|
|
|
|
|
2017-10-25 01:46:58 +08:00
|
|
|
log "Cleaning up CARLA Plugin..."
|
2017-10-25 23:26:31 +08:00
|
|
|
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
|
|
|
|
|
|
|
popd > /dev/null
|
|
|
|
|
2017-10-25 01:46:58 +08:00
|
|
|
log "Cleaning up CARLAUE4..."
|
2017-10-25 23:26:31 +08:00
|
|
|
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- Build and launch Unreal project -------------------------------------------
|
|
|
|
# ==============================================================================
|
2017-10-25 01:46:58 +08:00
|
|
|
|
2017-10-25 23:26:31 +08:00
|
|
|
pushd "$UNREAL_PROJECT_FOLDER" >/dev/null
|
2017-10-25 01:46:58 +08:00
|
|
|
|
2017-10-25 23:26:31 +08:00
|
|
|
# This command usually fails but normally we can continue anyway.
|
2017-10-25 01:46:58 +08:00
|
|
|
set +e
|
|
|
|
log "Generate Unreal project files..."
|
|
|
|
${UE4_ROOT}/GenerateProjectFiles.sh -project="${PWD}/CarlaUE4.uproject" -game -engine
|
|
|
|
set -e
|
|
|
|
|
|
|
|
log "Build CarlaUE4 project..."
|
|
|
|
make CarlaUE4Editor
|
|
|
|
|
2017-10-25 23:26:31 +08:00
|
|
|
log "Launching UE4Editor..."
|
2017-10-25 01:46:58 +08:00
|
|
|
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject"
|
2017-10-25 23:26:31 +08:00
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
# -- ...and we are done --------------------------------------------------------
|
|
|
|
# ==============================================================================
|
|
|
|
|
|
|
|
popd >/dev/null
|