Esempio n. 1
0
 static void GenImport(XmlOutputGen output, Import import)
 {
     output.BeginElem("Import");
     output.AddAttribute(nameof(import.Project), import.Project);
     if (import.Label != null)
     {
         output.AddAttribute(nameof(import.Label), import.Label);
     }
     if (!string.IsNullOrEmpty(import.Condition))
     {
         output.AddAttribute(nameof(import.Condition), import.Condition);
     }
     output.EndElem();
 }
Esempio n. 2
0
        static void GenPropertyConfigs2(XmlOutputGen output, List <ProjectConfiguration> projConfigs)
        {
            foreach (ProjectConfiguration projConfig in projConfigs)
            {
                ConfigurationPropertyGroup config = projConfig.Config;

                output.BeginElem(PROPERTY_GROUP);
                output.AddAttribute(nameof(config.Condition), config.Condition);
                output.AddAttribute("Label", "Configuration");
                output.AppendSimpleElem(nameof(config.ConfigurationType), config.ConfigurationType);
                output.AppendSimpleElem(nameof(config.CharacterSet), config.CharacterSet);
                output.AppendSimpleElem(nameof(config.PlatformToolset), config.PlatformToolset);
                output.EndElem();
            }
        }
Esempio n. 3
0
 static void GenPropertySheet(XmlOutputGen output, PropertySheets propertySheet)
 {
     output.BeginElem(IMPORT_GROUP);
     output.AddAttribute("Label", nameof(PropertySheets));
     GenImport(output, propertySheet.Import);
     output.EndElem();
 }
Esempio n. 4
0
        static void GenOutputConfigs(XmlOutputGen output, string projFileVersion, List <ProjectConfiguration> projConfigs)
        {
            void GenOutputElem(string elemName, string condition, string textValue)
            {
                //NESTED method
                output.BeginElem(elemName);
                output.AddAttribute("Condition", condition);
                output.AppendTextNode(textValue);
                output.EndElem();
            }

            //7.
            output.BeginElem(PROPERTY_GROUP);
            output.AppendSimpleElem("_ProjectFileVersion", projFileVersion);
            foreach (ProjectConfiguration conf in projConfigs)
            {
                ConditionConfig condConf = conf.Config.ConditionConfig;

                GenOutputElem(nameof(condConf.OutDir), condConf.Condition, condConf.OutDir);
                GenOutputElem(nameof(condConf.IntDir), condConf.Condition, condConf.IntDir);
                GenOutputElem(nameof(condConf.TargetName), condConf.Condition, condConf.TargetName);
                GenOutputElem(nameof(condConf.TargetExt), condConf.Condition, condConf.TargetExt);
                GenOutputElem(nameof(condConf.LinkIncremental), condConf.Condition, condConf.LinkIncremental);
                GenOutputElem(nameof(condConf.GenerateManifest), condConf.Condition, condConf.GenerateManifest);
            }

            output.EndElem();//property group
        }
Esempio n. 5
0
        static void GenPropertyConfigs(XmlOutputGen output, List <ProjectConfiguration> projConfigs)
        {
            output.BeginElem(ITEM_GROUP);

            output.AddAttribute(LABEL, "ProjectConfigurations");

            foreach (ProjectConfiguration projConfig in projConfigs)
            {
                output.BeginElem(nameof(ProjectConfiguration));

                output.AddAttribute(nameof(projConfig.Include), projConfig.Include);
                output.AppendSimpleElem(nameof(projConfig.Configuration), projConfig.Configuration);
                output.AppendSimpleElem(nameof(projConfig.Platform), projConfig.Platform);

                output.EndElem();
            }
            output.EndElem();
        }
Esempio n. 6
0
        static void GenGlobalsProp(XmlOutputGen output, GlobalsPropertyGroup globalsProp)
        {
            output.BeginElem(PROPERTY_GROUP);
            output.AddAttribute(LABEL, "Globals");
            output.AppendSimpleElem(nameof(globalsProp.ProjectGuid), "{6481C558-B7F1-3FA1-BA6E-AD764749B15C}");
            output.AppendSimpleElem(nameof(globalsProp.WindowsTargetPlatformVersion), globalsProp.WindowsTargetPlatformVersion);
            output.AppendSimpleElem(nameof(globalsProp.Keyword), globalsProp.Keyword);
            output.AppendSimpleElem(nameof(globalsProp.Platform), globalsProp.Platform);
            output.AppendSimpleElem(nameof(globalsProp.ProjectName), globalsProp.ProjectName);
            output.AppendSimpleElem(nameof(globalsProp.VCProjectUpgraderObjectName), globalsProp.VCProjectUpgraderObjectName);

            output.EndElem();
        }
