/// <summary>
        /// Creates compiler flags for the configuration passed in.
        /// </summary>
        private void createConfigurationFlagsVariable(ProjectConfigurationInfo_CSharp configurationInfo)
        {
            string variableName = getFlagsVariableName(configurationInfo);
            string flags        = "";

            // Target
            if (m_projectInfo.ProjectType == ProjectInfo.ProjectTypeEnum.CSHARP_EXECUTABLE)
            {
                flags += " /target:exe";
            }
            else if (m_projectInfo.ProjectType == ProjectInfo.ProjectTypeEnum.CSHARP_LIBRARY)
            {
                flags += " /target:library";
            }
            else if (m_projectInfo.ProjectType == ProjectInfo.ProjectTypeEnum.CSHARP_WINFORMS_EXECUTABLE)
            {
                flags += " /target:winexe";
            }

            // Platform
            flags += " /platform:" + configurationInfo.Platform;

            // Optimize...
            if (configurationInfo.Optimize == true)
            {
                flags += " /optimize+ ";
            }
            else
            {
                flags += " /optimize- ";
            }

            // Treat warnings as errors...
            if (configurationInfo.ThreatWarningsAsErrors == true)
            {
                flags += " /warnaserror+ ";
            }

            // Defined constants...
            foreach (string definedConstant in configurationInfo.getDefinedConstants())
            {
                flags += (" /define:" + definedConstant + " ");
            }

            // Debug build...
            if (configurationInfo.Debug == true)
            {
                flags += " /debug+ ";
            }

            // Type of debug info...
            if (configurationInfo.DebugInfo != "")
            {
                flags += (" /debug:" + configurationInfo.DebugInfo + " ");
            }

            // Warnings to ignore...
            List <string> warningsToIgnore = configurationInfo.getWarningsToIgnore();

            if (warningsToIgnore.Count > 0)
            {
                flags += " /nowarn:";
                foreach (string warningToIgnore in warningsToIgnore)
                {
                    flags += (warningToIgnore + ",");
                }
                flags = flags.TrimEnd(',') + " ";
            }

            // File alignment...
            flags += (" /filealign:" + configurationInfo.FileAlignment + " ");

            // Warning level...
            flags += (" /warn:" + configurationInfo.WarningLevel + " ");

            m_file.WriteLine("." + variableName + " = '" + flags + "'");
            m_file.WriteLine("");
        }
Пример #2
0
        /// <summary>
        /// Creates compiler flags for the configuration passed in.
        /// </summary>
        private void createConfigurationFlagsVariable(ProjectConfigurationInfo_CSharp configurationInfo)
        {
            string variableName = getFlagsVariableName(configurationInfo);
            string flags        = "";

            // Optimize...
            if (configurationInfo.Optimize == true)
            {
                flags += "-optimize+ ";
            }
            else
            {
                flags += "-optimize- ";
            }

            // Treat warnings as errors...
            if (configurationInfo.ThreatWarningsAsErrors == true)
            {
                flags += "-warnaserror+ ";
            }

            // Defined constants...
            foreach (string definedConstant in configurationInfo.getDefinedConstants())
            {
                flags += ("-define:" + definedConstant + " ");
            }

            // Debug build...
            if (configurationInfo.Debug == true)
            {
                flags += "-debug+ ";
            }

            // Type of debug info...
            if (configurationInfo.DebugInfo != "")
            {
                flags += ("-debug:" + configurationInfo.DebugInfo + " ");
            }

            // Warnings to ignore...
            List <string> warningsToIgnore = configurationInfo.getWarningsToIgnore();

            if (warningsToIgnore.Count > 0)
            {
                flags += "-nowarn:";
                foreach (string warningToIgnore in warningsToIgnore)
                {
                    flags += (warningToIgnore + ",");
                }
                flags = flags.TrimEnd(',') + " ";
            }

            // File alignment...
            flags += ("-filealign:" + configurationInfo.FileAlignment + " ");

            // Warning level...
            flags += ("-warn:" + configurationInfo.WarningLevel + " ");

            // We add the mono .net packages (if we are not in a cygwin build)...
            if (MakeItSoConfig.Instance.IsCygwinBuild == false)
            {
                flags += "-pkg:dotnet ";
            }

            // We add the flags to the makefile...
            m_file.WriteLine(variableName + " = " + flags);
        }