コード例 #1
0
ファイル: UEToolChain.cs プロジェクト: xiangyuan/Unreal4
		public static void RegisterPlatformToolChain(CPPTargetPlatform InPlatform, IUEToolChain InToolChain)
		{
			if (CPPToolChainDictionary.ContainsKey(InPlatform) == true)
			{
				Log.TraceInformation("RegisterPlatformToolChain Warning: Registering tool chain {0} for {1} when it is already set to {2}",
					InToolChain.ToString(), InPlatform.ToString(), CPPToolChainDictionary[InPlatform].ToString());
				CPPToolChainDictionary[InPlatform] = InToolChain;
			}
			else
			{
				CPPToolChainDictionary.Add(InPlatform, InToolChain);
			}
		}
コード例 #2
0
 public static void RegisterPlatformToolChain(CPPTargetPlatform InPlatform, IUEToolChain InToolChain)
 {
     if (CPPToolChainDictionary.ContainsKey(InPlatform) == true)
     {
         Log.TraceInformation("RegisterPlatformToolChain Warning: Registering tool chain {0} for {1} when it is already set to {2}",
                              InToolChain.ToString(), InPlatform.ToString(), CPPToolChainDictionary[InPlatform].ToString());
         CPPToolChainDictionary[InPlatform] = InToolChain;
     }
     else
     {
         CPPToolChainDictionary.Add(InPlatform, InToolChain);
     }
 }
コード例 #3
0
        /// <summary>
        /// Builds the binary.
        /// </summary>
        /// <param name="CompileEnvironment">The environment to compile the binary in</param>
        /// <param name="LinkEnvironment">The environment to link the binary in</param>
        /// <returns></returns>
        public override IEnumerable <FileItem> Build(IUEToolChain TargetToolChain, CPPEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            // UnrealCodeAnalyzer produces output files only for a specific module.
            if (BuildConfiguration.bRunUnrealCodeAnalyzer && !(ModuleNames.Contains(BuildConfiguration.UCAModuleToAnalyze)))
            {
                return(new List <FileItem>());
            }

            // Setup linking environment.
            var BinaryLinkEnvironment = SetupBinaryLinkEnvironment(LinkEnvironment, CompileEnvironment);

            // Return linked files.
            return(SetupOutputFiles(TargetToolChain, ref BinaryLinkEnvironment));
        }
コード例 #4
0
ファイル: UEBuildBinary.cs プロジェクト: liguangshi/UE4
        /// <summary>
        /// Overrides base class to add module runtime dependencies to the build receipt.
        /// </summary>
        /// <param name="ToolChain">The platform toolchain</param>
        public override BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = base.MakeReceipt(ToolChain);

            // Set the IsPrecompiled flag on all the build products if we're not actually building this binary
            if (!Config.bAllowCompilation)
            {
                foreach (BuildProduct BuildProduct in Receipt.BuildProducts)
                {
                    BuildProduct.IsPrecompiled = true;
                }
            }

            // Add the compiled resource file if we're building a static library containing the launch module on Windows
            if (Config.Type == UEBuildBinaryType.StaticLibrary && ModuleNames.Contains("Launch") && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64))
            {
                string ResourceFilePath = Path.Combine(Config.IntermediateDirectory, "Launch", "PCLaunch.rc.res");
                Receipt.AddBuildProduct(ResourceFilePath, BuildProductType.StaticLibrary);
            }

            // Add runtime dependencies for all the modules in this binary, and build up a list of all the referenced modules
            Dictionary <string, UEBuildModule> ReferencedModules = new Dictionary <string, UEBuildModule>();
            List <UEBuildModule> OrderedModules = new List <UEBuildModule>();

            foreach (string ModuleName in ModuleNames)
            {
                UEBuildModule Module = Target.GetModuleByName(ModuleName);
                foreach (RuntimeDependency RuntimeDependency in Module.RuntimeDependencies)
                {
                    Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                }
                Module.GetAllDependencyModules(ReferencedModules, OrderedModules, true, false, true);
            }

            // Add runtime dependencies for all the referenced external modules. These may be introduce dependencies for the binary without actually being listed for inclusion in it.
            foreach (UEBuildModule OrderedModule in OrderedModules)
            {
                UEBuildExternalModule ExternalModule = OrderedModule as UEBuildExternalModule;
                if (ExternalModule != null)
                {
                    foreach (RuntimeDependency RuntimeDependency in ExternalModule.RuntimeDependencies)
                    {
                        Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                    }
                }
            }
            return(Receipt);
        }
コード例 #5
0
        /// <summary>
        /// Creates a receipt for this binary.
        /// </summary>
        /// <param name="ToolChain">Toolchain for the target platform</param>
        /// <param name="BuildPlatform">Platform that we're building for</param>
        public virtual BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = new BuildReceipt();

            // Get the type of build products we're creating
            BuildProductType Type = BuildProductType.RequiredResource;

            switch (Config.Type)
            {
            case UEBuildBinaryType.Executable:
                Type = BuildProductType.Executable;
                break;

            case UEBuildBinaryType.DynamicLinkLibrary:
                Type = BuildProductType.DynamicLibrary;
                break;

            case UEBuildBinaryType.StaticLibrary:
                Type = BuildProductType.StaticLibrary;
                break;
            }

            // Add the primary build products
            string DebugExtension = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtension(Config.Type);

            foreach (string OutputFilePath in Config.OutputFilePaths)
            {
                AddBuildProductAndDebugFile(OutputFilePath, Type, DebugExtension, Receipt);
            }

            // Add the console app, if there is one
            if (Config.Type == UEBuildBinaryType.Executable && Config.bBuildAdditionalConsoleApp)
            {
                foreach (string OutputFilePath in Config.OutputFilePaths)
                {
                    AddBuildProductAndDebugFile(GetAdditionalConsoleAppPath(OutputFilePath), Type, DebugExtension, Receipt);
                }
            }

            // Add any extra files from the toolchain
            ToolChain.AddFilesToReceipt(Receipt, this);
            return(Receipt);
        }
コード例 #6
0
        /// <summary>
        /// Builds the binary.
        /// </summary>
        /// <param name="ToolChain">The toolchain to use for building</param>
        /// <param name="CompileEnvironment">The environment to compile the binary in</param>
        /// <param name="LinkEnvironment">The environment to link the binary in</param>
        /// <returns></returns>
        public override IEnumerable <FileItem> Build(IUEToolChain ToolChain, CPPEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            var ProjectCSharpEnviroment = new CSharpEnvironment();

            if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug)
            {
                ProjectCSharpEnviroment.TargetConfiguration = CSharpTargetConfiguration.Debug;
            }
            else
            {
                ProjectCSharpEnviroment.TargetConfiguration = CSharpTargetConfiguration.Development;
            }
            ProjectCSharpEnviroment.EnvironmentTargetPlatform = LinkEnvironment.Config.Target.Platform;

            // Currently only supported by windows...
            UEToolChain.GetPlatformToolChain(CPPTargetPlatform.Win64).CompileCSharpProject(
                ProjectCSharpEnviroment, Config.ProjectFilePath, Config.OutputFilePath);

            return(new FileItem[] { FileItem.GetItemByPath(Config.OutputFilePath) });
        }
