// Georgy Treshchev 2025.

using System.IO;
using UnrealBuildTool;

public class RuntimeMetaHumanLipSync_Standard : ModuleRules
{
	public RuntimeMetaHumanLipSync_Standard(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
		
		PublicDependencyModuleNames.AddRange(new string[] { "RuntimeMetaHumanLipSync" });
		PrivateDependencyModuleNames.AddRange(new string[] { "AnimGraphRuntime", "Projects" });
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

        string ThirdPartyDirectory = Path.Combine(ModuleDirectory, "ThirdParty");
        string PlatformString = Target.Platform.ToString();
        string LibraryDirectory = Path.Combine(ThirdPartyDirectory, "Lib", PlatformString);
        PublicIncludePaths.Add(Path.Combine(ThirdPartyDirectory, "Include"));
        PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "AnimGraphRuntime", "SignalProcessing", "AudioPlatformConfiguration", "SignalProcessing" });

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            PublicAdditionalLibraries.Add(Path.Combine(LibraryDirectory, "OVRLipSyncShim.lib"));
            PublicDelayLoadDLLs.Add("OVRLipSync.dll");
            RuntimeDependencies.Add(Path.Combine(LibraryDirectory, "OVRLipSync.dll"), StagedFileType.NonUFS);
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicAdditionalLibraries.Add(Path.Combine(LibraryDirectory, "libOVRLipSyncShim.a"));
            RuntimeDependencies.Add(Path.Combine(LibraryDirectory, "libOVRLipSync.dylib"), StagedFileType.NonUFS);
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            string Android64Directory = Path.Combine(ThirdPartyDirectory, "Lib", "Android", "arm64-v8a");
            string Android32Directory = Path.Combine(ThirdPartyDirectory, "Lib", "Android", "armeabi-v7a");
            PublicSystemLibraryPaths.Add(LibraryDirectory);
            PublicSystemLibraryPaths.Add(Android32Directory);
            PublicSystemLibraryPaths.Add(Android64Directory);
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(ModuleDirectory, "RuntimeMetaHumanLipSync_APL.xml"));
            PublicAdditionalLibraries.Add(Path.Combine(Android32Directory, "libOVRLipSyncShim.a"));
            PublicAdditionalLibraries.Add(Path.Combine(Android64Directory, "libOVRLipSyncShim.a"));
        }
	}
}
