Skip to content

Commit

Permalink
Mobu LiveLink 2.5
Browse files Browse the repository at this point in the history
- Pushing Mobu LiveLink plugin version 2.5 matching UE4.27 release.
  • Loading branch information
SimonTherriaultEpic committed Aug 16, 2021
1 parent 6b98b37 commit 0762b9a
Show file tree
Hide file tree
Showing 13 changed files with 2,205 additions and 1,680 deletions.
23 changes: 13 additions & 10 deletions Source/MobuLiveLinkPlugin2016.Target.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;
using System.IO;

public class MobuLiveLinkPlugin2016Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2016Target(TargetInfo Target) : base(Target, "2016")
{}
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;
using System.IO;

public class MobuLiveLinkPlugin2016Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2016Target(TargetInfo Target) : base(Target, "2016")
{
//Mobu is not strict c++ compliant before Mobu 2019
WindowsPlatform.bStrictConformanceMode = false;
}
}
153 changes: 77 additions & 76 deletions Source/MobuLiveLinkPlugin2017.Build.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.IO;

public abstract class MobuLiveLinkPluginBase : ModuleRules
{
public MobuLiveLinkPluginBase(ReadOnlyTargetRules Target, string MobuVersionString) : base(Target)
{
PrivatePCHHeaderFile = "Private/MobuLiveLinkPluginPrivatePCH.h";

bEnforceIWYU = false;
bUseRTTI = true;

PrivateIncludePaths.AddRange(new string[]
{
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Public"),
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Private"),
Path.Combine(ModuleDirectory, "StreamObjects/Public")
});

// Unreal dependency modules
PrivateDependencyModuleNames.AddRange(new string[]
{
"Core",
"CoreUObject",
"ApplicationCore",
"Projects",
"UdpMessaging",
"LiveLinkInterface",
"LiveLinkMessageBusFramework",
});

// Mobu SDK setup
{
//UE_MOTIONBUILDER2017_INSTALLATIONFOLDER
string MobuInstallFolder = System.Environment.GetEnvironmentVariable("UE_MOTIONBUILDER" + MobuVersionString + "_INSTALLATIONFOLDER");
if (string.IsNullOrEmpty(MobuInstallFolder))
{
MobuInstallFolder = @"C:\Program Files\Autodesk\MotionBuilder " + MobuVersionString;
}
MobuInstallFolder = Path.Combine(MobuInstallFolder, "OpenRealitySDK");

if (!Directory.Exists(MobuInstallFolder))
{
// Try with build machine setup
string SDKRootEnvVar = System.Environment.GetEnvironmentVariable("UE_SDKS_ROOT");
if (!string.IsNullOrEmpty(SDKRootEnvVar))
{
MobuInstallFolder = Path.Combine(SDKRootEnvVar, "HostWin64", "Win64", "MotionBuilder", MobuVersionString);
}
}

// Make sure this version of Mobu is actually installed
if (Directory.Exists(MobuInstallFolder))
{
PrivateIncludePaths.Add(Path.Combine(MobuInstallFolder, "include"));

if (Target.Platform == UnrealTargetPlatform.Win64) // @todo: Support other platforms?
{
string LibDir = Path.Combine(MobuInstallFolder, "lib/x64");

// Mobu library we're depending on
PublicAdditionalLibraries.Add(Path.Combine(LibDir, "fbsdk.lib"));
}
}
}
}
}

public class MobuLiveLinkPlugin2017 : MobuLiveLinkPluginBase
{
public MobuLiveLinkPlugin2017(ReadOnlyTargetRules Target) : base(Target, "2017")
{
}
}
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.IO;

