2022-08-10 16:03:37 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2023-03-22 00:43:18 -04:00
|
|
|
using EpicGames.Core;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2022-08-10 16:03:37 +00:00
|
|
|
using UnrealBuildTool;
|
|
|
|
|
|
|
|
|
|
public class XInput : ModuleRules
|
|
|
|
|
{
|
2023-08-14 18:16:33 -04:00
|
|
|
protected string DirectXSDKDir { get => Target.WindowsPlatform.DirectXDir; }
|
2022-08-10 16:03:37 +00:00
|
|
|
|
|
|
|
|
public XInput(ReadOnlyTargetRules Target) : base(Target)
|
|
|
|
|
{
|
|
|
|
|
Type = ModuleType.External;
|
|
|
|
|
|
|
|
|
|
// Ensure correct include and link paths for xinput so the correct dll is loaded (xinput1_3.dll)
|
2023-03-29 04:35:22 -04:00
|
|
|
if (Target.IsInPlatformGroup(UnrealPlatformGroup.Windows))
|
2022-08-10 16:03:37 +00:00
|
|
|
{
|
2023-03-22 00:43:18 -04:00
|
|
|
if (Target.Architecture.bIsX64)
|
|
|
|
|
{
|
2023-08-14 18:16:33 -04:00
|
|
|
PublicAdditionalLibraries.Add(Path.Combine(Target.WindowsPlatform.DirectXLibDir, "XInput.lib"));
|
2023-07-19 20:43:16 -04:00
|
|
|
PublicDependencyModuleNames.Add("DirectX");
|
2023-03-22 00:43:18 -04:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Version WindowsSdkVersion;
|
|
|
|
|
DirectoryReference WindowsSdkDir;
|
|
|
|
|
if (!WindowsExports.TryGetWindowsSdkDir(null, out WindowsSdkVersion, out WindowsSdkDir))
|
|
|
|
|
{
|
|
|
|
|
throw new BuildException("Windows SDK must be installed in order to build this target.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add basic XInput library
|
|
|
|
|
string WindowsSdkLibDir = Path.Combine(WindowsSdkDir.ToString(), "lib", WindowsSdkVersion.ToString(), "um", Target.Architecture.WindowsSystemLibDir);
|
|
|
|
|
PublicAdditionalLibraries.Add(Path.Combine(WindowsSdkLibDir, "xinput.lib"));
|
|
|
|
|
}
|
2022-08-10 16:03:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|