Beispiel #1
0
 private CxxProject(string sourcePath, string targetPath, CxxTarget target,
                    ConfigurationPlatforms configurationPlatforms, ProjectType type)
     : base(configurationPlatforms, type)
 {
     targetPath_ = System.IO.Path.Combine(targetPath, target.Name + ".vcxproj");
     sourcePath_ = sourcePath;
     Target      = target;
 }
        public ConfigurationPlatformAnalysis GetConfigurationPlatform(string configuration, string platform)
        {
            var result = ConfigurationPlatforms.FirstOrDefault(x => x.Configuration.Equals(configuration) &&
                                                               x.Platform.Equals(platform));

            if (result != null)
            {
                return(result);
            }

            result = new ConfigurationPlatformAnalysis
            {
                Configuration = configuration,
                Platform      = platform
            };
            ConfigurationPlatforms.Add(result);
            return(result);
        }
Beispiel #3
0
        private void ValidateProjectConfiguration()
        {
            foreach (SolutionProject project in Projects.Values)
            {
                ISet <string> configurations = new HashSet <string>(), platforms = new HashSet <string>();

                // Ensure the solution has the configured pair
                foreach (ConfigurationPlatformPair configPlatform in project.ConfigurationPlatformMapping.Keys)
                {
                    configurations.Add(configPlatform.Configuration);
                    platforms.Add(configPlatform.Platform);

                    if (!ConfigurationPlatforms.Contains(configPlatform))
                    {
                        logger?.LogWarning(nameof(TemplatedSolutionExporter), $"Configuration mapping for project '{project.Name}' {configPlatform.Configuration}|{configPlatform.Platform} isn't part of the general solution config map. Adding it.");
                        ConfigurationPlatforms.Add(configPlatform);
                    }
                }

                // Now go through the pairs and ensure we add the appropriate default to the project
                string GetOption(ISet <string> set, string targetItem) => set.Contains(targetItem) ? targetItem : (set.FirstOrDefault() ?? targetItem);

                foreach (ConfigurationPlatformPair configPlatform in ConfigurationPlatforms)
                {
                    if (!project.ConfigurationPlatformMapping.ContainsKey(configPlatform))
                    {
                        ConfigurationPlatformPair projectConfigPlatform = new ConfigurationPlatformPair(GetOption(configurations, configPlatform.Configuration), GetOption(platforms, configPlatform.Platform));
                        project.ConfigurationPlatformMapping.Add(configPlatform, new ProjectConfigurationPlatformMapping()
                        {
                            ConfigurationPlatform = projectConfigPlatform,
                            EnabledForBuild       = false
                        });
                    }
                }
            }
        }
Beispiel #4
0
 public Project(ConfigurationPlatforms configurationPlatforms,
                ProjectType type)
 {
     configurationPlatforms_ = configurationPlatforms;
     Type = type;
 }
Beispiel #5
0
 public CxxProject(string sourcePath, string targetPath,
                   CxxLibraryTarget target, ConfigurationPlatforms configurationPlatforms)
     : this(sourcePath, targetPath, target as CxxTarget, configurationPlatforms, ProjectType.StaticLibrary)
 {
 }
Beispiel #6
0
 public CxxProject(string sourcePath, string targetPath,
                   CxxExecutableTarget target, ConfigurationPlatforms configurationPlatforms)
     : this(sourcePath, targetPath, target as CxxTarget, configurationPlatforms, ProjectType.Executable)
 {
 }