public NPath Build() { object[] arg = new object[] { this._programBuildDescription.OutputFile.FileName, this._cppToolChain.GetType().Name, Environment.NewLine, this._programBuildDescription.OutputFile.Parent, this._workingDirectory }; Console.WriteLine("Building {0} with {1}.{2}\tOutput directory: {3}{2}\tCache directory: {4}", arg); if (!this.CanBuildInCurrentEnvironment()) { throw new InvalidOperationException($"Builder is unable to build using selected toolchain ({this._cppToolChain.GetType().Name}) or architecture ({this._cppToolChain.Architecture})!"); } using (TinyProfiler.Section("BuildBinary", "")) { CppCompilationInstruction[] instructionArray; IEnumerable <NPath> enumerable; CppToolChainContext toolChainContext = this._cppToolChain.CreateToolChainContext(); using (TinyProfiler.Section("ToolChain OnBeforeCompile Build", "")) { this._cppToolChain.OnBeforeCompile(this._programBuildDescription, toolChainContext, this._workingDirectory, this._forceRebuild, this._verbose); } using (TinyProfiler.Section("FindFilesToCompile", "")) { instructionArray = this._programBuildDescription.CppCompileInstructions.Concat <CppCompilationInstruction>(toolChainContext.ExtraCompileInstructions).ToArray <CppCompilationInstruction>(); foreach (CppCompilationInstruction instruction in instructionArray) { instruction.Defines = instruction.Defines.Concat <string>(this._cppToolChain.ToolChainDefines()); instruction.IncludePaths = instruction.IncludePaths.Concat <NPath>(this._cppToolChain.ToolChainIncludePaths()).Concat <NPath>(toolChainContext.ExtraIncludeDirectories); } } using (TinyProfiler.Section("Calculate header hashes", "")) { this._headerHashProvider.Initialize(instructionArray); } using (TinyProfiler.Section("BuildAllCppFiles", "")) { enumerable = this.BuildAllCppFiles(instructionArray); } using (TinyProfiler.Section("OnBeforeLink Build", "")) { this.OnBeforeLink(enumerable, toolChainContext); } using (TinyProfiler.Section("Postprocess Object Files", "")) { this.PostprocessObjectFiles(enumerable, toolChainContext); } using (TinyProfiler.Section("ProgramDescription Finalize Build", "")) { this._programBuildDescription.FinalizeBuild(this._cppToolChain); } using (TinyProfiler.Section("ToolChain OnAfterLink Build", "")) { this._cppToolChain.OnAfterLink(this._programBuildDescription.OutputFile, toolChainContext, this._forceRebuild, this._verbose); } using (TinyProfiler.Section("Clean IL2CPP Cache", "")) { this.CleanWorkingDirectory(enumerable); } } return(this._programBuildDescription.OutputFile); }
public virtual void OnBeforeLink(ProgramBuildDescription programBuildDescription, NPath workingDirectory, IEnumerable <NPath> objectFiles, CppToolChainContext toolChainContext, bool forceRebuild, bool verbose) { }
public virtual void OnAfterLink(NPath outputFile, CppToolChainContext toolChainContext, bool forceRebuild, bool verbose) { }
public virtual void OnBeforeCompile(ProgramBuildDescription programBuildDescription, CppToolChainContext toolChainContext, NPath workingDirectory, bool forceRebuild, bool verbose) { }
public abstract CppProgramBuilder.LinkerInvocation MakeLinkerInvocation(IEnumerable <NPath> objectFiles, NPath outputFile, IEnumerable <NPath> staticLibraries, IEnumerable <NPath> dynamicLibraries, IEnumerable <string> specifiedLinkerFlags, CppToolChainContext toolChainContext);