Update build system for Linux

This commit is contained in:
nsubiron 2017-03-30 14:25:37 +02:00
parent 4f62a201a0
commit 3e83f4d4d6
4 changed files with 61 additions and 12 deletions

View File

@ -1,9 +1,41 @@
CARLA UE4 Plugin
================
To build within a project [CarlaServer](Source/CarlaServer/README.md) needs to
be built first.
Plugin for Unreal Engine 4.
See [carla-ue4](https://bitbucket.org/carla-cvc/carla-ue4).
Compiling a UE4 project with CARLA plugin
-----------------------------------------
Clone or copy the files of this repository under the folder
`<project-root>/Plugins/Carla`.
Build CarlaServer located at `<project-root>/Plugins/Carla/Source/CarlaServer`,
follow the instructions [here](Source/CarlaServer/README.md) to build all the
necessary dependencies too.
Now compile the Unreal project.
#### Linux
Opening the .uproject file with UE4Editor usually triggers a recompile. If not
you can follow the next steps to do it manually.
Generate project files
$ <unreal-installation-path>/GenerateProjectFiles.sh -project="<full-path-to-the-project-root-folder>/<project-name>.uproject" -game -engine
Build project in the in-editor configuration
$ cd <project-root-folder>
$ make <project-name>Editor
Now you can launch the editor.
#### Windows
Usually double-clicking the .uproject file triggers a recompile.
To build from Visual Studio, right-click the project file and select "Generate
Visual Studio Files". Open the generated solution (.sln) and compile. You can
change the build configuration to development/debug both in-editor and
standalone game.

View File

@ -127,7 +127,12 @@ public class Carla : ModuleRules
{
if (Target.Platform == UnrealTargetPlatform.Linux)
{
PublicAdditionalLibraries.Add("turbojpeg");
string TurboJPEGLibPath = System.Environment.GetEnvironmentVariable("TURBOJPEG_LIB_PATH");
if (string.IsNullOrEmpty(TurboJPEGLibPath) || !System.IO.Directory.Exists(TurboJPEGLibPath))
{
throw new System.Exception("TURBOJPEG_LIB_PATH is not defined, or points to a non-existant directory, please set this environment variable.");
}
PublicAdditionalLibraries.Add(Path.Combine(TurboJPEGLibPath, "libturbojpeg.a"));
}
}

View File

@ -90,8 +90,12 @@ endif (UNIX)
if (UNIX)
set(TurboJPEG_LIBRARIES ${TurboJPEG_LIBRARIES} turbojpeg)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_TURBOJPEG")
if (EXISTS $ENV{TURBOJPEG_LIB_PATH})
set(TurboJPEG_LIBRARIES ${TurboJPEG_LIBRARIES} $ENV{TURBOJPEG_LIB_PATH}/libturbojpeg.a)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_TURBOJPEG")
else (EXISTS $ENV{TURBOJPEG_LIB_PATH})
message(FATAL_ERROR "TURBOJPEG_LIB_PATH is not defined, or points to a non-existant directory, please set this environment variable.")
endif (EXISTS $ENV{TURBOJPEG_LIB_PATH})
elseif (WIN32)

View File

@ -12,19 +12,27 @@ Install boost, protobuf, cmake and ninja.
$ sudo apt-get install libprotobuf-dev protobuf-compiler libboost-all-dev cmake ninja-build
Run make
$ make
Requires to manually compile
[TurboJPEG](https://github.com/libjpeg-turbo/libjpeg-turbo).
Follow the instructions
[here](https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md).
At the configure step add PIC compile option
[here](https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md),
but at the configure step make sure to use the compile option -fPIC otherwise
Unreal is not able to link
$ {source_directory}/configure CFLAGS='-fPIC'
$ make
Most probably libraries are generated under `.lib` folder.
Set the environment variable `TURBOJPEG_LIB_PATH` to a folder containing the
generated `libturbojpeg.a` (e.g., add
`export TURBOJPEG_LIB_PATH=<path-to-the-folder>` to your `~/.bashrc`). This way
we can find the right version of the library from Unreal Build Tool.
Back to CarlaServer folder, run make
$ make
#### Windows
Note: JPEG compression is not implemented on Windows, the server won't send any