コード例 #7
0
        /// <summary>
        /// Overrides base class to add module runtime dependencies to the build receipt.
        /// </summary>
        /// <param name="ToolChain">The platform toolchain</param>
        public override BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = base.MakeReceipt(ToolChain);

            // Set the IsPrecompiled flag on all the build products if we're not actually building this binary
            if (!Config.bAllowCompilation)
            {
                foreach (BuildProduct BuildProduct in Receipt.BuildProducts)
                {
                    BuildProduct.IsPrecompiled = true;
                }
            }

            // Add runtime dependencies for all the modules in this binary, and build up a list of all the referenced modules
            Dictionary <string, UEBuildModule> ReferencedModules = new Dictionary <string, UEBuildModule>();
            List <UEBuildModule> OrderedModules = new List <UEBuildModule>();

            foreach (string ModuleName in ModuleNames)
            {
                UEBuildModule Module = Target.GetModuleByName(ModuleName);
                foreach (RuntimeDependency RuntimeDependency in Module.RuntimeDependencies)
                {
                    Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                }
                Module.GetAllDependencyModules(ReferencedModules, OrderedModules, true, false, true);
            }

            // Add runtime dependencies for all the referenced external modules. These may be introduce dependencies for the binary without actually being listed for inclusion in it.
            foreach (UEBuildModule OrderedModule in OrderedModules)
            {
                UEBuildExternalModule ExternalModule = OrderedModule as UEBuildExternalModule;
                if (ExternalModule != null)
                {
                    foreach (RuntimeDependency RuntimeDependency in ExternalModule.RuntimeDependencies)
                    {
                        Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                    }
                }
            }
            return(Receipt);
        }
コード例 #8
0
ファイル: UEBuildBinary.cs プロジェクト: mymei/UE4
 /// <summary>
 /// Builds the binary.
 /// </summary>
 /// <param name="ToolChain">The toolchain which to use for building</param>
 /// <param name="CompileEnvironment">The environment to compile the binary in</param>
 /// <param name="LinkEnvironment">The environment to link the binary in</param>
 /// <returns></returns>
 public abstract IEnumerable<FileItem> Build(IUEToolChain ToolChain, CPPEnvironment CompileEnvironment,LinkEnvironment LinkEnvironment);
