// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System; using System.Collections.Generic; namespace Flax.Build.NativeCpp { /// /// The compilation optimization hint. /// public enum FavorSizeOrSpeed { /// /// The default option. /// Neither, /// /// The fast code. /// FastCode, /// /// The small code. /// SmallCode } /// /// The compilation optimization hint. /// public enum CppVersion { /// /// C++14 /// Cpp14, /// /// C++17 /// Cpp17, /// /// C++20 /// Cpp20, /// /// The latest version supported by the compiler. /// Latest, } /// /// The C++ compilation environment required to build source files in the native modules. /// public class CompileEnvironment : ICloneable { /// /// C++ standard version to use for compilation. /// public CppVersion CppVersion = CppVersion.Cpp14; /// /// Selects a predefined set of options that affect the size and speed of generated code. /// public FavorSizeOrSpeed FavorSizeOrSpeed = FavorSizeOrSpeed.Neither; /// /// Enables exceptions support. /// public bool EnableExceptions = false; /// /// Enables RTTI. /// public bool RuntimeTypeInfo = true; /// /// Enables functions inlining support. /// public bool Inlining = false; /// /// Enables code optimization. /// public bool Optimization = false; /// /// Enables the whole program optimization. /// public bool WholeProgramOptimization = false; /// /// Enables functions level linking support. /// public bool FunctionLevelLinking = false; /// /// Enables debug information generation. /// public bool DebugInformation = false; /// /// Hints to use Debug version of the standard library. /// public bool UseDebugCRT = false; /// /// Hints to compile code for WinRT. /// public bool CompileAsWinRT = false; /// /// Enables WinRT component extensions. /// public bool WinRTComponentExtensions = false; /// /// Enables documentation generation. /// public bool GenerateDocumentation = false; /// /// Enables runtime checks. /// public bool RuntimeChecks = false; /// /// Enables string pooling. /// public bool StringPooling = false; /// /// Enables the compiler intrinsic functions. /// public bool IntrinsicFunctions = false; /// /// Enables buffer security checks. /// public bool BufferSecurityCheck = true; /// /// Hints to treat warnings as errors. /// public bool TreatWarningsAsErrors = false; /// /// The collection of defines with preprocessing symbol for a source files. /// public readonly HashSet PreprocessorDefinitions = new HashSet(); /// /// The additional paths to add to the list of directories searched for include files. /// public readonly List IncludePaths = new List(); /// /// The collection of custom arguments to pass to the compilator. /// public readonly HashSet CustomArgs = new HashSet(); /// public object Clone() { var clone = new CompileEnvironment { CppVersion = CppVersion, FavorSizeOrSpeed = FavorSizeOrSpeed, EnableExceptions = EnableExceptions, RuntimeTypeInfo = RuntimeTypeInfo, Inlining = Inlining, Optimization = Optimization, WholeProgramOptimization = WholeProgramOptimization, FunctionLevelLinking = FunctionLevelLinking, DebugInformation = DebugInformation, UseDebugCRT = UseDebugCRT, CompileAsWinRT = CompileAsWinRT, WinRTComponentExtensions = WinRTComponentExtensions, GenerateDocumentation = GenerateDocumentation, RuntimeChecks = RuntimeChecks, StringPooling = StringPooling, IntrinsicFunctions = IntrinsicFunctions, BufferSecurityCheck = BufferSecurityCheck, TreatWarningsAsErrors = TreatWarningsAsErrors }; clone.PreprocessorDefinitions.AddRange(PreprocessorDefinitions); clone.IncludePaths.AddRange(IncludePaths); clone.CustomArgs.AddRange(CustomArgs); return clone; } } }