public FreeImage(ReadOnlyTargetRules Target) : base(Target)
    {
        Type = ModuleType.External;

        PublicSystemIncludePaths.Add(Path.Combine(ModuleDirectory, "Source"));

        string BinaryLibraryFolder = Path.Combine(Target.UEThirdPartyBinariesDirectory, "FreeImage", Target.Platform.ToString());
        string LibraryFileName     = "";
        bool   bWithFreeImage      = false;

        if (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Win32)
        {
            LibraryFileName = "FreeImage.dll";
            string DynLibPath = Path.Combine(BinaryLibraryFolder, LibraryFileName);

            string LibPath = Path.Combine(ModuleDirectory, "lib", Target.Platform.ToString());
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "FreeImage.lib"));

            PublicDelayLoadDLLs.Add(LibraryFileName);
            RuntimeDependencies.Add(DynLibPath);
            bWithFreeImage = true;
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            LibraryFileName = "libfreeimage-3.18.0.so";
            string DynLibPath = Path.Combine(BinaryLibraryFolder, LibraryFileName);

            PublicRuntimeLibraryPaths.Add(BinaryLibraryFolder);
            PublicAdditionalLibraries.Add(DynLibPath);

            PublicDelayLoadDLLs.Add(LibraryFileName);
            RuntimeDependencies.Add(DynLibPath);

            PublicSystemLibraries.Add("stdc++");
            bWithFreeImage = true;
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            LibraryFileName = "libfreeimage-3.18.0.dylib";
            string DynLibPath = Path.Combine(BinaryLibraryFolder, LibraryFileName);

            PublicRuntimeLibraryPaths.Add(BinaryLibraryFolder);
            PublicAdditionalLibraries.Add(DynLibPath);

            PublicDelayLoadDLLs.Add(DynLibPath);
            RuntimeDependencies.Add(DynLibPath);

            PublicSystemLibraries.Add("stdc++");
            bWithFreeImage = true;
        }

        PublicDefinitions.Add("WITH_FREEIMAGE_LIB=" + (bWithFreeImage ? '1' : '0'));
        if (LibraryFileName != "")
        {
            PublicDefinitions.Add("FREEIMAGE_LIB_FILENAME=\"" + LibraryFileName + "\"");
        }
    }
