// Project Lab - NHTV Igad

using UnrealBuildTool;
using System.IO;
using System;

public class UnrealProject : ModuleRules
{
    private string ModulePath
    {
        get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
    }

    private string RootPath
    {
        get { return Path.GetFullPath(Path.Combine(ModulePath, "..\\..\\")); }
    }
    private string ThirdPartyPath
    {
        get { return Path.GetFullPath(Path.Combine(ModulePath, "..\\..\\ThirdParty\\")); }
    }

    private string FilterName(string name)
    {
        return "..\\Source\\UnrealProject\\" + name + "\\";
    }

    public UnrealProject(TargetInfo Target)
    {
        MinFilesUsingPrecompiledHeaderOverride = 1;
        bFasterWithoutUnity = true;

        PublicDependencyModuleNames.AddRange(new string[] {
            "Core", "CoreUObject", "Engine", "InputCore",
            "UMG", "Slate", "SlateCore",
            "OnlineSubsystem", "OnlineSubsystemUtils",
            "MoviePlayer", "MediaAssets", "Blutility" });

        // Add steam, external library and metrics for PC
        if(Target.Platform == UnrealTargetPlatform.Win64)
        {
            // Matchmaking
            //PublicIncludePaths.Add(RootPath + "MatchMaking\\");
            //PublicAdditionalLibraries.Add(RootPath + "MatchMaking\\MatchMakingClient_x64_Release.lib");

            DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
            PublicDependencyModuleNames.Add("Steamworks");
            PrivateDependencyModuleNames.Add("Networking");
        }

        // Add steam, external library and metrics for PC
        if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
            PublicDependencyModuleNames.Add("Steamworks");
        }
         DynamicallyLoadedModuleNames.Add("OnlineSubsystemNull");
        
        // Fetch all subdirectories, and add them as filters
        string[] directories = Directory.GetDirectories(ModuleDirectory, "*", SearchOption.AllDirectories);
        for (int i = 0; i < directories.Length; i++)
        {
            string dir = directories[i];
            string subdir = dir.Substring(ModuleDirectory.Length + 1, dir.Length - ModuleDirectory.Length - 1);
            PublicIncludePaths.Add(FilterName(subdir));
        }
    }
}
