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

using System.IO;
using UnrealBuildTool;

public class SkyPortal : ModuleRules
{
    public SkyPortal(ReadOnlyTargetRules Target) : base(Target)
    {
        bPrecompile = true;
        // Add the path to the hidapi include directory
        PublicIncludePaths.Add(Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "include"));

        // Check platform-specific settings
        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            // Add the path to the library (for Windows platform)
            PublicSystemLibraryPaths.Add(Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "lib", "Windows"));

            // Link against the hidapi.lib (static library)
            PublicAdditionalLibraries.Add(Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "lib", "Windows", "hidapi.lib"));

            // Add runtime library path for the .dll (dynamic library)
            PublicRuntimeLibraryPaths.Add(Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "bin", "Windows"));

            // Copy the DLL to the output folder, if using dynamic linking
            RuntimeDependencies.Add("$(BinaryOutputDir)/hidapi.dll", Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "bin", "Windows", "hidapi.dll"));
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicSystemLibraryPaths.Add(Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "lib", "Mac"));
            PublicAdditionalLibraries.Add("hidapi.a");

            // Handle Mac-specific dynamic linking
            RuntimeDependencies.Add("$(BinaryOutputDir)/hidapi.dylib", Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "bin", "Mac", "hidapi.dylib"));
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            PublicSystemLibraryPaths.Add(Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "lib", "Linux"));
            PublicAdditionalLibraries.Add("hidapi.a");

            RuntimeDependencies.Add("$(BinaryOutputDir)/hidapi.so", Path.Combine(PluginDirectory, "ThirdParty", "hidapi", "bin", "Linux", "hidapi.so"));
        }


        PublicIncludePaths.AddRange(
            new string[] {

    }
            );


        PrivateIncludePaths.AddRange(
            new string[] {
				// ... add other private include paths required here ...
			}
            );


        PublicDependencyModuleNames.AddRange(
            new string[]
            {
                "Core",
                "CoreUObject",
                "Engine",
                "OpenSSL", 
                "SSL"
					}
            );


        PrivateDependencyModuleNames.AddRange(
            new string[]
            {
                "CoreUObject",
                "Engine",
                "Slate",
                "SlateCore",
				
			}
            );


        DynamicallyLoadedModuleNames.AddRange(
            new string[]
            {
				// ... add any modules that your module loads dynamically here ...
			}
            );
    }
}