Exemplo n.º 2
0
    public PRT(ReadOnlyTargetRules Target) : base(Target)
    {
        bUseRTTI          = true;
        bEnableExceptions = true;
        Type = ModuleType.External;

        AbstractPlatform Platform;

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            Platform = new WindowsPlatform();
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            Platform = new MacPlatform();
        }
        else
        {
            throw new System.PlatformNotSupportedException();
        }

        string LibDir     = Path.Combine(ModuleDirectory, "lib", Platform.Name, "Release");
        string BinDir     = Path.Combine(ModuleDirectory, "bin", Platform.Name, "Release");
        string IncludeDir = Path.Combine(ModuleDirectory, "include");

        // 1. Check if prt is already available and has correct version, otherwise download from official github repo
        bool PrtInstalled = Directory.Exists(LibDir) && Directory.Exists(BinDir);

        string PrtCorePath     = Path.Combine(BinDir, PrtCoreDllName);
        bool   PrtCoreExists   = File.Exists(PrtCorePath);
        bool   PrtVersionMatch = PrtCoreExists && CheckDllVersion(PrtCorePath, PrtMajor, PrtMinor, PrtBuild);

        if (!PrtInstalled || !PrtVersionMatch)
        {
            string PrtUrl     = "https://github.com/Esri/esri-cityengine-sdk/releases/download";
            string PrtVersion = string.Format("{0}.{1}.{2}", PrtMajor, PrtMinor, PrtBuild);

            string PrtLibName     = string.Format("esri_ce_sdk-{0}-{1}", PrtVersion, Platform.PrtPlatform);
            string PrtLibZipFile  = PrtLibName + ".zip";
            string PrtDownloadUrl = Path.Combine(PrtUrl, PrtVersion, PrtLibZipFile);

            try
            {
                if (Directory.Exists(LibDir))
                {
                    Directory.Delete(LibDir, true);
                }
                if (Directory.Exists(BinDir))
                {
                    Directory.Delete(BinDir, true);
                }
                if (Directory.Exists(IncludeDir))
                {
                    Directory.Delete(IncludeDir, true);
                }

                if (Debug)
                {
                    if (!PrtInstalled)
                    {
                        Console.WriteLine("PRT not found");
                    }
                    Console.WriteLine("Updating PRT");
                }

                if (Debug)
                {
                    System.Console.WriteLine("Downloading " + PrtDownloadUrl + "...");
                }

                using (var Client = new WebClient())
                {
                    Client.DownloadFile(PrtDownloadUrl, Path.Combine(ModuleDirectory, PrtLibZipFile));
                }

                if (Debug)
                {
                    System.Console.WriteLine("Extracting " + PrtLibZipFile + "...");
                }

                Platform.ZipExtractor.Unzip(ModuleDirectory, PrtLibZipFile, PrtLibName);

                Directory.CreateDirectory(LibDir);
                Directory.CreateDirectory(BinDir);
                Copy(Path.Combine(ModuleDirectory, PrtLibName, "lib"), Path.Combine(ModuleDirectory, LibDir));
                Copy(Path.Combine(ModuleDirectory, PrtLibName, "bin"), Path.Combine(ModuleDirectory, BinDir));
                Copy(Path.Combine(ModuleDirectory, PrtLibName, "include"), Path.Combine(ModuleDirectory, "include"));
            }
            finally
            {
                Directory.Delete(Path.Combine(ModuleDirectory, PrtLibName), true);
                File.Delete(Path.Combine(ModuleDirectory, PrtLibZipFile));
            }
        }
        else if (Debug)
        {
            Console.WriteLine("PRT found");
        }

        // 2. Copy libraries to module binaries directory and add dependencies
        string ModuleBinariesDir = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../..", "Binaries", Platform.Name));

        if (Debug)
        {
            System.Console.WriteLine("PRT Source Lib Dir: " + LibDir);
            System.Console.WriteLine("PRT Source Bin Dir: " + BinDir);
            System.Console.WriteLine("PRT Source Include Dir: " + IncludeDir);
            System.Console.WriteLine("Module Binaries Dir: " + ModuleBinariesDir);
        }

        Directory.CreateDirectory(ModuleBinariesDir);
        PublicRuntimeLibraryPaths.Add(ModuleBinariesDir);

        // Copy PRT core libraries
        if (Debug)
        {
            Console.WriteLine("Adding PRT core libraries");
        }
        foreach (string FilePath in Directory.GetFiles(BinDir))
        {
            string LibraryName = Path.GetFileName(FilePath);

            Platform.AddPrtCoreLibrary(FilePath, LibraryName, this);
        }

        // Delete unused PRT extension libraries
        if (Debug)
        {
            Console.WriteLine("Deleting unused PRT extension libraries");
        }
        foreach (string FilePath in Directory.GetFiles(LibDir))
        {
            string FileName = Path.GetFileName(FilePath);
            if (Path.GetExtension(FilePath) == Platform.DynamicLibExtension)
            {
                if (!Array.Exists(ExtensionLibraries, e => e == Path.GetFileName(FilePath)))
                {
                    File.Delete(FilePath);
                }
                else
                {
                    RuntimeDependencies.Add(FilePath);
                    PublicDelayLoadDLLs.Add(FileName);
                }
            }
        }

        // Delete all sub directories from the extensions
        foreach (string DirectoryPath in Directory.GetDirectories(LibDir))
        {
            Directory.Delete(DirectoryPath, true);
        }

        // Add include search path
        if (Debug)
        {
            Console.WriteLine("Adding include search path " + IncludeDir);
        }
        PublicSystemIncludePaths.Add(IncludeDir);
    }
    public VAPlugin(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage          = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
        bEnableExceptions = true;

        PublicIncludePaths.AddRange(
            new string[] {
            // ... add public include paths required here ...
            //"VALibrary/include"
        }
            );


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


        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            "Projects",
            "CoreUObject",
            "Engine",
            "DisplayCluster",
            "DisplayClusterExtensions",
            "InputCore",
            "Sockets",
            "Networking"
            //,
            //"VALibrary"
            // ... add other public dependencies that you statically link with here ...
        }
            );


        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            // ... add private dependencies that you statically link with here ...
        }
            );


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


        // Path pPath = Path.Combine(ModuleDirectory, "..", "VALibrary", "lib");
        PublicLibraryPaths.Add(Path.Combine(ModuleDirectory, "..", "VALibrary", "lib"));
        PublicRuntimeLibraryPaths.Add(Path.Combine(ModuleDirectory, "..", "VALibrary", "lib"));


        if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
        {
            // Add the import library
            //PublicLibraryPaths.Add("VALibrary/lib");
            //PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "x64", "Release"));
            PublicAdditionalLibraries.Add("VABase.lib");
            PublicAdditionalLibraries.Add("VistaBase.lib");
            PublicAdditionalLibraries.Add("VistaAspects.lib");
            PublicAdditionalLibraries.Add("VistaInterProcComm.lib");
            PublicAdditionalLibraries.Add("VANet.lib");

            // Delay-load the DLL, so we can load it from the right place first
            PublicDelayLoadDLLs.Add("VABase.dll");
            PublicDelayLoadDLLs.Add("VistaBase.dll");
            PublicDelayLoadDLLs.Add("VistaAspects.dll");
            PublicDelayLoadDLLs.Add("VistaInterProcComm.dll");
            PublicDelayLoadDLLs.Add("VANet.dll");
        }
        else // if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            // PublicRuntimeLibraryPaths.Add(Path.Combine(ModuleDirectory, "..", "VALibrary", "lib"));

            // Tried PublicAdditionalLibraries("VABase.so");

            // PublicAdditionalLibraries.Add("VistaBase.so");
            // PublicAdditionalLibraries.Add("VistaAspects.so");
            // PublicAdditionalLibraries.Add("VistaInterProcComm.so");
            // PublicAdditionalLibraries.Add("VABase.so");
            // PublicAdditionalLibraries.Add("VANet.so");

            // PublicAdditionalLibraries.Add("VABase.so");
            // PublicAdditionalLibraries.Add("VistaBase.so");
            // PublicAdditionalLibraries.Add("VistaAspects.so");
            // PublicAdditionalLibraries.Add("VistaInterProcComm.so");
            // PublicAdditionalLibraries.Add("VANet.so");


            // Path.GetFullPath(Path.Combine(ModuleDirectory, actualPath))

            // run fr 3.5. 18.00
            // PublicDelayLoadDLLs.Add("VABase.so");
            // PublicDelayLoadDLLs.Add("VistaBase.so");
            // PublicDelayLoadDLLs.Add("VistaAspects.so");
            // PublicDelayLoadDLLs.Add("VistaInterProcComm.so");
            // PublicDelayLoadDLLs.Add("VANet.so");

            // PublicAdditionalLibraries.Add("VABase.so");
            // PublicAdditionalLibraries.Add("VistaBase.so");
            // PublicAdditionalLibraries.Add("VistaAspects.so");
            // PublicAdditionalLibraries.Add("VistaInterProcComm.so");
            // PublicAdditionalLibraries.Add("VANet.so");


            // PublicAdditionalLibraries.Add("VistaBase.so");
            // PublicAdditionalLibraries.Add("VistaAspects.so");
            // PublicAdditionalLibraries.Add("VistaInterProcComm.so");
            // PublicAdditionalLibraries.Add("VABase.so");
            // PublicAdditionalLibraries.Add("VANet.so");

            // from USDImporter.Build.cs (G:\Programme\UE_4.21\Engine\Plugins\Editor\USDImporter\Source\USDImporter)

            /*
             * else if (Target.Platform == UnrealTargetPlatform.Linux && Target.Architecture.StartsWith("x86_64"))
             * {
             *  // link directly to runtime libs on Linux, as this also puts them into rpath
             *  string RuntimeLibraryPath = Path.Combine(ModuleDirectory, "../../Binaries", Target.Platform.ToString(), Target.Architecture.ToString());
             *  PrivateRuntimeLibraryPaths.Add(RuntimeLibraryPath);
             *  PublicAdditionalLibraries.Add(RuntimeLibraryPath + "/libUnrealUSDWrapper.so");
             *
             *  foreach (string FilePath in Directory.EnumerateFiles(RuntimeLibraryPath, "*.so*", SearchOption.AllDirectories))
             *  {
             *      RuntimeDependencies.Add(FilePath);
             *  }
             * }
             */

            // PrivateRuntimeLibraryPaths.Add(RuntimeLibraryPath);
            string RuntimeLibraryPath = Path.Combine(ModuleDirectory, "..", "VALibrary", "lib");
            PrivateRuntimeLibraryPaths.Add(RuntimeLibraryPath);
            PublicLibraryPaths.Add(RuntimeLibraryPath);

            foreach (string FilePath in Directory.EnumerateFiles(RuntimeLibraryPath, "*.so", SearchOption.AllDirectories))
            {
                PublicAdditionalLibraries.Add(FilePath);
                RuntimeDependencies.Add(FilePath);
            }
            foreach (string FilePath in Directory.EnumerateFiles(RuntimeLibraryPath, "*.so.*", SearchOption.AllDirectories))
            {
                RuntimeDependencies.Add(FilePath);
            }

            // RuntimeDependencies.Add("VistaBase.so");
            // RuntimeDependencies.Add("VistaAspects.so");
            // RuntimeDependencies.Add("VistaInterProcComm.so");
            // RuntimeDependencies.Add("VABase.so");
            // RuntimeDependencies.Add("VANet.so");
        }

        //this is needed to register on Editor delegates, i.e., BeginPIE and EndPIE, but only in Editor builds
        if (Target.Type == TargetRules.TargetType.Editor)
        {
            PrivateDependencyModuleNames.AddRange(
                new string[]
            {
                "UnrealEd"
            }
                );
        }
    }
