// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.IO;

public class HiveRemotePlay : ModuleRules
{
	public HiveRemotePlay(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
		
		PublicIncludePaths.AddRange(
			new string[] {
				// ... add public include paths required here ...
			}
			);
				
		
		PrivateIncludePaths.AddRange(
			new string[] {
				// ... add other private include paths required here ...
			}
			);
			
		
		PublicDependencyModuleNames.AddRange(
			new string[]
			{
				"Core",
				// ... add other public dependencies that you statically link with here ...
			}
			);
			
		
		PrivateDependencyModuleNames.AddRange(
			new string[]
			{
				"CoreUObject",
				"Engine",
				"Slate",
				"SlateCore",
				// ... add private dependencies that you statically link with here ...	
			}
			);
		
		
		DynamicallyLoadedModuleNames.AddRange(
			new string[]
			{
				// ... add any modules that your module loads dynamically here ...
			}
			);

		string ThirdPartyPath = Path.Combine(ModuleDirectory, "../../Binaries/Win64");

		if (Target.Platform == UnrealTargetPlatform.Win64) {
			string PluginDir = Path.Combine("$(BinaryOutputDir)", "plugins");
			if (!Directory.Exists(PluginDir)) {
				Directory.CreateDirectory(PluginDir);
			}
            PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "RemotePlayDll.lib"));
            PublicDelayLoadDLLs.Add("RemotePlayDll.dll");
			RuntimeDependencies.Add(Path.Combine(PluginDir, "RemotePlayDll.dll"), Path.Combine(ThirdPartyPath, "RemotePlayDll.dll"));
			RuntimeDependencies.Add("$(TargetOutputDir)/HiveRemoteStreamer.dll", Path.Combine(ThirdPartyPath, "HiveRemoteStreamer.dll"));

            //	Copy exe. png.
            string rootDirectory = Path.GetFullPath(ModuleDirectory + "/additional/");
            DirectoryInfo dir = new DirectoryInfo(rootDirectory);
            DirectoryInfo[] dirs = dir.GetDirectories("*", SearchOption.TopDirectoryOnly);
            FileInfo[] files = dir.GetFiles("*.*", SearchOption.TopDirectoryOnly);
            foreach (FileInfo file in files)
            {
                if (!file.Name.EndsWith(".meta"))
                {
                    RuntimeDependencies.Add("$(TargetOutputDir)/" + file.Name, file.FullName);
                }
            }

        }
	}
}