public abstract class MobuLiveLinkPluginBase : ModuleRules
{
public MobuLiveLinkPluginBase(ReadOnlyTargetRules Target, string MobuVersionString) : base(Target)
{
PrivatePCHHeaderFile = "Private/MobuLiveLinkPluginPrivatePCH.h";

bEnforceIWYU = false;
bUseRTTI = true;

PrivateIncludePaths.AddRange(new string[]
{
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Public"),
Path.Combine(EngineDirectory, "Source/Runtime/Launch/Private"),
Path.Combine(ModuleDirectory, "StreamObjects/Public"),
});

// Unreal dependency modules
PrivateDependencyModuleNames.AddRange(new string[]
{
"Core",
"CoreUObject",
"ApplicationCore",
"Messaging",
"Projects",
"UdpMessaging",
"LiveLinkInterface",
"LiveLinkMessageBusFramework",
});

// Mobu SDK setup
{
//UE_MOTIONBUILDER2017_INSTALLATIONFOLDER
string MobuInstallFolder = System.Environment.GetEnvironmentVariable("UE_MOTIONBUILDER" + MobuVersionString + "_INSTALLATIONFOLDER");
if (string.IsNullOrEmpty(MobuInstallFolder))
{
MobuInstallFolder = @"C:\Program Files\Autodesk\MotionBuilder " + MobuVersionString;
}
MobuInstallFolder = Path.Combine(MobuInstallFolder, "OpenRealitySDK");

if (!Directory.Exists(MobuInstallFolder))
{
// Try with build machine setup
string SDKRootEnvVar = System.Environment.GetEnvironmentVariable("UE_SDKS_ROOT");
if (!string.IsNullOrEmpty(SDKRootEnvVar))
{
MobuInstallFolder = Path.Combine(SDKRootEnvVar, "HostWin64", "Win64", "MotionBuilder", MobuVersionString);
}
}

// Make sure this version of Mobu is actually installed
if (Directory.Exists(MobuInstallFolder))
{
PrivateIncludePaths.Add(Path.Combine(MobuInstallFolder, "include"));

if (Target.Platform == UnrealTargetPlatform.Win64) // @todo: Support other platforms?
{
string LibDir = Path.Combine(MobuInstallFolder, "lib/x64");

// Mobu library we're depending on
PublicAdditionalLibraries.Add(Path.Combine(LibDir, "fbsdk.lib"));
}
}
}
}
}

public class MobuLiveLinkPlugin2017 : MobuLiveLinkPluginBase
{
public MobuLiveLinkPlugin2017(ReadOnlyTargetRules Target) : base(Target, "2017")
{
}
}
159 changes: 116 additions & 43 deletions Source/MobuLiveLinkPlugin2017.Target.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,116 @@
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;
using System.IO;

public abstract class MobuLiveLinkPluginTargetBase : TargetRules
{
public MobuLiveLinkPluginTargetBase(TargetInfo Target, string InMobuVersionString) : base(Target)
{
Type = TargetType.Program;

bShouldCompileAsDLL = true;
LinkType = TargetLinkType.Monolithic;
SolutionDirectory = "Programs/LiveLink";

bool bIsNotForLicensees = false;
string NotForLicenseesFolder = bIsNotForLicensees ? "NotForLicensees" : "";

ExeBinariesSubFolder = Path.Combine(NotForLicenseesFolder, "MotionBuilder", InMobuVersionString);
LaunchModuleName = "MobuLiveLinkPlugin" + InMobuVersionString;

// We only need minimal use of the engine for this plugin
bBuildDeveloperTools = false;
bUseMallocProfiler = false;
bBuildWithEditorOnlyData = true;
bCompileAgainstEngine = false;
bCompileAgainstCoreUObject = true;
bCompileICU = false;
bHasExports = false;

string ResourcesFolder = Path.GetFullPath(Path.Combine("Programs", NotForLicenseesFolder, "MobuLiveLink/Resources"));
string BinariesDirectory = Path.GetFullPath(Path.Combine("../Binaries", "Win64", NotForLicenseesFolder, "MotionBuilder", InMobuVersionString));
PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", ResourcesFolder, BinariesDirectory));
PostBuildSteps.Add(string.Format("copy /a /b /y /v \"{0}\\*.*\" \"{1}\" 1>nul", ResourcesFolder, BinariesDirectory));
}
}

public class MobuLiveLinkPlugin2017Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2017Target(TargetInfo Target) : base(Target, "2017")
{ }
}
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System;
using System.IO;
using Tools.DotNETCommon;
using System.Runtime.CompilerServices;

