Skip to content

Commit

Permalink
switch to Unreal 4.16
Browse files Browse the repository at this point in the history
  • Loading branch information
sytelus committed Jul 26, 2017
1 parent abd07f8 commit 2bf1180
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Unreal/Environments/Blocks/Blocks.uproject
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"Enabled": true
}
],
"EngineAssociation": "4.15"
"EngineAssociation": "4.16"
}
25 changes: 25 additions & 0 deletions Unreal/Environments/Blocks/Source/Blocks.Target.4.15.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;

public class BlocksTarget : TargetRules
{
public BlocksTarget(TargetInfo Target)
{
Type = TargetType.Game;
}

//
// TargetRules interface.
//

public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.Add("Blocks");
}
}
13 changes: 0 additions & 13 deletions Unreal/Environments/Blocks/Source/Blocks.Target.4.16.cs

This file was deleted.

16 changes: 2 additions & 14 deletions Unreal/Environments/Blocks/Source/Blocks.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,9 @@

public class BlocksTarget : TargetRules
{
public BlocksTarget(TargetInfo Target)
public BlocksTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
}

//
// TargetRules interface.
//

public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.Add("Blocks");
ExtraModuleNames.AddRange(new string[] { "Blocks" });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class Blocks : ModuleRules
{
public Blocks(ReadOnlyTargetRules Target) : base(Target)
public Blocks(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
}
Expand Down
2 changes: 1 addition & 1 deletion Unreal/Environments/Blocks/Source/Blocks/Blocks.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class Blocks : ModuleRules
{
public Blocks(TargetInfo Target)
public Blocks(ReadOnlyTargetRules Target) : base(Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
}
Expand Down
25 changes: 25 additions & 0 deletions Unreal/Environments/Blocks/Source/BlocksEditor.Target.4.15.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;

public class BlocksEditorTarget : TargetRules
{
public BlocksEditorTarget(TargetInfo Target)
{
Type = TargetType.Editor;
}

//
// TargetRules interface.
//

public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.Add("Blocks");
}
}
13 changes: 0 additions & 13 deletions Unreal/Environments/Blocks/Source/BlocksEditor.Target.4.16.cs

This file was deleted.

16 changes: 2 additions & 14 deletions Unreal/Environments/Blocks/Source/BlocksEditor.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,9 @@

public class BlocksEditorTarget : TargetRules
{
public BlocksEditorTarget(TargetInfo Target)
public BlocksEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
}

//
// TargetRules interface.
//

public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
OutExtraModuleNames.Add("Blocks");
ExtraModuleNames.AddRange(new string[] { "Blocks" });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private enum CompileMode
CppCompileWithRpc
}

private void SetupCompileMode(CompileMode mode, ReadOnlyTargetRules Target)
private void SetupCompileMode(CompileMode mode, TargetInfo Target)
{
LoadAirSimDependency(Target, "MavLinkCom", "MavLinkCom");

Expand All @@ -47,6 +47,7 @@ private void SetupCompileMode(CompileMode mode, ReadOnlyTargetRules Target)
Definitions.Add("AIRLIB_NO_RPC=1");
break;
case CompileMode.CppCompileWithRpc:
LoadAirSimDependency(Target, "MavLinkCom", "MavLinkCom");
LoadAirSimDependency(Target, "rpclib", "rpc");
break;
default:
Expand All @@ -55,11 +56,10 @@ private void SetupCompileMode(CompileMode mode, ReadOnlyTargetRules Target)

}

public AirSim(ReadOnlyTargetRules Target) : base(Target)
public AirSim(TargetInfo Target)
{
//bEnforceIWYU = true; //to support 4.16
bEnforceIWYU = false;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
//below is no longer supported in 4.16
bEnableExceptions = true;

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "RenderCore", "RHI" });
Expand All @@ -73,10 +73,10 @@ public AirSim(ReadOnlyTargetRules Target) : base(Target)
PrivateIncludePaths.Add(Path.Combine(AirSimPath, "deps", "eigen3"));
AddOSLibDependencies(Target);

SetupCompileMode(CompileMode.CppCompileWithRpc, Target);
SetupCompileMode(CompileMode.HeaderOnlyWithRpc, Target);
}

