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

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

				if (Platform == UnrealTargetPlatform.Win64 && Configuration != UnrealTargetConfiguration.Shipping)
				{
					Config.bBuildAdditionalConsoleApp = true;
				}

				AppBinaries.Add(new UEBuildBinaryCPP(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!
			}
		}
예제 #2
0
        /// <summary>
        /// Setup the binaries for this target
        /// </summary>
        protected override void SetupBinaries()
        {
            base.SetupBinaries();

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

                AppBinaries.Add(new UEBuildBinaryCPP(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
            UEBuildPlatform.GetBuildPlatform(Platform).SetupBinaries(this);
        }
예제 #3
0
		/// <summary>
		/// Setup the binaries for this target
		/// </summary>
		protected override void SetupBinaries()
		{
			base.SetupBinaries();

			{
				// Don't write to the Engine intermediate directory for Monolithic builds
				DirectoryReference IntermediateDirectory = ShouldCompileMonolithic() ? ProjectIntermediateDirectory : EngineIntermediateDirectory;

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

				AppBinaries.Add(new UEBuildBinaryCPP(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!
			}
		}
예제 #4
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 UEBuildBinaryCPP(UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig)
     : base(InTarget, InConfig)
 {
     ModuleNames = new HashSet <string>(InConfig.ModuleNames);
     bCreateImportLibrarySeparately      = InConfig.bCreateImportLibrarySeparately;
     bIncludeDependentLibrariesInLibrary = InConfig.bIncludeDependentLibrariesInLibrary;
 }
예제 #5
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 UEBuildBinary(UEBuildBinaryConfiguration InConfig)
 {
     Debug.Assert(InConfig.OutputFilePath != null && InConfig.IntermediateDirectory != null);
     Config = InConfig;
     bCreateImportLibrarySeparately      = InConfig.bCreateImportLibrarySeparately;
     bIncludeDependentLibrariesInLibrary = InConfig.bIncludeDependentLibrariesInLibrary;
 }
예제 #6
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 UEBuildBinary(UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig)
 {
     Debug.Assert(InConfig.OutputFilePath != null && InConfig.IntermediateDirectory != null);
     Target = InTarget;
     Config = InConfig;
 }
예제 #7
0
파일: UEBuildBinary.cs 프로젝트: mymei/UE4
 /// <summary>
 /// Create an instance initialized to the given configuration
 /// </summary>
 /// <param name="InConfig">The build binary configuration to initialize the instance to</param>
 public UEBuildBinaryCSDLL(UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig)
     : base(InTarget, InConfig)
 {
 }
예제 #8
0
파일: UEBuildBinary.cs 프로젝트: mymei/UE4
 /// <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 UEBuildBinary( UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig)
 {
     Debug.Assert(InConfig.OutputFilePath != null && InConfig.IntermediateDirectory != null);
     Target = InTarget;
     Config = InConfig;
 }
예제 #9
0
파일: UEBuildBinary.cs 프로젝트: mymei/UE4
 /// <summary>
 /// Create an instance initialized to the given configuration
 /// </summary>
 /// <param name="InConfig">The build binary configuration to initialize the instance to</param>
 public UEBuildBinaryCPP( UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig )
     : base(InTarget, InConfig)
 {
     ModuleNames = new List<string>(InConfig.ModuleNames);
     bCreateImportLibrarySeparately = InConfig.bCreateImportLibrarySeparately;
     bIncludeDependentLibrariesInLibrary = InConfig.bIncludeDependentLibrariesInLibrary;
 }
예제 #10
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 UEBuildBinaryCPP(UEBuildBinaryConfiguration InConfig)
     : base(InConfig)
 {
     bCreateImportLibrarySeparately      = InConfig.bCreateImportLibrarySeparately;
     bIncludeDependentLibrariesInLibrary = InConfig.bIncludeDependentLibrariesInLibrary;
 }
예제 #11
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
            UEBuildBinaryType BinaryType = bCompileMonolithic ? UEBuildBinaryType.StaticLibrary : UEBuildBinaryType.DynamicLinkLibrary;

            // Get the output path. Don't prefix the app name for Rocket
            string[] OutputFilePaths;
            if ((UnrealBuildTool.BuildingRocket() || UnrealBuildTool.RunningRocket()) && bCompileMonolithic)
            {
                OutputFilePaths = MakeBinaryPaths(Module.Name, Module.Name, BinaryType, TargetType, Plugin, AppName);
                if (UnrealBuildTool.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 == UnrealTargetConfiguration.DebugGame ? UnrealTargetConfiguration.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
            UEBuildBinaryConfiguration Config = new UEBuildBinaryConfiguration( InType:                  BinaryType,
                                                                                InOutputFilePaths:       OutputFilePaths,
                                                                                InIntermediateDirectory: PluginIntermediateBuildPath,
                                                                                bInAllowExports:         true,
                                                                                bInAllowCompilation:     bShouldBeBuiltFromSource,
                                                                                bInHasModuleRules:       bHasModuleRules,
                                                                                InModuleNames:           new List<string> { Module.Name } );
            AppBinaries.Add(new UEBuildBinaryCPP(this, Config));
            return SpecialRocketLibFilesThatAreBuildProducts;
        }
예제 #12
0
        public override void RecursivelyProcessUnboundModules(UEBuildTarget Target, ref Dictionary<string, UEBuildBinary> Binaries, UEBuildBinary ExecutableBinary)
        {
            // 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 ) )
                    {
                        UEBuildBinary BinaryToBindTo;
                        if (Target.ShouldCompileMonolithic())
                        {
                            // When linking monolithically, any unbound modules will be linked into the main executable
                            BinaryToBindTo = ExecutableBinary;
                        }
                        else
                        {
                            // Is this a Rocket module?
                            bool bIsRocketModule = RulesCompiler.IsRocketProjectModule(DependencyName);

                            // Is this a plugin module?
                            var PluginInfo = Plugins.GetPluginInfoForModule( DependencyName );

                            string OutputFilePath = Target.MakeBinaryPath(DependencyModule.Name, Target.GetAppName() + "-" + DependencyModule.Name, UEBuildBinaryType.DynamicLinkLibrary, Target.Rules.Type, bIsRocketModule, PluginInfo, "");

                            // If it's an engine module, output intermediates to the engine intermediates directory.
                            string IntermediateDirectory = Binary.Config.IntermediateDirectory;
                            if (PluginInfo == null && 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
                            UEBuildBinaryConfiguration Config = new UEBuildBinaryConfiguration( InType: UEBuildBinaryType.DynamicLinkLibrary,
                                                                                                InOutputFilePath: OutputFilePath,
                                                                                                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
                            Config.OutputFilePath = DependencyModule.FixupOutputPath(Config.OutputFilePath);

                            BinaryToBindTo = new UEBuildBinaryCPP( 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 );
        }
예제 #13
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 UEApkDummyBinary(UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig)
     : base(InTarget, InConfig)
 {
 }
예제 #14
0
        public override void SetupBinaries(UEBuildTarget InBuildTarget)
        {
            // dangerously fast mode doesn't generate stub files
            if (!IOSToolChain.bUseDangerouslyFastMode)
            {
                List<UEBuildBinary> NewBinaries = new List<UEBuildBinary>();
                // add the .apk to the binaries
                foreach (var Binary in InBuildTarget.AppBinaries)
                {
                    // make a binary that just points to the .stub of this executable
                    UEBuildBinaryConfiguration NewConfig = new UEBuildBinaryConfiguration(
                                                                    InType: Binary.Config.Type,
                                                                    InOutputFilePath: Path.ChangeExtension(Binary.Config.OutputFilePath, ".apk"),
                                                                    InIntermediateDirectory: Binary.Config.IntermediateDirectory,
                                                                    bInCreateImportLibrarySeparately: Binary.Config.bCreateImportLibrarySeparately,
                                                                    bInAllowExports: Binary.Config.bAllowExports,
                                                                    InModuleNames: Binary.Config.ModuleNames);

                    NewBinaries.Add(new UEStubDummyBinary(InBuildTarget, NewConfig));
                }

                InBuildTarget.AppBinaries.AddRange(NewBinaries);
            }
        }
예제 #15
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 UEBuildBinaryCPP(UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig)
			: base(InTarget, InConfig)
		{
			bCreateImportLibrarySeparately = InConfig.bCreateImportLibrarySeparately;
			bIncludeDependentLibrariesInLibrary = InConfig.bIncludeDependentLibrariesInLibrary;
		}
예제 #16
0
파일: UEBuildTarget.cs 프로젝트: mymei/UE4
        /// <summary>
        /// Adds a binary for the given module. Does not check whether a binary already exists, or whether a binary should be created for this build configuration.
        /// </summary>
        /// <param name="ModuleName">Name of the binary</param>
        /// <param name="BinaryType">Type of binary to be created</param>
        /// <param name="bAllowCompilation">Whether this binary can be compiled. The function will check whether plugin binaries can be compiled.</param>
        /// <param name="bIsCrossTarget">True if module is for supporting a different target-platform</param>
        /// <returns>The new binary</returns>
        private UEBuildBinaryCPP AddBinaryForModule(string ModuleName, UEBuildBinaryType BinaryType, bool bAllowCompilation, bool bIsCrossTarget)
        {
            // Get the plugin info for this module
            PluginInfo Plugin = FindPluginForModule(ModuleName);

            // Get the root output directory and base name (target name/app name) for this binary
            string BaseOutputDirectory;
            if(Plugin != null)
            {
                BaseOutputDirectory = Path.GetFullPath(Plugin.Directory);
            }
            else if(RulesCompiler.IsGameModule(ModuleName) || !bUseSharedBuildEnvironment)
            {
                BaseOutputDirectory = Path.GetFullPath(ProjectDirectory);
            }
            else
            {
                BaseOutputDirectory = Path.GetFullPath(BuildConfiguration.RelativeEnginePath);
            }

            // Get the configuration that this module will be built in. Engine modules compiled in DebugGame will use Development.
            UnrealTargetConfiguration ModuleConfiguration = Configuration;
            if(Configuration == UnrealTargetConfiguration.DebugGame && !RulesCompiler.IsGameModule(ModuleName))
            {
                ModuleConfiguration = UnrealTargetConfiguration.Development;
            }

            // Get the output and intermediate directories for this module
            string OutputDirectory = Path.Combine(BaseOutputDirectory, "Binaries", Platform.ToString());
             			string IntermediateDirectory = Path.Combine(BaseOutputDirectory, BuildConfiguration.PlatformIntermediateFolder, AppName, ModuleConfiguration.ToString());

            // Append a subdirectory if the module rules specifies one
            ModuleRules ModuleRules;
            if(RulesCompiler.TryCreateModuleRules(ModuleName, TargetInfo, out ModuleRules) && !String.IsNullOrEmpty(ModuleRules.BinariesSubFolder))
            {
                OutputDirectory = Path.Combine(OutputDirectory, ModuleRules.BinariesSubFolder);
                IntermediateDirectory = Path.Combine(IntermediateDirectory, ModuleRules.BinariesSubFolder);
            }

            // Get the output filenames
            string BaseBinaryPath = Path.Combine(OutputDirectory, MakeBinaryFileName(AppName + "-" + ModuleName, Platform, ModuleConfiguration, Rules.UndecoratedConfiguration, BinaryType));
            string[] OutputFilePaths = UEBuildPlatform.GetBuildPlatform(Platform).FinalizeBinaryPaths(BaseBinaryPath);

            // Prepare the configuration object
            UEBuildBinaryConfiguration Config = new UEBuildBinaryConfiguration(BinaryType);
            Config.OutputFilePaths = OutputFilePaths;
            Config.IntermediateDirectory = IntermediateDirectory;
            Config.bHasModuleRules = (ModuleRules != null);
            Config.bAllowExports = (BinaryType == UEBuildBinaryType.DynamicLinkLibrary);
            Config.bAllowCompilation = bAllowCompilation;
            Config.bIsCrossTarget = bIsCrossTarget;
            Config.ModuleNames.Add(ModuleName);

            // Create the new binary
            UEBuildBinaryCPP Binary = new UEBuildBinaryCPP(this, Config);
            AppBinaries.Add(Binary);
            return Binary;
        }
예제 #17
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 UEBuildBinaryCSDLL(UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig)
     : base(InTarget, InConfig)
 {
 }
예제 #18
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 UEBuildBinaryCSDLL(UEBuildBinaryConfiguration InConfig)
     : base(InConfig)
 {
 }
예제 #19
0
        /// When building a target, this is called to add any additional modules that should be compiled along
        /// with the main target.  If you override this in a derived class, remember to call the base implementation!
        protected virtual void AddExtraModules()
        {
            // Add extra modules that will either link into the main binary (monolithic), or be linked into separate DLL files (modular)
            foreach (var ModuleName in ExtraModuleNames)
            {
                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, UEBuildBinaryType.DynamicLinkLibrary, TargetType, null, AppName);
                    UEBuildBinaryConfiguration Config = new UEBuildBinaryConfiguration( InType: UEBuildBinaryType.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 UEBuildBinaryCPP(this, Config));
                }
            }
        }