Inheritance: GCCToolchain
コード例 #1
0
        public override async Task <IProject> Generate(ISolution solution, string name)
        {
            var shell   = IoC.Get <IShell>();
            var project = await base.Generate(solution, name);

            project.ToolChain = shell.ToolChains.FirstOrDefault(tc => tc is LocalGCCToolchain);

            var settings = LocalGCCToolchain.ProvisionLocalGccSettings(project);

            project.Debugger = shell.Debuggers.FirstOrDefault(db => db is LocalDebugAdaptor);

            var code = new StringBuilder();

            code.AppendLine("#include <stdio.h>");
            code.AppendLine();
            code.AppendLine("int main (void)");
            code.AppendLine("{");
            code.AppendLine("    printf(\"Hello World\");");
            code.AppendLine("    return 0;");
            code.AppendLine("}");
            code.AppendLine();

            await SourceFile.Create(project, "main.cpp", code.ToString());

            project.Save();

            return(project);
        }
コード例 #2
0
        public LinkerSettingsFormViewModel(IProject project) : base("Linker", project)
        {
            try
            {
                try
                {
                    settings = LocalGCCToolchain.GetSettings(project).LinkSettings;
                }
                catch (Exception e)
                {
                    Model.ToolchainSettings.LocalGCC = new LocalGccToolchainSettings();
                }
            }
            catch (Exception e)
            {
                Model.ToolchainSettings.LocalGCC = new LocalGccToolchainSettings();
                settings = Model.ToolchainSettings.LocalGCC.LinkSettings;
            }

            if (settings == null)
            {
                settings = new LinkSettings();
            }


            useMemoryLayout       = settings.UseMemoryLayout;
            discardUnusedSections = settings.DiscardUnusedSections;
            notUseStandardStartup = settings.NotUseStandardStartupFiles;
            linkedLibraries       = new ObservableCollection <string>(settings.LinkedLibraries);
            inRom1Start           = string.Format("0x{0:X8}", settings.InRom1Start);
            inRom1Size            = string.Format("0x{0:X8}", settings.InRom1Size);
            inRom2Start           = string.Format("0x{0:X8}", settings.InRom2Start);
            inRom2Size            = string.Format("0x{0:X8}", settings.InRom2Size);
            inRam1Start           = string.Format("0x{0:X8}", settings.InRam1Start);
            inRam1Size            = string.Format("0x{0:X8}", settings.InRam1Size);
            inRam2Start           = string.Format("0x{0:X8}", settings.InRam2Start);
            inRam2Size            = string.Format("0x{0:X8}", settings.InRam2Size);
            scatterFile           = settings.ScatterFile;
            miscOptions           = settings.MiscLinkerArguments;
            librarySelectedIndex  = (int)settings.Library;

            //AddLinkedLibraryCommand = new RoutingCommand(AddLinkedLibrary);
            //RemoveLinkedLibraryCommand = new RoutingCommand(RemoveLinkedLibrary);
            //BrowseScatterFileCommand = new RoutingCommand(BrowseScatterFile);
            //EditScatterFileCommand = new RoutingCommand(EditScatterFile);

            UpdateLinkerString();
        }
コード例 #3
0
        public CompileSettingsFormViewModel(IProject project) : base("Compiler", project)
        {
            try
            {
                settings = LocalGCCToolchain.GetSettings(project).CompileSettings;
            }
            catch (Exception e)
            {
                Model.ToolchainSettings.LocalGCC = new LocalGccToolchainSettings();
            }

            defines      = new ObservableCollection <string>(settings.Defines);
            includePaths = new ObservableCollection <string>(settings.Includes);

            //var config = project.SelectedConfiguration;
            //cppSupport = config.CppSupport;
            miscOptions = settings.CustomFlags;
            //includePaths = new ObservableCollection<string>(config.IncludePaths);


            optimizationLevelSelectedIndex      = (int)settings.Optimization;
            optimizationPreferenceSelectedIndex = (int)settings.OptimizationPreference;
            fpuSelectedIndex = (int)settings.Fpu;
            debugSymbols     = settings.DebugInformation;
            rtti             = settings.Rtti;
            exceptions       = settings.Exceptions;

            AddDefineCommand = ReactiveCommand.Create();
            // new RoutingCommand(AddDefine, (o) => DefineText != string.Empty && DefineText != null && !Defines.Contains(DefineText));
            AddDefineCommand.Subscribe(AddDefine);

            RemoveDefineCommand = ReactiveCommand.Create();
            // new RoutingCommand(RemoveDefine, (o) => SelectedDefine != string.Empty && SelectedDefine != null);
            RemoveDefineCommand.Subscribe(RemoveDefine);

            AddIncludePathCommand = ReactiveCommand.Create();
            AddIncludePathCommand.Subscribe(AddIncludePath);

            RemoveIncludePathCommand = ReactiveCommand.Create();
            RemoveIncludePathCommand.Subscribe(RemoveIncludePath);

            UpdateCompileString();
        }