Exemplo n.º 4
0
    void ThirdPartyCustom(ReadOnlyTargetRules Target)
    {
        PublicDefinitions.Add("V8_COMPRESS_POINTERS");

        string LibraryPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "Library"));

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            bool   UseMonolith   = Target.LinkType == TargetLinkType.Monolithic;
            string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Win64");
            if (UseMonolith)
            {
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_monolith.lib"));
            }
            else
            {
                PublicRuntimeLibraryPaths.Add(V8LibraryPath);
                System.Action <string> AddLib = (string Name) => {
                    string DllName     = Name + ".dll";
                    string LibName     = DllName + ".lib";
                    string DllFullPath = Path.Combine(V8LibraryPath, DllName);
                    string LibFullName = Path.Combine(V8LibraryPath, LibName);

                    PublicAdditionalLibraries.Add(LibFullName);
                    PublicDelayLoadDLLs.Add(DllFullPath);
                    RuntimeDependencies.Add(Path.Combine(ModuleDirectory, "../../Binaries/Win64", DllName), DllFullPath);
                };

                AddLib("zlib");
                AddLib("v8_libbase");
                AddLib("v8");
                AddLib("v8_libplatform");
            }
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            if (Target.Version.MajorVersion == 5 || (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion >= 25))
            {
                // for armv7
                string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "armv7a-release", "8.4.371.19");
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
                // for arm64
                V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "arm64-release", "8.5.210.20");
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_monolith.a"));
            }
            else if (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion < 25)
            {
                // for armv7
                string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "armv7a-release", "7.4.288");
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));
                // for arm64
                V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "arm64-release", "7.4.288");
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
                PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));
            }
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicFrameworks.AddRange(new string[] { "WebKit" });
            string V8LibraryPath = Path.Combine(LibraryPath, "V8", "macOS");
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libbindings.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libencoding.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector_string_conversions.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_base.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_generated_definitions.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_generated_initializers.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base_without_compiler.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_compiler.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_init.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_initializers.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_nosnapshot.a"));

            PublicAdditionalLibraries.Add(Path.Combine(Path.Combine(LibraryPath, "ffi", "macOS"), "libffi.a"));
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicFrameworks.AddRange(new string[] { "WebKit" });
            string V8LibraryPath = Path.Combine(LibraryPath, "V8", "iOS", "arm64");
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libbindings.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libencoding.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector_string_conversions.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_generated_definitions.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base_without_compiler.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_compiler.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
            PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));

            PublicAdditionalLibraries.Add(Path.Combine(Path.Combine(LibraryPath, "ffi", "iOS"), "libffi.a"));
        }

        string HeaderPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "Include"));

        // External headers
        if (Target.Platform == UnrealTargetPlatform.Android)
        {
            if (Target.Version.MajorVersion == 5 || (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion >= 25))
            {
                PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "v8", "8.5.210.20") });
            }
            else if (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion < 25)
            {
                PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "v8", "7.4.288") });
            }
            PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "websocketpp") });
            PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "asio") });
        }
        else if (Target.Platform == UnrealTargetPlatform.Win64 ||
                 Target.Platform == UnrealTargetPlatform.IOS ||
                 Target.Platform == UnrealTargetPlatform.Mac ||
                 Target.Platform == UnrealTargetPlatform.Linux)
        {
            PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "v8", "8.5.210.20") });
            PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "websocketpp") });
            PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "asio") });
        }

        //if (Target.Platform == UnrealTargetPlatform.Mac)
        //{
        //    PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "ffi", "macOS") });
        //}
        //else if (Target.Platform == UnrealTargetPlatform.IOS)
        //{
        //    PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "ffi", "iOS") });
        //}
    }