コード例 #9
0
ファイル: UEBuildTarget.cs プロジェクト: mymei/UE4
        /// <summary>
        /// Setup target before build. This method finds dependencies, sets up global environment etc.
        /// </summary>
        /// <returns>Special Rocket lib files that are build products.</returns>
        public void PreBuildSetup(IUEToolChain TargetToolChain)
        {
            // Set up the global compile and link environment in GlobalCompileEnvironment and GlobalLinkEnvironment.
            SetupGlobalEnvironment();

            // Setup the target's modules.
            SetupModules();

            // Setup the target's binaries.
            SetupBinaries();

            // Setup the target's plugins
            SetupPlugins();

            // Add the enabled plugins to the build
            foreach (PluginInfo BuildPlugin in BuildPlugins)
            {
                AddPlugin(BuildPlugin);
            }

            // Allow the platform to setup binaries/plugins/modules
            UEBuildPlatform.GetBuildPlatform(Platform).SetupBinaries(this);

            // Describe what's being built.
            Log.TraceVerbose("Building {0} - {1} - {2} - {3}", AppName, TargetName, Platform, Configuration);

            // Put the non-executable output files (PDB, import library, etc) in the intermediate directory.
            GlobalLinkEnvironment.Config.IntermediateDirectory = Path.GetFullPath(GlobalCompileEnvironment.Config.OutputDirectory);
            GlobalLinkEnvironment.Config.OutputDirectory = GlobalLinkEnvironment.Config.IntermediateDirectory;

            // By default, shadow source files for this target in the root OutputDirectory
            GlobalLinkEnvironment.Config.LocalShadowDirectory = GlobalLinkEnvironment.Config.OutputDirectory;

            // Add all of the extra modules, including game modules, that need to be compiled along
            // with this app.  These modules are always statically linked in monolithic targets, but not necessarily linked to anything in modular targets,
            // and may still be required at runtime in order for the application to load and function properly!
            AddExtraModules();

            // Add all the precompiled modules to the target. In contrast to "Extra Modules", these modules are not compiled into monolithic targets by default.
            AddPrecompiledModules();

            // Bind modules for all app binaries. Static libraries can be linked into other binaries, so bound modules to those first.
            foreach(UEBuildBinary Binary in AppBinaries)
            {
                if(Binary.Config.Type == UEBuildBinaryType.StaticLibrary)
                {
                    Binary.BindModules();
                }
            }
            foreach (var Binary in AppBinaries)
            {
                if(Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
                {
                    Binary.BindModules();
                }
            }

            // Process all referenced modules and create new binaries for DLL dependencies if needed. The AppBinaries
            // list may have entries added to it as modules are bound, so make sure we handle those too.
            for(int Idx = 0; Idx < AppBinaries.Count; Idx++)
            {
                AppBinaries[Idx].ProcessUnboundModules();
            }

            // On Mac AppBinaries paths for non-console targets need to be adjusted to be inside the app bundle
            if (GlobalLinkEnvironment.Config.Target.Platform == CPPTargetPlatform.Mac && !GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
            {
                TargetToolChain.FixBundleBinariesPaths(this, AppBinaries);
            }

            // If we're building a single module, then find the binary for that module and add it to our target
            if (OnlyModules.Count > 0)
            {
                AppBinaries = FilterOnlyModules();
            }
            else if (UEBuildConfiguration.bHotReloadFromIDE)
            {
                AppBinaries = FilterGameModules();
            }

            // Filter out binaries that were already built and are just used for linking. We will not build these binaries but we need them for link information
            {
                var FilteredBinaries = new List<UEBuildBinary>();

                foreach (var DLLBinary in AppBinaries)
                {
                    if (DLLBinary.Config.bAllowCompilation)
                    {
                        FilteredBinaries.Add(DLLBinary);
                    }
                }

                // Copy the result into the final list
                AppBinaries = FilteredBinaries;

                if (AppBinaries.Count == 0)
                {
                    throw new BuildException("No modules found to build. All requested binaries were already built.");
                }
            }

            // If we are only interested in platform specific binaries, filter everything else out now
            if (UnrealBuildTool.GetOnlyPlatformSpecificFor() != UnrealTargetPlatform.Unknown)
            {
                var FilteredBinaries = new List<UEBuildBinary>();

                var OtherThingsWeNeedToBuild = new List<OnlyModule>();

                foreach (var DLLBinary in AppBinaries)
                {
                    if (DLLBinary.Config.bIsCrossTarget)
                    {
                        FilteredBinaries.Add(DLLBinary);
                        bool bIncludeDynamicallyLoaded = false;
                        var AllReferencedModules = DLLBinary.GetAllDependencyModules(bIncludeDynamicallyLoaded, bForceCircular: true);
                        foreach (var Other in AllReferencedModules)
                        {
                            OtherThingsWeNeedToBuild.Add(new OnlyModule(Other.Name));
                        }
                    }
                }
                foreach (var DLLBinary in AppBinaries)
                {
                    if (!FilteredBinaries.Contains(DLLBinary) && DLLBinary.FindOnlyModule(OtherThingsWeNeedToBuild) != null)
                    {
                        if (!File.Exists(DLLBinary.Config.OutputFilePath))
                        {
                            throw new BuildException("Module {0} is potentially needed for the {1} platform to work, but it isn't actually compiled. This either needs to be marked as platform specific or made a dynamic dependency of something compiled with the base editor.", DLLBinary.Config.OutputFilePath, UnrealBuildTool.GetOnlyPlatformSpecificFor().ToString());
                        }
                    }
                }

                // Copy the result into the final list
                AppBinaries = FilteredBinaries;
            }

            //@todo.Rocket: Will users be able to rebuild UnrealHeaderTool? NO
            if (!ProjectFileGenerator.bGenerateProjectFiles && UnrealBuildTool.RunningRocket() && AppName != "UnrealHeaderTool")
            {
                var FilteredBinaries = new List<UEBuildBinary>();

                // Have to do absolute here as this could be a project that is under the root
                string FullEnginePath = Path.GetFullPath(BuildConfiguration.RelativeEnginePath);

                // We only want to build rocket projects...
                foreach (var DLLBinary in AppBinaries)
                {
                    if (!Utils.IsFileUnderDirectory(DLLBinary.Config.OutputFilePath, FullEnginePath))
                    {
                        FilteredBinaries.Add(DLLBinary);
                    }
                }

                // Copy the result into the final list
                AppBinaries = FilteredBinaries;

                if (AppBinaries.Count == 0)
                {
                    throw new BuildException("Rocket: No modules found to build?");
                }
            }

            if (ShouldCheckOutputDistributionLevel())
            {
                // Check the distribution level of all binaries based on the dependencies they have
                foreach (var Binary in AppBinaries)
                {
                    Binary.CheckOutputDistributionLevelAgainstDependencies();
                }
            }
        }
コード例 #10
0
ファイル: UEBuildTarget.cs プロジェクト: mymei/UE4
        /** Creates the receipt for the target */
        private void PrepareReceipt(IUEToolChain ToolChain)
        {
            Receipt = new BuildReceipt();

            // Add the target properties
            Receipt.SetProperty("TargetName", TargetName);
            Receipt.SetProperty("Platform", Platform.ToString());
            Receipt.SetProperty("Configuration", Configuration.ToString());
            Receipt.SetProperty("Precompile", bPrecompile.ToString());

            // Merge all the binary receipts into this
            foreach(UEBuildBinary Binary in AppBinaries)
            {
                BuildReceipt BinaryReceipt = Binary.MakeReceipt(ToolChain);
                if(Binary.Config.Type == UEBuildBinaryType.StaticLibrary)
                {
                    BinaryReceipt.RuntimeDependencies.Clear();
                }
                Receipt.Merge(BinaryReceipt);
            }

            // Convert all the paths to use variables for the engine and project root
            Receipt.InsertStandardPathVariables(BuildConfiguration.RelativeEnginePath, ProjectDirectory);
        }
コード例 #11
0
ファイル: UEBuildBinary.cs プロジェクト: mymei/UE4
        /// <summary>
        /// Builds the binary.
        /// </summary>
        /// <param name="ToolChain">The toolchain to use for building</param>
        /// <param name="CompileEnvironment">The environment to compile the binary in</param>
        /// <param name="LinkEnvironment">The environment to link the binary in</param>
        /// <returns></returns>
        public override IEnumerable<FileItem> Build(IUEToolChain ToolChain, CPPEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            var ProjectCSharpEnviroment = new CSharpEnvironment();
            if (LinkEnvironment.Config.Target.Configuration == CPPTargetConfiguration.Debug)
            {
                ProjectCSharpEnviroment.TargetConfiguration = CSharpTargetConfiguration.Debug;
            }
            else
            {
                ProjectCSharpEnviroment.TargetConfiguration = CSharpTargetConfiguration.Development;
            }
            ProjectCSharpEnviroment.EnvironmentTargetPlatform = LinkEnvironment.Config.Target.Platform;

            // Currently only supported by windows...
            UEToolChain.GetPlatformToolChain(CPPTargetPlatform.Win64).CompileCSharpProject(
                ProjectCSharpEnviroment, Config.ProjectFilePath, Config.OutputFilePath);

            return new FileItem[] { FileItem.GetItemByPath(Config.OutputFilePath) };
        }
コード例 #12
0
ファイル: UEBuildBinary.cs プロジェクト: mymei/UE4
        private List<FileItem> SetupOutputFiles(IUEToolChain TargetToolChain, ref LinkEnvironment BinaryLinkEnvironment)
        {
            // Early exits first
            if (ProjectFileGenerator.bGenerateProjectFiles)
            {
                // We're generating projects.  Since we only need include paths and definitions, there is no need
                // to go ahead and run through the linking logic.
                return BinaryLinkEnvironment.InputFiles;
            }

            if (BuildConfiguration.bEnableCodeAnalysis)
            {
                // We're only analyzing code, so we won't actually link any executables.  Instead, our output
                // files will simply be the .obj files that were compiled during static analysis.
                return BinaryLinkEnvironment.InputFiles;
            }

            if (BuildConfiguration.bRunUnrealCodeAnalyzer)
            {
                //
                // Create actions to analyze *.includes files and provide suggestions on how to modify PCH.
                //
                return CreateOutputFilesForUCA(BinaryLinkEnvironment);
            }

            //
            // Regular linking action.
            //
            var OutputFiles = new List<FileItem>();
            if (bCreateImportLibrarySeparately)
            {
                // Mark the link environment as cross-referenced.
                BinaryLinkEnvironment.Config.bIsCrossReferenced = true;

                if (BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Mac && BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Linux)
                {
                    // Create the import library.
                    OutputFiles.AddRange(BinaryLinkEnvironment.LinkExecutable(true));
                }
            }

            BinaryLinkEnvironment.Config.bIncludeDependentLibrariesInLibrary = bIncludeDependentLibrariesInLibrary;

            // Link the binary.
            FileItem[] Executables = BinaryLinkEnvironment.LinkExecutable(false);
            OutputFiles.AddRange(Executables);

            // Produce additional console app if requested
            if (Config.bBuildAdditionalConsoleApp)
            {
                // Produce additional binary but link it as a console app
                var ConsoleAppLinkEvironment = BinaryLinkEnvironment.DeepCopy();
                ConsoleAppLinkEvironment.Config.bIsBuildingConsoleApplication = true;
                ConsoleAppLinkEvironment.Config.WindowsEntryPointOverride = "WinMainCRTStartup";		// For WinMain() instead of "main()" for Launch module
                for (int Index = 0; Index < Config.OutputFilePaths.Length; Index++)
                {
                    ConsoleAppLinkEvironment.Config.OutputFilePaths[Index] = GetAdditionalConsoleAppPath(ConsoleAppLinkEvironment.Config.OutputFilePaths[Index]);
                }

                // Link the console app executable
                OutputFiles.AddRange(ConsoleAppLinkEvironment.LinkExecutable(false));
            }

            foreach (var Executable in Executables)
            {
                OutputFiles.AddRange(TargetToolChain.PostBuild(Executable, BinaryLinkEnvironment));
            }

            return OutputFiles;
        }
コード例 #13
0
ファイル: UEBuildBinary.cs プロジェクト: mymei/UE4
        /// <summary>
        /// Overrides base class to add module runtime dependencies to the build receipt.
        /// </summary>
        /// <param name="ToolChain">The platform toolchain</param>
        public override BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = base.MakeReceipt(ToolChain);

            // Set the IsPrecompiled flag on all the build products if we're not actually building this binary
            if(!Config.bAllowCompilation)
            {
                foreach(BuildProduct BuildProduct in Receipt.BuildProducts)
                {
                    BuildProduct.IsPrecompiled = true;
                }
            }

            // Add the compiled resource file if we're building a static library containing the launch module on Windows
            if(Config.Type == UEBuildBinaryType.StaticLibrary && ModuleNames.Contains("Launch") && (Target.Platform == UnrealTargetPlatform.Win32 || Target.Platform == UnrealTargetPlatform.Win64))
            {
                string ResourceFilePath = Path.Combine(Config.IntermediateDirectory, "Launch", "PCLaunch.rc.res");
                Receipt.AddBuildProduct(ResourceFilePath, BuildProductType.StaticLibrary);
            }

            // Add runtime dependencies for all the modules in this binary, and build up a list of all the referenced modules
            Dictionary<string, UEBuildModule> ReferencedModules = new Dictionary<string,UEBuildModule>();
            List<UEBuildModule> OrderedModules = new List<UEBuildModule>();
            foreach (string ModuleName in ModuleNames)
            {
                UEBuildModule Module = Target.GetModuleByName(ModuleName);
                foreach(RuntimeDependency RuntimeDependency in Module.RuntimeDependencies)
                {
                    Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                }
                Module.GetAllDependencyModules(ReferencedModules, OrderedModules, true, false, true);
            }

            // Add runtime dependencies for all the referenced external modules. These may be introduce dependencies for the binary without actually being listed for inclusion in it.
            foreach(UEBuildModule OrderedModule in OrderedModules)
            {
                UEBuildExternalModule ExternalModule = OrderedModule as UEBuildExternalModule;
                if(ExternalModule != null)
                {
                    foreach(RuntimeDependency RuntimeDependency in ExternalModule.RuntimeDependencies)
                    {
                        Receipt.RuntimeDependencies.Add(new RuntimeDependency(RuntimeDependency));
                    }
                }
            }
            return Receipt;
        }
コード例 #14
0
ファイル: UEBuildTarget.cs プロジェクト: mymei/UE4
        /** Builds the target, appending list of output files and returns building result. */
        public ECompilationResult Build(IUEToolChain TargetToolChain, out List<FileItem> OutputItems, out List<UHTModuleInfo> UObjectModules, out string EULAViolationWarning)
        {
            OutputItems = new List<FileItem>();
            UObjectModules = new List<UHTModuleInfo>();

            PreBuildSetup(TargetToolChain);

            EULAViolationWarning = !ProjectFileGenerator.bGenerateProjectFiles
                ? CheckForEULAViolation()
                : null;

            // If we're compiling monolithic, make sure the executable knows about all referenced modules
            if (ShouldCompileMonolithic())
            {
                var ExecutableBinary = AppBinaries[0];

                // Add all the modules that the executable depends on. Plugins will be already included in this list.
                var AllReferencedModules = ExecutableBinary.GetAllDependencyModules(bIncludeDynamicallyLoaded: true, bForceCircular: true);
                foreach (var CurModule in AllReferencedModules)
                {
                    if (CurModule.Binary == null || CurModule.Binary == ExecutableBinary || CurModule.Binary.Config.Type == UEBuildBinaryType.StaticLibrary)
                    {
                        ExecutableBinary.AddModule(CurModule.Name);
                    }
                }

                bool IsCurrentPlatform;
                if (Utils.IsRunningOnMono)
                {
                    IsCurrentPlatform = Platform == UnrealTargetPlatform.Mac;
                }
                else
                {
                    IsCurrentPlatform = Platform == UnrealTargetPlatform.Win64 || Platform == UnrealTargetPlatform.Win32;

                }

                if ( (TargetRules.IsAGame(TargetType) || (TargetType == TargetRules.TargetType.Server))
                    && IsCurrentPlatform)
                {
                    // The hardcoded engine directory needs to be a relative path to match the normal EngineDir format. Not doing so breaks the network file system (TTP#315861).
                    string OutputFilePath = ExecutableBinary.Config.OutputFilePath;
                    if (Platform == UnrealTargetPlatform.Mac && OutputFilePath.Contains(".app/Contents/MacOS"))
                    {
                        OutputFilePath = OutputFilePath.Substring(0, OutputFilePath.LastIndexOf(".app/Contents/MacOS") + 4);
                    }
                    string EnginePath = Utils.CleanDirectorySeparators(Utils.MakePathRelativeTo(ProjectFileGenerator.EngineRelativePath, Path.GetDirectoryName(OutputFilePath)), '/');
                    if (EnginePath.EndsWith("/") == false)
                    {
                        EnginePath += "/";
                    }
                    GlobalCompileEnvironment.Config.Definitions.Add("UE_ENGINE_DIRECTORY=" + EnginePath);
                }

                // Set the define for the project name. This allows the executable to locate the correct project file to use, which may not be the same as the game name or target.
                if(UnrealBuildTool.HasUProjectFile())
                {
                    string ProjectName = Path.GetFileNameWithoutExtension(UnrealBuildTool.GetUProjectFile());
                    GlobalCompileEnvironment.Config.Definitions.Add(String.Format("UE_PROJECT_NAME={0}", ProjectName));
                }
            }

            // On Mac and Linux we have actions that should be executed after all the binaries are created
            if (GlobalLinkEnvironment.Config.Target.Platform == CPPTargetPlatform.Mac || GlobalLinkEnvironment.Config.Target.Platform == CPPTargetPlatform.Linux)
            {
                TargetToolChain.SetupBundleDependencies(AppBinaries, TargetName);
            }

            // Generate the external file list
            if(UEBuildConfiguration.bGenerateExternalFileList)
            {
                GenerateExternalFileList();
                return ECompilationResult.Succeeded;
            }

            // Create a receipt for the target
            PrepareReceipt(TargetToolChain);

            // If we're only generating the manifest, return now
            if (UEBuildConfiguration.bGenerateManifest || UEBuildConfiguration.bCleanProject)
            {
                GenerateManifest();
                if (!BuildConfiguration.bXGEExport)
                {
                    return ECompilationResult.Succeeded;
                }
            }

            // We don't need to worry about shared PCH headers when only generating project files.  This is
            // just an optimization
            if( !ProjectFileGenerator.bGenerateProjectFiles )
            {
                GlobalCompileEnvironment.SharedPCHHeaderFiles = FindSharedPCHHeaders();
            }

            if( (BuildConfiguration.bXGEExport && UEBuildConfiguration.bGenerateManifest) || (!UEBuildConfiguration.bGenerateManifest && !UEBuildConfiguration.bCleanProject && !ProjectFileGenerator.bGenerateProjectFiles) )
            {
                var UObjectDiscoveryStartTime = DateTime.UtcNow;

                // Reconstruct a full list of binaries. Binaries which aren't compiled are stripped out of AppBinaries, but we still need to scan them for UHT.
                List<UEBuildBinary> AllAppBinaries = AppBinaries.Union(PrecompiledBinaries).Distinct().ToList();

                // Figure out which modules have UObjects that we may need to generate headers for
                foreach( var Binary in AllAppBinaries )
                {
                    var LocalUObjectModules = UObjectModules;	// For lambda access
                    var DependencyModules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
                    foreach( var DependencyModuleCPP in DependencyModules.OfType<UEBuildModuleCPP>().Where( CPPModule => !LocalUObjectModules.Any( Module => Module.ModuleName == CPPModule.Name ) ) )
                    {
                        if( !DependencyModuleCPP.bIncludedInTarget )
                        {
                            throw new BuildException( "Expecting module {0} to have bIncludeInTarget set", DependencyModuleCPP.Name );
                        }

                        var UHTModuleInfo = DependencyModuleCPP.GetUHTModuleInfo();
                        if( UHTModuleInfo.PublicUObjectClassesHeaders.Count > 0 || UHTModuleInfo.PrivateUObjectHeaders.Count > 0 || UHTModuleInfo.PublicUObjectHeaders.Count > 0 )
                        {
                            // If we've got this far and there are no source files then it's likely we're running Rocket and ignoring
                            // engine files, so we don't need a .generated.cpp either
                            UEBuildModuleCPP.AutoGenerateCppInfoClass.BuildInfoClass BuildInfo = null;
                            UHTModuleInfo.GeneratedCPPFilenameBase = Path.Combine( DependencyModuleCPP.GeneratedCodeDirectory, UHTModuleInfo.ModuleName ) + ".generated";
                            if (DependencyModuleCPP.SourceFilesToBuild.Count != 0)
                            {
                                BuildInfo = new UEBuildModuleCPP.AutoGenerateCppInfoClass.BuildInfoClass( UHTModuleInfo.GeneratedCPPFilenameBase + "*.cpp" );
                            }

                            DependencyModuleCPP.AutoGenerateCppInfo = new UEBuildModuleCPP.AutoGenerateCppInfoClass(BuildInfo);

                            // If we're running in "gather" mode only, we'll go ahead and cache PCH information for each module right now, so that we don't
                            // have to do it in the assembling phase.  It's OK for gathering to take a bit longer, even if UObject headers are not out of
                            // date in order to save a lot of time in the assembling runs.
                            UHTModuleInfo.PCH = "";
                            if( UnrealBuildTool.IsGatheringBuild && !UnrealBuildTool.IsAssemblingBuild )
                            {
                                // We need to figure out which PCH header this module is including, so that UHT can inject an include statement for it into any .cpp files it is synthesizing
                                var ModuleCompileEnvironment = DependencyModuleCPP.CreateModuleCompileEnvironment(GlobalCompileEnvironment);
                                DependencyModuleCPP.CachePCHUsageForModuleSourceFiles(ModuleCompileEnvironment);
                                if (DependencyModuleCPP.ProcessedDependencies.UniquePCHHeaderFile != null)
                                {
                                    UHTModuleInfo.PCH = DependencyModuleCPP.ProcessedDependencies.UniquePCHHeaderFile.AbsolutePath;
                                }
                            }

                            UObjectModules.Add( UHTModuleInfo );
                            Log.TraceVerbose( "Detected UObject module: " + UHTModuleInfo.ModuleName );
                        }
                    }
                }

                if( BuildConfiguration.bPrintPerformanceInfo )
                {
                    double UObjectDiscoveryTime = ( DateTime.UtcNow - UObjectDiscoveryStartTime ).TotalSeconds;
                    Trace.TraceInformation( "UObject discovery time: " + UObjectDiscoveryTime + "s" );
                }

                // NOTE: Even in Gather mode, we need to run UHT to make sure the files exist for the static action graph to be setup correctly.  This is because UHT generates .cpp
                // files that are injected as top level prerequisites.  If UHT only emitted included header files, we wouldn't need to run it during the Gather phase at all.
                if( UObjectModules.Count > 0 )
                {
                    // Execute the header tool
                    string ModuleInfoFileName = Path.GetFullPath( Path.Combine( ProjectIntermediateDirectory, "UnrealHeaderTool.manifest" ) );
                    ECompilationResult UHTResult = ECompilationResult.OtherCompilationError;
                    if (!ExternalExecution.ExecuteHeaderToolIfNecessary(this, GlobalCompileEnvironment, UObjectModules, ModuleInfoFileName, ref UHTResult))
                    {
                        Log.TraceInformation("UnrealHeaderTool failed for target '" + GetTargetName() + "' (platform: " + Platform.ToString() + ", module info: " + ModuleInfoFileName + ").");
                        return UHTResult;
                    }
                }
            }

            if (ShouldCompileMonolithic() && !ProjectFileGenerator.bGenerateProjectFiles && Rules != null && TargetType != TargetRules.TargetType.Program)
            {
                // All non-program monolithic binaries implicitly depend on all static plugin libraries so they are always linked appropriately
                // In order to do this, we create a new module here with a cpp file we emit that invokes an empty function in each library.
                // If we do not do this, there will be no static initialization for libs if no symbols are referenced in them.
                CreateLinkerFixupsCPPFile();
            }

            GlobalLinkEnvironment.bShouldCompileMonolithic = ShouldCompileMonolithic();

            // Build the target's binaries.
            foreach (var Binary in AppBinaries)
            {
                OutputItems.AddRange(Binary.Build(TargetToolChain, GlobalCompileEnvironment, GlobalLinkEnvironment));
            }

            if( BuildConfiguration.bPrintPerformanceInfo )
            {
                foreach( var SharedPCH in GlobalCompileEnvironment.SharedPCHHeaderFiles )
                {
                    Log.TraceInformation( "Shared PCH '" + SharedPCH.Module.Name + "': Used " + SharedPCH.NumModulesUsingThisPCH + " times" );
                }
            }

            return ECompilationResult.Succeeded;
        }
コード例 #15
0
        /// <summary>
        /// Builds the binary.
        /// </summary>
        /// <param name="CompileEnvironment">The environment to compile the binary in</param>
        /// <param name="LinkEnvironment">The environment to link the binary in</param>
        /// <returns></returns>
        public override IEnumerable <FileItem> Build(IUEToolChain TargetToolChain, CPPEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            // Determine the type of binary we're linking.
            switch (Config.Type)
            {
            case UEBuildBinaryType.DynamicLinkLibrary:
                CompileEnvironment.Config.bIsBuildingDLL     = true;
                CompileEnvironment.Config.bIsBuildingLibrary = false;
                break;

            case UEBuildBinaryType.StaticLibrary:
                CompileEnvironment.Config.bIsBuildingDLL     = false;
                CompileEnvironment.Config.bIsBuildingLibrary = true;
                break;

            default:
                CompileEnvironment.Config.bIsBuildingDLL     = false;
                CompileEnvironment.Config.bIsBuildingLibrary = false;
                break;
            }
            ;

            var OutputFiles = new List <FileItem>();

            var BinaryCompileEnvironment = CompileEnvironment.DeepCopy();
            var BinaryLinkEnvironment    = LinkEnvironment.DeepCopy();

            // Process each module that is linked into the binary.
            var BinaryDependencies            = new List <UEBuildBinary>();
            var LinkEnvironmentVisitedModules = new Dictionary <UEBuildModule, bool>();

            // @Hack: This to prevent UHT from listing CoreUObject.generated.cpp as its dependency.
            // We flag the compile environment when we build UHT so that we don't need to check
            // this for each file when generating their dependencies.
            BinaryCompileEnvironment.bHackHeaderGenerator = (Target.GetAppName() == "UnrealHeaderTool");

            // @todo: This should be in some Windows code somewhere...
            // Set the original file name macro; used in PCLaunch.rc to set the binary metadata fields.
            var OriginalFilename = (Config.OriginalOutputFilePaths != null) ?
                                   Path.GetFileName(Config.OriginalOutputFilePaths[0]) :
                                   Path.GetFileName(Config.OutputFilePaths[0]);

            BinaryCompileEnvironment.Config.Definitions.Add("ORIGINAL_FILE_NAME=\"" + OriginalFilename + "\"");

            foreach (var ModuleName in ModuleNames)
            {
                var Module = Target.GetModuleByName(ModuleName);

                // Compile each module.
                Log.TraceVerbose("Compile module: " + ModuleName);

                var LinkInputFiles = Module.Compile(CompileEnvironment, BinaryCompileEnvironment, Config.bCompileMonolithic);

                // NOTE: Because of 'Shared PCHs', in monolithic builds the same PCH file may appear as a link input
                // multiple times for a single binary.  We'll check for that here, and only add it once.  This avoids
                // a linker warning about redundant .obj files.
                foreach (var LinkInputFile in LinkInputFiles)
                {
                    if (!BinaryLinkEnvironment.InputFiles.Contains(LinkInputFile))
                    {
                        BinaryLinkEnvironment.InputFiles.Add(LinkInputFile);
                    }
                }

                // Allow the module to modify the link environment for the binary.
                Module.SetupPrivateLinkEnvironment(ref BinaryLinkEnvironment, ref BinaryDependencies, ref LinkEnvironmentVisitedModules);
            }

            // Remove the default resource file on Windows (PCLaunch.rc) if the user has specified their own
            if (BinaryLinkEnvironment.InputFiles.Select(Item => Path.GetFileName(Item.AbsolutePath).ToLower()).Any(Name => Name.EndsWith(".res") && !Name.EndsWith(".inl.res") && Name != "pclaunch.rc.res"))
            {
                BinaryLinkEnvironment.InputFiles.RemoveAll(x => Path.GetFileName(x.AbsolutePath).ToLower() == "pclaunch.rc.res");
            }

            // Allow the binary dependencies to modify the link environment.
            foreach (var BinaryDependency in BinaryDependencies)
            {
                BinaryDependency.SetupDependentLinkEnvironment(ref BinaryLinkEnvironment);
            }

            // Set the link output file.
            BinaryLinkEnvironment.Config.OutputFilePaths = Config.OutputFilePaths != null ? (string[])Config.OutputFilePaths.Clone() : null;

            // Set whether the link is allowed to have exports.
            BinaryLinkEnvironment.Config.bHasExports = Config.bAllowExports;

            // Set the output folder for intermediate files
            BinaryLinkEnvironment.Config.IntermediateDirectory = Config.IntermediateDirectory;

            // Put the non-executable output files (PDB, import library, etc) in the same directory as the production
            BinaryLinkEnvironment.Config.OutputDirectory = Path.GetDirectoryName(Config.OutputFilePaths[0]);

            // Determine the type of binary we're linking.
            switch (Config.Type)
            {
            case UEBuildBinaryType.DynamicLinkLibrary:
                BinaryLinkEnvironment.Config.bIsBuildingDLL     = true;
                BinaryLinkEnvironment.Config.bIsBuildingLibrary = false;
                break;

            case UEBuildBinaryType.StaticLibrary:
                BinaryLinkEnvironment.Config.bIsBuildingDLL     = false;
                BinaryLinkEnvironment.Config.bIsBuildingLibrary = true;
                break;

            default:
                BinaryLinkEnvironment.Config.bIsBuildingDLL     = false;
                BinaryLinkEnvironment.Config.bIsBuildingLibrary = false;
                break;
            }
            ;

            if (ProjectFileGenerator.bGenerateProjectFiles)
            {
                // We're generating projects.  Since we only need include paths and definitions, there is no need
                // to go ahead and run through the linking logic.
                OutputFiles = BinaryLinkEnvironment.InputFiles;
            }
            else if (BuildConfiguration.bEnableCodeAnalysis)
            {
                // We're only analyzing code, so we won't actually link any executables.  Instead, our output
                // files will simply be the .obj files that were compiled during static analysis.
                OutputFiles = BinaryLinkEnvironment.InputFiles;
            }
            else
            {
                if (bCreateImportLibrarySeparately)
                {
                    // Mark the link environment as cross-referenced.
                    BinaryLinkEnvironment.Config.bIsCrossReferenced = true;

                    if (BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Mac && BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Linux)
                    {
                        // Create the import library.
                        OutputFiles.AddRange(BinaryLinkEnvironment.LinkExecutable(true));
                    }
                }

                BinaryLinkEnvironment.Config.bIncludeDependentLibrariesInLibrary = bIncludeDependentLibrariesInLibrary;

                // Link the binary.
                FileItem[] Executables = BinaryLinkEnvironment.LinkExecutable(false);
                OutputFiles.AddRange(Executables);

                // Produce additional console app if requested
                if (BinaryLinkEnvironment.Config.CanProduceAdditionalConsoleApp && UEBuildConfiguration.bBuildEditor)
                {
                    // Produce additional binary but link it as a console app
                    var ConsoleAppLinkEvironment = BinaryLinkEnvironment.DeepCopy();
                    ConsoleAppLinkEvironment.Config.bIsBuildingConsoleApplication = true;
                    ConsoleAppLinkEvironment.Config.WindowsEntryPointOverride     = "WinMainCRTStartup";                                // For WinMain() instead of "main()" for Launch module
                    for (int Index = 0; Index < Config.OutputFilePaths.Length; Index++)
                    {
                        ConsoleAppLinkEvironment.Config.OutputFilePaths[Index] = GetAdditionalConsoleAppPath(ConsoleAppLinkEvironment.Config.OutputFilePaths[Index]);
                    }

                    // Link the console app executable
                    OutputFiles.AddRange(ConsoleAppLinkEvironment.LinkExecutable(false));
                }

                foreach (var Executable in Executables)
                {
                    OutputFiles.AddRange(TargetToolChain.PostBuild(Executable, BinaryLinkEnvironment));
                }
            }

            return(OutputFiles);
        }
コード例 #16
0
        private List <FileItem> SetupOutputFiles(IUEToolChain TargetToolChain, ref LinkEnvironment BinaryLinkEnvironment)
        {
            // Early exits first
            if (ProjectFileGenerator.bGenerateProjectFiles)
            {
                // We're generating projects.  Since we only need include paths and definitions, there is no need
                // to go ahead and run through the linking logic.
                return(BinaryLinkEnvironment.InputFiles);
            }

            if (BuildConfiguration.bEnableCodeAnalysis)
            {
                // We're only analyzing code, so we won't actually link any executables.  Instead, our output
                // files will simply be the .obj files that were compiled during static analysis.
                return(BinaryLinkEnvironment.InputFiles);
            }

            if (BuildConfiguration.bRunUnrealCodeAnalyzer)
            {
                //
                // Create actions to analyze *.includes files and provide suggestions on how to modify PCH.
                //
                return(CreateOutputFilesForUCA(BinaryLinkEnvironment));
            }

            //
            // Regular linking action.
            //
            var OutputFiles = new List <FileItem>();

            if (bCreateImportLibrarySeparately)
            {
                // Mark the link environment as cross-referenced.
                BinaryLinkEnvironment.Config.bIsCrossReferenced = true;

                if (BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Mac && BinaryLinkEnvironment.Config.Target.Platform != CPPTargetPlatform.Linux)
                {
                    // Create the import library.
                    OutputFiles.AddRange(BinaryLinkEnvironment.LinkExecutable(true));
                }
            }

            BinaryLinkEnvironment.Config.bIncludeDependentLibrariesInLibrary = bIncludeDependentLibrariesInLibrary;

            // Link the binary.
            FileItem[] Executables = BinaryLinkEnvironment.LinkExecutable(false);
            OutputFiles.AddRange(Executables);

            // Produce additional console app if requested
            if (Config.bBuildAdditionalConsoleApp)
            {
                // Produce additional binary but link it as a console app
                var ConsoleAppLinkEvironment = BinaryLinkEnvironment.DeepCopy();
                ConsoleAppLinkEvironment.Config.bIsBuildingConsoleApplication = true;
                ConsoleAppLinkEvironment.Config.WindowsEntryPointOverride     = "WinMainCRTStartup";                            // For WinMain() instead of "main()" for Launch module
                ConsoleAppLinkEvironment.Config.OutputFilePaths = ConsoleAppLinkEvironment.Config.OutputFilePaths.Select(Path => GetAdditionalConsoleAppPath(Path)).ToList();

                // Link the console app executable
                OutputFiles.AddRange(ConsoleAppLinkEvironment.LinkExecutable(false));
            }

            foreach (var Executable in Executables)
            {
                OutputFiles.AddRange(TargetToolChain.PostBuild(Executable, BinaryLinkEnvironment));
            }

            return(OutputFiles);
        }
コード例 #17
0
        /// <summary>
        /// Adds a build product and its associated debug file to a receipt.
        /// </summary>
        /// <param name="OutputFile">Build product to add</param>
        /// <param name="DebugExtension">Extension for the matching debug file (may be null).</param>
        /// <param name="Receipt">Receipt to add to</param>
        static void AddBuildProductAndDebugFile(string OutputFile, BuildProductType OutputType, string DebugExtension, BuildReceipt Receipt, IUEToolChain ToolChain)
        {
            Receipt.AddBuildProduct(OutputFile, OutputType);

            if(!String.IsNullOrEmpty(DebugExtension) && ToolChain.ShouldAddDebugFileToReceipt(OutputFile, OutputType))
            {
                Receipt.AddBuildProduct(Path.ChangeExtension(OutputFile, DebugExtension), BuildProductType.SymbolFile);
            }
        }
コード例 #18
0
        /// <summary>
        /// Adds a build product and its associated debug file to a receipt.
        /// </summary>
        /// <param name="OutputFile">Build product to add</param>
        /// <param name="DebugExtension">Extension for the matching debug file (may be null).</param>
        /// <param name="Receipt">Receipt to add to</param>
        static void AddBuildProductAndDebugFile(string OutputFile, BuildProductType OutputType, string DebugExtension, BuildReceipt Receipt, IUEToolChain ToolChain)
        {
            Receipt.AddBuildProduct(OutputFile, OutputType);

            if (!String.IsNullOrEmpty(DebugExtension) && ToolChain.ShouldAddDebugFileToReceipt(OutputFile, OutputType))
            {
                Receipt.AddBuildProduct(Path.ChangeExtension(OutputFile, DebugExtension), BuildProductType.SymbolFile);
            }
        }
コード例 #19
0
 /// <summary>
 /// Builds the binary.
 /// </summary>
 /// <param name="ToolChain">The toolchain which to use for building</param>
 /// <param name="CompileEnvironment">The environment to compile the binary in</param>
 /// <param name="LinkEnvironment">The environment to link the binary in</param>
 /// <returns></returns>
 public abstract IEnumerable <FileItem> Build(IUEToolChain ToolChain, CPPEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment);
コード例 #20
0
ファイル: UEBuildBinary.cs プロジェクト: mymei/UE4
        /// <summary>
        /// Creates a receipt for this binary.
        /// </summary>
        /// <param name="ToolChain">Toolchain for the target platform</param>
        /// <param name="BuildPlatform">Platform that we're building for</param>
        public virtual BuildReceipt MakeReceipt(IUEToolChain ToolChain)
        {
            BuildReceipt Receipt = new BuildReceipt();

            // Get the type of build products we're creating
            BuildProductType Type = BuildProductType.RequiredResource;
            switch(Config.Type)
            {
                case UEBuildBinaryType.Executable:
                    Type = BuildProductType.Executable;
                    break;
                case UEBuildBinaryType.DynamicLinkLibrary:
                    Type = BuildProductType.DynamicLibrary;
                    break;
                case UEBuildBinaryType.StaticLibrary:
                    Type = BuildProductType.StaticLibrary;
                    break;
            }

            // Add the primary build products
            string DebugExtension = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetDebugInfoExtension(Config.Type);
            foreach (string OutputFilePath in Config.OutputFilePaths)
            {
                AddBuildProductAndDebugFile(OutputFilePath, Type, DebugExtension, Receipt);
            }

            // Add the console app, if there is one
            if (Config.Type == UEBuildBinaryType.Executable && Config.bBuildAdditionalConsoleApp)
            {
                foreach (string OutputFilePath in Config.OutputFilePaths)
                {
                    AddBuildProductAndDebugFile(GetAdditionalConsoleAppPath(OutputFilePath), Type, DebugExtension, Receipt);
                }
            }

            // Add any extra files from the toolchain
            ToolChain.AddFilesToReceipt(Receipt, this);
            return Receipt;
        }
コード例 #21
0
ファイル: UEBuildBinary.cs プロジェクト: mymei/UE4
        /// <summary>
        /// Builds the binary.
        /// </summary>
        /// <param name="CompileEnvironment">The environment to compile the binary in</param>
        /// <param name="LinkEnvironment">The environment to link the binary in</param>
        /// <returns></returns>
        public override IEnumerable<FileItem> Build(IUEToolChain TargetToolChain, CPPEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            // UnrealCodeAnalyzer produces output files only for a specific module.
            if (BuildConfiguration.bRunUnrealCodeAnalyzer && !(ModuleNames.Contains(BuildConfiguration.UCAModuleToAnalyze)))
            {
                return new List<FileItem>();
            }

            // Setup linking environment.
            var BinaryLinkEnvironment = SetupBinaryLinkEnvironment(LinkEnvironment, CompileEnvironment);

            // Return linked files.
            return SetupOutputFiles(TargetToolChain, ref BinaryLinkEnvironment);
        }
コード例 #22
0
        /** Generates a public manifest file for writing out */
        public void GenerateManifest(IUEToolChain ToolChain, List<UEBuildBinary> Binaries, CPPTargetPlatform Platform, List<string> SpecialRocketLibFilesThatAreBuildProducts)
        {
            string ManifestPath;
            if (UnrealBuildTool.RunningRocket())
            {
                ManifestPath = Path.Combine(UnrealBuildTool.GetUProjectPath(), BuildConfiguration.BaseIntermediateFolder, "Manifest.xml");
            }
            else
            {
                ManifestPath = "../Intermediate/Build/Manifest.xml";
            }

            FileManifest Manifest = new FileManifest();
            if (UEBuildConfiguration.bMergeManifests)
            {
                // Load in existing manifest (if any)
                Manifest = Utils.ReadClass<FileManifest>(ManifestPath);
            }

            UnrealTargetPlatform TargetPlatform = CPPTargetPlatformToUnrealTargetPlatform( Platform );
            var BuildPlatform = UEBuildPlatform.GetBuildPlatform( TargetPlatform );

            // Iterate over all the binaries, and add the relevant info to the manifest
            foreach( UEBuildBinary Binary in Binaries )
            {
                // Get the platform specific extension for debug info files

                // Don't add static library files to the manifest as we do not check them into perforce.
                // However, add them to the manifest when cleaning the project as we do want to delete
                // them in that case.
                if (UEBuildConfiguration.bCleanProject == false)
                {
                    if (Binary.Config.Type == UEBuildBinaryType.StaticLibrary)
                    {
                        continue;
                    }
                }
                string DebugInfoExtension = BuildPlatform.GetDebugInfoExtension(Binary.Config.Type);

                // Create and add the binary and associated debug info
                foreach (string OutputFilePath in Binary.Config.OutputFilePaths)
                {
                    Manifest.AddBinaryNames(OutputFilePath, DebugInfoExtension);
                }

                if (Binary.Config.Type == UEBuildBinaryType.Executable &&
                      GlobalLinkEnvironment.Config.CanProduceAdditionalConsoleApp &&
                      UEBuildConfiguration.bBuildEditor)
                {
                    foreach (string OutputFilePath in Binary.Config.OutputFilePaths)
                    {
                        Manifest.AddBinaryNames(UEBuildBinary.GetAdditionalConsoleAppPath(OutputFilePath), DebugInfoExtension);
                    }
                }

                ToolChain.AddFilesToManifest(ref Manifest,Binary);
            }
            {
                string DebugInfoExtension = BuildPlatform.GetDebugInfoExtension(UEBuildBinaryType.StaticLibrary);
                foreach (var RedistLib in SpecialRocketLibFilesThatAreBuildProducts)
                {
                    Manifest.AddBinaryNames(RedistLib, DebugInfoExtension);
                }
            }

            if (UEBuildConfiguration.bCleanProject)
            {
                CleanTarget(Binaries, Platform, Manifest);
            }
            if (UEBuildConfiguration.bGenerateManifest)
            {
                Utils.WriteClass<FileManifest>(Manifest, ManifestPath, "");
            }
        }