Exemplo n.º 1
0
        void AddReference(VisualCppProject vcproj, Project reference, HashSet <Project> references)
        {
            if (!references.Contains(reference))
            {
                references.Add(reference);

                foreach (Project @ref in reference.References)
                {
                    AddReference(vcproj, @ref, references);
                }

                if (reference.AssemblyType == OutputAssemblyType.Static)
                {
                    foreach (FileDescriptor external in reference.Externals)
                    {
                        vcproj.Dependencies.Add(external);
                    }
                }

                VisualCppProject tmp; if (builtStateComplete.TryGetValue(reference, out tmp))
                {
                    vcproj.ProjectReferences.Add(tmp);
                }
            }
        }
Exemplo n.º 2
0
        public override void Execute()
        {
            LoadInput();

            Project          project = inputPins[0].Data as Project;
            VisualCppProject vcproj; if (CppCompiler.CompilerServices.Targets.Length == 1)

            {
                vcproj = new VisualCppProject(version, project.Files.Nodes.Select(x => x.File), project.Location, project.Name);
            }

            else
            {
                vcproj = new VisualCppProject(version, project.Files.Nodes.Select(x => x.File), project.Location, string.Format(ProjectNamingPattern, project.Name, project.Target.TechnicalName));
            }
            vcproj.AssemblyName = project.AssemblyName;

            vcproj.IsModule = project.IsModule;
            using (new Scope(builtStateCompleteLock))
                builtStateComplete.Add(project, vcproj);

            foreach (BuildMode configuration in CppAnalyzer.Analyzer.GetProjectConfigurations())
            {
                vcproj.BuildTargets.Add(new BuildTarget(project.Target.Platform, project.Target.Architecture, configuration));
            }
            vcproj.OutputType = project.AssemblyType;
            vcproj.OutputPath = Application.GetDeploymentPath(project.Location);

            HashSet <Project> references = new HashSet <Project>();

            foreach (Project reference in project.References)
            {
                AddReference(vcproj, reference, references);
            }

            foreach (FileDescriptor assembly in project.Externals)
            {
                if (!vcproj.Dependencies.Contains(assembly))
                {
                    vcproj.Dependencies.Add(assembly);
                }
            }

            Application.Log(SeverityFlags.Minimal, "Creating {0} project {1}", version.Flag.ToString(), vcproj.FullName);

            vcproj.CreateFile();
            outputPins[0].Data = vcproj;
        }