Exemplo n.º 5
0
    public NDIIO(ReadOnlyTargetRules Target) : base(Target)
    {
        bEnforceIWYU = true;
        PCHUsage     = PCHUsageMode.UseExplicitOrSharedPCHs;

        #region Public Includes

        // Include the Public include paths
        if (Directory.Exists(Path.Combine(ModuleDirectory, "Public")))
        {
            PublicIncludePaths.AddRange(new string[] {
                // ... add public include paths required here ...
                Path.Combine(ModuleDirectory, "Public"),
            });
        }

        // Define the public dependencies
        PublicDependencyModuleNames.AddRange(new string[] {
            "Engine",
            "Core",
            "CoreUObject",
            "Projects"
        });

        #endregion

        #region Private Includes

        if (Directory.Exists(Path.Combine(ModuleDirectory, "Private")))
        {
            PrivateIncludePaths.AddRange(new string[] {
                // ... add other private include paths required here ...
                Path.Combine(ModuleDirectory, "Private")
            });
        }

        PrivateDependencyModuleNames.AddRange(new string[] {
            "Renderer",
            "RenderCore",
            "RHI",
            "Slate",
            "SlateCore",
            "UMG",
            "ImageWrapper",
            "AudioMixer",
            "InputCore",

            "Media",
            "MediaAssets",
            "MediaUtils",

            "CinematicCamera"
        });

        #endregion

        #region Editor Includes

        if (Target.bBuildEditor == true)
        {
            PrivateIncludePathModuleNames.AddRange(new string[] {
                "AssetTools",
                "TargetPlatform",
            });

            PrivateDependencyModuleNames.AddRange(new string[] {
                "UnrealEd",
                "AssetTools",
                "MaterialUtilities"
            });
        }

        #endregion

        #region ThirdParty Includes

        // Our plugin only support the Win64 platform
        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            // Get the environment variables for the sdk and runtime for NDI
            string sdk_path     = Path.GetFullPath(Path.Combine(ModuleDirectory, "ThirdParty", "NDI"));
            string runtime_path = Environment.GetEnvironmentVariable("NDI_RUNTIME_DIR_V4");

            // When building the project you must have the NDI SDK installed...
            // verify the sdk and runtime environment variables exist
            if (!string.IsNullOrEmpty(sdk_path) && !string.IsNullOrEmpty(runtime_path))
            {
                // Retrieve the directories from the environmental paths
                string SDK_DIRECTORY     = Path.GetFullPath(sdk_path);
                string LIB_DIRECTORY     = Path.GetFullPath(Path.Combine(sdk_path, "Libraries/Win64"));
                string RUNTIME_DIRECTORY = Path.GetFullPath(runtime_path);

                // Determine if the 'SDK' directory exists
                if (Directory.Exists(Path.Combine(SDK_DIRECTORY, "Includes")))
                {
                    PublicIncludePaths.AddRange(new string[] {
                        // ... add other private include paths required here ...
                        Path.Combine(SDK_DIRECTORY, "Includes"),
                    });
                }

                // ensure that we have both the sdk and runtime directories
                if (Directory.Exists(LIB_DIRECTORY) && Directory.Exists(RUNTIME_DIRECTORY))
                {
                    // Add the Library Files to a collection
                    String[] LibraryFilePaths = new string[] {
                        Path.Combine(LIB_DIRECTORY, "Processing.NDI.Lib.x64.lib"),
                    };

                    // Load the .lib files from the FilePaths collection
                    foreach (var FilePath in LibraryFilePaths)
                    {
                        PublicAdditionalLibraries.Add(FilePath);
                    }

                    // Load the DLL from the runtime directory
                    PublicDelayLoadDLLs.Add("Processing.NDI.Lib.x64.dll");
                    PublicRuntimeLibraryPaths.Add(RUNTIME_DIRECTORY);

                    // Ensure that we define our c++ define
                    PublicDefinitions.Add("NDI_SDK_ENABLED");
                }
            }
        }

        #endregion
    }
