示例#1
0
        public static string BuildOneStepBuildString(DProject prj, IEnumerable <string> builtObjects, ConfigurationSelector sel)
        {
            var cfg    = prj.GetConfiguration(sel) as DProjectConfiguration;
            var target = prj.GetOutputFileName(sel);

            var rawArgumentString = new StringBuilder();
            var s = GenAdditionalAttributes(prj.Compiler, cfg);

            if (!string.IsNullOrWhiteSpace(s))
            {
                rawArgumentString.Append(s.Trim()).Append(' ');
            }
            rawArgumentString.Append(BuildArguments(cfg).OneStepBuildArguments.Trim());
            if (!string.IsNullOrEmpty(cfg.ExtraCompilerArguments))
            {
                rawArgumentString.Append(' ').Append(cfg.ExtraCompilerArguments.Trim());
            }
            if (!string.IsNullOrEmpty(cfg.ExtraLinkerArguments))
            {
                rawArgumentString.Append(' ').Append(PrefixedExtraLinkerFlags(cfg));
            }

            var commonMacros = new PrjPathMacroProvider {
                slnPath = prj.ParentSolution != null?EnsureCorrectPathSeparators(prj.ParentSolution.BaseDirectory) : ""
            };

            var res = FillInMacros(rawArgumentString.ToString(),
                                   new OneStepBuildArgumentMacroProvider
            {
                ObjectsStringPattern  = prj.Compiler.ArgumentPatterns.ObjectFileLinkPattern,
                IncludesStringPattern = prj.Compiler.ArgumentPatterns.IncludePathPattern,

                SourceFiles = builtObjects,
                Includes    = FillInMacros(prj.IncludePaths, commonMacros),
                Libraries   = GetLibraries(cfg, prj.Compiler),

                RelativeTargetDirectory = cfg.OutputDirectory.ToRelative(prj.BaseDirectory),
                ObjectsDirectory        = ObjectDirectory(cfg),
                TargetFile = target,
            }, commonMacros);

            return(res);
        }
示例#2
0
        public static string BuildOneStepBuildString(DProject prj, IEnumerable<string> builtObjects, ConfigurationSelector sel)
        {
            var cfg = prj.GetConfiguration (sel) as DProjectConfiguration;
            var target = prj.GetOutputFileName (sel);

            var rawArgumentString = new StringBuilder();
            var s = GenAdditionalAttributes (prj.Compiler, cfg);
            if(!string.IsNullOrWhiteSpace(s) )
                rawArgumentString.Append(s.Trim()).Append(' ');
            rawArgumentString.Append(BuildArguments(cfg).OneStepBuildArguments.Trim());
            if(!string.IsNullOrEmpty(cfg.ExtraCompilerArguments))
                rawArgumentString.Append(' ').Append(cfg.ExtraCompilerArguments.Trim());
            if (!string.IsNullOrEmpty(cfg.ExtraLinkerArguments))
                rawArgumentString.Append(' ').Append(PrefixedExtraLinkerFlags(cfg));

            var commonMacros = new PrjPathMacroProvider {
                slnPath = prj.ParentSolution != null ? EnsureCorrectPathSeparators(prj.ParentSolution.BaseDirectory) : ""
            };

            var res = FillInMacros(rawArgumentString.ToString(),
                new OneStepBuildArgumentMacroProvider
                {
                    ObjectsStringPattern = prj.Compiler.ArgumentPatterns.ObjectFileLinkPattern,
                    IncludesStringPattern = prj.Compiler.ArgumentPatterns.IncludePathPattern,

                    SourceFiles = builtObjects,
                    Includes = FillInMacros(prj.IncludePaths,commonMacros),
                    Libraries = GetLibraries(cfg, prj.Compiler),

                    RelativeTargetDirectory = cfg.OutputDirectory.ToRelative(prj.BaseDirectory),
                    ObjectsDirectory = ObjectDirectory(cfg),
                    TargetFile = target,
                }, commonMacros);

            return res;
        }