// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System; using System.Collections.Generic; namespace Flax.Build.NativeCpp { /// /// The linked output file types. /// public enum LinkerOutput { /// /// The executable file (aka .exe file). /// Executable, /// /// The shared library file (aka .dll file). /// SharedLibrary, /// /// The static library file (aka .lib file). /// StaticLibrary, /// /// The import library file (aka .lib file). /// ImportLibrary, } /// /// The C++ linking environment required to build source files in the native modules. /// public class LinkEnvironment : ICloneable { /// /// The output type. /// public LinkerOutput Output; /// /// Enables the code optimization. /// public bool Optimization = false; /// /// Enables debug information generation. /// public bool DebugInformation = false; /// /// Hints to use full debug information. /// public bool UseFullDebugInformation = false; /// /// Hints to use fast PDB linking. /// public bool UseFastPDBLinking = false; /// /// Enables the link time code generation (LTCG). /// public bool LinkTimeCodeGeneration = false; /// /// Hints to use incremental linking. /// public bool UseIncrementalLinking = false; /// /// Enables Windows Metadata generation. /// public bool GenerateWindowsMetadata = false; /// /// Use CONSOLE subsystem on Windows instead of the WINDOWS one. /// public bool LinkAsConsoleProgram = false; /// /// Enables documentation generation. /// public bool GenerateDocumentation = false; /// /// The collection of the object files to be linked. /// public readonly HashSet InputFiles = new HashSet(); /// /// The collection of the documentation files to be used during linked file documentation generation. Used only if is enabled. /// public readonly List DocumentationFiles = new List(); /// /// The collection of dependent static or import libraries that need to be linked. /// public readonly List InputLibraries = new List(); /// /// The collection of dependent static or import libraries paths. /// public readonly List LibraryPaths = new List(); /// /// The collection of custom arguments to pass to the linker. /// public readonly HashSet CustomArgs = new HashSet(); /// public object Clone() { var clone = new LinkEnvironment { Output = Output, Optimization = Optimization, DebugInformation = DebugInformation, UseFullDebugInformation = UseFullDebugInformation, UseFastPDBLinking = UseFastPDBLinking, LinkTimeCodeGeneration = LinkTimeCodeGeneration, UseIncrementalLinking = UseIncrementalLinking, GenerateWindowsMetadata = GenerateWindowsMetadata, LinkAsConsoleProgram = LinkAsConsoleProgram, GenerateDocumentation = GenerateDocumentation }; foreach (var e in InputFiles) clone.InputFiles.Add(e); clone.DocumentationFiles.AddRange(DocumentationFiles); clone.InputLibraries.AddRange(InputLibraries); clone.LibraryPaths.AddRange(LibraryPaths); clone.CustomArgs.AddRange(CustomArgs); return clone; } } }