Esempio n. 1
0
 // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
 //       program executable, so we want the application name to be the game name.  In the case of a modular
 //       binary, we use 'UnrealEngine' for our application name
 public STBuildEditor(
     string InGameName,
     STTargetPlatform InPlatform,
     STTargetConfiguration InConfiguration,
     TargetRules InRulesObject,
     List<string> InAdditionalDefinitions,
     string InRemoteRoot,
     List<OnlyModule> InOnlyModules,
     bool bInEditorRecompile)
     : base(InAppName: STBuildTarget.GetBinaryBaseName(
             InGameName,
             InRulesObject,
             InPlatform,
             InConfiguration,
             (InRulesObject.Type == TargetRules.TargetType.Editor) ? "Editor" : ""
             ),
         InGameName: InGameName,
         InPlatform: InPlatform,
         InConfiguration: InConfiguration,
         InRulesObject: InRulesObject,
         InAdditionalDefinitions: InAdditionalDefinitions,
         InRemoteRoot: InRemoteRoot,
         InOnlyModules: InOnlyModules,
         bInEditorRecompile: bInEditorRecompile)
 {
 }
 /// <summary>
 /// Allow various platform project generators to generate any special project properties if required
 /// </summary>
 /// <param name="InPlatform"></param>
 /// <returns></returns>
 public static bool GenerateGamePlatformSpecificProperties(STTargetPlatform InPlatform, STTargetConfiguration Configuration, TargetRules.TargetType TargetType, StringBuilder VCProjectFileContent, string RootDirectory, string TargetFilePath)
 {
     if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
     {
         ProjectGeneratorDictionary[InPlatform].GenerateGameProperties(Configuration, VCProjectFileContent, TargetType, RootDirectory, TargetFilePath); ;
     }
     return true;
 }
 /// <summary>
 /// Allow various platform project generators to generate stub projects if required
 /// </summary>
 /// <param name="InTargetName"></param>
 /// <param name="InTargetFilepath"></param>
 /// <returns></returns>
 public static bool GenerateGameProjectStubs(ProjectFileGenerator InGenerator, string InTargetName, string InTargetFilepath, TargetRules InTargetRules,
     List<STTargetPlatform> InPlatforms, List<STTargetConfiguration> InConfigurations)
 {
     foreach (KeyValuePair<STTargetPlatform, STPlatformProjectGenerator> Entry in ProjectGeneratorDictionary)
     {
         STPlatformProjectGenerator ProjGen = Entry.Value;
         ProjGen.GenerateGameProjectStub(InGenerator, InTargetName, InTargetFilepath, InTargetRules, InPlatforms, InConfigurations);
     }
     return true;
 }
Esempio n. 4
0
 // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
 //       program executable, so we want the application name to be the game name.  In the case of a modular
 //       binary, we use 'UnrealEngine' for our application name
 public STBuildClient(
     string InGameName,
     STTargetPlatform InPlatform,
     STTargetConfiguration InConfiguration,
     TargetRules InRulesObject,
     List<string> InAdditionalDefinitions,
     string InRemoteRoot,
     List<OnlyModule> InOnlyModules,
     bool bInEditorRecompile)
     : base(InAppName: STBuildTarget.GetBinaryBaseName(InGameName, InRulesObject, InPlatform, InConfiguration, "Client"),
         InGameName: InGameName,
         InPlatform: InPlatform,
         InConfiguration: InConfiguration,
         InRulesObject: InRulesObject,
         InAdditionalDefinitions: InAdditionalDefinitions,
         InRemoteRoot: InRemoteRoot,
         InOnlyModules: InOnlyModules,
         bInEditorRecompile: bInEditorRecompile)
 {
     if (ShouldCompileMonolithic())
     {
         if ((STBuildTool.IsDesktopPlatform(Platform) == false) ||
             (Platform == STTargetPlatform.WinRT) ||
             (Platform == STTargetPlatform.WinRT_ARM))
         {
             // We are compiling for a console...
             // We want the output to go into the <GAME>\Binaries folder
             if (InRulesObject.bOutputToEngineBinaries == false)
             {
                 for (int Index = 0; Index < OutputPaths.Length; Index++)
                 {
                     OutputPaths[Index] = OutputPaths[Index].Replace("Engine\\Binaries", InGameName + "\\Binaries");
                 }
             }
         }
     }
 }