Esempio n. 7
0
        static void GenerateItemGroupDef(XmlOutputGen output, List <ProjectConfiguration> projConfigs)
        {
            foreach (ProjectConfiguration conf in projConfigs)
            {
                ItemDefinitionGroup itemDefGroup = conf.ItemDefinitionGroup;

                output.BeginElem(nameof(ItemDefinitionGroup));
                {
                    output.AddAttribute("Condition", conf.Config.Condition);
                    ClCompile clcompile = itemDefGroup.ClCompile;
                    output.BeginElem(nameof(ClCompile));
                    {
                        output.AppendSimpleElem(nameof(clcompile.AdditionalIncludeDirectories), clcompile.AdditionalIncludeDirectories);
                        output.AppendSimpleElem(nameof(clcompile.AssemblerListingLocation), clcompile.AssemblerListingLocation);
                        output.AppendSimpleElem(nameof(clcompile.BasicRuntimeChecks), clcompile.BasicRuntimeChecks);
                        output.AppendSimpleElem(nameof(clcompile.CompileAs), clcompile.CompileAs);
                        output.AppendSimpleElem(nameof(clcompile.DebugInformationFormat), clcompile.DebugInformationFormat);
                        output.AppendSimpleElem(nameof(clcompile.ExceptionHandling), clcompile.ExceptionHandling);
                        output.AppendSimpleElem(nameof(clcompile.FloatingPointModel), clcompile.FloatingPointModel);
                        output.AppendSimpleElem(nameof(clcompile.InlineFunctionExpansion), clcompile.InlineFunctionExpansion);
                        output.AppendSimpleElem(nameof(clcompile.IntrinsicFunctions), clcompile.IntrinsicFunctions);
                        output.AppendSimpleElem(nameof(clcompile.Optimization), clcompile.Optimization);
                        output.AppendSimpleElem(nameof(clcompile.PrecompiledHeader), clcompile.PrecompiledHeader);
                        output.AppendSimpleElem(nameof(clcompile.RuntimeLibrary), clcompile.RuntimeLibrary);
                        output.AppendSimpleElem(nameof(clcompile.RuntimeTypeInfo), clcompile.RuntimeTypeInfo);
                        output.AppendSimpleElem(nameof(clcompile.UseFullPaths), clcompile.UseFullPaths);
                        output.AppendSimpleElem(nameof(clcompile.WarningLevel), clcompile.WarningLevel);
                        output.AppendSimpleElem(nameof(clcompile.PreprocessorDefinitions), clcompile.PreprocessorDefinitions);
                        output.AppendSimpleElem(nameof(clcompile.ObjectFileName), clcompile.ObjectFileName);
                    }
                    output.EndElem();
                    //-----
                    ResourceCompile resCompile = itemDefGroup.ResourceCompile;
                    output.BeginElem(nameof(ResourceCompile));
                    {
                        output.AppendSimpleElem(nameof(resCompile.PreprocessorDefinitions), resCompile.PreprocessorDefinitions);
                        output.AppendSimpleElem(nameof(resCompile.AdditionalIncludeDirectories), resCompile.AdditionalIncludeDirectories);
                    }
                    output.EndElem();

                    //-----
                    Midl midl = itemDefGroup.Midl;
                    output.BeginElem(nameof(Midl));
                    {
                        output.AppendSimpleElem(nameof(midl.AdditionalIncludeDirectories), midl.AdditionalIncludeDirectories);
                        output.AppendSimpleElem(nameof(midl.OutputDirectory), midl.OutputDirectory);
                        output.AppendSimpleElem(nameof(midl.HeaderFileName), midl.HeaderFileName);
                        output.AppendSimpleElem(nameof(midl.TypeLibraryName), midl.TypeLibraryName);
                        output.AppendSimpleElem(nameof(midl.InterfaceIdentifierFileName), midl.InterfaceIdentifierFileName);
                        output.AppendSimpleElem(nameof(midl.ProxyFileName), midl.ProxyFileName);
                    }
                    output.EndElem();
                    //-----

                    Link link = itemDefGroup.Link;
                    output.BeginElem(nameof(Link));
                    {
                        output.AppendSimpleElem(nameof(link.AdditionalDependencies), link.AdditionalDependencies);
                        output.AppendSimpleElem(nameof(link.AdditionalLibraryDirectories), link.AdditionalLibraryDirectories);
                        output.AppendSimpleElem(nameof(link.AdditionalOptions), link.AdditionalOptions);
                        output.AppendSimpleElem(nameof(link.GenerateDebugInformation), link.GenerateDebugInformation);
                        output.AppendSimpleElem(nameof(link.IgnoreSpecificDefaultLibraries), link.IgnoreSpecificDefaultLibraries);
                        output.AppendSimpleElem(nameof(link.ImportLibrary), link.ImportLibrary);
                        output.AppendSimpleElem(nameof(link.ProgramDataBaseFile), link.ProgramDataBaseFile);
                        output.AppendSimpleElem(nameof(link.SubSystem), link.SubSystem);
                    }
                    output.EndElem();
                    //-----
                    output.BeginElem(nameof(ProjectReference));
                    {
                        ProjectReference projRef = itemDefGroup.ProjectReference;
                        output.AppendSimpleElem(nameof(projRef.LinkLibraryDependencies), projRef.LinkLibraryDependencies);
                    }
                    output.EndElem();
                }
                output.EndElem();
            }
        }