[SupportedPlatforms(UnrealPlatformClass.Desktop)]
public abstract class MobuLiveLinkPluginTargetBase : TargetRules
{
/// <summary>
/// Finds the innermost parent directory with the provided name. Search is case insensitive.
/// </summary>
string InnermostParentDirectoryPathWithName(string ParentName, string CurrentPath)
{
DirectoryInfo ParentInfo = Directory.GetParent(CurrentPath);

if (ParentInfo == null)
{
throw new DirectoryNotFoundException("Could not find parent folder '" + ParentName + "'");
}

// Case-insensitive check of the parent folder name.
if (ParentInfo.Name.ToLower() == ParentName.ToLower())
{
return ParentInfo.ToString();
}

return InnermostParentDirectoryPathWithName(ParentName, ParentInfo.ToString());
}

/// <summary>
/// Returns the path to this .cs file.
/// </summary>
string GetCallerFilePath([CallerFilePath] string CallerFilePath = "")
{
if (CallerFilePath.Length == 0)
{
throw new FileNotFoundException("Could not find the path of our .cs file");
}

return CallerFilePath;
}

public MobuLiveLinkPluginTargetBase(TargetInfo Target, string InMobuVersionString) : base(Target)
{
Type = TargetType.Program;

bShouldCompileAsDLL = true;
LinkType = TargetLinkType.Monolithic;
SolutionDirectory = "Programs/LiveLink";
LaunchModuleName = "MobuLiveLinkPlugin" + InMobuVersionString;

// We only need minimal use of the engine for this plugin
bBuildDeveloperTools = false;
bUseMallocProfiler = false;
bBuildWithEditorOnlyData = true;
bCompileAgainstEngine = false;
bCompileAgainstCoreUObject = true;
bCompileICU = false;
bHasExports = false;

// This .cs file must be inside the source folder of this Program. We later use this to find other key directories.
string TargetFilePath = GetCallerFilePath();

// We need to avoid failing to load DLL due to looking for EngineDir() in non-existent folders.
// By having it build in the same directory as the engine, it will assume the engine is in the same directory
// as the program, and because this folder always exists, it will not fail the check inside EngineDir().

// Because this is a Program, we assume that this target file resides under a "Programs" folder.
string ProgramsDir = InnermostParentDirectoryPathWithName("Programs", TargetFilePath);

// We assume this Program resides under a Source folder.
string SourceDir = InnermostParentDirectoryPathWithName("Source", ProgramsDir);

// The program is assumed to reside inside the "Engine" folder.
string EngineDir = InnermostParentDirectoryPathWithName("Engine", SourceDir);

// The default Binaries path is assumed to be a sibling of "Source" folder.
string DefaultBinDir = Path.GetFullPath(Path.Combine(SourceDir, "..", "Binaries", Platform.ToString()));

// We assume that the engine exe resides in Engine/Binaries/[Platform]
string EngineBinariesDir = Path.Combine(EngineDir, "Binaries", Platform.ToString());

// Now we calculate the relative path between the default output directory and the engine binaries,
// in order to force the output of this program to be in the same folder as th engine.
ExeBinariesSubFolder = (new DirectoryReference(EngineBinariesDir)).MakeRelativeTo(new DirectoryReference(DefaultBinDir));

// Setting this is necessary since we are creating the binaries outside of Restricted.
bLegalToDistributeBinary = true;

// 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.
// MobuLiveLinkPlugin.xml will be unaware of how the files got there.

string ResourcesDir = Path.Combine(ProgramsDir, "MobuLiveLink", "Resources");
string PostBuildBinDir = Path.Combine(DefaultBinDir, "MotionBuilder", InMobuVersionString);

// Copy resources
PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", ResourcesDir, PostBuildBinDir));
PostBuildSteps.Add(string.Format("xcopy /y /i /v \"{0}\\*.*\" \"{1}\" 1>nul", ResourcesDir, PostBuildBinDir));

// Copy binaries
PostBuildSteps.Add(string.Format("echo Copying {0} to {1}...", EngineBinariesDir, PostBuildBinDir));
PostBuildSteps.Add(string.Format("xcopy /y /i /v \"{0}\\{1}.*\" \"{2}\" 1>nul", EngineBinariesDir, LaunchModuleName, PostBuildBinDir));
}
}

public class MobuLiveLinkPlugin2017Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2017Target(TargetInfo Target) : base(Target, "2017")
{
//Mobu is not strict c++ compliant before Mobu 2019
WindowsPlatform.bStrictConformanceMode = false;
}
}
23 changes: 13 additions & 10 deletions Source/MobuLiveLinkPlugin2018.Target.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;
using System.IO;

public class MobuLiveLinkPlugin2018Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2018Target(TargetInfo Target) : base(Target, "2018")
{}
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;
using System.IO;

public class MobuLiveLinkPlugin2018Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2018Target(TargetInfo Target) : base(Target, "2018")
{
//Mobu is not strict c++ compliant before Mobu 2019
WindowsPlatform.bStrictConformanceMode = false;
}
}
11 changes: 11 additions & 0 deletions Source/MobuLiveLinkPlugin2020.Build.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.IO;

public class MobuLiveLinkPlugin2020 : MobuLiveLinkPluginBase
{
public MobuLiveLinkPlugin2020(ReadOnlyTargetRules Target) : base(Target, "2020")
{
}
}
11 changes: 11 additions & 0 deletions Source/MobuLiveLinkPlugin2020.Target.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;
using System.IO;

public class MobuLiveLinkPlugin2020Target : MobuLiveLinkPluginTargetBase
{
public MobuLiveLinkPlugin2020Target(TargetInfo Target) : base(Target, "2020")
{}
}
Loading

0 comments on commit 0762b9a

Please sign in to comment.