Esempio n. 5
0
        /**
         * @param InAppName - The name of the application being built, which is used to scope all intermediate and output file names.
         * @param InGameName - The name of the game being build - can be empty
         * @param InPlatform - The platform the target is being built for.
         * @param InConfiguration - The configuration the target is being built for.
         * @param InAdditionalDefinitions - Additional definitions provided on the UBT command-line for the target.
         * @param InRemoteRoot - The remote path that the build output is synced to.
         */
        public STBuildTarget(
            string InAppName,
            string InGameName,
            STTargetPlatform InPlatform,
            STTargetConfiguration InConfiguration,
            TargetRules InRulesObject,
            List<string> InAdditionalDefinitions,
            string InRemoteRoot,
            List<OnlyModule> InOnlyModules,
            bool bInEditorRecompile)
        {
            AppName = InAppName;
            GameName = InGameName;
            Platform = InPlatform;
            Configuration = InConfiguration;
            Rules = InRulesObject;
            bEditorRecompile = bInEditorRecompile;

            {
                bCompileMonolithic = (Rules != null) ? Rules.ShouldCompileMonolithic(InPlatform, InConfiguration) : false;

                // Platforms may *require* monolithic compilation...
                bCompileMonolithic |= STBuildPlatform.PlatformRequiresMonolithicBuilds(InPlatform, InConfiguration);

                // Force monolithic or modular mode if we were asked to
                if (STBuildTool.CommandLineContains("-Monolithic") ||
                    STBuildTool.CommandLineContains("MONOLITHIC_BUILD=1"))
                {
                    bCompileMonolithic = true;
                }
                else if (STBuildTool.CommandLineContains("-Modular"))
                {
                    bCompileMonolithic = false;
                }
            }

            // Figure out what the project directory is. If we have a uproject file, use that. Otherwise use the engine directory.
            if (STBuildTool.HasUProjectFile())
            {
                ProjectDirectory = Path.GetFullPath(STBuildTool.GetUProjectPath());
            }
            else
            {
                ProjectDirectory = Path.GetFullPath(BuildConfiguration.RelativeEnginePath);
            }

            // Build the project intermediate directory
            ProjectIntermediateDirectory = Path.GetFullPath(Path.Combine(ProjectDirectory, BuildConfiguration.PlatformIntermediateFolder, GetTargetName(), Configuration.ToString()));

            // Build the engine intermediate directory. If we're building agnostic engine binaries, we can use the engine intermediates folder. Otherwise we need to use the project intermediates directory.
            if (ShouldCompileMonolithic())
            {
                EngineIntermediateDirectory = ProjectIntermediateDirectory;
            }
            else if (Configuration == STTargetConfiguration.DebugGame)
            {
                EngineIntermediateDirectory = Path.GetFullPath(Path.Combine(BuildConfiguration.RelativeEnginePath, BuildConfiguration.PlatformIntermediateFolder, AppName, STTargetConfiguration.Development.ToString()));
            }
            else
            {
                EngineIntermediateDirectory = Path.GetFullPath(Path.Combine(BuildConfiguration.RelativeEnginePath, BuildConfiguration.PlatformIntermediateFolder, AppName, Configuration.ToString()));
            }

            RemoteRoot = InRemoteRoot;

            OnlyModules = InOnlyModules;

            TargetTypeOrNull = (Rules != null) ? Rules.Type : (TargetRules.TargetType?)null;

            // Construct the output path based on configuration, platform, game if not specified.
            OutputPaths = MakeBinaryPaths("", AppName, STBuildBinaryType.Executable, TargetType, null, AppName, Configuration == STTargetConfiguration.Shipping ? Rules.ForceNameAsForDevelopment() : false, Rules.ExeBinariesSubFolder);
            for (int Index = 0; Index < OutputPaths.Length; Index++)
            {
                OutputPaths[Index] = Path.GetFullPath(OutputPaths[Index]);
            }

            if (bCompileMonolithic && TargetRules.IsGameType(InRulesObject.Type))
            {
                // For Rocket, UE4Game.exe and UE4Editor.exe still go into Engine/Binaries/<PLATFORM>
                if (!InRulesObject.bOutputToEngineBinaries)
                {
                    // We are compiling a monolithic game...
                    // We want the output to go into the <GAME>\Binaries folder
                    if (STBuildTool.HasUProjectFile() == false)
                    {
                        for (int Index = 0; Index < OutputPaths.Length; Index++)
                        {
                            OutputPaths[Index] = OutputPaths[Index].Replace(Path.Combine("Engine", "Binaries"), Path.Combine(InGameName, "Binaries"));
                        }
                    }
                    else
                    {
                        string EnginePath = Path.GetFullPath(Path.Combine(ProjectFileGenerator.EngineRelativePath, "Binaries"));
                        string UProjectPath = STBuildTool.GetUProjectPath();
                        if (Path.IsPathRooted(UProjectPath) == false)
                        {
                            string FilePath = UProjectInfo.GetProjectForTarget(InGameName);
                            string FullPath = Path.GetFullPath(FilePath);
                            UProjectPath = Path.GetDirectoryName(FullPath);
                        }
                        string ProjectPath = Path.GetFullPath(Path.Combine(UProjectPath, "Binaries"));
                        for (int Index = 0; Index < OutputPaths.Length; Index++)
                        {
                            OutputPaths[Index] = OutputPaths[Index].Replace(EnginePath, ProjectPath);
                        }
                    }
                }
            }

            // handle some special case defines (so build system can pass -DEFINE as normal instead of needing
            // to know about special parameters)
            foreach (string Define in InAdditionalDefinitions)
            {
                switch (Define)
                {
                    case "WITH_EDITOR=0":
                        STBuildConfiguration.bBuildEditor = false;
                        break;

                    case "WITH_EDITORONLY_DATA=0":
                        STBuildConfiguration.bBuildWithEditorOnlyData = false;
                        break;

                    // Memory profiler doesn't work if frame pointers are omitted
                    case "USE_MALLOC_PROFILER=1":
                        BuildConfiguration.bOmitFramePointers = false;
                        break;

                    case "WITH_LEAN_AND_MEAN_UE=1":
                        STBuildConfiguration.bCompileLeanAndMeanUE = true;
                        break;
                }
            }

            // Add the definitions specified on the command-line.
            GlobalCompileEnvironment.Config.Definitions.AddRange(InAdditionalDefinitions);
        }
        /**
         * Return any custom paths for VisualStudio this platform requires
         * This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
         *
         *	@param	InPlatform			The STTargetPlatform being built
         *	@param	TargetType			The type of target (game or program)
         *
         *	@return	string				The custom path lines for the project file; Empty string if it doesn't require one
         */
        public virtual string GetVisualStudioPathsEntries(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration, TargetRules.TargetType TargetType, string TargetRulesPath, string ProjectFilePath, string NMakeOutputPath)
        {
            // NOTE: We are intentionally overriding defaults for these paths with empty strings.  We never want Visual Studio's
            //       defaults for these fields to be propagated, since they are version-sensitive paths that may not reflect
            //       the environment that UBT is building in.  We'll set these environment variables ourselves!
            // NOTE: We don't touch 'ExecutablePath' because that would result in Visual Studio clobbering the system "Path"
            //       environment variable
            string PathsLines =
                "		<IncludePath />\n" +
                "		<ReferencePath />\n" +
                "		<LibraryPath />\n" +
                "		<LibraryWPath />\n" +
                "		<SourcePath />\n" +
                "		<ExcludePath />\n";

            return PathsLines;
        }
 /**
  *	Get the output manifest section, if required
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *
  *	@return	string				The output manifest section for the project file; Empty string if it doesn't require one
  */
 public virtual string GetVisualStudioOutputManifestSection(STTargetPlatform InPlatform, TargetRules.TargetType TargetType, string TargetRulesPath, string ProjectFilePath)
 {
     return "";
 }
 /**
  * Return any custom layout directory sections
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *	@param	TargetType			The type of target (game or program)
  *
  *	@return	string				The custom property import lines for the project file; Empty string if it doesn't require one
  */
 public virtual string GetVisualStudioLayoutDirSection(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration, string InConditionString, TargetRules.TargetType TargetType, string TargetRulesPath, string ProjectFilePath)
 {
     return "";
 }
 public virtual void GenerateGameProperties(STTargetConfiguration Configuration, StringBuilder VCProjectFileContent, TargetRules.TargetType TargetType, string RootDirectory, string TargetFilePath)
 {
     // Do nothing
 }
 public virtual void GenerateGameProjectStub(ProjectFileGenerator InGenerator, string InTargetName, string InTargetFilepath, TargetRules InTargetRules,
     List<STTargetPlatform> InPlatforms, List<STTargetConfiguration> InConfigurations)
 {
     // Do nothing
 }