Esempio n. 8
0
        public static void GenerateOutput(this VcxProject proj, XmlOutputGen output)
        {
            output.AddXmlHeader();
            output.BeginElem("Project");
            {
                //----
                output.AddAttribute(nameof(proj.DefaultTargets), proj.DefaultTargets);
                output.AddAttribute(nameof(proj.ToolVersion), proj.ToolVersion);
                output.AddAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");
                //----
                output.BeginElem(PROPERTY_GROUP);
                output.AppendSimpleElem(nameof(proj.PreferredToolArchitecture), proj.PreferredToolArchitecture);
                output.EndElem();
            }
            //----
            //1.
            GenPropertyConfigs(output, proj.Configurations);
            //2. global prop
            GenGlobalsProp(output, proj.GlobalsPropertyGroup);
            //3.
            GenImport(output, proj.CppDefaultProp);
            //4. gen property groups's condition config
            GenPropertyConfigs2(output, proj.Configurations);
            //5. import
            GenImport(output, proj.CppProp);
            //6.
            GenPropertySheet(output, proj.PropertySheets);
            //7.
            GenOutputConfigs(output, proj.ProjectFileVersion, proj.Configurations);
            //8.
            GenerateItemGroupDef(output, proj.Configurations);

            //9.
            output.BeginElem(ITEM_GROUP);
            {
                foreach (InputItem inputItem in proj.InputItems)
                {
                    string elem_name = "";
                    switch (inputItem.InputKind)
                    {
                    default: throw new NotSupportedException();

                    case InputKind.ClCompile:
                        elem_name = nameof(InputKind.ClCompile);
                        break;

                    case InputKind.ClInclude:
                        elem_name = nameof(InputKind.ClInclude);
                        break;

                    case InputKind.Object:
                        elem_name = nameof(InputKind.Object);
                        break;
                    }
                    output.BeginElem(elem_name);
                    output.AddAttribute(nameof(inputItem.Include), inputItem.Include);
                    output.EndElem();
                }
            }
            output.EndElem();//item group
            //-----
            //10.
            GenImport(output, new Import {
                Project = @"$(VCTargetsPath)\Microsoft.Cpp.targets"
            });
            output.BeginElem(IMPORT_GROUP);
            output.AddAttribute("Label", "ExtensionTargets");
            output.EndElem();
            //
            //<ImportGroup Label="ExtensionTargets">

            output.EndElem(); //Project
        }