コード例 #1
0
        public override FileItem LinkFiles(LinkEnvironment LinkEnvironment, bool bBuildImportLibraryOnly, IActionGraphBuilder Graph)
        {
            FileItem OutputFile = FileItem.GetItemByFileReference(LinkEnvironment.OutputFilePath);

            Action LinkAction = Graph.CreateAction(ActionType.Link);

            LinkAction.CommandDescription = "FakeCompile";
            LinkAction.CommandPath        = BuildHostPlatform.Current.Shell;
            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64)
            {
                LinkAction.CommandArguments = String.Format("/C echo Linked > {0}", LinkEnvironment.OutputFilePath.FullName);
            }
            else
            {
                LinkAction.CommandArguments = String.Format("echo Linked > {0}", Utils.EscapeShellArgument(LinkEnvironment.OutputFilePath.FullName));
            }
            LinkAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory;
            foreach (FileItem InputFile in LinkEnvironment.InputFiles)
            {
                LinkAction.PrerequisiteItems.Add(InputFile);
            }
            LinkAction.ProducedItems.Add(OutputFile);
            LinkAction.DeleteItems.Add(OutputFile);
            LinkAction.StatusDescription   = OutputFile.Location.GetFileName();
            LinkAction.bCanExecuteRemotely = false;

            return(OutputFile);
        }
コード例 #2
0
        /// <summary>
        /// Creates an action which copies a file from one location to another
        /// </summary>
        /// <param name="SourceFile">The source file location</param>
        /// <param name="TargetFile">The target file location</param>
        /// <param name="ActionGraph">The action graph</param>
        /// <returns>File item for the output file</returns>
        static FileItem CreateCopyAction(FileReference SourceFile, FileReference TargetFile, ActionGraph ActionGraph)
        {
            FileItem SourceFileItem = FileItem.GetItemByFileReference(SourceFile);
            FileItem TargetFileItem = FileItem.GetItemByFileReference(TargetFile);

            Action CopyAction = ActionGraph.Add(ActionType.BuildProject);

            CopyAction.CommandDescription = "Copy";
            if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64)
            {
                CopyAction.CommandPath      = "cmd.exe";
                CopyAction.CommandArguments = String.Format("/C \"copy /Y \"{0}\" \"{1}\" 1>nul\"", SourceFile, TargetFile);
            }
            else
            {
                CopyAction.CommandPath      = "/bin/sh";
                CopyAction.CommandArguments = String.Format("cp -f {0} {1}", Utils.EscapeShellArgument(SourceFile.FullName), Utils.EscapeShellArgument(TargetFile.FullName));
            }
            CopyAction.WorkingDirectory = Environment.CurrentDirectory;
            CopyAction.PrerequisiteItems.Add(SourceFileItem);
            CopyAction.ProducedItems.Add(TargetFileItem);
            CopyAction.DeleteItems.Add(TargetFileItem);
            CopyAction.StatusDescription   = TargetFileItem.Location.GetFileName();
            CopyAction.bCanExecuteRemotely = false;

            return(TargetFileItem);
        }
コード例 #3
0
        public override CPPOutput CompileCPPFiles(CppCompileEnvironment CompileEnvironment, List <FileItem> InputFiles, DirectoryReference OutputDir, string ModuleName, List <Action> Actions)
        {
            // Create a compile action for each source file.
            CPPOutput Result = new CPPOutput();

            foreach (FileItem SourceFile in InputFiles)
            {
                FileItem ObjectFile = FileItem.GetItemByFileReference(FileReference.Combine(OutputDir, Path.GetFileName(SourceFile.AbsolutePath) + ".xo"));

                Action CompileAction = new Action(ActionType.Compile);
                CompileAction.CommandDescription = "FakeCompile";
                CompileAction.CommandPath        = BuildHostPlatform.Current.Shell;
                // we use type/cat instead of copy so that timestamp gets updated
                if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64)
                {
                    CompileAction.CommandArguments = String.Format("/C \"type \"{0}\" > \"{1}\"\"", SourceFile, ObjectFile);
                }
                else
                {
                    CompileAction.CommandArguments = String.Format("cat {0} > {1}", Utils.EscapeShellArgument(SourceFile.AbsolutePath), Utils.EscapeShellArgument(ObjectFile.AbsolutePath));
                }
                CompileAction.WorkingDirectory = UnrealBuildTool.EngineSourceDirectory;
                CompileAction.PrerequisiteItems.Add(SourceFile);
                CompileAction.ProducedItems.Add(ObjectFile);
                CompileAction.StatusDescription   = ObjectFile.Location.GetFileName();
                CompileAction.bCanExecuteRemotely = false;
                Result.ObjectFiles.Add(ObjectFile);

                foreach (FileItem ForceIncludeFile in CompileEnvironment.ForceIncludeFiles)
                {
                    CompileAction.PrerequisiteItems.Add(ForceIncludeFile);
                }


                Actions.Add(CompileAction);
            }

            return(Result);
        }