Пример #1
0
        public void Load(DCompilerConfiguration compiler)
        {
            configuration = compiler;

            if (compiler == null)
            {
                txtBinPath.Text                         =
                    txtCompiler.Text                    =
                        txtConsoleAppLinker.Text        =
                            txtSharedLibLinker.Text     =
                                txtStaticLibLinker.Text = null;

                text_DefaultLibraries.Buffer.Clear();
                text_Includes.Buffer.Clear();

                releaseArgumentsDialog.Load(null, false);
                debugArgumentsDialog.Load(null, true);

                btnMakeDefault.Sensitive = false;
                return;
            }
            //for now, using Executable target compiler command for all targets source compiling
            LinkTargetConfiguration targetConfig;

            targetConfig = compiler.GetOrCreateTargetConfiguration(DCompileTarget.Executable);

            txtBinPath.Text  = compiler.BinPath;
            txtCompiler.Text = compiler.SourceCompilerCommand;
            check_enableLibPrefixing.Active = compiler.EnableGDCLibPrefixing;

            //linker targets
            targetConfig             = compiler.GetOrCreateTargetConfiguration(DCompileTarget.Executable);
            txtConsoleAppLinker.Text = targetConfig.Linker;

            targetConfig            = compiler.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            txtSharedLibLinker.Text = targetConfig.Linker;

            targetConfig            = compiler.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            txtStaticLibLinker.Text = targetConfig.Linker;

            releaseArgumentsDialog.Load(compiler, false);
            debugArgumentsDialog.Load(compiler, true);

            text_DefaultLibraries.Buffer.Text = string.Join(Environment.NewLine, compiler.DefaultLibraries);
            text_Includes.Buffer.Text         = string.Join(Environment.NewLine, compiler.IncludePaths);

            btnMakeDefault.Active =
                configuration.Vendor == defaultCompilerVendor;
            btnMakeDefault.Sensitive = true;

            using (var buf = new StringWriter())
                using (var xml = new System.Xml.XmlTextWriter(buf)) {
                    xml.Formatting = System.Xml.Formatting.Indented;
                    xml.WriteStartDocument();
                    xml.WriteStartElement("patterns");
                    compiler.ArgumentPatterns.SaveTo(xml);
                    xml.WriteEndDocument();
                    tb_ArgPatterns.Buffer.Text = buf.ToString();
                }
        }
Пример #2
0
        public void Load(DCompilerConfiguration config, bool isDebug)
        {
            Configuration = config;
            IsDebug       = isDebug;

            if (config == null)
            {
                Load(null);
                return;
            }

            //compiler targets
            argsStore [DCompileTarget.ConsolelessExecutable] = config
                                                               .GetOrCreateTargetConfiguration(DCompileTarget.ConsolelessExecutable)
                                                               .GetArguments(isDebug)
                                                               .Clone();

            argsStore [DCompileTarget.Executable] = config
                                                    .GetOrCreateTargetConfiguration(DCompileTarget.Executable)
                                                    .GetArguments(isDebug)
                                                    .Clone();

            argsStore [DCompileTarget.SharedLibrary] = config
                                                       .GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary)
                                                       .GetArguments(isDebug)
                                                       .Clone();

            argsStore [DCompileTarget.StaticLibrary] = config
                                                       .GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary)
                                                       .GetArguments(isDebug)
                                                       .Clone();

            SelectedCompileTarget = DCompileTarget.ConsolelessExecutable;
        }
