예제 #1
0
        private Application(string[] args)
        {
            //
            // Setup GC
            //

            GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.Default;
            GCSettings.LatencyMode = GCLatencyMode.SustainedLowLatency;


            //
            // Setup console tracing.
            //

            Trace.Listeners.Add(new ConsoleTraceListener());
            Application.EmitLogo();

            Trace.WriteLine($@"Graphyte Build version {Application.Current}");
            Trace.WriteLine($@"{RuntimeInformation.OSDescription} ({RuntimeInformation.FrameworkDescription})");
            Trace.WriteLine($@"Working directory: {Environment.CurrentDirectory}");

            //
            // Parse options.
            //

            this.m_Options = CommandLineParser.Parse <Options>(args);
            this.m_Options.Dump();


            //
            // Map to enums.
            //

            this.m_PlatformType  = PlatformType.Create(this.m_Options.Platform);
            this.m_ToolchainType = ToolchainType.Create(this.m_Options.Toolchain);
            this.m_GeneratorType = GeneratorType.Create(this.m_Options.Generator);

            this.m_ConfigurationTypes = Enum.GetValues(typeof(ConfigurationType))
                                        .Cast <ConfigurationType>()
                                        .ToArray();


            //
            // Parse profile.
            //

            var bytes = File.ReadAllBytes(this.m_Options.Profile.FullName);

            this.m_Profile = Profile.Parse(bytes);


            //
            // Resolve specific platform and toolchain.
            //

            this.m_Generator = this.m_GeneratorsProvider.Generators
                               .First(x => x.GeneratorType == this.m_GeneratorType)
                               .Create(this.m_Profile);


            //
            // Factories have unique architecture types.
            //

            this.m_PlatformFactories = this.m_PlatformsProvider.Platforms.Where(
                x => x.PlatformType == this.m_PlatformType && x.ToolchainType == this.m_ToolchainType)
                                       .ToArray();

            this.m_Architectures = this.m_PlatformFactories.Select(x => x.ArchitectureType).ToArray();

            Trace.Assert(this.m_Architectures.Distinct().Count() == this.m_Architectures.Length);

            this.m_Solutions = this.m_SolutionsProvider.Create();
        }