// Copyright (c) Ubisoft. All Rights Reserved. // Licensed under the Apache 2.0 License. See LICENSE.md in the project root for license information. namespace Sharpmake { public abstract partial class BasePlatform { private const string _projectConfigurationsCompileTemplate = @" [options.UsePrecompiledHeader] [options.CompileAsWinRT] [options.WarningLevel] [options.TreatAngleIncludeAsExternal] [options.ExternalWarningLevel] [options.ExternalTemplatesDiagnostics] [options.Optimization] [EscapeXML:options.PreprocessorDefinitions];%(PreprocessorDefinitions);$(PreprocessorDefinitions) [options.AdditionalIncludeDirectories] [options.AdditionalUsingDirectories] [options.DebugInformationFormat] [compileAsManaged] true [options.TreatWarningAsError] [options.DiagnosticsFormat] [options.MultiProcessorCompilation] false [options.InlineFunctionExpansion] [options.EnableIntrinsicFunctions] [options.FavorSizeOrSpeed] [options.OmitFramePointers] [options.EnableFiberSafeOptimizations] [options.CompilerWholeProgramOptimization] false [options.IgnoreStandardIncludePath] [options.GeneratePreprocessedFile] [options.PreprocessSuppressLineNumbers] [options.KeepComments] [options.UseStandardConformingPreprocessor] [options.StringPooling] [options.MinimalRebuild] [options.ExceptionHandling] [options.SmallerTypeCheck] [options.BasicRuntimeChecks] [options.RuntimeLibrary] [options.StructMemberAlignment] [options.BufferSecurityCheck] [options.EnableFunctionLevelLinking] [options.EnableEnhancedInstructionSet] [options.FloatingPointModel] [options.FloatingPointExceptions] [options.CompilerCreateHotpatchableImage] [options.ConformanceMode] [options.DisableLanguageExtensions] [options.TreatWChar_tAsBuiltInType] [options.RemoveUnreferencedCodeData] [options.ForceConformanceInForLoopScope] [options.RuntimeTypeInfo] [options.OpenMP] [options.LanguageStandard_C] [options.LanguageStandard] false NoListing [options.GenerateXMLDocumentation] false [options.CallingConvention] Default [options.DisableSpecificWarnings] [options.UndefinePreprocessorDefinitions] [options.AllAdditionalCompilerOptions] [options.PrecompiledHeaderThrough] [options.PrecompiledHeaderFile] [options.CompilerProgramDatabaseFile] [options.RuntimeLibrary] [options.ShowIncludes] [options.ForcedIncludeFiles] [options.ForcedUsingFiles] [options.SupportJustMyCode] [options.MaxFilesPerJumboFile] [options.MinFilesPerJumboFile] [options.MinJumboFiles] "; private const string _projectConfigurationsLinkTemplate = @" [options.SubSystem] [options.LinkerGenerateDebugInformation] [options.FullProgramDatabaseFile] [options.OutputFile] [options.ShowProgress] [options.AdditionalLibraryDirectories] [options.ManifestFile] [options.LinkerProgramDatabaseFile] [options.GenerateMapFile] [options.MapExports] false false NotSet [options.OptimizeReferences] [options.EnableCOMDATFolding] [options.ProfileGuidedDatabase] [options.LinkTimeCodeGeneration] false 1 false false [options.RandomizedBaseAddress] [options.FixedBaseAddress] false [options.TargetMachine] false Default PromptImmediately [options.AdditionalLinkerOptions] [options.AdditionalDependencies] [options.SuppressStartupBanner] [options.IgnoreAllDefaultLibraries] [options.IgnoreDefaultLibraryNames] [options.AssemblyDebug] [options.HeapReserveSize] [options.HeapCommitSize] [options.StackReserveSize] [options.StackCommitSize] [options.LargeAddressAware] [options.MapFileName] [options.ImportLibrary] [options.FunctionOrder] [options.ForceFileOutput] [options.ModuleDefinitionFile] [options.DelayLoadedDLLs] [options.BaseAddress] [options.UACExecutionLevel] [options.AllowIsolation] [options.GenerateWindowsMetadata] [options.WindowsMetadataFile] [options.TreatLinkerWarningAsErrors] [options.LinkerCreateHotPatchableImage] "; private const string _projectConfigurationsStaticLinkTemplate = @" [options.LinkerGenerateDebugInformation] [options.FullProgramDatabaseFile] [options.EnableCOMDATFolding] [options.OptimizeReferences] [options.TreatLinkerWarningAsErrors] [options.TargetMachine] [options.LinkTimeCodeGeneration] [options.AdditionalLibrarianOptions] [options.TreatLibWarningAsErrors] [options.OutputFile] [options.AdditionalLibraryDirectories] [options.AdditionalDependencies] "; private const string _userFileConfigurationGeneralTemplate = @" [conf.VcxprojUserFile.LocalDebuggerCommand] [conf.VcxprojUserFile.LocalDebuggerCommandArguments] [conf.VcxprojUserFile.LocalDebuggerEnvironment] [conf.VcxprojUserFile.LocalDebuggerWorkingDirectory] [conf.VcxprojUserFile.LocalDebuggerAttachString] WindowsLocalDebugger "; private const string _projectConfigurationsGeneral = @" [options.ConfigurationType] [options.UseDebugLibraries] [options.PreferredToolArchitecture] [options.TranslateIncludes] [options.CharacterSet] [options.UseOfMfc] [options.WholeProgramOptimization] [options.PlatformToolset] [options.TrackFileAccess] [options.CLRSupport] [options.WindowsTargetPlatformVersion] [options.SpectreMitigation] [options.EnableASAN] [options.JumboBuild] "; private const string _projectConfigurationsGeneral2 = @" [options.OutputFileName] [options.OutputDirectory]\ [options.IntermediateDirectory]\ [options.OutputFileExtension] [options.GenerateManifest] [options.PostBuildEventEnable] [options.PreBuildEventEnable] [options.PreLinkEventEnable] [options.LinkIncremental] [options.OutputFile] [options.EmbedManifest] [options.IgnoreImportLibrary] [options.RunCodeAnalysis] [options.MicrosoftCodeAnalysis] [options.ClangTidyCodeAnalysis] [options.CAexcludePaths];%(CAExcludepath) [options.CustomBuildStepBeforeTargets] [options.CustomBuildStepAfterTargets] [options.ExecutablePath] [options.IncludePath] [options.ExternalIncludePath] [options.ReferencePath] [options.LibraryPath] [options.LibraryWPath] [options.SourcePath] [options.ExcludePath] [options.PublicIncludeDirectories] [options.AllProjectIncludesArePublic] [options.PublicModuleDirectories] [options.AllProjectBMIsArePublic] [options.DisableFastUpToDateCheck] [options.EnableManagedIncrementalBuild] [options.UseClangCl] [options.UseLldLink] [options.CopyLocalDeploymentContent] [options.CopyLocalProjectReference] [options.CopyLocalDebugSymbols] [options.CopyCppRuntimeToOutputDir] "; private const string _windowsSDKOverridesBegin = @" [UCRTContentRoot] [UniversalCRTSdkDir_10] <[windowsSdkDirKey]>[windowsSdkDirValue] $([windowsSdkDirKey]) [targetPlatformVersion] "; private const string _windowsSDKOverridesEnd = @" "; // Notes: // Clean: // Visual Studio automatically cleans most files from the intermediate directory as soon as the clean command is active. However, it doesn't // clean them all, so we manually delete everything! // Also, it doesn't erase the target file and its related file extensions. We now clean them manually. Feel free to add more extensions if some were forgotten. // Removing unity blobs is useful if the number of blobs changes this will erase the ones that are no longer used. // Implementation note: // del *.* doesn't work and Visual studio seems to have a protection against this so we must delete explicit files or extensions... private const string _projectConfigurationsFastBuildMakefile = @" [options.OutputDirectory]\ [options.IntermediateDirectory]\ cd [fastBuildWorkingDirectory] [conf.FastBuildCustomActionsBeforeBuildCommand] [fastBuildMakeCommandBuild] cd [fastBuildWorkingDirectory] [conf.FastBuildCustomActionsBeforeBuildCommand] [fastBuildMakeCommandRebuild] del ""[options.IntermediateDirectory]\*unity*.cpp"" >NUL 2>NUL del ""[options.IntermediateDirectory]\*.obj"" >NUL 2>NUL del ""[options.IntermediateDirectory]\*.a"" >NUL 2>NUL del ""[options.IntermediateDirectory]\*.lib"" >NUL 2>NUL del ""[options.OutputDirectory]\[conf.TargetFileFullName].exe"" >NUL 2>NUL del ""[options.OutputDirectory]\[conf.TargetFileFullName].elf"" >NUL 2>NUL del ""[options.OutputDirectory]\[conf.TargetFileFullName].exp"" >NUL 2>NUL del ""[options.OutputDirectory]\[conf.TargetFileFullName].ilk"" >NUL 2>NUL del ""[options.OutputDirectory]\[conf.TargetFileFullName].lib"" >NUL 2>NUL del ""[options.OutputDirectory]\[conf.TargetFileFullName].pdb"" >NUL 2>NUL [options.OutputFile] [EscapeXML:options.PreprocessorDefinitions][EscapeXML:options.IntellisenseAdditionalDefines] [options.NMakeIncludeSearchPath] [options.ForcedIncludeFiles] [options.IntellisenseCommandLineOptions] cd [fastBuildWorkingDirectory] [conf.FastBuildCustomActionsBeforeBuildCommand] [fastBuildMakeCommandCompileFile] "; private const string _projectConfigurationsCustomMakefile = @" [options.OutputDirectory]\ [options.IntermediateDirectory]\ [conf.CustomBuildSettings.BuildCommand] [conf.CustomBuildSettings.RebuildCommand] [conf.CustomBuildSettings.CleanCommand] [conf.CustomBuildSettings.OutputFile] [EscapeXML:options.PreprocessorDefinitions] [options.NMakeIncludeSearchPath] [options.ForcedIncludeFiles] [options.IntellisenseCommandLineOptions] [conf.CustomBuildSettings.CompileFileCommand] "; private const string _projectConfigurationsNasmTemplate = @" [EscapeXML:options.PreprocessorDefinitions];%(PreprocessorDefinitions);$(PreprocessorDefinitions) [options.AdditionalAssemblyIncludeDirectories] [ExePath] [PreIncludedFiles] "; } }