Esempio n. 11
0
        /** Given a UBT-built binary name (e.g. "Core"), returns a relative path to the binary for the current build configuration (e.g. "../Binaries/Win64/Core-Win64-Debug.lib") */
        public static string[] MakeBinaryPaths(string ModuleName, string BinaryName, STTargetPlatform Platform,
            STTargetConfiguration Configuration, STBuildBinaryType BinaryType, TargetRules.TargetType? TargetType, PluginInfo PluginInfo, string AppName, bool bForceNameAsForDevelopment = false, string ExeBinariesSubFolder = null)
        {
            // Determine the binary extension for the platform and binary type.
            var BuildPlatform = STBuildPlatform.GetBuildPlatform(Platform);
            string BinaryExtension;

            if (!BuildConfiguration.bRunUnrealCodeAnalyzer)
            {
                BinaryExtension = BuildPlatform.GetBinaryExtension(BinaryType);
            }
            else
            {
                BinaryExtension = @"-" + BuildConfiguration.UCAModuleToAnalyze + @".analysis";
            }

            STTargetConfiguration LocalConfig = Configuration;
            if (Configuration == STTargetConfiguration.DebugGame && !String.IsNullOrEmpty(ModuleName) && !RulesCompiler.IsGameModule(ModuleName))
            {
                LocalConfig = STTargetConfiguration.Development;
            }

            string ModuleBinariesSubDir = "";
            if (BinaryType == STBuildBinaryType.DynamicLinkLibrary && (string.IsNullOrEmpty(ModuleName) == false))
            {
                // Allow for modules to specify sub-folders in the Binaries folder
                var RulesFilename = RulesCompiler.GetModuleFilename(ModuleName);
                // Plugins can be binary-only and can have no rules object
                if (PluginInfo == null || !String.IsNullOrEmpty(RulesFilename))
                {
                    ModuleRules ModuleRulesObj = RulesCompiler.CreateModuleRules(ModuleName, new TargetInfo(Platform, Configuration, TargetType), out RulesFilename);
                    if (ModuleRulesObj != null)
                    {
                        ModuleBinariesSubDir = ModuleRulesObj.BinariesSubFolder;
                    }
                }
            }
            else if (BinaryType == STBuildBinaryType.Executable && string.IsNullOrEmpty(ExeBinariesSubFolder) == false)
            {
                ModuleBinariesSubDir = ExeBinariesSubFolder;
            }

            //@todo.Rocket: This just happens to work since exp and lib files go into intermediate...

            // Build base directory string ("../Binaries/<Platform>/")
            string BinariesDirName;
            if (TargetType.HasValue && TargetType.Value == TargetRules.TargetType.Program && STBuildTool.HasUProjectFile() && !ProjectFileGenerator.bGenerateProjectFiles)
            {
                BinariesDirName = Path.Combine(STBuildTool.GetUProjectPath(), "Binaries");
            }
            else if (PluginInfo != null)
            {
                BinariesDirName = Path.Combine(PluginInfo.Directory, "Binaries");
            }
            else
            {
                BinariesDirName = Path.Combine("..", "Binaries");
            }
            var BaseDirectory = Path.Combine(BinariesDirName, Platform.ToString());
            if (ModuleBinariesSubDir.Length > 0)
            {
                BaseDirectory = Path.Combine(BaseDirectory, ModuleBinariesSubDir);
            }

            string BinarySuffix = "";
            if ((PluginInfo != null) && (BinaryType != STBuildBinaryType.DynamicLinkLibrary))
            {
                BinarySuffix = "-Static";
            }

            // append the architecture to the end of the binary name
            BinarySuffix = BuildPlatform.ApplyArchitectureName(BinarySuffix);

            string OutBinaryPath = "";
            // Append binary file name
            string Prefix = "";
            if (Platform == STTargetPlatform.Linux && (BinaryType == STBuildBinaryType.DynamicLinkLibrary || BinaryType == STBuildBinaryType.StaticLibrary))
            {
                Prefix = "lib";
            }

            if (LocalConfig == STTargetConfiguration.Development || bForceNameAsForDevelopment)
            {
                OutBinaryPath = Path.Combine(BaseDirectory, String.Format("{3}{0}{1}{2}", BinaryName, BinarySuffix, BinaryExtension, Prefix));
            }
            else
            {
                OutBinaryPath = Path.Combine(BaseDirectory, String.Format("{5}{0}-{1}-{2}{3}{4}",
                    BinaryName, Platform.ToString(), LocalConfig.ToString(), BinarySuffix, BinaryExtension, Prefix));
            }

            return BuildPlatform.FinalizeBinaryPaths(OutBinaryPath);
        }
