Adapt Linux build system
This commit is contained in:
parent
2fe886af6e
commit
361ba17a40
|
@ -1,7 +1,6 @@
|
|||
./Dist
|
||||
./Doxygen
|
||||
./Util/Build
|
||||
./Util/Install
|
||||
Dist
|
||||
Doxygen
|
||||
Util/Build
|
||||
|
||||
*.VC.db
|
||||
*.VC.opendb
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
".vs",
|
||||
"Build",
|
||||
"Binaries",
|
||||
"Content",
|
||||
"Unreal/CarlaUE4/Content*",
|
||||
"DerivedDataCache",
|
||||
"Doxygen",
|
||||
"Intermediate",
|
||||
"Saved"
|
||||
],
|
||||
|
|
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 = Source Util/CarlaServer/source Util/PythonClient
|
||||
INPUT = Unreal/CarlaUE4/Source Unreal/CarlaUE4/Plugins/Carla/Source Util/CarlaServer/source PythonClient
|
||||
FILE_PATTERNS = *.cpp *.h *.hpp *.cc *.py
|
||||
RECURSIVE = YES
|
||||
SOURCE_BROWSER = YES
|
||||
|
@ -26,7 +26,7 @@ FORMULA_FONTSIZE = 12
|
|||
GENERATE_LATEX = NO
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
INCLUDE_PATH = Source Util/CarlaServer/source Util/Install/include
|
||||
INCLUDE_PATH = Unreal/CarlaUE4/Source Unreal/CarlaUE4/Plugins/Carla/Source Util/CarlaServer/source Util/CarlaServer/include PythonClient
|
||||
INCLUDE_FILE_PATTERNS = *.h *.hpp
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = YES
|
||||
|
|
20
Makefile
20
Makefile
|
@ -1,5 +1,5 @@
|
|||
INSTALL_FOLDER=$(CURDIR)/Util/Install
|
||||
PYTHON_CLIENT_FOLDER=$(CURDIR)/Util/PythonClient/test
|
||||
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)"
|
||||
|
@ -28,11 +28,11 @@ release: $(BUILD_RULE)
|
|||
|
||||
build_linux: MY_CMAKE_FLAGS+=-G "Ninja"
|
||||
build_linux: call_cmake
|
||||
cd $(BUILD_FOLDER) && ninja && ninja install
|
||||
@cd $(BUILD_FOLDER) && ninja && ninja install
|
||||
|
||||
build_windows: MY_CMAKE_FLAGS+=-G "NMake Makefiles"
|
||||
build_windows: call_cmake
|
||||
cd $(BUILD_FOLDER) && nmake && nmake install
|
||||
@cd $(BUILD_FOLDER) && nmake && nmake install
|
||||
|
||||
vsproject: BUILD_FOLDER=$(BASE_BUILD_FOLDER)/visualstudio
|
||||
vsproject: MY_CMAKE_FLAGS+=-DCMAKE_BUILD_TYPE=Debug
|
||||
|
@ -40,25 +40,25 @@ vsproject: MY_CMAKE_FLAGS+=-G "Visual Studio 14 2015 Win64"
|
|||
vsproject: call_cmake
|
||||
|
||||
call_cmake: protobuf
|
||||
mkdir -p $(BUILD_FOLDER)
|
||||
cd $(BUILD_FOLDER) && cmake $(MY_CMAKE_FLAGS) "$(MY_CMAKE_FOLDER)"
|
||||
@mkdir -p $(BUILD_FOLDER)
|
||||
@cd $(BUILD_FOLDER) && cmake $(MY_CMAKE_FLAGS) "$(MY_CMAKE_FOLDER)"
|
||||
|
||||
protobuf:
|
||||
$(PROTOC_COMPILE)
|
||||
@$(PROTOC_COMPILE)
|
||||
|
||||
### Docs #######################################################################
|
||||
|
||||
docs: doxygen
|
||||
|
||||
doxygen:
|
||||
doxygen
|
||||
@doxygen
|
||||
@echo "Documentation index at ./Doxygen/html/index.html"
|
||||
|
||||
### Clean ######################################################################
|
||||
|
||||
clean:
|
||||
rm -Rf $(BASE_BUILD_FOLDER) $(INSTALL_FOLDER) Doxygen
|
||||
$(PROTOC_CLEAN)
|
||||
@rm -Rf $(BASE_BUILD_FOLDER) $(INSTALL_FOLDER) Doxygen
|
||||
@$(PROTOC_CLEAN)
|
||||
|
||||
### Test #######################################################################
|
||||
|
||||
|
|
17
Rebuild.bat
17
Rebuild.bat
|
@ -1,11 +1,14 @@
|
|||
@echo off
|
||||
|
||||
echo Deleting intermediate folders...
|
||||
FOR %%G IN (Binaries,Intermediate,Plugins\Carla\Binaries,Plugins\Carla\Intermediate) DO (if exist %%G ( rmdir /s/q %%G ))
|
||||
msg * "Sorry, this script is currently unavailable."
|
||||
exit
|
||||
|
||||
echo Making CarlaServer...
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
START /wait cmd.exe /k "cd Plugins\Carla & make clean default & pause & exit"
|
||||
rem echo Deleting intermediate folders...
|
||||
rem FOR %%G IN (Binaries,Intermediate,Plugins\Carla\Binaries,Plugins\Carla\Intermediate) DO (if exist %%G ( rmdir /s/q %%G ))
|
||||
|
||||
echo Launch editor...
|
||||
start CarlaUE4.uproject
|
||||
rem echo Making CarlaServer...
|
||||
rem call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
rem START /wait cmd.exe /k "cd Plugins\Carla & make clean default & pause & exit"
|
||||
|
||||
rem echo Launch editor...
|
||||
rem start CarlaUE4.uproject
|
||||
|
|
51
Rebuild.sh
51
Rebuild.sh
|
@ -1,9 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
PLUGIN_FOLDER=./Plugins/Carla
|
||||
PLUGIN_INTERMEDIATE_FOLDERS="Binaries Intermediate"
|
||||
CARLAUE4_INTERMEDIATE_FOLDERS="Binaries Build Intermediate DerivedDataCache"
|
||||
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"
|
||||
|
@ -18,15 +20,38 @@ 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
|
||||
|
||||
# ==============================================================================
|
||||
# -- 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..."
|
||||
(cd ${PLUGIN_FOLDER} && rm -Rf ${PLUGIN_INTERMEDIATE_FOLDERS})
|
||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
log "Cleaning up CARLAUE4..."
|
||||
rm -Rf ${CARLAUE4_INTERMEDIATE_FOLDERS}
|
||||
rm -Rf ${UE4_INTERMEDIATE_FOLDERS}
|
||||
|
||||
log "Making CARLA Plugin dependencies..."
|
||||
(cd ${PLUGIN_FOLDER} && make clean && make debug && make release)
|
||||
popd >/dev/null
|
||||
|
||||
# This command usually fails but we can continue anyway.
|
||||
# ==============================================================================
|
||||
# -- 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
|
||||
|
@ -35,5 +60,13 @@ set -e
|
|||
log "Build CarlaUE4 project..."
|
||||
make CarlaUE4Editor
|
||||
|
||||
log "Launch editor..."
|
||||
log "Launching UE4Editor..."
|
||||
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${PWD}/CarlaUE4.uproject"
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
||||
|
|
43
Setup.sh
43
Setup.sh
|
@ -10,15 +10,11 @@
|
|||
# important parts of this script.
|
||||
################################################################################
|
||||
|
||||
# set -x
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
pushd "$SCRIPT_DIR" >/dev/null
|
||||
|
||||
mkdir -p Util/Build
|
||||
pushd Util/Build >/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.";
|
||||
|
@ -26,6 +22,32 @@ command -v clang++-3.9 >/dev/null 2>&1 || {
|
|||
exit 1;
|
||||
}
|
||||
|
||||
mkdir -p Util/Build
|
||||
pushd Util/Build >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- Download the content ------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
CONTENT_FOLDER=$SCRIPT_DIR/Unreal/CarlaUE4/Content
|
||||
|
||||
CONTENT_GDRIVE_ID=$(tac $SCRIPT_DIR/Util/ContentVersions.txt | egrep -m 1 . | rev | cut -d' ' -f1 | rev)
|
||||
|
||||
if [[ ! -d "$CONTENT_FOLDER/.git" ]]; then
|
||||
if [[ -d "$CONTENT_FOLDER" ]]; then
|
||||
echo "Backing up existing Content..."
|
||||
mv -v "$CONTENT_FOLDER" "${CONTENT_FOLDER}_$(date +%Y%m%d%H%M%S)"
|
||||
fi
|
||||
mkdir -p $CONTENT_FOLDER
|
||||
mkdir -p Content
|
||||
../download_from_gdrive.py $CONTENT_GDRIVE_ID Content.tar.gz
|
||||
tar -xvzf Content.tar.gz -C Content
|
||||
rm Content.tar.gz
|
||||
mv Content/* $CONTENT_FOLDER
|
||||
else
|
||||
echo "Using git version of 'Content', skipping download..."
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- Get and compile libc++ ----------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
@ -145,10 +167,21 @@ popd >/dev/null
|
|||
popd >/dev/null
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# -- Copy CarlaSettings.ini ----------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
CARLA_SETTINGS_FILE="./Unreal/CarlaUE4/Config/CarlaSettings.ini"
|
||||
|
||||
if [[ ! -f $CARLA_SETTINGS_FILE ]]; then
|
||||
cp -v ./Docs/Example.CarlaSettings.ini $CARLA_SETTINGS_FILE
|
||||
fi
|
||||
|
||||
# ==============================================================================
|
||||
# -- ...and we are done --------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
set +x
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
./Binaries
|
||||
./Build
|
||||
./Debug
|
||||
./DerivedDataCache
|
||||
./Intermediate
|
||||
./Saved
|
||||
./Plugins/Carla/Binaries
|
||||
./Plugins/Carla/Build
|
||||
./Plugins/Carla/Debug
|
||||
./Plugins/Carla/DerivedDataCache
|
||||
./Plugins/Carla/Intermediate
|
||||
./Plugins/Carla/Saved
|
||||
Binaries
|
||||
Build
|
||||
Debug
|
||||
DerivedDataCache
|
||||
Intermediate
|
||||
Saved
|
||||
Plugins/Carla/Binaries
|
||||
Plugins/Carla/Build
|
||||
Plugins/Carla/CarlaServer
|
||||
Plugins/Carla/Debug
|
||||
Plugins/Carla/DerivedDataCache
|
||||
Plugins/Carla/Intermediate
|
||||
Plugins/Carla/Saved
|
||||
|
||||
./Content
|
||||
./Config/CarlaSettings.ini
|
||||
Content*
|
||||
Config/CarlaSettings.ini
|
||||
|
||||
./CMakeLists.txt
|
||||
./Makefile
|
||||
CMakeLists.txt
|
||||
Makefile
|
||||
|
|
|
@ -74,7 +74,7 @@ public class Carla : ModuleRules
|
|||
|
||||
private void AddCarlaServerDependency(ReadOnlyTargetRules Target)
|
||||
{
|
||||
string CarlaServerInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Util/Install"));
|
||||
string CarlaServerInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaServer"));
|
||||
|
||||
string CarlaServerLib;
|
||||
if (UseDebugLibs(Target))
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# Here we keep a list of the Google Drive id's of the Content files. The last id
|
||||
# in the list it's picked up by the Setup.sh script to download the last version
|
||||
# of the contents.
|
||||
#
|
||||
# You can direct download with https://drive.google.com/open?id=PUT_FILE_ID_HERE
|
||||
|
||||
Demo: 0B2HFV-VuKn3PN2s5ZWdIc2VNWVU
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set PROTOBUF_SRC_DIR=Proto
|
||||
set PROTOBUF_CPP_OUT_DIR=CarlaServer/source/carla/server
|
||||
set PROTOBUF_PY_OUT_DIR=PythonClient/carla
|
||||
set PROTOBUF_PY_OUT_DIR=../PythonClient/carla
|
||||
set PROTO_BASENAME=carla_server
|
||||
|
||||
if "%1" == "--clean" (
|
||||
|
|
|
@ -7,7 +7,7 @@ pushd "$SCRIPT_DIR" >/dev/null
|
|||
|
||||
PROTOBUF_SRC_DIR=Proto
|
||||
PROTOBUF_CPP_OUT_DIR=CarlaServer/source/carla/server
|
||||
PROTOBUF_PY_OUT_DIR=PythonClient/carla
|
||||
PROTOBUF_PY_OUT_DIR=../PythonClient/carla
|
||||
PROTO_BASENAME=carla_server
|
||||
|
||||
if [ "$1" == "--clean" ]; then
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""Download big files from Google Drive."""
|
||||
|
||||
import argparse
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
def sizeof_fmt(num, suffix='B'):
|
||||
# https://stackoverflow.com/a/1094933/5308925
|
||||
for unit in ['','K','M','G','T','P','E','Z']:
|
||||
if abs(num) < 1000.0:
|
||||
return "%3.2f%s%s" % (num, unit, suffix)
|
||||
num /= 1000.0
|
||||
return "%.2f%s%s" % (num, 'Yi', suffix)
|
||||
|
||||
|
||||
def print_status(destination, progress):
|
||||
message = "Downloading %s... %s" % (destination, sizeof_fmt(progress))
|
||||
empty_space = shutil.get_terminal_size((80, 20)).columns - len(message)
|
||||
sys.stdout.write('\r' + message + empty_space * ' ')
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def download_file_from_google_drive(id, destination):
|
||||
# https://stackoverflow.com/a/39225039/5308925
|
||||
|
||||
def save_response_content(response, destination):
|
||||
chunk_size = 32768
|
||||
written_size = 0
|
||||
|
||||
with open(destination, "wb") as f:
|
||||
for chunk in response.iter_content(chunk_size):
|
||||
if chunk: # filter out keep-alive new chunks
|
||||
f.write(chunk)
|
||||
written_size += chunk_size
|
||||
print_status(destination, written_size)
|
||||
print('Done.')
|
||||
|
||||
def get_confirm_token(response):
|
||||
for key, value in response.cookies.items():
|
||||
if key.startswith('download_warning'):
|
||||
return value
|
||||
|
||||
return None
|
||||
|
||||
url = "https://docs.google.com/uc?export=download"
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
response = session.get(url, params={'id': id}, stream=True)
|
||||
token = get_confirm_token(response)
|
||||
|
||||
if token:
|
||||
params = {'id': id, 'confirm': token}
|
||||
response = session.get(url, params=params, stream=True)
|
||||
|
||||
save_response_content(response, destination)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
try:
|
||||
|
||||
argparser = argparse.ArgumentParser(description=__doc__)
|
||||
argparser.add_argument(
|
||||
'id',
|
||||
help='Google Drive\'s file id')
|
||||
argparser.add_argument(
|
||||
'destination',
|
||||
help='destination file path')
|
||||
args = argparser.parse_args()
|
||||
|
||||
download_file_from_google_drive(args.id, args.destination)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print('\nCancelled by user. Bye!')
|
Loading…
Reference in New Issue