Exemplo n.º 6
0
    public SpatialGDK(ReadOnlyTargetRules Target) : base(Target)
    {
        bLegacyPublicIncludePaths = false;
        PCHUsage  = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
        bUseUnity = BuildUtils.GetUnityModeSetting();

        PrivateIncludePaths.Add("SpatialGDK/Private");

        var WorkerSDKPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "Public", "WorkerSDK"));

        PublicIncludePaths.Add(WorkerSDKPath); // Worker SDK uses a different include format <improbable/x.h>
        PrivateIncludePaths.Add(WorkerSDKPath);

        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            "CoreUObject",
            "Engine",
            "EngineSettings",
            "Http",
            "InputCore",
            "OnlineSubsystemUtils",
            "Projects",
            "ReplicationGraph",
            "Sockets",
            "Slate",
            "UMG"
        });

        if (Target.bWithPushModel)
        {
            PublicDependencyModuleNames.Add("NetCore");
        }

        if (Target.bBuildDeveloperTools || (Target.Configuration != UnrealTargetConfiguration.Shipping &&
                                            Target.Configuration != UnrealTargetConfiguration.Test))
        {
            PublicDependencyModuleNames.Add("GameplayDebugger");
            PublicDefinitions.Add("WITH_GAMEPLAY_DEBUGGER=1");
        }
        else
        {
            PublicDefinitions.Add("WITH_GAMEPLAY_DEBUGGER=0");
        }

        if (Target.bBuildEditor)
        {
            PublicDependencyModuleNames.Add("UnrealEd");
            PublicDependencyModuleNames.Add("SpatialGDKServices");
        }

        if (Target.bWithPerfCounters)
        {
            PublicDependencyModuleNames.Add("PerfCounters");
        }

        var WorkerLibraryDir = Path.Combine(ModuleDirectory, "..", "..", "Binaries", "ThirdParty", "Improbable", Target.Platform.ToString());

        string LibPrefix       = "libimprobable_";
        string ImportLibSuffix = ".so";
        string SharedLibSuffix = ".so";
        bool   bAddDelayLoad   = false;

        if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)
        {
            LibPrefix       = "improbable_";
            ImportLibSuffix = ".lib";
            SharedLibSuffix = ".dll";
            bAddDelayLoad   = true;
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            ImportLibSuffix = SharedLibSuffix = ".dylib";
        }
        else if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            ImportLibSuffix = "_stub.a";
            SharedLibSuffix = ".prx";
            bAddDelayLoad   = true;
        }
        else if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            LibPrefix       = "improbable_";
            ImportLibSuffix = ".lib";
            SharedLibSuffix = ".dll";
            // We don't set bAddDelayLoad = true here, because we get "unresolved external symbol __delayLoadHelper2".
            // See: https://www.fmod.org/questions/question/deploy-issue-on-xboxone-with-unrealengine-4-14/
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            ImportLibSuffix = SharedLibSuffix = "_static.a";
        }
        else if (!(Target.Platform == UnrealTargetPlatform.Linux || Target.Platform == UnrealTargetPlatform.Android))
        {
            throw new System.Exception(System.String.Format("Unsupported platform {0}", Target.Platform.ToString()));
        }

        string WorkerImportLib = System.String.Format("{0}worker{1}", LibPrefix, ImportLibSuffix);
        string WorkerSharedLib = System.String.Format("{0}worker{1}", LibPrefix, SharedLibSuffix);

        if (Target.Platform != UnrealTargetPlatform.Android)
        {
            RuntimeDependencies.Add(Path.Combine(WorkerLibraryDir, WorkerSharedLib), StagedFileType.NonUFS);
            if (bAddDelayLoad)
            {
                PublicDelayLoadDLLs.Add(WorkerSharedLib);
            }

            WorkerImportLib = Path.Combine(WorkerLibraryDir, WorkerImportLib);
            PublicRuntimeLibraryPaths.Add(WorkerLibraryDir);

            PublicAdditionalLibraries.Add(WorkerImportLib);
        }
        else
        {
            var WorkerLibraryPaths = new List <string>
            {
                Path.Combine(WorkerLibraryDir, "arm64-v8a"),
                Path.Combine(WorkerLibraryDir, "armeabi-v7a"),
                Path.Combine(WorkerLibraryDir, "x86_64"),
            };

            string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(PluginPath, "SpatialGDK_APL.xml"));

            PublicRuntimeLibraryPaths.AddRange(WorkerLibraryPaths);

            var WorkerLibraries = new List <string>
            {
                Path.Combine(WorkerLibraryDir, "arm64-v8a", WorkerSharedLib),
                Path.Combine(WorkerLibraryDir, "armeabi-v7a", WorkerSharedLib),
                Path.Combine(WorkerLibraryDir, "x86_64", WorkerSharedLib),
            };

            PublicAdditionalLibraries.AddRange(WorkerLibraries);
        }
    }