Esempio n. 12
0
        public GxBase(TargetRules target)
            : base(target)
        {
            this.Type     = ModuleType.SharedLibrary;
            this.Kind     = ModuleKind.Runtime;
            this.Language = ModuleLanguage.CPlusPlus;

            this.PrivateDefines.AddRange(new[] {
                "__AVX__=1",
                "_WINDLL",
                "_WIN32",
                "_WIN32_WINNT=0x0A00",
                "WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP",
                "__WINDOWS__",
                "__STDC_WANT_LIB_EXT1__=1",
                "__STDINT_MACROS",
                "__STDINT_LIMITS",
                "__STDC_CONSTANT_MACROS",
                "__STDC_FORMAT_MACROS",
                "__STDC_LIMIT_MACROS",
                "_UNICODE",
                "UNICODE",
                "_HAS_EXCEPTIONS=0",
                "_HAS_ITERATOR_DEBUGGING=0",
                "_SCL_SECURE=0",
                "_SECURE_SCL=0",
                "_CRT_SECURE_INVALID_PARAMETER=",
            });

            // BUG: redefine this conditionally
            this.PrivateDefines.Add("module_base_EXPORTS=1");

            this.PublicIncludePaths.Add(Path.Combine(target.SourceDirectory.FullName, "engine", "include"));
            this.PublicIncludePaths.Add(Path.Combine(this.SourceDirectory.FullName, "public"));

            this.PrivateDependencies.Add(typeof(SdkLz4));
            this.PublicDependencies.Add(typeof(SdkFmt));

            if (target.Descriptor.Platform != TargetPlatform.UniversalWindows)
            {
                this.PrivateDependencies.Add(typeof(SdkMbedtls));
            }

            if (target.Descriptor.Platform == TargetPlatform.Windows ||
                target.Descriptor.Platform == TargetPlatform.UniversalWindows)
            {
                this.PrivateLibraries.AddRange(new[] {
                    "ntdll.lib",
                    "comctl32.lib",
                    "iphlpapi.lib",
                    "ws2_32.lib",
                    "dwmapi.lib",
                    "xinput.lib",
                    "xaudio2.lib",
                    "advapi32.lib",
                    "gdi32.lib",
                    "shell32.lib",
                    "ole32.lib",
                    "Faultrep.lib",
                    "Bcrypt.lib",
                    "user32.lib",
                    "Mincore.lib",
                    "msvcprtd.lib",
                });

                if (target.Descriptor.Configuration != TargetConfiguration.Release)
                {
                    this.PrivateLibraries.Add("dbghelp.lib");
                }
            }
            else if (target.Descriptor.Platform == TargetPlatform.Linux)
            {
                this.PublicLibraries.AddRange(new[] {
                    "pthread",
                    "uuid",
                    "dl",
                    "SDL2",
                    "unwind",
                    "unwind-generic",
                });

                if (target.Descriptor.Architecture == TargetArchitecture.X64)
                {
                    this.PublicLibraries.Add("unwind-x86_64");
                }
                else if (target.Descriptor.Architecture == TargetArchitecture.Arm64)
                {
                    this.PublicLibraries.Add("unwind-aarch64");
                }
            }
        }
 /// <summary>
 /// Get the text to insert into the user file for the given platform/configuration/target
 /// </summary>
 /// <param name="InPlatform">The platform being added</param>
 /// <param name="InConfiguration">The configuration being added</param>
 /// <param name="InConditionString">The condition string </param>
 /// <param name="InTargetRules">The target rules </param>
 /// <param name="TargetRulesPath">The target rules path</param>
 /// <param name="ProjectFilePath">The project file path</param>
 /// <returns>The string to append to the user file</returns>
 public virtual string GetVisualStudioUserFileStrings(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration,
     string InConditionString, TargetRules InTargetRules, string TargetRulesPath, string ProjectFilePath)
 {
     return "";
 }
Esempio n. 14
0
 /** Given a UBT-built binary name (e.g. "Core"), returns a relative path to the binary for the current build configuration (e.g. "../../Binaries/Win64/Core-Win64-Debug.lib") */
 public string[] MakeBinaryPaths(string ModuleName, string BinaryName, STBuildBinaryType BinaryType, TargetRules.TargetType? TargetType, PluginInfo PluginInfo, string AppName, bool bForceNameAsForDevelopment = false, string ExeBinariesSubFolder = null)
 {
     if (String.IsNullOrEmpty(ModuleName) && Configuration == STTargetConfiguration.DebugGame && !bCompileMonolithic)
     {
         return MakeBinaryPaths(ModuleName, BinaryName, Platform, STTargetConfiguration.Development, BinaryType, TargetType, PluginInfo, AppName, bForceNameAsForDevelopment);
     }
     else
     {
         return MakeBinaryPaths(ModuleName, BinaryName, Platform, Configuration, BinaryType, TargetType, PluginInfo, AppName, bForceNameAsForDevelopment, ExeBinariesSubFolder);
     }
 }