Пример #3
0
        public bool ApplyToVirtConfiguration()
        {
            if (configuration == null)
            {
                return(false);
            }

            configuration.BinPath = txtBinPath.Text;

            //for now, using Executable target compiler command for all targets source compiling
            LinkTargetConfiguration targetConfig;

            targetConfig          = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);
            targetConfig.Compiler = txtCompiler.Text;

            //linker targets
            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);
            targetConfig.Linker = txtConsoleAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.ConsolelessExecutable);
            targetConfig.Linker = txtGUIAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            targetConfig.Linker = txtSharedLibLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            targetConfig.Linker = txtStaticLibLinker.Text;

            releaseArgumentsDialog.Store();
            debugArgumentsDialog.Store();

            configuration.DefaultLibraries.Clear();
            configuration.DefaultLibraries.AddRange(text_DefaultLibraries.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries));

            #region Store new include paths
            var paths = text_Includes.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

            // Remove trailing / and \
            for (int i = 0; i < paths.Length; i++)
            {
                paths[i] = paths[i].TrimEnd('\\', '/');
            }

            if (configuration.ParseCache.UpdateRequired(paths))
            {
                configuration.ParseCache.ParsedDirectories.Clear();
                configuration.ParseCache.ParsedDirectories.AddRange(paths);

                try {
                    // Update parse cache immediately
                    DCompilerConfiguration.UpdateParseCacheAsync(configuration.ParseCache);
                } catch (Exception ex) {
                    LoggingService.LogError("Include path analysis error", ex);
                }
            }
            #endregion

            return(true);
        }
Пример #4
0
        public void Load(DCompilerConfiguration config)
        {
            configuration = config;

            if (config == null)
            {
                txtBinPath.Text                             =
                    txtCompiler.Text                        =
                        txtConsoleAppLinker.Text            =
                            txtGUIAppLinker.Text            =
                                txtSharedLibLinker.Text     =
                                    txtStaticLibLinker.Text = null;

                text_DefaultLibraries.Buffer.Clear();
                text_Includes.Buffer.Clear();

                releaseArgumentsDialog.Load(null, false);
                debugArgumentsDialog.Load(null, true);

                btnMakeDefault.Sensitive = false;
                return;
            }
            //for now, using Executable target compiler command for all targets source compiling
            LinkTargetConfiguration targetConfig;

            targetConfig = config.GetOrCreateTargetConfiguration(DCompileTarget.Executable);

            txtBinPath.Text = config.BinPath;

            txtCompiler.Text = targetConfig.Compiler;

            //linker targets
            targetConfig             = config.GetOrCreateTargetConfiguration(DCompileTarget.Executable);
            txtConsoleAppLinker.Text = targetConfig.Linker;

            targetConfig         = config.GetOrCreateTargetConfiguration(DCompileTarget.ConsolelessExecutable);
            txtGUIAppLinker.Text = targetConfig.Linker;

            targetConfig            = config.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            txtSharedLibLinker.Text = targetConfig.Linker;

            targetConfig            = config.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            txtStaticLibLinker.Text = targetConfig.Linker;

            releaseArgumentsDialog.Load(config, false);
            debugArgumentsDialog.Load(config, true);

            text_DefaultLibraries.Buffer.Text = string.Join("\n", config.DefaultLibraries);
            text_Includes.Buffer.Text         = string.Join("\n", config.ParseCache.ParsedDirectories);

            btnMakeDefault.Active =
                configuration.Vendor == defaultCompilerVendor;
            btnMakeDefault.Sensitive = true;
        }
Пример #5
0
        public void Load(DCompilerConfiguration compiler)
        {
            configuration = compiler;

            if (compiler == null)
            {
                txtBinPath.Text                         =
                    txtCompiler.Text                    =
                        txtConsoleAppLinker.Text        =
                            txtSharedLibLinker.Text     =
                                txtStaticLibLinker.Text = null;

                text_DefaultLibraries.Buffer.Clear();
                text_Includes.Buffer.Clear();

                releaseArgumentsDialog.Load(null, false);
                debugArgumentsDialog.Load(null, true);

                btnMakeDefault.Sensitive = false;
                return;
            }
            //for now, using Executable target compiler command for all targets source compiling
            LinkTargetConfiguration targetConfig;

            targetConfig = compiler.GetOrCreateTargetConfiguration(DCompileTarget.Executable);

            txtBinPath.Text  = compiler.BinPath;
            txtCompiler.Text = compiler.SourceCompilerCommand;
            check_enableLibPrefixing.Active = compiler.EnableGDCLibPrefixing;

            //linker targets
            targetConfig             = compiler.GetOrCreateTargetConfiguration(DCompileTarget.Executable);
            txtConsoleAppLinker.Text = targetConfig.Linker;

            targetConfig            = compiler.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            txtSharedLibLinker.Text = targetConfig.Linker;

            targetConfig            = compiler.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            txtStaticLibLinker.Text = targetConfig.Linker;

            releaseArgumentsDialog.Load(compiler, false);
            debugArgumentsDialog.Load(compiler, true);

            text_DefaultLibraries.Buffer.Text = string.Join("\n", compiler.DefaultLibraries);
            text_Includes.Buffer.Text         = string.Join("\n", compiler.IncludePaths);

            btnMakeDefault.Active =
                configuration.Vendor == defaultCompilerVendor;
            btnMakeDefault.Sensitive = true;
        }
