public void ToVcxprojProperties(XmlWriter writer)
        {
            if (AreAdditionalIncludeDirectoriesSpecified && AdditionalIncludeDirectories.Length > 0)
            {
                writer.WriteElementString("AdditionalIncludeDirectories", string.Join(";", AdditionalIncludeDirectories));
            }
            if (AreAdditionalOptionsSpecified && AdditionalOptions.Length > 0)
            {
                writer.WriteElementString("AdditionalOptions", string.Join(";", AdditionalOptions));
            }
            if (AreAdditionalUsingDirectoriesSpecified && AdditionalUsingDirectories.Length > 0)
            {
                writer.WriteElementString("AdditionalUsingDirectories", string.Join(";", AdditionalUsingDirectories));
            }
            if (IsAssemblerListingLocationSpecified)
            {
                writer.WriteElementString("AssemblerListingLocation", AssemblerListingLocation);
            }
            writer.WriteElementString("AssemblerOutput", (IsAssemblerOutputSpecified ? AssemblerOutput : AssemblerOutputType.NoListing).ToString());
            if (IsBasicRuntimeChecksSpecified && BasicRuntimeChecks != RuntimeCheckType.Default)
            {
                writer.WriteElementString("BasicRuntimeChecks", BasicRuntimeChecks.ToString());
            }
            if (IsBrowseInformationFileSpecified)
            {
                writer.WriteElementString("BrowseInformationFile", BrowseInformationFile);
            }
            writer.WriteElementString("BufferSecurityCheck", XmlConvert.ToString(!IsBufferSecurityCheckSpecified || BufferSecurityCheck));
            writer.WriteElementString("CallingConvention", (IsCallingConventionSpecified ? CallingConvention : CallingConvention.Cdecl).ToString());
            if (IsCompileAsSpecified && CompileAs != CLanguage.Default)
            {
                writer.WriteElementString("CompileAs", CompileAs.ToString());
            }
            writer.WriteElementString("CompileAsManaged", CompileAsManagedToString(IsCompileAsManagedSpecified ? CompileAsManaged : ManagedCppType.NotManaged));
            writer.WriteElementString("CreateHotpatchableImage", XmlConvert.ToString(IsCreateHotpatchableImageSpecified && CreateHotpatchableImage));
            if (IsDebugInformationFormatSpecified && DebugInformationFormat != DebugInformationFormat.None)
            {
                writer.WriteElementString("DebugInformationFormat", DebugInformationFormat.ToString());
            }
            else
            {
                writer.WriteElementString("DebugInformationFormat", (suite.ActiveGoal.Has(Suite.DebugGoal.Name)
                    ? DebugInformationFormat.EditAndContinue
                    : DebugInformationFormat.None).ToString());
            }
            writer.WriteElementString("DisableLanguageExtensions", XmlConvert.ToString(IsDisableLanguageExtensionsSpecified && DisableLanguageExtensions));
            WriteStringArray(writer, "DisableSpecificWarnings", AreSuppressedWarningsSpecified ? SuppressedWarnings.Select(warn => warn.ToString(CultureInfo.InvariantCulture)).ToArray() : new string[0]);
            if (IsEnableEnhancedInstructionSetSpecified && EnableEnhancedInstructionSet != EnhancedInstructionSet.None)
            {
                writer.WriteElementString("EnhancedInstructionSet", EnableEnhancedInstructionSet.ToString());
            }
            else
            {
                writer.WriteElementString("EnhancedInstructionSet", (EnhancedInstructionSet.SSE2).ToString());
            }
            writer.WriteElementString("EnableFiberSafeOptimizations", XmlConvert.ToString(IsEnableFiberSafeOptimizationsSpecified && EnableFiberSafeOptimizations));
            writer.WriteElementString("CodeAnalysis", XmlConvert.ToString(!IsCodeAnalysisSpecified || CodeAnalysis));
            if (IsExceptionHandlingSpecified && ExceptionHandling != ExceptionHandlingType.NotSpecified)
            {
                writer.WriteElementString("ExceptionHandling", ExceptionHandling.ToString());
            }
            writer.WriteElementString("ExpandAttributedSource", XmlConvert.ToString(IsExpandAttributedSourceSpecified && ExpandAttributedSource));
            writer.WriteElementString("FavorSizeOrSpeed", (IsFavorSpecified ? Favor : OptimizationFavor.Speed).ToString());
            writer.WriteElementString("FloatingPointExceptions", XmlConvert.ToString(!IsFloatingPointExceptionsSpecified || FloatingPointExceptions));
            writer.WriteElementString("FloatingPointModel", (IsFloatingPointModelSpecified ? FloatingPointModel : FloatingPointModel.Precise).ToString());
            writer.WriteElementString("ForceConformanceInForLoopScope", XmlConvert.ToString(IsForceConformanceInForLoopScopeSpecified && ForceConformanceInForLoopScope));
            WriteStringArray(writer, "ForcedUsingFiles", AreForcedUsingFilesSpecified ? ForcedUsingFiles : new string[0]);
            writer.WriteElementString("FunctionLevelLinking", XmlConvert.ToString(IsFunctionLevelLinkingSpecified && FunctionLevelLinking));
            writer.WriteElementString("GenerateXMLDocumentationFiles", XmlConvert.ToString(IsGenerateXMLDocumentationFilesSpecified && GenerateXMLDocumentationFiles));
            writer.WriteElementString("IgnoreStandardIncludePath", XmlConvert.ToString(IsIgnoreStandardIncludePathSpecified && IgnoreStandardIncludePath));
            if (IsInlineFunctionExpansionSpecified && InlineFunctionExpansion != InlineExpansion.Default)
            {
                writer.WriteElementString("InlineFunctionExpansion", InlineFunctionExpansion.ToString());
            }
            writer.WriteElementString("IntrinsicFunctions", XmlConvert.ToString(IsIntrinsicFunctionsSpecified && IntrinsicFunctions));
            writer.WriteElementString("MinimalRebuild", XmlConvert.ToString(!IsMinimalRebuildSpecified || MinimalRebuild));
            writer.WriteElementString("MultiProcessorCompilation", XmlConvert.ToString(!IsMultiProcessorCompilationSpecified || MultiProcessorCompilation));
            writer.WriteElementString("OmitDefaultLibName", XmlConvert.ToString(IsOmitDefaultLibNameSpecified && OmitDefaultLibName));
            writer.WriteElementString("OmitFramePointers", XmlConvert.ToString(IsOmitFramePointersSpecified && OmitFramePointers));
            writer.WriteElementString("OpenMPSupport", XmlConvert.ToString(IsOpenMPSupportSpecified && OpenMPSupport));
            writer.WriteElementString("Optimization",
                                      (IsOptimizationSpecified
                    ? Optimization
                    : suite.ActiveGoal.Has(Suite.DebugGoal.Name)
                        ? OptimizationLevel.Disabled
                        : OptimizationLevel.Full).ToString());

            string[] defines;
            if (AreDefinesSpecified)
            {
                defines = Defines;
            }
            else
            {
                defines = suite.ActiveGoal.Has(Suite.DebugGoal.Name)
                          ? new[] { "_DEBUG" }
            }
            : new[] { "NDEBUG" };
            WriteStringArray(writer, "PreprocessorDefinitions", defines);

            if (ProcessorNumber.HasValue)
            {
                writer.WriteElementString("ProcessorNumber", ProcessorNumber.Value.ToString(CultureInfo.InvariantCulture));
            }

            writer.WriteElementString("RuntimeLibrary",
                                      (IsRuntimeLibrarySpecified
                    ? RuntimeLibrary
                    : suite.ActiveGoal.Has(Suite.DebugGoal.Name)
                        ? RuntimeLibraryType.MultiThreadedDebugDLL
                        : RuntimeLibraryType.MultiThreadedDLL).ToString());
            writer.WriteElementString("RuntimeTypeInfo", XmlConvert.ToString(!IsRuntimeTypeInfoSpecified || RuntimeTypeInfo));
            writer.WriteElementString("SmallerTypeCheck", XmlConvert.ToString(IsSmallerTypeCheckSpecified ? SmallerTypeCheck : suite.ActiveGoal.Has(Suite.DebugGoal.Name)));
            writer.WriteElementString("StringPooling", XmlConvert.ToString(!IsStringPoolingSpecified || StringPooling));
            if (StructMemberAlignment.HasValue)
            {
                writer.WriteElementString("StructMemberAlignment", StructMemberAlignment.Value.ToString(CultureInfo.InvariantCulture));
            }
            writer.WriteElementString("TreatWarningAsError", XmlConvert.ToString(IsAllWarningsAsErrorSpecified && AllWarningsAsError));
            WriteStringArray(writer, "SpecificWarningsAsError", AreSpecificWarningsAsErrorSpecified ? SpecificWarningsAsError.Select(warn => warn.ToString(CultureInfo.InvariantCulture)).ToArray() : new string[0]);
            writer.WriteElementString("TreatWCharTAsBuiltInType", XmlConvert.ToString(!IsTreatWCharTAsBuiltInTypeSpecified || TreatWCharTAsBuiltInType));
            writer.WriteElementString("UndefineAllPreprocessorDefinitions", XmlConvert.ToString(IsUndefineAllPreprocessorDefinitionsSpecified && UndefineAllPreprocessorDefinitions));
            WriteStringArray(writer, "UndefinePreprocessorDefinitions", AreUndefinePreprocessorDefinitionsSpecified ? UndefinePreprocessorDefinitions : new string[0]);
            writer.WriteElementString("WarningLevel", WarningLevelToString(IsWarningLevelSpecified ? WarningLevel : CppWarningLevel.All));
            writer.WriteElementString("WholeProgramOptimization", XmlConvert.ToString(IsWholeProgramOptimizationSpecified ? WholeProgramOptimization : suite.ActiveGoal.Has(Suite.ReleaseGoal.Name)));
            writer.WriteElementString("ProgramDataBaseFileName", PDBFileName);
        }
