carla/Util/BuildTools/BuildUE4Plugins.sh

91 lines
2.2 KiB
Bash
Executable File

#! /bin/bash
DOC_STRING="Download StreetMapUE4 Plugin."
USAGE_STRING=$(cat <<- END
Usage: $0 [-h|--help]
commands
[--clean] Clean intermediate files.
[--rebuild] Clean and rebuild both configurations.
END
)
REMOVE_INTERMEDIATE=false
BUILD_STREETMAP=false
GIT_PULL=true
CURRENT_STREETMAP_COMMIT=260273d6b7c3f28988cda31fd33441de7e272958
STREETMAP_BRANCH=master
STREETMAP_REPO=https://github.com/carla-simulator/StreetMap.git
OPTS=`getopt -o h --long build,rebuild,clean, -n 'parse-options' -- "$@"`
eval set -- "$OPTS"
while [[ $# -gt 0 ]]; do
case "$1" in
--rebuild )
REMOVE_INTERMEDIATE=true;
BUILD_STREETMAP=true;
shift ;;
--build )
BUILD_STREETMAP=true;
shift ;;
--no-pull )
GIT_PULL=false
shift ;;
--clean )
REMOVE_INTERMEDIATE=true;
shift ;;
-h | --help )
echo "$DOC_STRING"
echo "$USAGE_STRING"
exit 1
;;
* )
shift ;;
esac
done
source $(dirname "$0")/Environment.sh
if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_STREETMAP}; }; then
fatal_error "Nothing selected to be done."
fi
# ==============================================================================
# -- Clean intermediate files --------------------------------------------------
# ==============================================================================
if ${REMOVE_INTERMEDIATE} ; then
log "Cleaning intermediate files and folders."
UE4_INTERMEDIATE_FOLDERS="Binaries Build Intermediate DerivedDataCache"
pushd "${CARLAUE4_STREETMAP_FOLDER}" >/dev/null
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
popd >/dev/null
fi
# ==============================================================================
# -- Build library -------------------------------------------------------------
# ==============================================================================
if ${BUILD_STREETMAP} ; then
log "Downloading STREETMAP plugin."
if ${GIT_PULL} ; then
if [ ! -d ${CARLAUE4_STREETMAP_FOLDER} ] ; then
git clone -b ${STREETMAP_BRANCH} ${STREETMAP_REPO} ${CARLAUE4_STREETMAP_FOLDER}
fi
cd ${CARLAUE4_STREETMAP_FOLDER}
git fetch
git checkout ${CURRENT_STREETMAP_COMMIT}
fi
fi
log "StreetMap Success!"