Skip to content

Commit 0762b9a

Browse files
Mobu LiveLink 2.5
- Pushing Mobu LiveLink plugin version 2.5 matching UE4.27 release.
1 parent 6b98b37 commit 0762b9a

13 files changed

+2205
-1680
lines changed
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
// Copyright Epic Games, Inc. All Rights Reserved.
2-
3-
using UnrealBuildTool;
4-
using System.Collections.Generic;
5-
using System.IO;
6-
7-
public class MobuLiveLinkPlugin2016Target : MobuLiveLinkPluginTargetBase
8-
{
9-
public MobuLiveLinkPlugin2016Target(TargetInfo Target) : base(Target, "2016")
10-
{}
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
using UnrealBuildTool;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
7+
public class MobuLiveLinkPlugin2016Target : MobuLiveLinkPluginTargetBase
8+
{
9+
public MobuLiveLinkPlugin2016Target(TargetInfo Target) : base(Target, "2016")
10+
{
11+
//Mobu is not strict c++ compliant before Mobu 2019
12+
WindowsPlatform.bStrictConformanceMode = false;
13+
}
1114
}
Lines changed: 77 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,77 @@
1-
// Copyright Epic Games, Inc. All Rights Reserved.
2-
3-
using UnrealBuildTool;
4-
using System.IO;
5-
6-
public abstract class MobuLiveLinkPluginBase : ModuleRules
7-
{
8-
public MobuLiveLinkPluginBase(ReadOnlyTargetRules Target, string MobuVersionString) : base(Target)
9-
{
10-
PrivatePCHHeaderFile = "Private/MobuLiveLinkPluginPrivatePCH.h";
11-
12-
bEnforceIWYU = false;
13-
bUseRTTI = true;
14-
15-
PrivateIncludePaths.AddRange(new string[]
16-
{
17-
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Public"),
18-
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Private"),
19-
Path.Combine(ModuleDirectory, "StreamObjects/Public")
20-
});
21-
22-
// Unreal dependency modules
23-
PrivateDependencyModuleNames.AddRange(new string[]
24-
{
25-
"Core",
26-
"CoreUObject",
27-
"ApplicationCore",
28-
"Projects",
29-
"UdpMessaging",
30-
"LiveLinkInterface",
31-
"LiveLinkMessageBusFramework",
32-
});
33-
34-
// Mobu SDK setup
35-
{
36-
//UE_MOTIONBUILDER2017_INSTALLATIONFOLDER
37-
string MobuInstallFolder = System.Environment.GetEnvironmentVariable("UE_MOTIONBUILDER" + MobuVersionString + "_INSTALLATIONFOLDER");
38-
if (string.IsNullOrEmpty(MobuInstallFolder))
39-
{
40-
MobuInstallFolder = @"C:\Program Files\Autodesk\MotionBuilder " + MobuVersionString;
41-
}
42-
MobuInstallFolder = Path.Combine(MobuInstallFolder, "OpenRealitySDK");
43-
44-
if (!Directory.Exists(MobuInstallFolder))
45-
{
46-
// Try with build machine setup
47-
string SDKRootEnvVar = System.Environment.GetEnvironmentVariable("UE_SDKS_ROOT");
48-
if (!string.IsNullOrEmpty(SDKRootEnvVar))
49-
{
50-
MobuInstallFolder = Path.Combine(SDKRootEnvVar, "HostWin64", "Win64", "MotionBuilder", MobuVersionString);
51-
}
52-
}
53-
54-
// Make sure this version of Mobu is actually installed
55-
if (Directory.Exists(MobuInstallFolder))
56-
{
57-
PrivateIncludePaths.Add(Path.Combine(MobuInstallFolder, "include"));
58-
59-
if (Target.Platform == UnrealTargetPlatform.Win64) // @todo: Support other platforms?
60-
{
61-
string LibDir = Path.Combine(MobuInstallFolder, "lib/x64");
62-
63-
// Mobu library we're depending on
64-
PublicAdditionalLibraries.Add(Path.Combine(LibDir, "fbsdk.lib"));
65-
}
66-
}
67-
}
68-
}
69-
}
70-
71-
public class MobuLiveLinkPlugin2017 : MobuLiveLinkPluginBase
72-
{
73-
public MobuLiveLinkPlugin2017(ReadOnlyTargetRules Target) : base(Target, "2017")
74-
{
75-
}
76-
}
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
using UnrealBuildTool;
4+
using System.IO;
5+
6+
public abstract class MobuLiveLinkPluginBase : ModuleRules
7+
{
8+
public MobuLiveLinkPluginBase(ReadOnlyTargetRules Target, string MobuVersionString) : base(Target)
9+
{
10+
PrivatePCHHeaderFile = "Private/MobuLiveLinkPluginPrivatePCH.h";
11+
12+
bEnforceIWYU = false;
13+
bUseRTTI = true;
14+
15+
PrivateIncludePaths.AddRange(new string[]
16+
{
17+
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Public"),
18+
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Private"),
19+
Path.Combine(ModuleDirectory, "StreamObjects/Public"),
20+
});
21+
22+
// Unreal dependency modules
23+
PrivateDependencyModuleNames.AddRange(new string[]
24+
{
25+
"Core",
26+
"CoreUObject",
27+
"ApplicationCore",
28+
"Messaging",
29+
"Projects",
30+
"UdpMessaging",
31+
"LiveLinkInterface",
32+
"LiveLinkMessageBusFramework",
33+
});
34+
35+
// Mobu SDK setup
36+
{
37+
//UE_MOTIONBUILDER2017_INSTALLATIONFOLDER
38+
string MobuInstallFolder = System.Environment.GetEnvironmentVariable("UE_MOTIONBUILDER" + MobuVersionString + "_INSTALLATIONFOLDER");
39+
if (string.IsNullOrEmpty(MobuInstallFolder))
40+
{
41+
MobuInstallFolder = @"C:\Program Files\Autodesk\MotionBuilder " + MobuVersionString;
42+
}
43+
MobuInstallFolder = Path.Combine(MobuInstallFolder, "OpenRealitySDK");
44+
45+
if (!Directory.Exists(MobuInstallFolder))
46+
{
47+
// Try with build machine setup
48+
string SDKRootEnvVar = System.Environment.GetEnvironmentVariable("UE_SDKS_ROOT");
49+
if (!string.IsNullOrEmpty(SDKRootEnvVar))
50+
{
51+
MobuInstallFolder = Path.Combine(SDKRootEnvVar, "HostWin64", "Win64", "MotionBuilder", MobuVersionString);
52+
}
53+
}
54+
55+
// Make sure this version of Mobu is actually installed
56+
if (Directory.Exists(MobuInstallFolder))
57+
{
58+
PrivateIncludePaths.Add(Path.Combine(MobuInstallFolder, "include"));
59+
60+
if (Target.Platform == UnrealTargetPlatform.Win64) // @todo: Support other platforms?
61+
{
62+
string LibDir = Path.Combine(MobuInstallFolder, "lib/x64");
63+
64+
// Mobu library we're depending on
65+
PublicAdditionalLibraries.Add(Path.Combine(LibDir, "fbsdk.lib"));
66+
}
67+
}
68+
}
69+
}
70+
}
71+
72+
public class MobuLiveLinkPlugin2017 : MobuLiveLinkPluginBase
73+
{
74+
public MobuLiveLinkPlugin2017(ReadOnlyTargetRules Target) : base(Target, "2017")
75+
{
76+
}
77+
}
Lines changed: 116 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,116 @@
1-
// Copyright Epic Games, Inc. All Rights Reserved.
2-
3-
using UnrealBuildTool;
4-
using System.Collections.Generic;
5-
using System.IO;
6-
7-
public abstract class MobuLiveLinkPluginTargetBase : TargetRules
8-
{
9-
public MobuLiveLinkPluginTargetBase(TargetInfo Target, string InMobuVersionString) : base(Target)
10-
{
11-
Type = TargetType.Program;
12-
13-
bShouldCompileAsDLL = true;
14-
LinkType = TargetLinkType.Monolithic;
15-
SolutionDirectory = "Programs/LiveLink";
16-
17-
bool bIsNotForLicensees = false;
18-
string NotForLicenseesFolder = bIsNotForLicensees ? "NotForLicensees" : "";
19-
20-
ExeBinariesSubFolder = Path.Combine(NotForLicenseesFolder, "MotionBuilder", InMobuVersionString);
21-
LaunchModuleName = "MobuLiveLinkPlugin" + InMobuVersionString;
22-
23-
// We only need minimal use of the engine for this plugin
24-
bBuildDeveloperTools = false;
25-
bUseMallocProfiler = false;
26-
bBuildWithEditorOnlyData = true;
27-
bCompileAgainstEngine = false;
28-
bCompileAgainstCoreUObject = true;
29-
bCompileICU = false;
30-
bHasExports = false;
31-
32-
string ResourcesFolder = Path.GetFullPath(Path.Combine("Programs", NotForLicenseesFolder, "MobuLiveLink/Resources"));
33-
string BinariesDirectory = Path.GetFullPath(Path.Combine("../Binaries", "Win64", NotForLicenseesFolder, "MotionBuilder", InMobuVersionString));
34-
PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", ResourcesFolder, BinariesDirectory));
35-
PostBuildSteps.Add(string.Format("copy /a /b /y /v \"{0}\\*.*\" \"{1}\" 1>nul", ResourcesFolder, BinariesDirectory));
36-
}
37-
}
38-
39-
public class MobuLiveLinkPlugin2017Target : MobuLiveLinkPluginTargetBase
40-
{
41-
public MobuLiveLinkPlugin2017Target(TargetInfo Target) : base(Target, "2017")
42-
{ }
43-
}
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
using UnrealBuildTool;
4+
using System;
5+
using System.IO;
6+
using Tools.DotNETCommon;
7+
using System.Runtime.CompilerServices;
8+
9+
[SupportedPlatforms(UnrealPlatformClass.Desktop)]
10+
public abstract class MobuLiveLinkPluginTargetBase : TargetRules
11+
{
12+
/// <summary>
13+
/// Finds the innermost parent directory with the provided name. Search is case insensitive.
14+
/// </summary>
15+
string InnermostParentDirectoryPathWithName(string ParentName, string CurrentPath)
16+
{
17+
DirectoryInfo ParentInfo = Directory.GetParent(CurrentPath);
18+
19+
if (ParentInfo == null)
20+
{
21+
throw new DirectoryNotFoundException("Could not find parent folder '" + ParentName + "'");
22+
}
23+
24+
// Case-insensitive check of the parent folder name.
25+
if (ParentInfo.Name.ToLower() == ParentName.ToLower())
26+
{
27+
return ParentInfo.ToString();
28+
}
29+
30+
return InnermostParentDirectoryPathWithName(ParentName, ParentInfo.ToString());
31+
}
32+
33+
/// <summary>
34+
/// Returns the path to this .cs file.
35+
/// </summary>
36+
string GetCallerFilePath([CallerFilePath] string CallerFilePath = "")
37+
{
38+
if (CallerFilePath.Length == 0)
39+
{
40+
throw new FileNotFoundException("Could not find the path of our .cs file");
41+
}
42+
43+
return CallerFilePath;
44+
}
45+
46+
public MobuLiveLinkPluginTargetBase(TargetInfo Target, string InMobuVersionString) : base(Target)
47+
{
48+
Type = TargetType.Program;
49+
50+
bShouldCompileAsDLL = true;
51+
LinkType = TargetLinkType.Monolithic;
52+
SolutionDirectory = "Programs/LiveLink";
53+
LaunchModuleName = "MobuLiveLinkPlugin" + InMobuVersionString;
54+
55+
// We only need minimal use of the engine for this plugin
56+
bBuildDeveloperTools = false;
57+
bUseMallocProfiler = false;
58+
bBuildWithEditorOnlyData = true;
59+
bCompileAgainstEngine = false;
60+
bCompileAgainstCoreUObject = true;
61+
bCompileICU = false;
62+
bHasExports = false;
63+
64+
// This .cs file must be inside the source folder of this Program. We later use this to find other key directories.
65+
string TargetFilePath = GetCallerFilePath();
66+
67+
// We need to avoid failing to load DLL due to looking for EngineDir() in non-existent folders.
68+
// By having it build in the same directory as the engine, it will assume the engine is in the same directory
69+
// as the program, and because this folder always exists, it will not fail the check inside EngineDir().
70+
71+
// Because this is a Program, we assume that this target file resides under a "Programs" folder.
72+
string ProgramsDir = InnermostParentDirectoryPathWithName("Programs", TargetFilePath);
73+
74+
// We assume this Program resides under a Source folder.
75+
string SourceDir = InnermostParentDirectoryPathWithName("Source", ProgramsDir);
76+
77+
// The program is assumed to reside inside the "Engine" folder.
78+
string EngineDir = InnermostParentDirectoryPathWithName("Engine", SourceDir);
79+
80+
// The default Binaries path is assumed to be a sibling of "Source" folder.
81+
string DefaultBinDir = Path.GetFullPath(Path.Combine(SourceDir, "..", "Binaries", Platform.ToString()));
82+
83+
// We assume that the engine exe resides in Engine/Binaries/[Platform]
84+
string EngineBinariesDir = Path.Combine(EngineDir, "Binaries", Platform.ToString());
85+
86+
// Now we calculate the relative path between the default output directory and the engine binaries,
87+
// in order to force the output of this program to be in the same folder as th engine.
88+
ExeBinariesSubFolder = (new DirectoryReference(EngineBinariesDir)).MakeRelativeTo(new DirectoryReference(DefaultBinDir));
89+
90+
// Setting this is necessary since we are creating the binaries outside of Restricted.
91+
bLegalToDistributeBinary = true;
92+
93+
// We still need to copy the resources, so at this point we might as well copy the files where the default Binaries folder was meant to be.
94+
// MobuLiveLinkPlugin.xml will be unaware of how the files got there.
95+
96+
string ResourcesDir = Path.Combine(ProgramsDir, "MobuLiveLink", "Resources");
97+
string PostBuildBinDir = Path.Combine(DefaultBinDir, "MotionBuilder", InMobuVersionString);
98+
99+
// Copy resources
100+
PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", ResourcesDir, PostBuildBinDir));
101+
PostBuildSteps.Add(string.Format("xcopy /y /i /v \"{0}\\*.*\" \"{1}\" 1>nul", ResourcesDir, PostBuildBinDir));
102+
103+
// Copy binaries
104+
PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", EngineBinariesDir, PostBuildBinDir));
105+
PostBuildSteps.Add(string.Format("xcopy /y /i /v \"{0}\\{1}.*\" \"{2}\" 1>nul", EngineBinariesDir, LaunchModuleName, PostBuildBinDir));
106+
}
107+
}
108+
109+
public class MobuLiveLinkPlugin2017Target : MobuLiveLinkPluginTargetBase
110+
{
111+
public MobuLiveLinkPlugin2017Target(TargetInfo Target) : base(Target, "2017")
112+
{
113+
//Mobu is not strict c++ compliant before Mobu 2019
114+
WindowsPlatform.bStrictConformanceMode = false;
115+
}
116+
}
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
// Copyright Epic Games, Inc. All Rights Reserved.
2-
3-
using UnrealBuildTool;
4-
using System.Collections.Generic;
5-
using System.IO;
6-
7-
public class MobuLiveLinkPlugin2018Target : MobuLiveLinkPluginTargetBase
8-
{
9-
public MobuLiveLinkPlugin2018Target(TargetInfo Target) : base(Target, "2018")
10-
{}
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
using UnrealBuildTool;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
7+
public class MobuLiveLinkPlugin2018Target : MobuLiveLinkPluginTargetBase
8+
{
9+
public MobuLiveLinkPlugin2018Target(TargetInfo Target) : base(Target, "2018")
10+
{
11+
//Mobu is not strict c++ compliant before Mobu 2019
12+
WindowsPlatform.bStrictConformanceMode = false;
13+
}
1114
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
using UnrealBuildTool;
4+
using System.IO;
5+
6+
public class MobuLiveLinkPlugin2020 : MobuLiveLinkPluginBase
7+
{
8+
public MobuLiveLinkPlugin2020(ReadOnlyTargetRules Target) : base(Target, "2020")
9+
{
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright Epic Games, Inc. All Rights Reserved.
2+
3+
using UnrealBuildTool;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
7+
public class MobuLiveLinkPlugin2020Target : MobuLiveLinkPluginTargetBase
8+
{
9+
public MobuLiveLinkPlugin2020Target(TargetInfo Target) : base(Target, "2020")
10+
{}
11+
}

0 commit comments

Comments
 (0)