Exemple #2
0
 public void ToVcxprojProperties(XmlWriter writer)
 {
     if (AdditionalIncludeDirectories != null && AdditionalIncludeDirectories.Length > 0)
     {
         writer.WriteElementString("AdditionalIncludeDirectories", string.Join(";", AdditionalIncludeDirectories));
     }
     if (AdditionalOptions != null && AdditionalOptions.Length > 0)
     {
         writer.WriteElementString("AdditionalOptions", string.Join(";", AdditionalOptions));
     }
     if (AdditionalUsingDirectories != null && AdditionalUsingDirectories.Length > 0)
     {
         writer.WriteElementString("AdditionalUsingDirectories", string.Join(";", AdditionalUsingDirectories));
     }
     if (!string.IsNullOrWhiteSpace(AssemblerListingLocation))
     {
         writer.WriteElementString("AssemblerListingLocation", AssemblerListingLocation);
     }
     writer.WriteElementString("AssemblerOutput", AssemblerOutput.ToString());
     if (BasicRuntimeChecks != RuntimeCheckType.Default)
     {
         writer.WriteElementString("BasicRuntimeChecks", BasicRuntimeChecks.ToString());
     }
     if (!string.IsNullOrWhiteSpace("BrowseInformationFile"))
     {
         writer.WriteElementString("BrowseInformationFile", BrowseInformationFile);
     }
     writer.WriteElementString("BufferSecurityCheck", XmlConvert.ToString(BufferSecurityCheck));
     writer.WriteElementString("CallingConvention", CallingConvention.ToString());
     if (CompileAs != CLanguage.Default)
     {
         writer.WriteElementString("CompileAs", CompileAs.ToString());
     }
     writer.WriteElementString("CompileAsManaged", CompileAsManagedToString(CompileAsManaged));
     writer.WriteElementString("CreateHotpatchableImage", XmlConvert.ToString(CreateHotpatchableImage));
     if (DebugInformationFormat != DebugInformationFormat.None)
     {
         writer.WriteElementString("DebugInformationFormat", DebugInformationFormat.ToString());
     }
     writer.WriteElementString("DisableLanguageExtensions", XmlConvert.ToString(DisableLanguageExtensions));
     WriteStringArray(writer, "DisableSpecificWarnings", SuppressedWarnings.Select(warn => warn.ToString(CultureInfo.InvariantCulture)).ToArray());
     if (EnableEnhancedInstructionSet != EnhancedInstructionSet.None)
     {
         writer.WriteElementString("EnhancedInstructionSet", EnableEnhancedInstructionSet.ToString());
     }
     writer.WriteElementString("EnableFiberSafeOptimizations", XmlConvert.ToString(EnableFiberSafeOptimizations));
     writer.WriteElementString("CodeAnalysis", XmlConvert.ToString(CodeAnalysis));
     if (ExceptionHandling != ExceptionHandlingType.NotSpecified)
     {
         writer.WriteElementString("ExceptionHandling", ExceptionHandling.ToString());
     }
     writer.WriteElementString("ExpandAttributedSource", XmlConvert.ToString(ExpandAttributedSource));
     writer.WriteElementString("FavorSizeOrSpeed", Favor.ToString());
     writer.WriteElementString("FloatingPointExceptions", XmlConvert.ToString(FloatingPointExceptions));
     writer.WriteElementString("FloatingPointModel", FloatingPointModel.ToString());
     writer.WriteElementString("ForceConformanceInForLoopScope", XmlConvert.ToString(ForceConformanceInForLoopScope));
     WriteStringArray(writer, "ForcedUsingFiles", ForcedUsingFiles);
     writer.WriteElementString("FunctionLevelLinking", XmlConvert.ToString(FunctionLevelLinking));
     writer.WriteElementString("GenerateXMLDocumentationFiles", XmlConvert.ToString(GenerateXMLDocumentationFiles));
     writer.WriteElementString("IgnoreStandardIncludePath", XmlConvert.ToString(IgnoreStandardIncludePath));
     if (InlineFunctionExpansion != InlineExpansion.Default)
     {
         writer.WriteElementString("InlineFunctionExpansion", InlineFunctionExpansion.ToString());
     }
     writer.WriteElementString("IntrinsicFunctions", XmlConvert.ToString(IntrinsicFunctions));
     writer.WriteElementString("MinimalRebuild", XmlConvert.ToString(MinimalRebuild));
     writer.WriteElementString("MultiProcessorCompilation", XmlConvert.ToString(MultiProcessorCompilation));
     writer.WriteElementString("OmitDefaultLibName", XmlConvert.ToString(OmitDefaultLibName));
     writer.WriteElementString("OmitFramePointers", XmlConvert.ToString(OmitFramePointers));
     writer.WriteElementString("OpenMPSupport", XmlConvert.ToString(OpenMPSupport));
     writer.WriteElementString("Optimization", Optimization.ToString());
     WriteStringArray(writer, "PreprocessorDefinitions", Defines);
     if (ProcessorNumber.HasValue)
     {
         writer.WriteElementString("ProcessorNumber", ProcessorNumber.Value.ToString(CultureInfo.InvariantCulture));
     }
     writer.WriteElementString("RuntimeLibrary", RuntimeLibrary.ToString());
     writer.WriteElementString("RuntimeTypeInfo", XmlConvert.ToString(RuntimeTypeInfo));
     writer.WriteElementString("SmallerTypeCheck", XmlConvert.ToString(SmallerTypeCheck));
     writer.WriteElementString("StringPooling", XmlConvert.ToString(StringPooling));
     if (StructMemberAlignment.HasValue)
     {
         writer.WriteElementString("StructMemberAlignment", StructMemberAlignment.Value.ToString(CultureInfo.InvariantCulture));
     }
     writer.WriteElementString("AllWarningsAsError", XmlConvert.ToString(AllWarningsAsError));
     WriteStringArray(writer, "SpecificWarningsAsError", SpecificWarningsAsError.Select(warn => warn.ToString(CultureInfo.InvariantCulture)).ToArray());
     writer.WriteElementString("TreatWCharTAsBuiltInType", XmlConvert.ToString(TreatWCharTAsBuiltInType));
     writer.WriteElementString("UndefineAllPreprocessorDefinitions", XmlConvert.ToString(UndefineAllPreprocessorDefinitions));
     WriteStringArray(writer, "UndefinePreprocessorDefinitions", UndefinePreprocessorDefinitions);
     writer.WriteElementString("WarningLevel", WarningLevelToString(WarningLevel));
     writer.WriteElementString("WholeProgramOptimization", XmlConvert.ToString(WholeProgramOptimization));
     writer.WriteElementString("ProgramDataBaseFileName", PDBFileName);
 }