private void AddOSLibDependencies(ReadOnlyTargetRules Target)
private void AddOSLibDependencies(TargetInfo Target)
{
if (Target.Platform == UnrealTargetPlatform.Win64)
{
Expand All @@ -92,13 +92,13 @@ private void AddOSLibDependencies(ReadOnlyTargetRules Target)
}
}

private bool LoadAirSimDependency(ReadOnlyTargetRules Target, string LibName, string LibFileName)
private bool LoadAirSimDependency(TargetInfo Target, string LibName, string LibFileName)
{
string LibrariesPath = Path.Combine(AirSimPath, "deps", LibName, "lib");
return AddLibDependency(LibName, LibrariesPath, LibFileName, Target, true);
}

private bool AddLibDependency(string LibName, string LibPath, string LibFileName, ReadOnlyTargetRules Target, bool IsAddLibInclude)
private bool AddLibDependency(string LibName, string LibPath, string LibFileName, TargetInfo Target, bool IsAddLibInclude)
{
string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac) ? "x64" : "x86";
string ConfigurationString = (Target.Configuration == UnrealTargetConfiguration.Debug) ? "Debug" : "Release";
Expand All @@ -108,7 +108,6 @@ private bool AddLibDependency(string LibName, string LibPath, string LibFileName
if (Target.Platform == UnrealTargetPlatform.Win64)
{
isLibrarySupported = true;

PublicAdditionalLibraries.Add(Path.Combine(LibPath, PlatformString, ConfigurationString, LibFileName + ".lib"));
} else if (Target.Platform == UnrealTargetPlatform.Linux || Target.Platform == UnrealTargetPlatform.Mac) {
isLibrarySupported = true;
Expand Down
17 changes: 9 additions & 8 deletions Unreal/Plugins/AirSim/Source/AirSim.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private enum CompileMode
CppCompileWithRpc
}

private void SetupCompileMode(CompileMode mode, TargetInfo Target)
private void SetupCompileMode(CompileMode mode, ReadOnlyTargetRules Target)
{
LoadAirSimDependency(Target, "MavLinkCom", "MavLinkCom");

Expand All @@ -47,7 +47,6 @@ private void SetupCompileMode(CompileMode mode, TargetInfo Target)
Definitions.Add("AIRLIB_NO_RPC=1");
break;
case CompileMode.CppCompileWithRpc:
LoadAirSimDependency(Target, "MavLinkCom", "MavLinkCom");
LoadAirSimDependency(Target, "rpclib", "rpc");
break;
default:
Expand All @@ -56,10 +55,11 @@ private void SetupCompileMode(CompileMode mode, TargetInfo Target)

}

public AirSim(TargetInfo Target)
public AirSim(ReadOnlyTargetRules Target) : base(Target)
{
bEnforceIWYU = false;
//bEnforceIWYU = true; //to support 4.16
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
//below is no longer supported in 4.16
bEnableExceptions = true;

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "RenderCore", "RHI" });
Expand All @@ -73,10 +73,10 @@ public AirSim(TargetInfo Target)
PrivateIncludePaths.Add(Path.Combine(AirSimPath, "deps", "eigen3"));
AddOSLibDependencies(Target);

SetupCompileMode(CompileMode.HeaderOnlyWithRpc, Target);
SetupCompileMode(CompileMode.CppCompileWithRpc, Target);
}

private void AddOSLibDependencies(TargetInfo Target)
private void AddOSLibDependencies(ReadOnlyTargetRules Target)
{
if (Target.Platform == UnrealTargetPlatform.Win64)
{
Expand All @@ -92,13 +92,13 @@ private void AddOSLibDependencies(TargetInfo Target)
}
}

private bool LoadAirSimDependency(TargetInfo Target, string LibName, string LibFileName)
private bool LoadAirSimDependency(ReadOnlyTargetRules Target, string LibName, string LibFileName)
{
string LibrariesPath = Path.Combine(AirSimPath, "deps", LibName, "lib");
return AddLibDependency(LibName, LibrariesPath, LibFileName, Target, true);
}