Esempio n. 15
0
 public override void ValidateTarget(TargetRules Target)
 {
     Target.bDeployAfterCompile = true;
     Target.bCompileNvCloth     = true;
 }
Esempio n. 16
0
    public AkAudio(TargetInfo Target)
#endif
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
        PrivateIncludePathModuleNames.AddRange(new string[] { "Settings", "UMG" });
#if UE_4_17_OR_LATER
        ReadOnlyTargetRules BuildConfig = Target;
#else
        TargetRules BuildConfig = UEBuildConfiguration;
#endif
        // Need to use Enum.Parse because Switch is not present in UE < 4.15
        try
        {
            var SwitchPlatform = (UnrealTargetPlatform)Enum.Parse(typeof(UnrealTargetPlatform), "Switch");
            if (SwitchPlatform != UnrealTargetPlatform.Unknown)
            {
                TargetPlatformIsNintendoSwitch = (Target.Platform == SwitchPlatform);
            }
        }
        catch (Exception)
        {
        }

        PrivateIncludePaths.AddRange(
            new string[] {
            "AkAudio/Private",
        }
            );

        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            "CoreUObject",
            "Engine",
            "SlateCore",
            "NetworkReplayStreaming",
            "MovieScene",
            "MovieSceneTracks",
            "Projects",
            "Json",
            "Slate",
            "InputCore"
        });

        PublicDependencyModuleNames.Add("UMG");

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

        string        akDir            = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../ThirdParty"));
        List <string> akPlatformLibDir = new List <string>();

#if UE_4_19_OR_LATER
        var Defs = PublicDefinitions;
#else
        var Defs = Definitions;
#endif

        Defs.Add("USE_AKAUDIO");

        PublicIncludePaths.AddRange(
            new string[] {
            // SDK includes
            Path.Combine(akDir, "include"),
        }
            );

        // These definitions can be set as platform-specific
        if (BuildConfig.bBuildEditor == true)
        {
            // Boost the number of IO for the editor, since it uses the old IO system
            Defs.Add("AK_UNREAL_MAX_CONCURRENT_IO=256");
        }
        else
        {
            Defs.Add("AK_UNREAL_MAX_CONCURRENT_IO=32");
        }

        Defs.Add("AK_UNREAL_IO_GRANULARITY=32768");

        if (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64)
        {
            string tempDir = (Target.Platform == UnrealTargetPlatform.Win32) ? "Win32_" : "x64_";
#if UE_4_18_OR_LATER
            tempDir += GetVisualStudioVersion(Target);
#else
            tempDir += GetVisualStudioVersion();
#endif
            akPlatformLibDir.Add(tempDir);
            string LibFolder = (Target.Platform == UnrealTargetPlatform.Win32) ? "x86" : "x64";
            // HACK
            string DXSDK_DIR = Path.GetFullPath(Path.Combine(EngineDirectory, "Source/ThirdParty/Windows/DirectX"));
            PublicLibraryPaths.Add(/*"$(DXSDK_DIR)"*/ DXSDK_DIR + Path.DirectorySeparatorChar + "Lib" + Path.DirectorySeparatorChar + LibFolder);

            if (BuildConfig.bBuildEditor == true)
            {
                // Sound frame is required for enabling communication between Wwise Application and the unreal editor.
                // Not to be defined in shipping mode.
                Defs.Add("AK_SOUNDFRAME");
            }

            PublicAdditionalLibraries.Add("dsound.lib");
            PublicAdditionalLibraries.Add("dxguid.lib");
            PublicAdditionalLibraries.Add("Msacm32.lib");
            PublicAdditionalLibraries.Add("XInput.lib");
            PublicAdditionalLibraries.Add("dinput8.lib");
        }
        else if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            string VSVersion = "vc140";

            // Use reflection because the GitHub version of UE is missing things.
            var XboxOnePlatformType = System.Type.GetType("XboxOnePlatform", false);
            if (XboxOnePlatformType != null)
            {
                var XboxOneCompilerField = XboxOnePlatformType.GetField("Compiler");
                if (XboxOneCompilerField != null)
                {
                    var XboxOneCompilerValue = XboxOneCompilerField.GetValue(null);
                    if (XboxOneCompilerValue.ToString() == "VisualStudio2012")
                    {
                        VSVersion = "vc110";
                    }
                }
            }

            akPlatformLibDir.Add("XboxOne_" + VSVersion);

            PublicAdditionalLibraries.Add("AcpHal.lib");
            PublicAdditionalLibraries.Add("MMDevApi.lib");
            Defs.Add("_XBOX_ONE");
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            akPlatformLibDir.Add("Linux_x64");
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            akPlatformLibDir.Add("Mac");
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            akPlatformLibDir.Add("iOS");
        }
        else if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            akPlatformLibDir.Add("PS4");
            PublicAdditionalLibraries.Add("SceAjm_stub_weak");
            PublicAdditionalLibraries.Add("SceAudio3d_stub_weak");
            PublicAdditionalLibraries.Add("SceMove_stub_weak");
            Defs.Add("__ORBIS__");
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            akPlatformLibDir.Add("Android_armeabi-v7a");
            akPlatformLibDir.Add("Android_x86");
            akPlatformLibDir.Add("Android_arm64-v8a");
            akPlatformLibDir.Add("Android_x86_64");
            Defs.Add("__ANDROID__");
        }
        else if (TargetPlatformIsNintendoSwitch)
        {
            akPlatformLibDir.Add("NX64");
            Defs.Add("NN_NINTENDO_SDK");
        }
#if UE_4_20_OR_LATER
        else if (Target.Platform == UnrealTargetPlatform.Lumin)
        {
            akPlatformLibDir.Add("Lumin");
            Defs.Add("AK_LUMIN");
        }
