-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build warnings for 4.18, add a build script to test compatibility.
- Loading branch information
Showing
9 changed files
with
165 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,116 @@ | ||
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. | ||
using System.IO; | ||
using System.Collections.Generic; | ||
|
||
// An engine version independent configuration class | ||
public class UnrealcvBuildConfig | ||
{ | ||
public List<string> PrivateIncludePaths = new List<string>(); | ||
public List<string> PublicIncludePaths = new List<string>(); | ||
public List<string> PublicDependencyModuleNames = new List<string>(); | ||
public List<string> EditorPrivateDependencyModuleNames = new List<string>(); | ||
public List<string> DynamicallyLoadedModuleNames = new List<string>(); | ||
|
||
public UnrealcvBuildConfig(string EnginePath) | ||
{ | ||
PublicIncludePaths.AddRange( | ||
new string[] | ||
{ | ||
EnginePath + "Source/Runtime/Launch/Resources", | ||
// To get Unreal Engine minor version | ||
} | ||
); | ||
|
||
PrivateIncludePaths.AddRange( | ||
new string[] { | ||
"UnrealCV/Private/Commands", | ||
"UnrealCV/Private/libs", // For 3rd-party libs | ||
} | ||
); | ||
|
||
PublicDependencyModuleNames.AddRange(new string[] { | ||
"Core", | ||
"CoreUObject", | ||
"Engine", | ||
"InputCore", | ||
"RenderCore", | ||
"Networking", | ||
"Sockets", | ||
"Slate", | ||
"ImageWrapper", | ||
"CinematicCamera", | ||
"Projects", // Support IPluginManager | ||
}); | ||
|
||
EditorPrivateDependencyModuleNames.AddRange( | ||
new string[] | ||
{ | ||
"UnrealEd", // To support GetGameWorld | ||
// This is only available for Editor build | ||
} | ||
); | ||
|
||
DynamicallyLoadedModuleNames.AddRange( | ||
new string[] | ||
{ | ||
"Renderer" | ||
} | ||
); | ||
} | ||
} | ||
|
||
#if WITH_FORWARDED_MODULE_RULES_CTOR | ||
namespace UnrealBuildTool.Rules | ||
{ | ||
public class UnrealCV: ModuleRules | ||
{ | ||
#if WITH_FORWARDED_MODULE_RULES_CTOR | ||
// ReadOnlyTargetRules for version > 4.15 | ||
public UnrealCV(ReadOnlyTargetRules Target) : base(Target) | ||
// 4.16 or better | ||
{ | ||
bEnforceIWYU = false; | ||
#else | ||
public UnrealCV(TargetInfo Target) //4.15 or lower | ||
{ | ||
#endif | ||
// This trick is from https://answers.unrealengine.com/questions/258689/how-to-include-private-header-files-of-other-modul.html | ||
string EnginePath = Path.GetFullPath(BuildConfiguration.RelativeEnginePath); | ||
|
||
PublicIncludePaths.AddRange( | ||
new string[] | ||
{ | ||
EnginePath + "Source/Runtime/Launch/Resources", | ||
// To get Unreal Engine minor version | ||
} | ||
); | ||
|
||
PrivateIncludePaths.AddRange( | ||
new string[] { | ||
"UnrealCV/Private/Commands", | ||
"UnrealCV/Private/libs", // For 3rd-party libs | ||
} | ||
); | ||
// This trick is from https://answers.unrealengine.com/questions/258689/how-to-include-private-header-files-of-other-modul.html | ||
// string EnginePath = Path.GetFullPath(BuildConfigurationTarget.RelativeEnginePath); | ||
string EnginePath = Path.GetFullPath(Target.RelativeEnginePath); | ||
UnrealcvBuildConfig BuildConfig = new UnrealcvBuildConfig(EnginePath); | ||
|
||
PublicDependencyModuleNames.AddRange(new string[] { | ||
"Core", | ||
"CoreUObject", | ||
"Engine", | ||
"InputCore", | ||
"RenderCore", | ||
"Networking", | ||
"Sockets", | ||
"Slate", | ||
"ImageWrapper", | ||
"CinematicCamera", | ||
"Projects", // Support IPluginManager | ||
}); | ||
PublicIncludePaths = BuildConfig.PublicIncludePaths; | ||
PrivateIncludePaths = BuildConfig.PrivateIncludePaths; | ||
PublicDependencyModuleNames = BuildConfig.PublicDependencyModuleNames; | ||
DynamicallyLoadedModuleNames = BuildConfig.DynamicallyLoadedModuleNames; | ||
|
||
// PrivateDependency only available in Private folder | ||
// Reference: https://answers.unrealengine.com/questions/23384/what-is-the-difference-between-publicdependencymod.html | ||
if (UEBuildConfiguration.bBuildEditor == true) | ||
// if (UEBuildConfiguration.bBuildEditor == true) | ||
if (Target.bBuildEditor == true) | ||
{ | ||
PrivateDependencyModuleNames.AddRange( | ||
new string[] | ||
{ | ||
"UnrealEd", // To support GetGameWorld | ||
} | ||
); | ||
PrivateDependencyModuleNames = BuildConfig.EditorPrivateDependencyModuleNames; | ||
} | ||
} | ||
} | ||
} | ||
|
||
#else //4.15 or lower, for backward compatibility | ||
namespace UnrealBuildTool.Rules | ||
{ | ||
public class UnrealCV: ModuleRules | ||
{ | ||
public UnrealCV(TargetInfo Target) | ||
{ | ||
string EnginePath = Path.GetFullPath(BuildConfiguration.RelativeEnginePath); | ||
UnrealcvBuildConfig BuildConfig = new UnrealcvBuildConfig(EnginePath); | ||
|
||
DynamicallyLoadedModuleNames.AddRange( | ||
new string[] | ||
{ | ||
"Renderer" | ||
} | ||
); | ||
PublicIncludePaths = BuildConfig.PublicIncludePaths; | ||
PrivateIncludePaths = BuildConfig.PrivateIncludePaths; | ||
PublicDependencyModuleNames = BuildConfig.PublicDependencyModuleNames; | ||
DynamicallyLoadedModuleNames = BuildConfig.DynamicallyLoadedModuleNames; | ||
|
||
if (UEBuildConfiguration.bBuildEditor == true) | ||
{ | ||
PrivateDependencyModuleNames = BuildConfig.EditorPrivateDependencyModuleNames; | ||
} | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Build UnrealCV against different UE4 version to check compatibility | ||
import subprocess, os, sys | ||
|
||
def format_cmd(UE4, output_folder): | ||
cmd = [ | ||
'python', | ||
'build.py', | ||
'--UE4', | ||
UE4, | ||
'--output', | ||
output_folder, | ||
] | ||
return cmd | ||
|
||
UE414 = [r'C:\Program Files\Epic Games\UE_4.14', r'C:/temp/unrealcv_built/414', 'log/UE414.log'] | ||
UE416 = [r'C:\Program Files\Epic Games\UE_4.16', r'C:/temp/unrealcv_built/416', 'log/UE416.log'] | ||
UE418 = [r'C:\Program Files\Epic Games\UE_4.18', r'C:/temp/unrealcv_built/418', 'log/UE418.log'] | ||
# Send the output to C:/temp to avoid cluttering current directory, which might cause failure to the build. | ||
|
||
ue_versions = [UE414, UE416, UE418] | ||
|
||
if not os.path.isdir('log'): | ||
os.mkdir('log') | ||
|
||
for ue4 in ue_versions: | ||
print('-' * 80) | ||
print('Run configuration', ue4) | ||
log_filename = ue4[2] | ||
if os.path.isfile(log_filename): | ||
print('Skip because log exists') | ||
continue | ||
cmd = format_cmd(ue4[0], ue4[1]) | ||
|
||
logfile = open(log_filename, 'wb') | ||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
for line in proc.stdout: | ||
sys.stdout.buffer.write(line) | ||
sys.stdout.flush() | ||
# see, https://stackoverflow.com/questions/908331/how-to-write-binary-data-in-stdout-in-python-3 | ||
logfile.write(line) | ||
proc.wait() | ||
# with open(log_filename, 'w') as f: | ||
# subprocess.call(cmd, stdout = f, stderr = f) |