Exemple #1
0
        /// <summary>
        /// Setup the binaries for this target
        /// </summary>
        protected override void SetupBinaries()
        {
            base.SetupBinaries();

            {
                // Make the editor executable.
                STBuildBinaryConfiguration Config = new STBuildBinaryConfiguration(InType: STBuildBinaryType.Executable,
                                                                                    InOutputFilePaths: OutputPaths,
                                                                                    InIntermediateDirectory: EngineIntermediateDirectory,
                                                                                    bInCreateImportLibrarySeparately: (ShouldCompileMonolithic() ? false : true),
                                                                                    bInAllowExports: !ShouldCompileMonolithic(),
                                                                                    InModuleNames: new List<string>() { "Launch" });

                AppBinaries.Add(new STBuildBinaryCPP(this, Config));
            }

            // Add the other modules that we want to compile along with the executable.  These aren't necessarily
            // dependencies to any of the other modules we're building, so we need to opt in to compile them.
            {
                // Modules should properly identify the 'extra modules' they need now.
                // There should be nothing here!
            }

            // Allow the platform to setup binaries
            STBuildPlatform.GetBuildPlatform(Platform).SetupBinaries(this);
        }
Exemple #2
0
 /// <summary>
 /// Create an instance initialized to the given configuration
 /// </summary>
 /// <param name="InConfig">The build binary configuration to initialize the instance to</param>
 public STBuildBinaryCSDLL(STBuildTarget InTarget, STBuildBinaryConfiguration InConfig)
     : base(InTarget, InConfig)
 {
 }
Exemple #3
0
 /// <summary>
 /// Create an instance of the class with the given configuration data
 /// </summary>
 /// <param name="InConfig">The build binary configuration to initialize the class with</param>
 public STBuildBinary(STBuildTarget InTarget, STBuildBinaryConfiguration InConfig)
 {
     Debug.Assert(InConfig.OutputFilePath != null && InConfig.IntermediateDirectory != null);
     Target = InTarget;
     Config = InConfig;
 }
Exemple #4
0
 public STBuildBinaryCPP(STBuildTarget InTarget, STBuildBinaryConfiguration InConfig)
     : base(InTarget, InConfig)
 {
     ModuleNames = new HashSet<string>(InConfig.ModuleNames);
     bCreateImportLibrarySeparately = InConfig.bCreateImportLibrarySeparately;
     bIncludeDependentLibrariesInLibrary = InConfig.bIncludeDependentLibrariesInLibrary;
 }
