예제 #1
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();
            }
        }
예제 #2
0
        ProjectConfiguration NewProjectConfig()
        {
            //----------------
            string combine = _config + "|" + _platform;
            var    conf    = new ProjectConfiguration()
            {
                Configuration = _config,
                Platform      = _platform,
                Include       = combine,
                Config        = new ConfigurationPropertyGroup()
                {
                    ConfigurationType = _configType,
                    CharacterSet      = _charset,
                    PlatformToolset   = _platformToolSet,
                }
            };

            string additionalIncludeDirs = FullProjBuildPath + ";";

            if (AdditionalIncludeDirs.Count > 0)
            {
                for (int i = 0; i < AdditionalIncludeDirs.Count; ++i)
                {
                    additionalIncludeDirs += AdditionalIncludeDirs[i] + ";";
                }
            }


            ConfigurationPropertyGroup configGroup     = conf.Config;
            ConditionConfig            conditionConfig = new ConditionConfig();

            configGroup.ConditionConfig = conditionConfig;

            configGroup.Condition = conditionConfig.Condition = "'$(Configuration)|$(Platform)'=='" + combine + "'";

            conditionConfig.OutDir     = _outdir;
            conditionConfig.IntDir     = ProjectName + ".dir\\" + _config + "\\";
            conditionConfig.TargetName = ProjectName;
            conditionConfig.TargetExt  = _extension;

            conditionConfig.LinkIncremental  = _linkIncremental;
            conditionConfig.GenerateManifest = "true";

            //----
            ClCompile clCompile = new ClCompile();

            clCompile.AdditionalIncludeDirectories = additionalIncludeDirs + "%(AdditionalIncludeDirectories)";
            clCompile.AssemblerListingLocation     = _initDir;
            clCompile.CompileAs          = "CompileAsCpp";
            clCompile.ExceptionHandling  = "Sync";
            clCompile.FloatingPointModel = "Fast";

            //debug



            if (_proj_config == ProjectConfigKind.Debug)
            {
                clCompile.DebugInformationFormat  = "ProgramDatabase";
                clCompile.BasicRuntimeChecks      = "EnableFastChecks";
                clCompile.InlineFunctionExpansion = "Disabled";
                clCompile.Optimization            = "Disabled";
                clCompile.RuntimeLibrary          = "MultiThreadedDebugDLL";
                clCompile.PreprocessorDefinitions = "WIN32;_WINDOWS;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)";
            }
            else
            {
                clCompile.DebugInformationFormat  = "";
                clCompile.InlineFunctionExpansion = "AnySuitable";
                clCompile.Optimization            = "MaxSpeed";
                clCompile.RuntimeLibrary          = "MultiThreadedDLL";
                clCompile.PreprocessorDefinitions = "WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)";
            }


            clCompile.ObjectFileName     = _initDir;
            clCompile.WarningLevel       = "Level3";
            clCompile.UseFullPaths       = "false";
            clCompile.RuntimeTypeInfo    = "true";
            clCompile.PrecompiledHeader  = "NotUsing";
            clCompile.IntrinsicFunctions = "true";


            //----------------------------------------------------
            ResourceCompile resCompile = new ResourceCompile();

            if (_proj_config == ProjectConfigKind.Debug)
            {
                resCompile.PreprocessorDefinitions = "WIN32;_DEBUG;_WINDOWS;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)";
            }
            else
            {
                resCompile.PreprocessorDefinitions = "WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)";
            }
            resCompile.AdditionalIncludeDirectories = additionalIncludeDirs + "%(AdditionalIncludeDirectories)";
            //----------------------------------------------------

            Midl midl = new Midl();

            midl.AdditionalIncludeDirectories = additionalIncludeDirs + "%(AdditionalIncludeDirectories)";
            midl.OutputDirectory             = "$(ProjectDir)/$(IntDir)";
            midl.HeaderFileName              = "%(Filename).h";
            midl.TypeLibraryName             = "%(Filename).tlb";
            midl.InterfaceIdentifierFileName = "%(Filename)_i.c";
            midl.ProxyFileName = "%(Filename)_p.c";



            //----------------------------------------------------
            string link_additional_opts = "/machine:x64";
            Link   link = new Link();

            link.AdditionalDependencies       = "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib";
            link.AdditionalLibraryDirectories = "%(AdditionalLibraryDirectories)";
            link.AdditionalOptions            = "%(AdditionalOptions) " + link_additional_opts; //***
            link.SubSystem = "Console";

            link.ProgramDataBaseFile = _outdir + "/" + ProjectName + ".pdb";
            link.ImportLibrary       = _outdir + "/" + ProjectName + ".lib";

            if (_proj_config == ProjectConfigKind.Debug)
            {
                link.GenerateDebugInformation = "true";
            }
            else
            {
                link.GenerateDebugInformation = "false";
            }

            link.IgnoreSpecificDefaultLibraries = "%(IgnoreSpecificDefaultLibraries)";

            //-----------
            ProjectReference projRef = new ProjectReference();

            projRef.LinkLibraryDependencies = "false";

            //-------------
            ItemDefinitionGroup itemDefs = new ItemDefinitionGroup();

            itemDefs.ClCompile        = clCompile;
            itemDefs.ResourceCompile  = resCompile;
            itemDefs.Midl             = midl;
            itemDefs.Link             = link;
            itemDefs.ProjectReference = projRef;

            conf.ItemDefinitionGroup = itemDefs;
            return(conf);
        }