Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public bool Store()
        {
            if (configuration == null)
            {
                return(false);
            }

            Gtk.TreeIter iter;
            string       line;

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

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

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

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

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

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

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

            defaultLibStore.GetIterFirst(out iter);
            configuration.DefaultLibraries.Clear();
            while (defaultLibStore.IterIsValid(iter))
            {
                line = (string)defaultLibStore.GetValue(iter, 0);
                configuration.DefaultLibraries.Add(line);
                defaultLibStore.IterNext(ref iter);
            }

            // Store new include paths
            includePathStore.GetIterFirst(out iter);
            configuration.GlobalParseCache.ParsedGlobalDictionaries.Clear();
            while (includePathStore.IterIsValid(iter))
            {
                line = (string)includePathStore.GetValue(iter, 0);
                // Add it to the compiler's global parse cache
                configuration.GlobalParseCache.Add(line);
                includePathStore.IterNext(ref iter);
            }

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

            return(true);
        }