Exemple #5
0
        public override void RecursivelyProcessUnboundModules(STBuildTarget Target, ref Dictionary<string, STBuildBinary> Binaries, STBuildBinary ExecutableBinary)
        {
            try
            {
                // Make sure this module is bound to a binary
                if (!bIncludedInTarget)
                {
                    throw new BuildException("Module '{0}' should already have been bound to a binary!", Name);
                }

                var AllModuleNames = new List<string>();
                AllModuleNames.AddRange(PrivateDependencyModuleNames);
                AllModuleNames.AddRange(PublicDependencyModuleNames);
                AllModuleNames.AddRange(DynamicallyLoadedModuleNames);
                AllModuleNames.AddRange(PlatformSpecificDynamicallyLoadedModuleNames);

                foreach (var DependencyName in AllModuleNames)
                {
                    var DependencyModule = Target.FindOrCreateModuleByName(DependencyName);

                    // Skip modules that are included with the target (externals)
                    if (!DependencyModule.bIncludedInTarget)
                    {
                        if (!Binaries.ContainsKey(DependencyModule.Name))
                        {
                            STBuildBinary BinaryToBindTo;
                            if (Target.ShouldCompileMonolithic())
                            {
                                // When linking monolithically, any unbound modules will be linked into the main executable
                                BinaryToBindTo = ExecutableBinary;
                            }
                            else
                            {
                                // Is this a plugin module?
                                var PluginInfo = Plugins.GetPluginInfoForModule(DependencyName);

                                string[] OutputFilePaths = Target.MakeBinaryPaths(DependencyModule.Name, Target.GetAppName() + "-" + DependencyModule.Name, STBuildBinaryType.DynamicLinkLibrary, Target.TargetType, PluginInfo, "");

                                // If it's an engine module, output intermediates to the engine intermediates directory.
                                string IntermediateDirectory = Binary.Config.IntermediateDirectory;
                                if (IntermediateDirectory != Target.EngineIntermediateDirectory && Path.GetFullPath(DependencyModule.ModuleDirectory).StartsWith(Path.GetFullPath(BuildConfiguration.RelativeEnginePath)))
                                {
                                    IntermediateDirectory = Target.EngineIntermediateDirectory;
                                }

                                // When using modular linkage, unbound modules will be linked into their own DLL files
                                STBuildBinaryConfiguration Config = new STBuildBinaryConfiguration(InType: STBuildBinaryType.DynamicLinkLibrary,
                                                                                                    InOutputFilePaths: OutputFilePaths,
                                                                                                    InIntermediateDirectory: IntermediateDirectory,
                                                                                                    bInAllowExports: true,
                                                                                                    InModuleNames: new List<string> { DependencyModule.Name },
                                                                                                    InTargetName: Target.GetAppName(),
                                                                                                    bInIsCrossTarget: PlatformSpecificDynamicallyLoadedModuleNames.Contains(DependencyName) && !DynamicallyLoadedModuleNames.Contains(DependencyName),
                                                                                                    InTargetConfiguration: Target.Configuration,
                                                                                                    bInCompileMonolithic: Target.ShouldCompileMonolithic());

                                // Fix up the binary path if this is module specifies an alternate output directory
                                for (int Index = 0; Index < Config.OutputFilePaths.Length; Index++)
                                {
                                    Config.OutputFilePaths[Index] = DependencyModule.FixupOutputPath(Config.OutputFilePaths[Index]);
                                }

                                BinaryToBindTo = new STBuildBinaryCPP(Target, Config);
                            }

                            Binaries[DependencyModule.Name] = BinaryToBindTo;

                            // Bind this module
                            DependencyModule.Binary = BinaryToBindTo;
                            DependencyModule.bIncludedInTarget = true;

                            // Also add binaries for this module's dependencies
                            DependencyModule.RecursivelyProcessUnboundModules(Target, ref Binaries, ExecutableBinary);
                        }
                    }

                    if (Target.ShouldCompileMonolithic() == false)
                    {
                        // Check to see if there is a circular relationship between the module and it's referencer
                        if (DependencyModule.Binary != null)
                        {
                            if (CircularlyReferencedDependentModules.Contains(DependencyName))
                            {
                                DependencyModule.Binary.SetCreateImportLibrarySeparately(true);
                            }
                        }
                    }
                }

                // Also make sure module entries are created for any module that is pulled in as an "include path" module.
                // These modules are never linked in unless they were referenced as an actual dependency of a different module,
                // but we still need to keep track of them so that we can find their include paths when setting up our
                // module's include paths.
                RecursivelyAddIncludePathModules(Target, bPublicIncludesOnly: false);
            }
            catch (System.Exception ex)
            {
                throw new ModuleProcessingException(this, ex);
            }
        }
Exemple #6
0
        /// <summary>
        /// Adds extra module to the target.
        /// </summary>
        /// <param name="ModuleName">Name of the module.</param>
        protected void AddExtraModule(string ModuleName)
        {
            if (ShouldCompileMonolithic())
            {
                // Add this module to the executable's list of included modules
                var ExecutableBinary = AppBinaries[0];
                ExecutableBinary.AddModule(ModuleName);
            }
            else
            {
                // Create a DLL binary for this module
                string[] OutputFilePaths = MakeBinaryPaths(ModuleName, GetAppName() + "-" + ModuleName, STBuildBinaryType.DynamicLinkLibrary, TargetType, null, AppName);
                STBuildBinaryConfiguration Config = new STBuildBinaryConfiguration(InType: STBuildBinaryType.DynamicLinkLibrary,
                                                                                    InOutputFilePaths: OutputFilePaths,
                                                                                    InIntermediateDirectory: RulesCompiler.IsGameModule(ModuleName) ? ProjectIntermediateDirectory : EngineIntermediateDirectory,
                                                                                    bInAllowExports: true,
                                                                                    InModuleNames: new List<string> { ModuleName });

                // Tell the target about this new binary
                AppBinaries.Add(new STBuildBinaryCPP(this, Config));
            }
        }