Пример #6
0
        public bool ApplyToVirtConfiguration()
        {
            if (configuration == null)
            {
                return(false);
            }

            configuration.BinPath = txtBinPath.Text;
            configuration.SourceCompilerCommand = txtCompiler.Text;
            configuration.EnableGDCLibPrefixing = check_enableLibPrefixing.Active;

            var targetConfig = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);

            targetConfig.Linker = txtConsoleAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            targetConfig.Linker = txtSharedLibLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            targetConfig.Linker = txtStaticLibLinker.Text;

            releaseArgumentsDialog.Store();
            debugArgumentsDialog.Store();

            configuration.DefaultLibraries.Clear();
            configuration.DefaultLibraries.AddRange(text_DefaultLibraries.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries));

            #region Store new include paths
            configuration.IncludePaths.Clear();
            foreach (var p in text_Includes.Buffer.Text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
            {
                configuration.IncludePaths.Add(p.TrimEnd('\\', '/'));
            }

            try {
                // Update parse cache immediately
                configuration.UpdateParseCacheAsync();
            } catch (Exception ex) {
                LoggingService.LogError("Include path analysis error", ex);
            }
            #endregion

            return(true);
        }
Пример #7
0
        public bool ApplyToVirtConfiguration()
        {
            if (configuration == null)
            {
                return(false);
            }

            configuration.BinPath = txtBinPath.Text;
            configuration.SourceCompilerCommand = txtCompiler.Text;
            configuration.EnableGDCLibPrefixing = check_enableLibPrefixing.Active;

            var targetConfig = configuration.GetOrCreateTargetConfiguration(DCompileTarget.Executable);

            targetConfig.Linker = txtConsoleAppLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.SharedLibrary);
            targetConfig.Linker = txtSharedLibLinker.Text;

            targetConfig        = configuration.GetOrCreateTargetConfiguration(DCompileTarget.StaticLibrary);
            targetConfig.Linker = txtStaticLibLinker.Text;

            releaseArgumentsDialog.Store();
            debugArgumentsDialog.Store();

            configuration.DefaultLibraries.Clear();
            foreach (var p in text_DefaultLibraries.Buffer.Text.Split('\n'))
            {
                var p_ = p.Trim();
                if (!String.IsNullOrWhiteSpace(p_))
                {
                    configuration.DefaultLibraries.Add(p_);
                }
            }

            try
            {
                using (var sr = new StringReader(tb_ArgPatterns.Buffer.Text))
                    using (var xml = new System.Xml.XmlTextReader(sr))
                        configuration.ArgumentPatterns.ReadFrom(xml);
            }
            catch (Exception ex) {
                LoggingService.LogError("Error during parsing argument patterns", ex);
                return(false);
            }

            #region Store new include paths
            configuration.IncludePaths.Clear();
            foreach (var p in text_Includes.Buffer.Text.Split('\n'))
            {
                var p_ = p.Trim().TrimEnd('\\', '/');
                if (!string.IsNullOrWhiteSpace(p_))
                {
                    configuration.IncludePaths.Add(p_);
                }
            }

            try {
                // Update parse cache immediately
                configuration.UpdateParseCacheAsync();
            } catch (Exception ex) {
                LoggingService.LogError("Include path analysis error", ex);
            }
            #endregion

            return(true);
        }