private bool AddLibDependency(string LibName, string LibPath, string LibFileName, TargetInfo Target, bool IsAddLibInclude)
private bool AddLibDependency(string LibName, string LibPath, string LibFileName, ReadOnlyTargetRules Target, bool IsAddLibInclude)
{
string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Mac) ? "x64" : "x86";
string ConfigurationString = (Target.Configuration == UnrealTargetConfiguration.Debug) ? "Debug" : "Release";
Expand All @@ -108,6 +108,7 @@ private bool AddLibDependency(string LibName, string LibPath, string LibFileName
if (Target.Platform == UnrealTargetPlatform.Win64)
{
isLibrarySupported = true;

PublicAdditionalLibraries.Add(Path.Combine(LibPath, PlatformString, ConfigurationString, LibFileName + ".lib"));
} else if (Target.Platform == UnrealTargetPlatform.Linux || Target.Platform == UnrealTargetPlatform.Mac) {
isLibrarySupported = true;
Expand Down
11 changes: 3 additions & 8 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@
**Make sure you have read the [prerequisites](prereq.md).**

## Install Unreal Engine
1. Download the Unreal 4 engine from [unreal.com](https://www.unrealengine.com/dashboard). While the Unreal Engine is open source, cross platform and free to download, registration is still required as of this writing.
You need version 4.15. To get version 4.15 you may need to expand "Add versions" as shown below:
1. Download Epic Games Launcher from [unreal.com](https://www.unrealengine.com/download). While the Unreal Engine is open source, cross platform and free to download, registration is still required. Run Epic Games Launcher, switch to Library tab on the left, click on the "Add Versions" which should show the option to download Unreal 4.16 as shown below.

![Unreal Versions](images/unreal_versions.png)
**Note**: Older versions of Unreal is not supported. Some tips to upgrade your projects can be found [here](unreal_upgrade.md).

**Note for 4.14 users**: If you had been using 4.14 or lower version with AirSim then upgrade is [simple and straight forward](unreal_upgrade.md).
![Unreal Versions](images/unreal_versions.png)

2. After the download, run the Epic Game Launcher and click the big yellow "Install" button under the Unreal Engine tab.

![Epic launcher install](images/epic_launcher_install.png).

## Get the Code and Build

### Windows
Expand Down
Binary file modified docs/images/unreal_versions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/linux_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Our current recommanded and tested environment is **Ubuntu 16.04 LTS**. Theorati
It's super simple 1-2-3!

1. Make sure you are [registered with Epic Games](https://docs.unrealengine.com/latest/INT/Platforms/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow/1/index.html). This is required so you can get Unreal engine's source code.
2. Clone Unreal in your favorite folder and run setup.sh (this may take a while!)
2. Clone Unreal in your favorite folder and run setup.sh (this may take a while!). Note: We only support Unreal 4.16 and newer.
```
mkdir -p GitHubSrc && cd GitHubSrc
git clone -b 4.15 https://github.com/EpicGames/UnrealEngine.git
git clone -b 4.16 https://github.com/EpicGames/UnrealEngine.git
cd UnrealEngine
./Setup.sh
./GenerateProjectFiles.sh
Expand Down Expand Up @@ -57,7 +57,7 @@ You can use Qt or CodeLite. Instructions for Qt Creator is [available here](http
Yes, you can but we haven't tested it. You can find [instructions here](https://docs.unrealengine.com/latest/INT/Platforms/Linux/GettingStarted/index.html).

#### What compiler and stdlib AirSim uses?
We use same compiler that Unreal uses which is Clang 3.9 for Unreal 4.15 nd Clang 4.0 for Unreal 4.16. AirSim's `setup.sh` will automatically download Clang 3.9. We also need to use libc++ that Unreal uses. The libc++ code is cloned by AirSim's `setup.sh` in to `llvm-source` folder and built in `llvm-build` folder. The cmake is the instructed to use libc++ from `llvm-build` folder. For other flavors of Linux and more info, please see [http://apt.llvm.org/](http://apt.llvm.org/).
We use same compiler that Unreal uses which is Clang 3.9. AirSim's `setup.sh` will automatically download Clang 3.9. We also need to use libc++ that Unreal uses. The libc++ code is cloned by AirSim's `setup.sh` in to `llvm-source` folder and built in `llvm-build` folder. The cmake is the instructed to use libc++ from `llvm-build` folder. For other flavors of Linux and more info, please see [http://apt.llvm.org/](http://apt.llvm.org/).

#### Can use AirSim with Unreal 4.16?
Yes! The `*.Build.cs` files are, however, no longer compatible (you will get compile error). You can find files for 4.16 as `*.Build.4.16.cs` so just rename those.
Expand Down
4 changes: 2 additions & 2 deletions docs/unreal_custenv.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This page contains the complete instructions start to finish for setting up a free downloadable unreal environment
with AirSim. This document goes with the [Unreal AirSim Setup Video](https://youtu.be/1oY8Qu5maQQ).

First, make sure Unreal 4.15 is installed as per [build instructions](build.md) then make sure the 4.15 version
First, make sure Unreal is installed as per [build instructions](build.md) then make sure the 4.16 version
is set as the `current` version in the Epic Games Launcher, like this:

![current version](images/current_version.png)
Expand Down Expand Up @@ -50,7 +50,7 @@ Now edit the `LandscapeMountains.uproject` so that it looks like this
````
{
"FileVersion": 3,
"EngineAssociation": "4.15",
"EngineAssociation": "4.16",
"Category": "Samples",
"Description": "",
"Modules": [
Expand Down
35 changes: 26 additions & 9 deletions docs/unreal_upgrade.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@

# Upgrading Unreal Engine Version
# Upgrading to Unreal 4.16

If you are using old version of AirSim with Unreal Engine 4.15 or earlier, here are some notes. More complete details are at [Unreal forum post](https://forums.unrealengine.com/showthread.php?145757-C-4-16-Transition-Guide).

**Note:** If you are using Blocks project that comes with AirSim then you don't need to do anything other than [installling Unreal 4.16](build.md).

If you have your own Unreal project using AirSim plugin then you need to upgrade your project to use Unreal 4.16. If your project doesn't have any code or assets other than environment you downloaded then you can also simply [recreate the project in Unreal 4.16 Editor](unreal_custenv.md) and then copy Plugins folder from `AirSim/Unreal/Plugins`. Alternativly, follow below instructions.

Unreal 4.16 Build system has breaking changes. So you need to modify your *.Build.cs and *.Target.cs which you can find in `Source` folder of your Unreal project. So what are those changes? Below is the gist of it but you should really refer to [Unreal's official 4.16 transition post](https://forums.unrealengine.com/showthread.php?145757-C-4-16-Transition-Guide).

### In your project's *.Target.cs
1. Change the contructor from, `public MyProjectTarget(TargetInfo Target)` to `public MyProjectTarget(TargetInfo Target) : base(Target)`

2. Remove `SetupBinaries` method if you have one and instead add following line in contructor above: `ExtraModuleNames.AddRange(new string[] { "MyProject" });`

### In your project's *.Build.cs
Change the constructor from `public MyProject(TargetInfo Target)` to `public MyProject(ReadOnlyTargetRules Target) : base(Target)`.

If you are using old version of AirSim with Unreal Engine 4.14 or earlier, please use below steps to upgrade to 4.15.
### In your *.uproject
Remove line for `EngineAssociation`

1. Windows + S and type Epic Games Launcher.
2. Switch to Library tab on the right.
3. Click on Add Version in Engine Versions section and select 4.15.
4. Click on Install. This would typically take few minutes because of large download.
5. Once install is complete, Launch button will appear. Click on it to launch UE Editor.
6. In UE Editor you should see your Unreal project bit greyed out. If you don't then use the browse button to navigate to your .uproject file.
7. Double click on the project. A warning might appear saying that there might be incompatibility. The warning box might show only "Open Copy" button. Don't click that. Instead click on More Options which will reveal more buttons. Choose Convert-In-Place option. Causion: Always keep backup of your project first!
8. If you don't have anything nasty, in place conversion should go through and you are now on new version of Unreal!
### And finally...
1. Make sure [Unreal 4.16 is installed](build,md).
2. Double click on your project's `*.uproject` file.
3. If you are asked to select Unreal version, select 4.16.
4. The warning box might show only "Open Copy" button. Don't click that. Instead click on More Options which will reveal more buttons. Choose Convert-In-Place option. Causion: Always keep backup of your project first!
5. If you don't have anything nasty, in place conversion should go through and you are now on new version of Unreal!

0 comments on commit 2bf1180

Please sign in to comment.