Пример #1
0
        public void ConfigureAll(
            Project.Configuration configuration,
            Target target)
        {
            string mySourceRootPath = Util.NormalizePath(this.SourceRootPath, target.Platform);

            // Set configuration name with the default composition logic.
            configuration.Name = Util.ComposeConfigurationName(target);

            // Compose default project path.
            configuration.ProjectPath = string.Format(
                Util.NormalizePath("./projects/{0}/{1}", target.Platform),
                this.Name,
                Util.ComposeProjectPath(target));

            // The output and intermediate paths is always the same by default.
            configuration.IntermediatePath = Util.NormalizePath(@"[conf.ProjectPath]\obj\$(PlatformTarget)\$(Configuration)", target.Platform);
            configuration.TargetPath       = this.ComposeTargetPath(configuration, target);

            // Always add the project's source and header folders.
            configuration.IncludePrivatePaths.Add(Util.NormalizePath(@"[project.SourceRootPath]\src", target.Platform));
            configuration.IncludePaths.Add(Util.NormalizePath(@"[project.SourceRootPath]\include", target.Platform));

            // The pre-compiled header.
            if (this.UseDefaultPrecompiledHeader == true)
            {
                // Add the pre-compiled header with the default names.
                configuration.PrecompHeader = this.Name + "_PCH.h";
                configuration.PrecompSource = this.Name + "_PCH.cpp";
            }

            // Post build script.
            if (this.UseDefaultPostBuildScript == true)
            {
                string postBuildScriptPath = Util.NormalizePath($"../../../../{mySourceRootPath}/misc/PostBuild.", target.Platform);
                if (Util.IsMswinPlatform(target.Platform) == true)
                {
                    postBuildScriptPath += "bat";
                }
                else
                {
                    postBuildScriptPath += "sh";
                }

                string projectToSrcRootPath = Util.NormalizePath($"../../../../{mySourceRootPath}", target.Platform);
                string postBuildArgs        = $"\"{configuration.TargetPath}\" \"{projectToSrcRootPath}\"";

                configuration.EventPostBuild.Add($"{postBuildScriptPath} {postBuildArgs} {this.DefaultPostBuildScriptArgs}");
            }

            // Set the project output type according to the target's output type.
            if (this.IsApplication == true)
            {
                configuration.Output = Configuration.OutputType.Exe;
            }
            else
            {
                if (target.OutputType == OutputType.Dll)
                {
                    configuration.Output = Configuration.OutputType.Dll;
                }
                else
                {
                    configuration.Output = Configuration.OutputType.Lib;
                }
            }

            // Set default character set to Unicode.
            configuration.Options.Add(Options.Vc.General.CharacterSet.Unicode);

            // Do custom configurations.
            this.CustomConfigure(configuration, target);
        }