Exemple #7
0
        /// <summary>
        /// Include the given plugin module in the target. Will be built in the appropriate subfolder under the plugin directory.
        /// </summary>
        public List<string> AddPluginModule(PluginInfo Plugin, PluginInfo.PluginModuleInfo Module)
        {
            var SpecialRocketLibFilesThatAreBuildProducts = new List<string>();

            bool bCompileMonolithic = ShouldCompileMonolithic();

            // Get the binary type to build
            STBuildBinaryType BinaryType = bCompileMonolithic ? STBuildBinaryType.StaticLibrary : STBuildBinaryType.DynamicLinkLibrary;

            // Get the output path. Don't prefix the app name for Rocket
            string[] OutputFilePaths;
            if ((STBuildTool.BuildingRocket() || STBuildTool.RunningRocket()) && bCompileMonolithic)
            {
                OutputFilePaths = MakeBinaryPaths(Module.Name, Module.Name, BinaryType, TargetType, Plugin, AppName);
                if (STBuildTool.BuildingRocket())
                {
                    SpecialRocketLibFilesThatAreBuildProducts.AddRange(OutputFilePaths);
                }
            }
            else
            {
                OutputFilePaths = MakeBinaryPaths(Module.Name, GetAppName() + "-" + Module.Name, BinaryType, TargetType, Plugin, AppName);
            }

            // Try to determine if we have the rules file
            var ModuleFilename = RulesCompiler.GetModuleFilename(Module.Name);
            var bHasModuleRules = String.IsNullOrEmpty(ModuleFilename) == false;

            // Figure out whether we should build it from source
            var ModuleSourceFolder = bHasModuleRules ? Path.GetDirectoryName(RulesCompiler.GetModuleFilename(Module.Name)) : ModuleFilename;
            bool bShouldBeBuiltFromSource = bHasModuleRules && Directory.GetFiles(ModuleSourceFolder, "*.cpp", SearchOption.AllDirectories).Length > 0;

            string PluginIntermediateBuildPath;
            {
                if (Plugin.LoadedFrom == PluginInfo.LoadedFromType.Engine)
                {
                    // Plugin folder is in the engine directory
                    var PluginConfiguration = Configuration == STTargetConfiguration.DebugGame ? STTargetConfiguration.Development : Configuration;
                    PluginIntermediateBuildPath = Path.GetFullPath(Path.Combine(BuildConfiguration.RelativeEnginePath, BuildConfiguration.PlatformIntermediateFolder, AppName, PluginConfiguration.ToString()));
                }
                else
                {
                    // Plugin folder is in the project directory
                    PluginIntermediateBuildPath = Path.GetFullPath(Path.Combine(ProjectDirectory, BuildConfiguration.PlatformIntermediateFolder, GetTargetName(), Configuration.ToString()));
                }
                PluginIntermediateBuildPath = Path.Combine(PluginIntermediateBuildPath, "Plugins", ShouldCompileMonolithic() ? "Static" : "Dynamic");
            }

            // Create the binary
            STBuildBinaryConfiguration Config = new STBuildBinaryConfiguration(InType: BinaryType,
                                                                                InOutputFilePaths: OutputFilePaths,
                                                                                InIntermediateDirectory: PluginIntermediateBuildPath,
                                                                                bInAllowExports: true,
                                                                                bInAllowCompilation: bShouldBeBuiltFromSource,
                                                                                bInHasModuleRules: bHasModuleRules,
                                                                                InModuleNames: new List<string> { Module.Name });
            AppBinaries.Add(new STBuildBinaryCPP(this, Config));
            return SpecialRocketLibFilesThatAreBuildProducts;
        }