#endif

        if (Target.Configuration == UnrealTargetConfiguration.Shipping)
        {
            Defs.Add("AK_OPTIMIZED");
        }

        string akConfigurationDir;

        if (Target.Configuration == UnrealTargetConfiguration.Debug)
        {
            // change bDebugBuildsActuallyUseDebugCRT to true in BuildConfiguration.cs to actually link debug binaries
#if UE_4_18_OR_LATER
            if (!Target.bDebugBuildsActuallyUseDebugCRT)
#else
            if (!BuildConfiguration.bDebugBuildsActuallyUseDebugCRT)
#endif
            {
                akConfigurationDir = "Profile";
            }
            else
            {
                akConfigurationDir = "Debug";
            }
        }
        else if (Target.Configuration == UnrealTargetConfiguration.Development ||
                 Target.Configuration == UnrealTargetConfiguration.Test ||
                 Target.Configuration == UnrealTargetConfiguration.DebugGame)
        {
            akConfigurationDir = "Profile";
        }
        else         // if (Target.Configuration == UnrealTargetConfiguration.Shipping)
        {
            akConfigurationDir = "Release";
        }

        if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            akConfigurationDir += "-iphoneos";
        }

        if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            // No profiler support in the cross-compile toolchain.
            akConfigurationDir = "Release";
        }

        foreach (string libDir in akPlatformLibDir)
        {
            akLibPath = Path.Combine(Path.Combine(Path.Combine(akDir, libDir), akConfigurationDir), "lib");
            PublicLibraryPaths.Add(akLibPath);
        }

        AddWwiseLib(Target, "AkSoundEngine");
        AddWwiseLib(Target, "AkMemoryMgr");
        AddWwiseLib(Target, "AkStreamMgr");
        AddWwiseLib(Target, "AkMusicEngine");
        AddWwiseLib(Target, "AkSpatialAudio");

        AddWwiseLib(Target, "AkVorbisDecoder");
        AddWwiseLib(Target, "AkSilenceSource");
        AddWwiseLib(Target, "AkSineSource");
        AddWwiseLib(Target, "AkToneSource");
        AddWwiseLib(Target, "AkPeakLimiterFX");
        AddWwiseLib(Target, "AkMatrixReverbFX");
        AddWwiseLib(Target, "AkParametricEQFX");
        AddWwiseLib(Target, "AkDelayFX");
        AddWwiseLib(Target, "AkExpanderFX");
        AddWwiseLib(Target, "AkFlangerFX");
        AddWwiseLib(Target, "AkCompressorFX");
        AddWwiseLib(Target, "AkGainFX");
        AddWwiseLib(Target, "AkHarmonizerFX");
        AddWwiseLib(Target, "AkTimeStretchFX");
        AddWwiseLib(Target, "AkPitchShifterFX");
        AddWwiseLib(Target, "AkStereoDelayFX");
        AddWwiseLib(Target, "AkMeterFX");
        AddWwiseLib(Target, "AkGuitarDistortionFX");
        AddWwiseLib(Target, "AkTremoloFX");
        AddWwiseLib(Target, "AkRoomVerbFX");
        AddWwiseLib(Target, "AkAudioInputSource");
        AddWwiseLib(Target, "AkSynthOneSource");
        AddWwiseLib(Target, "AkRecorderFX");

        AddWwisePlugin(Target, "AkReflectFX");
        AddWwisePlugin(Target, "AkConvolutionReverbFX");
        AddWwisePlugin(Target, "AuroHeadphoneFX");

        if (SupportsAkAutobahn())
        {
            Defs.Add("AK_SUPPORT_WAAPI=1");
            AddWwiseLib(Target, "AkAutobahn");
        }
        else
        {
            Defs.Add("AK_SUPPORT_WAAPI=0");
        }

        if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            AddWwiseLib(Target, "SceAudio3dEngine");
        }

        if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicAdditionalFrameworks.Add(new Framework("AudioUnit"));
            PublicAdditionalFrameworks.Add(new Framework("AudioToolbox"));
            PublicAdditionalFrameworks.Add(new Framework("CoreAudio"));
            AddWwiseLib(Target, "AkAACDecoder");
        }

        if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicAdditionalFrameworks.Add(new Framework("AudioToolbox"));
            PublicAdditionalFrameworks.Add(new Framework("CoreAudio"));
            AddWwiseLib(Target, "AkAACDecoder");
        }

        if (TargetPlatformIsNintendoSwitch)
        {
            AddWwiseLib(Target, "AkOpusNXDecoder");
        }
        else
        {
            AddWwiseLib(Target, "AkOpusDecoder");
        }

        if (Defs.Contains("AK_OPTIMIZED") == false && Target.Platform != UnrealTargetPlatform.Linux)
        {
            AddWwiseLib(Target, "CommunicationCentral");
        }

        // SoundFrame libs
        if (Defs.Contains("AK_SOUNDFRAME") == true)
        {
            PublicAdditionalLibraries.Add("SFLib.lib");
        }

        // If AK_SOUNDFRAME is defined, make UnrealEd a dependency
        if (BuildConfig.bBuildEditor == true)
        {
            PrivateDependencyModuleNames.Add("SlateCore");
            PrivateDependencyModuleNames.Add("Slate");
            PrivateDependencyModuleNames.Add("UnrealEd");
        }
    }
    public CesiumEditor(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

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


        PrivateIncludePaths.AddRange(
            new string[] {
            Path.Combine(ModuleDirectory, "../ThirdParty/include")
        }
            );

        string libPrefix;
        string libPostfix;
        string platform;

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            platform   = "Windows-x64";
            libPostfix = ".lib";
            libPrefix  = "";
        }
        else if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            platform   = "Darwin-x64";
            libPostfix = ".a";
            libPrefix  = "lib";
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            platform   = "Android-xaarch64";
            libPostfix = ".a";
            libPrefix  = "lib";
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            platform   = "Linux-x64";
            libPostfix = ".a";
            libPrefix  = "lib";
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            platform   = "iOS-xarm64";
            libPostfix = ".a";
            libPrefix  = "lib";
        }
        else
        {
            platform   = "Unknown";
            libPostfix = ".Unknown";
            libPrefix  = "Unknown";
        }

        string libPath = Path.Combine(ModuleDirectory, "../ThirdParty/lib/" + platform);

        string releasePostfix = "";
        string debugPostfix   = "d";

        bool   preferDebug = (Target.Configuration == UnrealTargetConfiguration.Debug || Target.Configuration == UnrealTargetConfiguration.DebugGame);
        string postfix     = preferDebug ? debugPostfix : releasePostfix;

        string[] libs = new string[]
        {
            "CesiumIonClient",
            "csprng"
        };

        if (preferDebug)
        {
            // We prefer Debug, but might still use Release if that's all that's available.
            foreach (string lib in libs)
            {
                string debugPath = Path.Combine(libPath, libPrefix + lib + debugPostfix + libPostfix);
                if (!File.Exists(debugPath))
                {
                    Console.WriteLine("Using release build of cesium-native because a debug build is not available.");
                    preferDebug = false;
                    postfix     = releasePostfix;
                    break;
                }
            }
        }

        PublicAdditionalLibraries.AddRange(libs.Select(lib => Path.Combine(libPath, libPrefix + lib + postfix + libPostfix)));

        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            "UnrealEd",
            "CesiumRuntime"
        }
            );

        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            "CoreUObject",
            "Engine",
            "ApplicationCore",
            "Slate",
            "SlateCore",
            "MeshDescription",
            "StaticMeshDescription",
            "HTTP",
            "MikkTSpace",
            "Chaos",
            "Projects",
            "InputCore",
            "PropertyEditor",
            "DeveloperSettings",
            "EditorStyle"
            // ... add private dependencies that you statically link with here ...
        }
            );

        PublicDefinitions.AddRange(
            new string[]
        {
        }
            );

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

        PCHUsage             = PCHUsageMode.UseExplicitOrSharedPCHs;
        PrivatePCHHeaderFile = "Private/PCH.h";
        CppStandard          = CppStandardVersion.Cpp17;

        if (Target.Platform == UnrealTargetPlatform.IOS ||
            (Target.Platform == UnrealTargetPlatform.Android &&
             Target.Version.MajorVersion == 4 &&
             Target.Version.MinorVersion == 26 &&
             Target.Version.PatchVersion < 2))
        {
            // In UE versions prior to 4.26.2, the Unreal Build Tool on Android
            // (AndroidToolChain.cs) ignores the CppStandard property and just
            // always uses C++14. Our plugin can't be compiled with C++14.
            //
            // So this hack uses reflection to add an additional argument to
            // the compiler command-line to force C++17 mode. Clang ignores all
            // but the last `-std=` argument, so the `-std=c++14` added by the
            // UBT is ignored.
            //
            // This is also needed for iOS builds on all engine versions as Unreal
            // defaults to c++14 regardless of the CppStandard setting
            Type        type       = Target.GetType();
            FieldInfo   innerField = type.GetField("Inner", BindingFlags.Instance | BindingFlags.NonPublic);
            TargetRules inner      = (TargetRules)innerField.GetValue(Target);
            inner.AdditionalCompilerArguments += " -std=c++17";
        }
    }