Exemplo n.º 7
0
    public SpatialGDK(ReadOnlyTargetRules Target) : base(Target)
    {
        bLegacyPublicIncludePaths = false;
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
#pragma warning disable 0618
        bFasterWithoutUnity = true;             // Deprecated in 4.24, replace with bUseUnity = false; once we drop support for 4.23
        if (Target.Version.MinorVersion == 24)  // Due to a bug in 4.24, bFasterWithoutUnity is inversed, fixed in master, so should hopefully roll into the next release, remove this once it does
        {
            bFasterWithoutUnity = false;
        }
#pragma warning restore 0618

        PrivateIncludePaths.Add("SpatialGDK/Private");

        var WorkerSDKPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "Public", "WorkerSDK"));

        PublicIncludePaths.Add(WorkerSDKPath); // Worker SDK uses a different include format <improbable/x.h>
        PrivateIncludePaths.Add(WorkerSDKPath);

        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            "CoreUObject",
            "Engine",
            "EngineSettings",
            "InputCore",
            "OnlineSubsystemUtils",
            "Projects",
            "ReplicationGraph",
            "Sockets",
            "Slate",
            "UMG"
        });

        if (Target.bBuildDeveloperTools || (Target.Configuration != UnrealTargetConfiguration.Shipping &&
                                            Target.Configuration != UnrealTargetConfiguration.Test))
        {
            PublicDependencyModuleNames.Add("GameplayDebugger");
        }

        if (Target.bBuildEditor)
        {
            PublicDependencyModuleNames.Add("UnrealEd");
            PublicDependencyModuleNames.Add("SpatialGDKServices");
        }

        if (Target.bWithPerfCounters)
        {
            PublicDependencyModuleNames.Add("PerfCounters");
        }

        var WorkerLibraryDir = Path.Combine(ModuleDirectory, "..", "..", "Binaries", "ThirdParty", "Improbable", Target.Platform.ToString());

        var WorkerLibraryPaths = new List <string>
        {
            WorkerLibraryDir,
        };

        string LibPrefix       = "improbable_";
        string ImportLibSuffix = "";
        string SharedLibSuffix = "";
        bool   bAddDelayLoad   = false;

        if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)
        {
            ImportLibSuffix = ".lib";
            SharedLibSuffix = ".dll";
            bAddDelayLoad   = true;
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            LibPrefix       = "libimprobable_";
            ImportLibSuffix = SharedLibSuffix = ".dylib";
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            LibPrefix       = "libimprobable_";
            ImportLibSuffix = SharedLibSuffix = ".so";
        }
        else if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            LibPrefix       = "libimprobable_";
            ImportLibSuffix = "_stub.a";
            SharedLibSuffix = ".prx";
            bAddDelayLoad   = true;
        }
        else if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            ImportLibSuffix = ".lib";
            SharedLibSuffix = ".dll";
            // We don't set bAddDelayLoad = true here, because we get "unresolved external symbol __delayLoadHelper2".
            // See: https://www.fmod.org/questions/question/deploy-issue-on-xboxone-with-unrealengine-4-14/
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            LibPrefix       = "libimprobable_";
            ImportLibSuffix = SharedLibSuffix = "_static.a";
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            LibPrefix = "improbable_";
            WorkerLibraryPaths.AddRange(new string[]
            {
                Path.Combine(WorkerLibraryDir, "arm64-v8a"),
                Path.Combine(WorkerLibraryDir, "armeabi-v7a"),
                Path.Combine(WorkerLibraryDir, "x86_64"),
            });

            string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
            AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(PluginPath, "SpatialGDK_APL.xml"));
        }
        else
        {
            throw new System.Exception(System.String.Format("Unsupported platform {0}", Target.Platform.ToString()));
        }

        string WorkerImportLib = System.String.Format("{0}worker{1}", LibPrefix, ImportLibSuffix);
        string WorkerSharedLib = System.String.Format("{0}worker{1}", LibPrefix, SharedLibSuffix);

        if (Target.Platform != UnrealTargetPlatform.Android)
        {
            RuntimeDependencies.Add(Path.Combine(WorkerLibraryDir, WorkerSharedLib), StagedFileType.NonUFS);
            if (bAddDelayLoad)
            {
                PublicDelayLoadDLLs.Add(WorkerSharedLib);
            }

            WorkerImportLib = Path.Combine(WorkerLibraryDir, WorkerImportLib);
        }

        PublicAdditionalLibraries.Add(WorkerImportLib);
        PublicRuntimeLibraryPaths.Add(WorkerLibraryDir);

        // Detect existence of trace library, if present add preprocessor
        string TraceStaticLibPath  = "";
        string TraceDynamicLib     = "";
        string TraceDynamicLibPath = "";
        if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)
        {
            TraceStaticLibPath  = Path.Combine(WorkerLibraryDir, "trace_dynamic.lib");
            TraceDynamicLib     = "trace_dynamic.dll";
            TraceDynamicLibPath = Path.Combine(WorkerLibraryDir, TraceDynamicLib);
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            TraceStaticLibPath  = Path.Combine(WorkerLibraryDir, "libtrace_dynamic.so");
            TraceDynamicLib     = "libtrace_dynamic.so";
            TraceDynamicLibPath = Path.Combine(WorkerLibraryDir, TraceDynamicLib);
        }

        if (File.Exists(TraceStaticLibPath) && File.Exists(TraceDynamicLibPath))
        {
            Log.TraceInformation("Detection of trace libraries found at {0} and {1}, enabling trace functionality.", TraceStaticLibPath, TraceDynamicLibPath);
            PublicDefinitions.Add("TRACE_LIB_ACTIVE=1");

            PublicAdditionalLibraries.Add(TraceStaticLibPath);

            RuntimeDependencies.Add(TraceDynamicLibPath, StagedFileType.NonUFS);
            if (bAddDelayLoad)
            {
                PublicDelayLoadDLLs.Add(TraceDynamicLib);
            }
        }
        else
        {
            Log.TraceInformation("Didn't find trace libraries at {0} and {1}, disabling trace functionality.", TraceStaticLibPath, TraceDynamicLibPath);
            PublicDefinitions.Add("TRACE_LIB_ACTIVE=0");
        }
    }