Esempio n. 18
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="InGameName"></param>
        /// <param name="InRulesObject"></param>
        /// <param name="InPlatform"></param>
        /// <param name="InConfiguration"></param>
        /// <returns></returns>
        public static string GetBinaryBaseName(string InGameName, TargetRules InRulesObject, STTargetPlatform InPlatform, STTargetConfiguration InConfiguration, string InNameAppend)
        {
            //@todo. Allow failure to get build platform here?
            bool bPlatformRequiresMonolithic = false;
            var BuildPlatform = STBuildPlatform.GetBuildPlatform(InPlatform, true);
            if (BuildPlatform != null)
            {
                bPlatformRequiresMonolithic = BuildPlatform.ShouldCompileMonolithicBinary(InPlatform);
            }

            if (InRulesObject.ShouldCompileMonolithic(InPlatform, InConfiguration) || bPlatformRequiresMonolithic)
            {
                return InGameName;
            }
            else
            {
                return "UE4" + InNameAppend;
            }
        }
Esempio n. 19
0
    // Sets up ISPC build rules as custom pre-build step in the passed in target, and caches autogenerated rule details.
    public static void SetupISPCRules(TargetRules Target)
    {
        System.Version ISPCVersion = GetISPCVersion();
        if (ISPCVersion.Major < 0)
        {
            Log.WriteLine(LogEventType.Warning, "Could not determine the ISPC version");
        }
        else if (ISPCVersion < MinimumISPCVersion)
        {
            throw new System.Exception(string.Format("ISPC version {0} is not recent enough, a minimum of {1} is required",
                                                     ISPCVersion.ToString(), MinimumISPCVersion.ToString()));
        }

        string ModuleName = new StackFrame().GetMethod().DeclaringType.ToString();

        string PlatformIntermediateDir = Path.Combine
                                         (
            Target.ProjectFile.Directory.FullName,
            "Intermediate",
            "Build",
            Target.Platform.ToString(),
            /*UEBuildPlatform.GetBuildPlatform(Target.Platform).GetFolderNameForArchitecture*/ (Target.Architecture)
                                         );

        string ModuleSourceDirectory = Path.Combine
                                       (
            Target.ProjectFile.Directory.FullName,
            "Source",
            ModuleName
                                       );

        Debug.Assert(File.Exists(Path.Combine(ModuleSourceDirectory, ModuleName + ".Build.cs")), string.Format("`ModuleSourceDirectory` needs to point at the `Source` directory of module `{0}`", ModuleName));

        string ObjectDir = Path.Combine
                           (
            PlatformIntermediateDir,
            Target.Name,
            Target.Configuration.ToString(),
            ModuleName
                           );

        string HeaderDir = Path.Combine
                           (
            PlatformIntermediateDir,
            Target.Type == TargetType.Editor ? "UE4Editor" : "UE4",
            "Inc",
            ModuleName
                           );

        Directory.CreateDirectory(ObjectDir);
        Directory.CreateDirectory(HeaderDir);

        var Sources = GetISPCSources(ModuleSourceDirectory);

        bool bUseGNUMake = System.Environment.OSVersion.Platform == System.PlatformID.Unix || System.Environment.OSVersion.Platform == System.PlatformID.MacOSX;

        string MakefilePath = Path.Combine(ObjectDir, MakefileName);

        Log.WriteLine(LogEventType.Console, "Generating ISPC makefile {0}", MakefilePath);
        using (StreamWriter Makefile = new StreamWriter(MakefilePath))
        {
            Makefile.WriteLine("# Generated automatically by module rules, do not modify");
            Makefile.WriteLine();

            Makefile.WriteLine("ISPC=" + GetISPCExecutablePath());
            Makefile.WriteLine("ISPCFLAGS=" + GetISPCFlags(Target.Platform, Target.Configuration, bUseInstrumentation));
            Makefile.WriteLine("SOURCE_DIR=" + ModuleSourceDirectory);
            Makefile.WriteLine("HEADER_DIR=" + HeaderDir);
            Makefile.WriteLine();

            List <string> AbsoluteSources = new List <string>();
            List <string> Objects         = new List <string>();
            List <string> AbsoluteObjects = new List <string>();
            List <string> Headers         = new List <string>();
            List <string> Dependencies    = new List <string>();
            foreach (string RelativeSource in Sources)
            {
                string BaseName   = Path.GetFileName(RelativeSource);
                string Object     = BaseName.Replace(".ispc", ".ispc.o");
                string Header     = BaseName.Replace(".ispc", ".ispc.h");
                string Dependency = BaseName.Replace(".ispc", ".ispc.d");
                string AbsSource  = Path.Combine(ModuleSourceDirectory, RelativeSource);
                string AbsObject  = Path.Combine(ObjectDir, Object);
                string AbsHeader  = Path.Combine(HeaderDir, Header);

                AbsoluteSources.Add(AbsSource);
                Objects.Add(Object);
                AbsoluteObjects.Add(AbsObject);
                Headers.Add(AbsHeader);
                Dependencies.Add(Dependency);

                Makefile.WriteLine(bUseGNUMake ? "ifdef $(HAVE_DEPENDENCIES)" : "!IFDEF HAVE_DEPENDENCIES");

                Makefile.WriteLine("# ISPC object file.");
                Makefile.WriteLine("{0} {1}", bUseGNUMake ? "include" : "!INCLUDE", Dependency);
                Makefile.WriteLine("\t$(ISPC) \"$(SOURCE_DIR){0}\" -o $@ -h \"$(HEADER_DIR){1}\" $(ISPCFLAGS)",
                                   Path.DirectorySeparatorChar + RelativeSource,
                                   Path.DirectorySeparatorChar + Header);

                Makefile.WriteLine("# ISPC C++ autogenerated header. Actually built together with the object file, so consider this indirect dependency a hack.");
                Makefile.WriteLine("\"$(HEADER_DIR){0}\": {1}", Path.DirectorySeparatorChar + Header, Object);

                Makefile.WriteLine(bUseGNUMake ? "else" : "!ELSE");

                Makefile.WriteLine("# ISPC object dependency file.");
                Makefile.WriteLine("{0}: \"$(SOURCE_DIR){1}\"", Dependency, Path.DirectorySeparatorChar + RelativeSource);
                Makefile.WriteLine("\t$(ISPC) $? -M -MF $@ -MT {0} --wno-perf $(ISPCFLAGS)", Object);

                Makefile.WriteLine(bUseGNUMake ? "endif" : "!ENDIF");

                Makefile.WriteLine();
            }
            Makefile.WriteLine("# Phony target for building all dependency files.");
            Makefile.WriteLine("depend: " + string.Join(" ", Dependencies));
            Makefile.WriteLine("# Phony target for building all objects.");
            Makefile.WriteLine("all: " + string.Join(" ", Objects));

            _ISPCObjects = AbsoluteObjects.ToArray();
        }

        // Use /C to silence nmake's output because the copyright notice is emitted to stderr and UBT interprets that as error.
        string MakeCmdline = bUseGNUMake ? "make -f" : "nmake /C /F";
        string PreTarget   = "HAVE_DEPENDENCIES=1";
        string PostTarget  = "";

        if (bUseGNUMake)
        {
            PostTarget = PreTarget;
            PreTarget  = "";
        }

        Target.PreBuildSteps.Add(string.Format("pushd \"{0}\" && " +
                                               "echo Gathering ISPC dependencies && " +
                                               "{1} \"{2}\" depend && " +
                                               "echo Building ISPC kernels && " +
                                               "{1} \"{2}\" {3} all {4} &&" +
                                               "popd",
                                               ObjectDir,
                                               MakeCmdline,
                                               MakefileName,
                                               PreTarget,
                                               PostTarget
                                               ));

        bISPCHasBeenSetupInTarget = true;
    }