Skip to content

Instantly share code, notes, and snippets.

@gitexperience
Created August 24, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gitexperience/c7d4ab8546e55da88675bfc641e763ea to your computer and use it in GitHub Desktop.
Save gitexperience/c7d4ab8546e55da88675bfc641e763ea to your computer and use it in GitHub Desktop.
Overhaul Xamarin Studio C/C++ Addin
diff --git a/cbindingreport/cbinding/cbinding/cbinding.csproj b/caddin/cbinding/cbinding/cbinding.csproj
index 69217e2..3e891db 100644
--- a/cbindingreport/cbinding/cbinding/cbinding.csproj
+++ b/caddin/cbinding/cbinding/cbinding.csproj
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <Import Project="..\packages\MonoDevelop.Addins.0.3.10\build\net40\MonoDevelop.Addins.props" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.10\build\net40\MonoDevelop.Addins.props')" />
+ <Import Project="..\packages\MonoDevelop.Addins.0.3.16\build\net45\MonoDevelop.Addins.props" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.16\build\net45\MonoDevelop.Addins.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -9,7 +8,7 @@
<OutputType>Library</OutputType>
<AssemblyName>MonoDevelop.CBinding</AssemblyName>
<RootNamespace>CBinding</RootNamespace>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AdjacentMD>..\..\monodevelop\main\build\bin</AdjacentMD>
<MDBinDir Condition="Exists('$(AdjacentMD)')">$(AdjacentMD)</MDBinDir>
</PropertyGroup>
@@ -30,15 +29,9 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Manifest.addin.xml" />
- <EmbeddedResource Include="templates\EmptyCProject.xpt.xml">
- <LogicalName>EmptyCProject.xpt.xml</LogicalName>
- </EmbeddedResource>
<EmbeddedResource Include="templates\EmptyCSourceFile.xft.xml">
<LogicalName>EmptyCSourceFile.xft.xml</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="templates\EmptyCppProject.xpt.xml">
- <LogicalName>EmptyCppProject.xpt.xml</LogicalName>
- </EmbeddedResource>
<EmbeddedResource Include="gtk-gui\gui.stetic">
<LogicalName>gui.stetic</LogicalName>
</EmbeddedResource>
@@ -63,12 +56,6 @@
<EmbeddedResource Include="templates\StaticLibraryCppProject.xpt.xml">
<LogicalName>StaticLibraryCppProject.xpt.xml</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="templates\ConsoleCProject.xpt.xml">
- <LogicalName>ConsoleCProject.xpt.xml</LogicalName>
- </EmbeddedResource>
- <EmbeddedResource Include="templates\ConsoleCppProject.xpt.xml">
- <LogicalName>ConsoleCppProject.xpt.xml</LogicalName>
- </EmbeddedResource>
<EmbeddedResource Include="templates\ConsoleObjCProject.xpt.xml">
<LogicalName>ConsoleObjCProject.xpt.xml</LogicalName>
</EmbeddedResource>
@@ -78,7 +65,7 @@
<EmbeddedResource Include="templates\EmptyObjCppSourceFile.xft.xml">
<LogicalName>EmptyObjCppSourceFile.xft.xml</LogicalName>
</EmbeddedResource>
- <EmbeddedResource Include="templates\EmptyCMakeListsFile.xft.xml">
+ <EmbeddedResource Include="templates\EmptyCMakeListsFile.xft.xml">
<LogicalName>EmptyCMakeListsFile.xft.xml</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\union-private-16.png">
@@ -126,6 +113,8 @@
</None>
<None Include="app.config" />
<None Include="packages.config" />
+ <None Include="templates\ConsoleCppProject.xpt.xml" />
+ <None Include="templates\ConsoleCProject.xpt.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="templates\" />
@@ -143,54 +132,43 @@
<Reference Include="Mono.Posix" />
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
- </Reference>
- <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"></Reference>
+ <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"></Reference>
+ <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"></Reference>
+ <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"></Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="Mono.Data.Sqlite">
+ <HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\Mono.Data.Sqlite.dll</HintPath>
+ <Private>False</Private>
</Reference>
- <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Reference Include="System.Data.Portable">
+ <HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\System.Data.Portable.dll</HintPath>
</Reference>
- <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+ <Reference Include="System.Transactions.Portable">
+ <HintPath>..\packages\Mono.Data.Sqlite.Portable.1.0.3.5\lib\net4\System.Transactions.Portable.dll</HintPath>
</Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.ComponentModel.DataAnnotations" />
- <Reference Include="Mono.Data.Sqlite" />
+ <Reference Include="System.Transactions" />
+ <Reference Include="mscorlib" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.IO.Compression.FileSystem" />
+ <Reference Include="System.ComponentModel.Composition" />
+ <Reference Include="System.Numerics" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Project\CProject.cs" />
- <Compile Include="Project\CProjectConfiguration.cs" />
<Compile Include="gtk-gui\generated.cs" />
- <Compile Include="Gui\CodeGenerationPanel.cs" />
- <Compile Include="Compiler\CCompiler.cs" />
- <Compile Include="Compiler\GccCompiler.cs" />
- <Compile Include="Compiler\GppCompiler.cs" />
- <Compile Include="Compiler\GNUCompiler.cs" />
- <Compile Include="Gui\CompilerPanel.cs" />
- <Compile Include="gtk-gui\CBinding.CodeGenerationPanel.cs" />
- <Compile Include="gtk-gui\CBinding.CompilerPanel.cs" />
- <Compile Include="Compiler\ICompiler.cs" />
- <Compile Include="Project\ProjectPackageCollection.cs" />
- <Compile Include="Gui\EditPackagesDialog.cs" />
- <Compile Include="gtk-gui\CBinding.EditPackagesDialog.cs" />
- <Compile Include="Project\Package.cs" />
- <Compile Include="Project\ProjectPackageEventArgs.cs" />
- <Compile Include="Gui\OutputOptionsPanel.cs" />
- <Compile Include="gtk-gui\CBinding.OutputOptionsPanel.cs" />
<Compile Include="ProjectPad\ProjectReferencesExtension.cs" />
- <Compile Include="ProjectPad\ProjectPackagesFolderNodeBuilder.cs" />
- <Compile Include="ProjectPad\ProjectPackageNodeBuilder.cs" />
<Compile Include="ProjectPad\ProjectNodeExtension.cs" />
<Compile Include="ProjectPad\FolderBasedProjectNodeBuilder.cs" />
<Compile Include="ProjectPad\CMakeTargetNodeBuilder.cs" />
<Compile Include="Gui\CTextEditorExtension.cs" />
<Compile Include="Gui\GeneralOptionsPanel.cs" />
<Compile Include="gtk-gui\CBinding.GeneralOptionsPanel.cs" />
- <Compile Include="Gui\PackageDetails.cs" />
- <Compile Include="gtk-gui\CBinding.PackageDetails.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AddinInfo.cs" />
<Compile Include="CLang\CLangManager.cs" />
- <Compile Include="Compiler\ClangCCompiler.cs" />
- <Compile Include="Compiler\ClangCXXCompiler.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Generated.cs" />
<Compile Include="Parser\ClangCompletionUnit.cs" />
@@ -206,22 +184,20 @@
<Compile Include="Refactoring\GotoDefinitionHandler.cs" />
<Compile Include="Refactoring\RefactoryCommands.cs" />
<Compile Include="Refactoring\GotoDeclarationHandler.cs" />
- <Compile Include="Parser\CDocumentParser.cs" />
<Compile Include="Gui\RenameHandlerDialog.cs" />
<Compile Include="gtk-gui\CBinding.RenameHandlerDialog.cs" />
<Compile Include="Parser\OverloadCandidate.cs" />
- <Compile Include="Parser\CParsedDocument.cs" />
<Compile Include="Project\UnsavedFilesManager.cs" />
<Compile Include="Project\UnsavedFile.cs" />
<Compile Include="Parser\SymbolDatabaseMediator.cs" />
<Compile Include="CLang\SerializationManager.cs" />
<Compile Include="CMake\CMakeCompletionDataLists.cs" />
<Compile Include="CMake\CMakeTextEditorExtension.cs" />
+ <Compile Include="CMake\CMakeProject.cs" />
<Compile Include="CMake\CMakeFileFormat.cs" />
<Compile Include="CMake\CMakeTarget.cs" />
<Compile Include="CMake\CMakeCommand.cs" />
<Compile Include="CMake\CMakeArgument.cs" />
- <Compile Include="CMake\CMakeProject.cs" />
<Compile Include="CMake\CMakeWorkspaceObjectReader.cs" />
<Compile Include="CMake\CMakeVariableManager.cs" />
<Compile Include="ProjectPad\SystemFolder.cs" />
@@ -233,11 +209,38 @@
<Compile Include="gtk-gui\CBinding.TargetPickerDialog.cs" />
<Compile Include="gtk-gui\CBinding.NewTargetDialog.cs" />
<Compile Include="Gui\NewTargetDialog.cs" />
+ <Compile Include="Project\ProjectPackageEventArgs.cs" />
+ <Compile Include="Compiler\VS15MSBuildToolchain.cs" />
+ <Compile Include="Compiler\CMakeToolchain.cs" />
+ <Compile Include="Compiler\VisualStudioToolchain.cs" />
+ <Compile Include="Compiler\VS14MSBuildToolchain.cs" />
+ <Compile Include="Compiler\VS12MSBuildToolchain.cs" />
+ <Compile Include="Compiler\MinGW32Toolchain.cs" />
+ <Compile Include="Compiler\ClangToolchain.cs" />
+ <Compile Include="Compiler\UnixMakeToolchain.cs" />
+ <Compile Include="Compiler\MacMakeToolchain.cs" />
+ <Compile Include="Parser\CDocumentParser.cs" />
+ <Compile Include="Parser\CParsedDocument.cs" />
+ <Compile Include="Parser\Class.cs" />
+ <Compile Include="Parser\ClassTemplate.cs" />
+ <Compile Include="Parser\ClassTemplatePartial.cs" />
+ <Compile Include="Parser\Enumeration.cs" />
+ <Compile Include="Parser\Enumerator.cs" />
+ <Compile Include="Parser\Field.cs" />
+ <Compile Include="Parser\Function.cs" />
+ <Compile Include="Parser\FunctionTemplate.cs" />
+ <Compile Include="Parser\Macro.cs" />
+ <Compile Include="Parser\MemberFunction.cs" />
+ <Compile Include="Parser\Namespace.cs" />
+ <Compile Include="Parser\Struct.cs" />
+ <Compile Include="Parser\Typedef.cs" />
+ <Compile Include="Parser\Union.cs" />
+ <Compile Include="Parser\Variable.cs" />
</ItemGroup>
<ItemGroup>
<AddinReference Include="MonoDevelop.Refactoring" />
<AddinReference Include="MonoDevelop.DesignerSupport" />
<AddinReference Include="MonoDevelop.Xml" />
</ItemGroup>
- <Import Project="..\packages\MonoDevelop.Addins.0.3.10\build\net40\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.10\build\net40\MonoDevelop.Addins.targets')" />
-</Project>
+ <Import Project="..\packages\MonoDevelop.Addins.0.3.16\build\net45\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.16\build\net45\MonoDevelop.Addins.targets')" />
+</Project>
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/compiler/ccompiler.cs b/ccompiler.cs
index 019daeb..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/compiler/ccompiler.cs
+++ b/ccompiler.cs
@@ -1,137 +0,0 @@
-//
-// CCompiler.cs: asbtract class that provides some basic implementation for ICompiler
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Text;
-using System.CodeDom.Compiler;
-
-using MonoDevelop.Core;
-using MonoDevelop.Core.Execution;
-using MonoDevelop.Projects;
-using MonoDevelop.Ide;
-
-namespace CBinding
-{
- public abstract class CCompiler : ICompiler
- {
- protected string compilerCommand;
- protected string linkerCommand;
-
- public abstract string Name {
- get;
- }
-
- public abstract Language Language {
- get;
- }
-
- public string CompilerCommand {
- get { return compilerCommand; }
- }
-
- public abstract bool SupportsCcache {
- get;
- }
-
- public abstract bool SupportsPrecompiledHeaders {
- get;
- }
-
- public abstract string GetCompilerFlags (Project project, CProjectConfiguration configuration);
-
- public abstract string GetDefineFlags (Project project, CProjectConfiguration configuration);
-
- public abstract BuildResult Compile (
- Project project,
- ProjectFileCollection projectFiles,
- ProjectPackageCollection packages,
- CProjectConfiguration configuration,
- ProgressMonitor monitor);
-
- public abstract void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProgressMonitor monitor);
-
- protected abstract void ParseCompilerOutput (string errorString, CompilerResults cr);
-
- protected abstract void ParseLinkerOutput (string errorString, CompilerResults cr);
-
- protected string GeneratePkgLinkerArgs (ProjectPackageCollection packages)
- {
- return GeneratePkgConfigArgs (packages, "--libs");
- }
-
- protected string GeneratePkgCompilerArgs (ProjectPackageCollection packages)
- {
- return GeneratePkgConfigArgs (packages, "--cflags");
- }
-
- protected static string GeneratePkgConfigArgs (ProjectPackageCollection packages, string pkgConfigArg)
- {
- if (packages == null || packages.Count < 1)
- return string.Empty;
- string originalPkgConfigPath = Environment.GetEnvironmentVariable ("PKG_CONFIG_PATH");
- string pkgConfigPath = originalPkgConfigPath;
-
- StringBuilder libs = new StringBuilder ();
-
- foreach (Package p in packages) {
- if (Path.IsPathRooted (p.File)) {
- pkgConfigPath = string.Format ("{0}{1}{2}", pkgConfigPath, Path.PathSeparator, Path.GetDirectoryName (p.File));
- libs.Append (Path.GetFileNameWithoutExtension (p.File) + " ");
- } else {
- libs.Append (p.File + " ");
- }
- }
-
- string args = string.Format ("{0} \"{1}\"", pkgConfigArg, libs.ToString ().Trim ());
-
- StringWriter output = new StringWriter ();
- ProcessWrapper proc = new ProcessWrapper ();
-
- try {
- Environment.SetEnvironmentVariable ("PKG_CONFIG_PATH", pkgConfigPath);
- proc = Runtime.ProcessService.StartProcess ("pkg-config", args, null, null);
- proc.WaitForExit ();
-
- string line;
- while ((line = proc.StandardOutput.ReadLine ()) != null)
- output.WriteLine (line);
- } catch (Exception ex) {
- MessageService.ShowError ("You need to have pkg-config installed");
- } finally {
- proc.Close ();
- Environment.SetEnvironmentVariable ("PKG_CONFIG_PATH", originalPkgConfigPath);
- }
-
- return output.ToString ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/parser/cdocumentparser.cs b/caddin/cbinding/cbinding/parser/cdocumentparser.cs
index ba64f1c..a036a94 100644
--- a/cbindingreport/cbinding/cbinding/parser/cdocumentparser.cs
+++ b/caddin/cbinding/cbinding/parser/cdocumentparser.cs
@@ -26,6 +26,7 @@
using System;
using MonoDevelop.Ide.TypeSystem;
+using MonoDevelop.Projects;
using System.Threading;
using System.Threading.Tasks;
@@ -38,11 +39,10 @@ namespace CBinding.Parser
/// </summary>
public class CDocumentParser: TypeSystemParser
{
-
public override Task<ParsedDocument> Parse(ParseOptions options, CancellationToken cancellationToken)
{
var fileName = options.FileName;
- var project = (CProject)options.Project;
+ var project = (CMakeProject)(options.Project as SolutionItem);
if (project == null || !project.HasLibClang)
return Task.FromResult ((ParsedDocument)new DefaultParsedDocument (fileName));
diff --git a/cbindingreport/cbinding/cbinding/compiler/clangccompiler.cs b/clangccompiler.cs
index 22dc5e4..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/compiler/clangccompiler.cs
+++ b/clangccompiler.cs
@@ -1,55 +0,0 @@
-//
-// ClangCCompiler.cs: Provides functionality to compile using clang
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-// Guba Dániel Olivér <gudaol@gmx.com>
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using Mono.Addins;
-
-
-namespace CBinding
-{
- [Extension ("/CBinding/Compilers")]
- public class ClangCCompiler : GNUCompiler
- {
- public override string Name {
- get { return "clang"; }
- }
-
- public override Language Language {
- get { return Language.C; }
- }
-
- public ClangCCompiler ()
- {
- compilerCommand = "clang";
- linkerCommand = "clang";
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/compiler/clangcxxcompiler.cs b/clangcxxcompiler.cs
index 2535421..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/compiler/clangcxxcompiler.cs
+++ b/clangcxxcompiler.cs
@@ -1,55 +0,0 @@
-//
-// ClangCXXCompiler.cs: Provides functionality to compile using clang++
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-// Guba Dániel Olivér <gudaol@gmx.com>
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using Mono.Addins;
-
-
-namespace CBinding
-{
- [Extension ("/CBinding/Compilers")]
- public class ClangCXXCompiler : GNUCompiler
- {
- public override string Name {
- get { return "clang++"; }
- }
-
- public override Language Language {
- get { return Language.CPP; }
- }
-
- public ClangCXXCompiler ()
- {
- compilerCommand = "clang++";
- linkerCommand = "clang++";
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/clang/clangmanager.cs b/caddin/cbinding/cbinding/clang/clangmanager.cs
index bdcac3b..705e5e2 100644
--- a/cbindingreport/cbinding/cbinding/clang/clangmanager.cs
+++ b/caddin/cbinding/cbinding/clang/clangmanager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -21,7 +21,7 @@ namespace CBinding
/// and the translation units itself are not.
/// For more information see the field SyncRoot
/// </summary>
- public class CLangManager : IDisposable
+ public class CLangManager : CMakeProject, IDisposable
{
/// <summary>
/// The sync root.
@@ -33,32 +33,23 @@ namespace CBinding
/// while reparsing is in progress in an other file could result in a fault.
/// </summary>
public readonly object SyncRoot = new object ();
- CProject project;
+ CMakeProject project;
CXIndex index;
Dictionary<string, CXTranslationUnit> translationUnits { get; }
SerializationManager SerManager { get; }
-
Dictionary<string, bool> Loaded { get; }
+ CMakeToolchain cmakeToolchain;
/// <summary>
/// Gets the command line arguments. Use with caution, when the project is not fully loaded and there are no active configuration yet, it will fail with nullrefexception.
/// </summary>
/// <value>The arguments.</value>
- public string [] CmdArguments (string name) {
- var compiler = new ClangCCompiler ();
+ public string [] CmdArguments (string name)
+ {
+ cmakeToolchain = CMakeToolchain.GetToolchain ();
var active_configuration =
- (CProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
- var args = new List<string> (compiler.GetCompilerFlagsAsArray (project, active_configuration));
- if (CProject.SourceExtensions.Any(o => o.Equals (new FilePath(name).Extension.ToUpper ()))) {
- foreach (var f in project.Files) {
- if (CProject.HeaderExtensions.Any (o => o.Equals (f.FilePath.Extension.ToUpper ()))) {
- if (File.Exists (f.Name + ".pch")) {
- args.Add ("-include-pch");
- args.Add (f.Name + ".pch");
- }
- }
- }
- }
+ project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
+ var args = new List<string> (cmakeToolchain.GetCompilerFlagsAsArray ());
return args.ToArray ();
}
@@ -66,12 +57,12 @@ namespace CBinding
/// Constructor
/// </summary>
/// <param name="proj">
- /// A <see cref="CProject"/> reference: project which the manager manages
+ /// A <see cref="CMakeProject"/> reference: project which the manager manages
/// </param>
- public CLangManager (CProject proj)
+ public CLangManager (CMakeProject proj)
{
project = proj;
- index = clang.createIndex (0, 0);
+ index = clang.createIndex (0, 0); // FIXME:- This is always giving DLLNOTFOUNDEXCEPTION during initialization of CMakeProject.
SerManager = new SerializationManager (project, this, index);
translationUnits = new Dictionary<string, CXTranslationUnit> ();
Loaded = new Dictionary<string, bool> ();
@@ -127,7 +118,7 @@ namespace CBinding
if (!SerializationManager.SerFormIsUpToDate (fileName)) {
SerManager.Update (fileName, CmdArguments (fileName));
}
- translationUnits.Add (fileName, clang.createTranslationUnit (index, fileName + ".pch"));
+ translationUnits.Add (fileName, clang.createTranslationUnit (index, fileName));
Loaded [fileName] = true;
} else {
translationUnits.Add (fileName, clang.parseTranslationUnit (
@@ -175,14 +166,14 @@ namespace CBinding
}
}
- void ReparseFilesWithExtension (string [] extensions)
+ void ReparseFilesWithExtension ()
{
var unsavedFiles = project.UnsavedFiles.Get ();
- foreach (var f in project.Files) {
- if (extensions.Any (o => o.Equals (f.FilePath.Extension.ToUpper ()))) {
- if (translationUnits.ContainsKey (f.Name))
- RemoveTranslationUnit (f.Name);
- CreateTranslationUnit (f.Name, unsavedFiles.ToArray ());
+ foreach (var f in OnGetItemFiles (false)) {
+ if(IsCFile (f.Extension.ToUpper ())) {
+ if (translationUnits.ContainsKey (f.FileName))
+ RemoveTranslationUnit (f.FileName);
+ CreateTranslationUnit (f.FileName, unsavedFiles.ToArray ());
}
}
}
@@ -194,8 +185,7 @@ namespace CBinding
{
lock (SyncRoot) {
//to precompile headers before parsing CPP files
- ReparseFilesWithExtension (CProject.HeaderExtensions);
- ReparseFilesWithExtension (CProject.SourceExtensions);
+ ReparseFilesWithExtension ();
}
}
@@ -505,7 +495,7 @@ namespace CBinding
/// <param name="fileName"></param>
public void CheckForBom (string fileName)
{
- if (project.Files.Any (arg => arg.Name.Equals (fileName))) {
+ if (OnGetItemFiles (false).Any (arg => arg.FileName.Equals (fileName))) {
using (var s = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
var BOM = new byte [3];
s.Read (BOM, 0, 3);
@@ -520,30 +510,15 @@ namespace CBinding
void HandleAddition (object sender, ProjectFileEventArgs args)
{
foreach (var e in args) {
-
CheckForBom (e.ProjectFile.Name);
-
- if (!project.Loading && !project.IsCompileable (e.ProjectFile.Name) &&
- e.ProjectFile.BuildAction == BuildAction.Compile) {
- e.ProjectFile.BuildAction = BuildAction.None;
- }
-
- if (!project.Loading && e.ProjectFile.BuildAction == BuildAction.Compile)
- TypeSystemService.ParseFile (project, e.ProjectFile.Name);
+ SerManager.Add (e.ProjectFile.Name, CmdArguments (e.ProjectFile.Name));
}
}
void HandleChange (object sender, ProjectFileEventArgs args)
{
foreach (var e in args) {
-
CheckForBom (e.ProjectFile.Name);
-
- if (!project.Loading && !project.IsCompileable (e.ProjectFile.Name) &&
- e.ProjectFile.BuildAction == BuildAction.Compile) {
- e.ProjectFile.BuildAction = BuildAction.None;
- }
-
SerManager.Update (e.ProjectFile.Name, CmdArguments (e.ProjectFile.Name));
}
}
@@ -551,13 +526,7 @@ namespace CBinding
void HandleRemoval (object sender, ProjectFileEventArgs args)
{
foreach (var e in args) {
- if (!project.Loading && !project.IsCompileable (e.ProjectFile.Name) &&
- e.ProjectFile.BuildAction == BuildAction.Compile) {
- e.ProjectFile.BuildAction = BuildAction.None;
- }
- if (e.ProjectFile.BuildAction == BuildAction.Compile)
RemoveTranslationUnit (e.ProjectFile.Name);
-
SerManager.Remove (e.ProjectFile.Name);
}
}
diff --git a/clangtoolchain.cs b/caddin/cbinding/cbinding/compiler/ClangToolchain.cs
index e69de29..8840dbd 100644
--- a/clangtoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/ClangToolchain.cs
@@ -0,0 +1,67 @@
+//
+// ClangToolchain.cs: Provides functionality to compile using Clang Toolchain.
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Threading.Tasks;
+using System.IO;
+
+using Mono.Addins;
+
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+
+namespace CBinding
+{
+ [Extension ("/CBinding/Toolchains")]
+ public class ClangToolchain : VisualStudioToolchain
+ {
+
+ /// <summary>
+ /// The name of this Toolchain.
+ /// </summary>
+ /// <value>The name.</value>
+ public override string ToolchainName {
+ get {
+ return "Clang Toolchain";
+ }
+ }
+
+ public override string GeneratorID {
+ get {
+ return "Visual Studio 15 2017";
+ }
+ }
+
+ public override string ToolchainID {
+ get {
+ return "LLVM-vs2014";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/parser/class.cs b/caddin/cbinding/cbinding/parser/class.cs
index d65528d..9843c1d 100644
--- a/cbindingreport/cbinding/cbinding/parser/class.cs
+++ b/caddin/cbinding/cbinding/parser/class.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Class : Symbol
{
- public Class (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Class (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/parser/classtemplate.cs b/caddin/cbinding/cbinding/parser/classtemplate.cs
index 56b1258..0a118f1 100644
--- a/cbindingreport/cbinding/cbinding/parser/classtemplate.cs
+++ b/caddin/cbinding/cbinding/parser/classtemplate.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class ClassTemplate : Class
{
- public ClassTemplate (CProject proj, CXCursor cursor ) : base (proj , cursor)
+ public ClassTemplate (CMakeProject proj, CXCursor cursor ) : base (proj , cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/parser/classtemplatepartial.cs b/caddin/cbinding/cbinding/parser/classtemplatepartial.cs
index 4a099ff..220ac8a 100644
--- a/cbindingreport/cbinding/cbinding/parser/classtemplatepartial.cs
+++ b/caddin/cbinding/cbinding/parser/classtemplatepartial.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class ClassTemplatePartial : ClassTemplate
{
- public ClassTemplatePartial (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public ClassTemplatePartial (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/cmake/cmakeproject.cs b/caddin/cbinding/cbinding/cmake/cmakeproject.cs
index 5a2e129..65b9442 100644
--- a/cbindingreport/cbinding/cbinding/cmake/cmakeproject.cs
+++ b/caddin/cbinding/cbinding/cmake/cmakeproject.cs
@@ -1,4 +1,4 @@
-//
+//
// CMakeProject.cs
//
// Author:
@@ -43,12 +43,48 @@ namespace CBinding
string name;
FilePath outputDirectory = new FilePath ("./bin");
CMakeFileFormat fileFormat;
+ CMakeToolchain cmakeToolchain;
+
+ /// <summary>
+ /// Occurs when a file is removed from this project.
+ /// </summary>
+ public event ProjectFileEventHandler FileRemovedFromProject;
+
+ /// <summary>
+ /// Occurs when a file is added to this project.
+ /// </summary>
+ public event ProjectFileEventHandler FileAddedToProject;
+
+ /// <summary>
+ /// Occurs when a file of this project has been modified
+ /// </summary>
+ public event ProjectFileEventHandler FileChangedInProject;
+
+ /// <summary>
+ /// Occurs when a file of this project has been renamed
+ /// </summary>
+ public event ProjectFileRenamedEventHandler FileRenamedInProject;
+
+
+ public bool HasLibClang { get; private set; }
+
+ public CLangManager ClangManager { get; private set; }
+
+ public SymbolDatabaseMediator DB { get; private set; }
+
+ public UnsavedFilesManager UnsavedFiles { get; private set; }
static readonly string [] supportedLanguages = { "C", "C++", "Objective-C", "Objective-C++" };
- Regex extensions = new Regex (@"(\.c|\.c\+\+|\.cc|\.cpp|\.cxx|\.m|\.mm|\.h|\.hh|\.h\+\+|\.hm|\.hpp|\.hxx|\.in|\.txx)$",
+ static Regex extensions = new Regex (@"(\.c|\.c\+\+|\.cc|\.cpp|\.cxx|\.m|\.mm|\.h|\.hh|\.h\+\+|\.hm|\.hpp|\.hxx|\.in|\.txx)$",
RegexOptions.IgnoreCase);
+ public static bool IsCFile (string file) {
+ if (extensions.IsMatch (file))
+ return true;
+ return false;
+ }
+
public override FilePath FileName {
get {
return file;
@@ -58,18 +94,6 @@ namespace CBinding
}
}
- Stream ExecuteCommand (string command, string args, string workingDir, ProgressMonitor monitor)
- {
- var stream = new MemoryStream ();
- var streamWriter = new StreamWriter (stream);
- FilePath path = file.ParentDirectory.Combine (workingDir);
- ProcessWrapper p = Runtime.ProcessService.StartProcess (command, args, path, monitor.Log, streamWriter, null);
- p.WaitForExit ();
- streamWriter.Flush ();
- stream.Position = 0;
- return stream;
- }
-
bool CheckCMake ()
{
try {
@@ -81,103 +105,6 @@ namespace CBinding
}
}
- Tuple<int, string> GetFileAndLine (string line, string separator)
- {
- int lineNumber = 0;
- string fileName = "";
- string s = line.Split (new string [] { separator }, StringSplitOptions.RemoveEmptyEntries) [1].Trim ();
- string [] args = s.Split (':');
- if (args [0].Length > 0) fileName = args [0];
- if (args.Length > 1 && args [1].Length > 0) {
- if (args [1].Contains ("("))
- int.TryParse (args [1].Split ('(') [0], out lineNumber);
- else
- int.TryParse (args [1], out lineNumber);
- }
-
- return Tuple.Create (lineNumber, fileName);
- }
-
- BuildResult ParseGenerationResult (Stream result, ProgressMonitor monitor)
- {
- var results = new BuildResult ();
- result.Position = 0;
- var sr = new StreamReader (result);
- var sb = new StringBuilder ();
- string line;
- string fileName = "";
- int lineNumber = 0;
- bool isWarning = false;
-
- while ((line = sr.ReadLine ()) != null) {
- //e.g. CMake Warning in/at CMakeLists.txt:10 (COMMAND):
- //or: CMake Warning:
- if (line.StartsWith ("CMake Warning", StringComparison.OrdinalIgnoreCase)) {
- //reset everything and add last error or warning.
- if (sb.Length > 0) {
- if (isWarning)
- results.AddWarning (BaseDirectory.Combine (fileName), lineNumber, 0, "", sb.ToString ());
- else
- results.AddError (BaseDirectory.Combine (fileName), lineNumber, 0, "", sb.ToString ());
- }
-
- sb.Clear ();
- fileName = "";
- lineNumber = 0;
- isWarning = true;
-
- // in/at CMakeLists.txt:10 (COMMAND):
- if (line.Contains (" in ")) {
- Tuple<int, string> t = GetFileAndLine (line, " in ");
- lineNumber = t.Item1;
- fileName = t.Item2;
- } else if (line.Contains (" at ")) {
- Tuple<int, string> t = GetFileAndLine (line, " at ");
- lineNumber = t.Item1;
- fileName = t.Item2;
- } else {
- string [] warning = line.Split (':');
- if (!string.IsNullOrEmpty (warning.ElementAtOrDefault (1))) {
- sb.Append (warning [1]);
- }
- }
- } else if (line.StartsWith ("CMake Error", StringComparison.OrdinalIgnoreCase)) {
- //reset everything and add last error or warning.
- if (sb.Length > 0) {
- if (isWarning)
- results.AddWarning (BaseDirectory.Combine (fileName), lineNumber, 0, "", sb.ToString ());
- else
- results.AddError (BaseDirectory.Combine (fileName), lineNumber, 0, "", sb.ToString ());
- }
-
- sb.Clear ();
- fileName = "";
- lineNumber = 0;
- isWarning = false;
-
- // in/at CMakeLists.txt:10 (COMMAND):
- if (line.Contains (" in ")) {
- Tuple<int, string> t = GetFileAndLine (line, " in ");
- lineNumber = t.Item1;
- fileName = t.Item2;
- } else if (line.Contains (" at ")) {
- Tuple<int, string> t = GetFileAndLine (line, " at ");
- lineNumber = t.Item1;
- fileName = t.Item2;
- } else {
- string [] error = line.Split (':');
- if (!string.IsNullOrEmpty (error.ElementAtOrDefault (1))) {
- sb.Append (error [1]);
- }
- }
- } else {
- sb.Append (line);
- }
- }
-
- return results;
- }
-
public void RemoveTarget (string targetName)
{
fileFormat.RemoveTarget (targetName);
@@ -193,6 +120,31 @@ namespace CBinding
return name;
}
+ public string MatchingFile (string sourceFile)
+ {
+ string filenameStub = Path.GetFileNameWithoutExtension (sourceFile);
+ bool wantHeader = !CMakeProject.IsHeaderFile (sourceFile);
+
+ foreach (FilePath file in OnGetItemFiles (false)) {
+ if (filenameStub == Path.GetFileNameWithoutExtension (file.FileName)
+ && (wantHeader == IsHeaderFile (file.FileName))) {
+ return file.FileName;
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Determines if a header file is specified by filename.
+ /// </summary>
+ /// <returns><c>true</c> if a header file is specified by filename; otherwise, <c>false</c>.</returns>
+ /// <param name="filename">Filename.</param>
+ public static bool IsHeaderFile (string filename)
+ {
+ return (0 <= Array.IndexOf (extensions.Split ("|").ToArray (), Path.GetExtension (filename.ToUpper ())));
+ }
+
public void LoadFrom (FilePath file)
{
this.file = file;
@@ -247,10 +199,9 @@ namespace CBinding
}
}
- protected override Task<BuildResult> OnBuild (ProgressMonitor monitor, ConfigurationSelector configuration,
+ protected async override Task<BuildResult> OnBuild (ProgressMonitor monitor, ConfigurationSelector configuration,
OperationContext operationContext)
{
- return Task.Factory.StartNew (() => {
BuildResult results;
if (!CheckCMake ()) {
@@ -261,33 +212,19 @@ namespace CBinding
FileService.CreateDirectory (file.ParentDirectory.Combine (outputDirectory));
- monitor.BeginStep ("Generating build files.");
- Stream generationResult = ExecuteCommand ("cmake", "../", outputDirectory, monitor);
- results = ParseGenerationResult (generationResult, monitor);
- monitor.EndStep ();
-
- monitor.BeginStep ("Building...");
- Stream buildResult = ExecuteCommand ("cmake", "--build ./ --clean-first", outputDirectory, monitor);
- //TODO: Parse results.
- monitor.EndStep ();
+ cmakeToolchain = CMakeToolchain.GetToolchain ();
+ cmakeToolchain.setFileLocation (file);
+ results = await cmakeToolchain.GenerateMakefiles (fileFormat.ProjectName, outputDirectory, monitor);
return results;
- });
+
}
- protected override Task<BuildResult> OnClean (ProgressMonitor monitor, ConfigurationSelector configuration,
+ protected async override Task<BuildResult> OnClean (ProgressMonitor monitor, ConfigurationSelector configuration,
OperationContext buildSession)
{
- return Task.Factory.StartNew (() => {
- var results = new BuildResult ();
-
- FilePath path = BaseDirectory.Combine (outputDirectory);
- if (Directory.Exists (path)) {
- FileService.DeleteDirectory (path);
- }
-
+ BuildResult results = await cmakeToolchain.Clean (fileFormat.ProjectName, outputDirectory, monitor);
return results;
- });
}
protected override Task OnExecute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
@@ -306,7 +243,6 @@ namespace CBinding
monitor.ReportError ("Can't find an executable target.");
return;
}
-
FilePath f = BaseDirectory.Combine (outputDirectory);
NativeExecutionCommand cmd;
if (File.Exists (f.Combine (targetName)))
@@ -355,6 +291,8 @@ namespace CBinding
{
base.OnFileRemoved (file);
+ FileRemovedFromProject?.Invoke (this, new ProjectFileEventArgs ());
+
foreach (var target in fileFormat.Targets.Values.ToList ()) {
target.RemoveFile (file);
}
@@ -377,6 +315,8 @@ namespace CBinding
{
base.OnFileRenamed (oldFile, newFile);
+ // FileRenamedInProject?.Invoke (this, new ProjectFileRenamedEventArgs ()); FIXME:- Need a fix
+
var oldFiles = new List<FilePath> () { oldFile };
var newFiles = new List<FilePath> () { newFile };
@@ -423,13 +363,25 @@ namespace CBinding
fileFormat.SaveAll ();
}
+ public override void OnFileChanged (FilePath file)
+ {
+ base.OnFileChanged (file);
+
+ if (!IsCFile (file))
+ return;
+
+ FileChangedInProject?.Invoke (this, new ProjectFileEventArgs ());
+ }
+
public override void OnFileAdded (FilePath file)
{
base.OnFileAdded (file);
- if (!extensions.IsMatch (file))
+ if (!IsCFile (file))
return;
+ FileAddedToProject?.Invoke (this, new ProjectFileEventArgs ());
+
using (var dlg = new TargetPickerDialog ("Pick a target", fileFormat)) {
if (MessageService.ShowCustomDialog (dlg) != (int)ResponseType.Ok)
return;
@@ -448,7 +400,7 @@ namespace CBinding
var filesToAdd = new List<FilePath> ();
foreach (var file in files) {
- if (extensions.IsMatch (file))
+ if (IsCFile (file))
filesToAdd.Add (file);
}
@@ -496,5 +448,22 @@ namespace CBinding
{
Initialize (this);
}
+
+ /// <summary>
+ /// Initialize this instance.
+ /// </summary>
+ protected override void OnInitialize ()
+ {
+ base.OnInitialize ();
+ try {
+ ClangManager = new CLangManager (this);
+ DB = new SymbolDatabaseMediator (this, ClangManager);
+ UnsavedFiles = new UnsavedFilesManager (this);
+ HasLibClang = true;
+ } catch (DllNotFoundException ex) {
+ LoggingService.LogError ("Could not load libclang", ex);
+ HasLibClang = false;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/cmake/cmaketexteditorextension.cs b/caddin/cbinding/cbinding/cmake/cmaketexteditorextension.cs
index b50762c..5e83aab 100644
--- a/cbindingreport/cbinding/cbinding/cmake/cmaketexteditorextension.cs
+++ b/caddin/cbinding/cbinding/cmake/cmaketexteditorextension.cs
@@ -94,10 +94,10 @@ namespace CBinding
}
public override Task<ICompletionDataList> HandleCodeCompletionAsync (CodeCompletionContext completionContext,
- char completionChar,
+ CompletionTriggerInfo triggerInfo,
CancellationToken token = default (CancellationToken))
{
- if (!char.IsLetter (completionChar))
+ if (triggerInfo.TriggerCharacter == null)
return null;
if (completionContext.TriggerOffset > 1 &&
diff --git a/cmaketoolchain.cs b/caddin/cbinding/cbinding/compiler/CMakeToolchain.cs
index e69de29..58835dc 100644
--- a/cmaketoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/CMakeToolchain.cs
@@ -0,0 +1,296 @@
+//
+// CMakeToolchain.cs: Abstract class that provides functionality to compile using various CMake Toolchains
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Threading.Tasks;
+using System.IO;
+using System.Text;
+using System.Linq;
+
+using Mono.Addins;
+
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+using MonoDevelop.Core.Execution;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace CBinding
+{
+ [TypeExtensionPoint ("/CBinding/Toolchains")]
+ public class CMakeToolchain
+ {
+ FilePath file;
+
+ /// <summary>
+ /// Name of the toolchain.
+ /// </summary>
+ public virtual string ToolchainName {
+ get;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether this Toolchain is supported for the Platform or not.
+ /// </summary>
+ public virtual bool IsSupported {
+ get;
+ }
+
+ /// <summary>
+ /// CMake generator id for this toolchain.
+ /// </summary>
+ public virtual string GeneratorID => "";
+
+ /// <summary>
+ /// CMake toolchain id for this toolchain.
+ /// </summary>
+ public virtual string ToolchainID => "";
+
+ /// <summary>
+ /// Creates the CMake cache entry.
+ /// </summary>
+ public virtual string CMakeCacheEntry => "";
+
+ public virtual string ProjectToBuild {
+ get;
+ set;
+ }
+
+ public string [] GetCompilerFlagsAsArray ()
+ {
+ FilePath outputDirectory = new FilePath ("./bin");
+ List<string> compileCommands = new List<string> ();
+ FilePath f = (file.ParentDirectory.Combine (outputDirectory)).Combine ("compile_commands.json");
+ if (File.Exists (f))
+ {
+ using (StreamReader r = new StreamReader ("compile_commands.json"))
+ {
+ string json = r.ReadToEnd ();
+ dynamic compilationDatabase = JsonConvert.DeserializeObject (json);
+ foreach (var commandObject in compilationDatabase) {
+ if (commandObject.command.Contains ("-o")) //FIXME:- changes needed - Only two flags added..
+ compileCommands.Add ("-o");
+ if (commandObject.command.Contains ("-c"))
+ compileCommands.Add ("-c");
+ }
+ }
+ }
+ return compileCommands.ToArray ();
+ }
+
+ Tuple<int, string> GetFileAndLine (string line, string separator)
+ {
+ int lineNumber = 0;
+ string fileName = "";
+ string s = line.Split (new string [] { separator }, StringSplitOptions.RemoveEmptyEntries) [1].Trim ();
+ string [] args = s.Split (':');
+ if (args [0].Length > 0) fileName = args [0];
+ if (args.Length > 1 && args [1].Length > 0) {
+ if (args [1].Contains ("("))
+ int.TryParse (args [1].Split ('(') [0], out lineNumber);
+ else
+ int.TryParse (args [1], out lineNumber);
+ }
+
+ return Tuple.Create (lineNumber, fileName);
+ }
+
+ public void setFileLocation (string file)
+ {
+ this.file = file;
+ }
+
+ protected Stream ExecuteCommand (string command, string args, string workingDir, ProgressMonitor monitor)
+ {
+ var stream = new MemoryStream ();
+ var streamWriter = new StreamWriter (stream);
+ FilePath path = file.ParentDirectory.Combine (workingDir);
+ ProcessWrapper p = Runtime.ProcessService.StartProcess (command, args, path, monitor.Log, streamWriter, null);
+ p.WaitForExit ();
+ streamWriter.Flush ();
+ stream.Position = 0;
+ return stream;
+ }
+
+ protected BuildResult ParseGenerationResult (Stream result, ProgressMonitor monitor)
+ {
+ var results = new BuildResult ();
+ result.Position = 0;
+ var sr = new StreamReader (result);
+ var sb = new StringBuilder ();
+ string line;
+ string fileName = "";
+ int lineNumber = 0;
+ bool isWarning = false;
+
+ while ((line = sr.ReadLine ()) != null) {
+ //e.g. CMake Warning in/at CMakeLists.txt:10 (COMMAND):
+ //or: CMake Warning:
+ if (line.StartsWith ("CMake Warning", StringComparison.OrdinalIgnoreCase)) {
+ //reset everything and add last error or warning.
+ if (sb.Length > 0) {
+ if (isWarning)
+ results.AddWarning (fileName, lineNumber, 0, "", sb.ToString ());
+ else
+ results.AddError (fileName, lineNumber, 0, "", sb.ToString ());
+ }
+
+ sb.Clear ();
+ fileName = "";
+ lineNumber = 0;
+ isWarning = true;
+
+ // in/at CMakeLists.txt:10 (COMMAND):
+ if (line.Contains (" in ")) {
+ Tuple<int, string> t = GetFileAndLine (line, " in ");
+ lineNumber = t.Item1;
+ fileName = t.Item2;
+ } else if (line.Contains (" at ")) {
+ Tuple<int, string> t = GetFileAndLine (line, " at ");
+ lineNumber = t.Item1;
+ fileName = t.Item2;
+ } else {
+ string [] warning = line.Split (':');
+ if (!string.IsNullOrEmpty (warning.ElementAtOrDefault (1))) {
+ sb.Append (warning [1]);
+ }
+ }
+ } else if (line.StartsWith ("CMake Error", StringComparison.OrdinalIgnoreCase)) {
+ //reset everything and add last error or warning.
+ if (sb.Length > 0) {
+ if (isWarning)
+ results.AddWarning (fileName, lineNumber, 0, "", sb.ToString ());
+ else
+ results.AddError (fileName, lineNumber, 0, "", sb.ToString ());
+ }
+
+ sb.Clear ();
+ fileName = "";
+ lineNumber = 0;
+ isWarning = false;
+
+ // in/at CMakeLists.txt:10 (COMMAND):
+ if (line.Contains (" in ")) {
+ Tuple<int, string> t = GetFileAndLine (line, " in ");
+ lineNumber = t.Item1;
+ fileName = t.Item2;
+ } else if (line.Contains (" at ")) {
+ Tuple<int, string> t = GetFileAndLine (line, " at ");
+ lineNumber = t.Item1;
+ fileName = t.Item2;
+ } else {
+ string [] error = line.Split (':');
+ if (!string.IsNullOrEmpty (error.ElementAtOrDefault (1))) {
+ sb.Append (error [1]);
+ }
+ }
+ } else {
+ sb.Append (line);
+ }
+ }
+
+ return results;
+ }
+
+ public static CMakeToolchain GetToolchain ()
+ {
+ string toolchainName;
+ toolchainName = PropertyService.Get<string> ("CBinding.DefaultToolchain", null);
+ return AddinManager.GetExtensionObjects<CMakeToolchain> ("/CBinding/Toolchains")
+ .FirstOrDefault<CMakeToolchain> (toolchain => toolchain.ToolchainName == toolchainName)
+ ?? GetDefaultToolchain ();
+ }
+
+ public static CMakeToolchain GetDefaultToolchain ()
+ {
+ if (Platform.IsWindows)
+ return new MinGW32Toolchain ();
+ else if (Platform.IsLinux)
+ return new UnixMakeToolchain ();
+ else if (Platform.IsMac)
+ return new MacMakeToolchain ();
+ else return new MinGW32Toolchain ();
+ }
+
+ /// <summary>
+ /// Use cmake to generate makefiles for this toolchain.
+ /// </summary>
+ /// <returns>The makefiles.</returns>
+ /// <param name="projectName">Project name.</param>
+ /// <param name="outputDirectory">Output directory.</param>
+ /// <param name="monitor">Monitor.</param>
+ public virtual Task<BuildResult> GenerateMakefiles (string projectName, FilePath outputDirectory, ProgressMonitor monitor)
+ {
+ string arguments = "../";
+ if(!string.IsNullOrEmpty (GeneratorID)) {
+ arguments += $" -G\"{GeneratorID}\"";
+ }
+ if(!string.IsNullOrEmpty (ToolchainID)) {
+ arguments += $" -T\"{ToolchainID}\"";
+ }
+ if(!string.IsNullOrEmpty (CMakeCacheEntry)) {
+ arguments += $" -D{CMakeCacheEntry}";
+ }
+
+ monitor.BeginStep ("Generating build files...");
+ Stream generationResult = ExecuteCommand ("cmake", arguments, outputDirectory, monitor);
+ BuildResult results = ParseGenerationResult (generationResult, monitor);
+ monitor.EndStep ();
+
+ Task<Stream> buildResult = Build (projectName, outputDirectory, monitor);
+
+ return Task.FromResult (results);
+ }
+
+ public virtual Task<Stream> Build (string projectName, FilePath outputDirectory, ProgressMonitor monitor)
+ {
+ monitor.BeginStep ("Building...");
+ Stream buildResult = ExecuteCommand ("cmake", "--build ./", outputDirectory, monitor);
+ monitor.EndStep ();
+ return Task.FromResult (buildResult);
+ }
+
+ public virtual Task<BuildResult> Clean (string projectName, FilePath outputDirectory, ProgressMonitor monitor)
+ {
+ monitor.BeginStep ("Cleaning...");
+ Stream buildResult = ExecuteCommand ("cmake", "--build ./ --target clean", outputDirectory, monitor);
+ monitor.EndStep ();
+ BuildResult results = ParseGenerationResult (buildResult, monitor);
+ return Task.FromResult (results);
+ }
+
+ public virtual Task<Stream> Rebuild (string projectName, FilePath outputDirectory, ProgressMonitor monitor)
+ {
+ monitor.BeginStep ("Rebuilding...");
+ Stream buildResult = ExecuteCommand ("cmake", "--build ./ --clean-first", outputDirectory, monitor);
+ monitor.EndStep ();
+ return Task.FromResult (buildResult);
+ }
+ }
+}
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/gui/codegenerationpanel.cs b/codegenerationpanel.cs
index 3940f30..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/gui/codegenerationpanel.cs
+++ b/codegenerationpanel.cs
@@ -1,418 +0,0 @@
-//
-// CodeGenerationPanel.cs: Code generation panel to configure project
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using MonoDevelop.Core;
-using MonoDevelop.Ide.Gui.Dialogs;
-using MonoDevelop.Components;
-using MonoDevelop.Ide;
-using MonoDevelop.Projects;
-
-namespace CBinding
-{
- public partial class CodeGenerationPanel : Gtk.Bin
- {
- private CProjectConfiguration configuration;
- private Gtk.ListStore libStore = new Gtk.ListStore (typeof(string));
- private Gtk.ListStore libPathStore = new Gtk.ListStore (typeof(string));
- private Gtk.ListStore includePathStore = new Gtk.ListStore (typeof(string));
-
- static string[,] quickPathInsertMenu = new string[,] {
- { GettextCatalog.GetString ("_Project Directory"), "${ProjectDir}" },
- { GettextCatalog.GetString ("_Root Solution Directory"), "${CombineDir}" },
- };
-
- public CodeGenerationPanel ()
- {
- this.Build ();
-
- Gtk.CellRendererText textRenderer = new Gtk.CellRendererText ();
-
- libTreeView.Model = libStore;
- libTreeView.HeadersVisible = false;
- libTreeView.AppendColumn ("Library", textRenderer, "text", 0);
-
- libPathTreeView.Model = libPathStore;
- libPathTreeView.HeadersVisible = false;
- libPathTreeView.AppendColumn ("Library", textRenderer, "text", 0);
-
- includePathTreeView.Model = includePathStore;
- includePathTreeView.HeadersVisible = false;
- includePathTreeView.AppendColumn ("Include", textRenderer, "text", 0);
-
- new MenuButtonEntry (libPathEntry, quickInsertLibButton, quickPathInsertMenu);
- new MenuButtonEntry (includePathEntry, quickInsertIncludeButton, quickPathInsertMenu);
- }
-
- public void Load (CProjectConfiguration config)
- {
- configuration = config;
-
- switch (configuration.CVersion) {
- case CVersion.CustomVersionString:
- CVersionComboBox.Active = 0;
- customVersionStringTextEntry.Text = configuration.CustomVersionString;
- break;
- case CVersion.ISOC:
- CVersionComboBox.Active = 1;
- break;
- case CVersion.C99:
- CVersionComboBox.Active = 2;
- break;
- case CVersion.C11:
- CVersionComboBox.Active = 3;
- break;
- case CVersion.ISOCPP:
- CVersionComboBox.Active = 4;
- break;
- case CVersion.CPP03:
- CVersionComboBox.Active = 5;
- break;
- case CVersion.CPP11:
- CVersionComboBox.Active = 6;
- break;
- }
-
- switch (configuration.WarningLevel) {
- case WarningLevel.None:
- noWarningRadio.Active = true;
- break;
- case WarningLevel.Normal:
- normalWarningRadio.Active = true;
- break;
- case WarningLevel.All:
- allWarningRadio.Active = true;
- break;
- }
-
- warningsAsErrorsCheckBox.Active = configuration.WarningsAsErrors;
-
- optimizationSpinButton.Value = configuration.OptimizationLevel;
-
- switch (configuration.CompileTarget) {
- case CompileTarget.Exe:
- targetComboBox.Active = 0;
- break;
- case CompileTarget.Library:
- targetComboBox.Active = 1;
- break;
- case CompileTarget.Module:
- targetComboBox.Active = 2;
- break;
- }
-
- extraCompilerTextView.Buffer.Text = configuration.ExtraCompilerArguments;
-
- extraLinkerTextView.Buffer.Text = configuration.ExtraLinkerArguments;
-
- defineSymbolsTextEntry.Text = configuration.DefineSymbols;
-
- libStore.Clear ();
- foreach (string lib in configuration.Libs)
- libStore.AppendValues (lib);
-
- libPathStore.Clear ();
- foreach (string libPath in configuration.LibPaths)
- libPathStore.AppendValues (libPath);
-
- includePathStore.Clear ();
- foreach (string includePath in configuration.Includes)
- includePathStore.AppendValues (includePath);
- }
-
- private void OnIncludePathAdded (object sender, EventArgs e)
- {
- if (includePathEntry.Text.Length > 0) {
- includePathStore.AppendValues (includePathEntry.Text);
- includePathEntry.Text = string.Empty;
- }
- }
-
- private void OnIncludePathRemoved (object sender, EventArgs e)
- {
- Gtk.TreeIter iter;
- includePathTreeView.Selection.GetSelected (out iter);
- includePathStore.Remove (ref iter);
- }
-
- private void OnLibPathAdded (object sender, EventArgs e)
- {
- if (libPathEntry.Text.Length > 0) {
- libPathStore.AppendValues (libPathEntry.Text);
- libPathEntry.Text = string.Empty;
- }
- }
-
- private void OnLibPathRemoved (object sender, EventArgs e)
- {
- Gtk.TreeIter iter;
- libPathTreeView.Selection.GetSelected (out iter);
- libPathStore.Remove (ref iter);
- }
-
- private void OnLibAdded (object sender, EventArgs e)
- {
- if (libAddEntry.Text.Length > 0) {
- libStore.AppendValues (libAddEntry.Text);
- libAddEntry.Text = string.Empty;
- }
- }
-
- private void OnLibRemoved (object sender, EventArgs e)
- {
- Gtk.TreeIter iter;
- libTreeView.Selection.GetSelected (out iter);
- libStore.Remove (ref iter);
- }
-
- // TODO: This is platform specific... the C Binding should have a global list of 'standard' library dirs...
- internal const string DEFAULT_LIB_DIR = "/usr/lib";
- internal const string DEFAULT_INCLUDE_DIR = "/usr/lib";
- internal const string STATIC_LIB_FILTER = "*.a";
- internal const string DYNAMIC_LIB_FILTER = "*.so";
-
- private void OnBrowseButtonClick (object sender, EventArgs e)
- {
- var dialog = new MonoDevelop.Components.SelectFileDialog (GettextCatalog.GetString ("Add Library")) {
- TransientFor = (Gtk.Window)Toplevel,
- CurrentFolder = DEFAULT_LIB_DIR,
- };
-
- dialog.AddFilter (GettextCatalog.GetString ("Static Library"), STATIC_LIB_FILTER);
- dialog.AddFilter (GettextCatalog.GetString ("Dynamic Library"), DYNAMIC_LIB_FILTER);
- dialog.AddAllFilesFilter ();
-
- if (dialog.Run ())
- libAddEntry.Text = dialog.SelectedFile;
- }
-
- private void OnIncludePathBrowseButtonClick (object sender, EventArgs e)
- {
- var dialog = new MonoDevelop.Components.SelectFolderDialog (GettextCatalog.GetString ("Add Path")) {
- TransientFor = (Gtk.Window)Toplevel,
- CurrentFolder = DEFAULT_INCLUDE_DIR,
- };
-
- if (dialog.Run ())
- includePathEntry.Text = dialog.SelectedFile;
- }
-
- private void OnLibPathBrowseButtonClick (object sender, EventArgs e)
- {
- var dialog = new MonoDevelop.Components.SelectFolderDialog (GettextCatalog.GetString ("Add Path")) {
- TransientFor = (Gtk.Window)Toplevel,
- CurrentFolder = DEFAULT_LIB_DIR,
- };
-
- if (dialog.Run ())
- libPathEntry.Text = dialog.SelectedFile;
- }
-
- public bool Store ()
- {
- if (configuration == null)
- return false;
-
- string line;
-
- Gtk.TreeIter iter;
- switch (CVersionComboBox.Active) {
- case 0:
- configuration.CVersion = CVersion.CustomVersionString;
- configuration.CustomVersionString = customVersionStringTextEntry.Text;
- break;
- case 1:
- configuration.CVersion = CVersion.ISOC;
- break;
- case 2:
- configuration.CVersion = CVersion.C99;
- break;
- case 3:
- configuration.CVersion = CVersion.C11;
- break;
- case 4:
- configuration.CVersion = CVersion.ISOCPP;
- break;
- case 5:
- configuration.CVersion = CVersion.CPP03;
- break;
- case 6:
- configuration.CVersion = CVersion.CPP11;
- break;
- }
-
-
- if (noWarningRadio.Active)
- configuration.WarningLevel = WarningLevel.None;
- else if (normalWarningRadio.Active)
- configuration.WarningLevel = WarningLevel.Normal;
- else
- configuration.WarningLevel = WarningLevel.All;
-
- configuration.WarningsAsErrors = warningsAsErrorsCheckBox.Active;
-
- configuration.OptimizationLevel = (int)optimizationSpinButton.Value;
-
- switch (targetComboBox.ActiveText) {
- case "Executable":
- configuration.CompileTarget = CompileTarget.Exe;
- break;
- case "Static Library":
- configuration.CompileTarget = CompileTarget.Library;
- break;
- case "Shared Object":
- configuration.CompileTarget = CompileTarget.Module;
- break;
- }
-
- configuration.ExtraCompilerArguments = extraCompilerTextView.Buffer.Text;
-
- configuration.ExtraLinkerArguments = extraLinkerTextView.Buffer.Text;
-
- configuration.DefineSymbols = defineSymbolsTextEntry.Text;
-
- libStore.GetIterFirst (out iter);
- configuration.Libs.Clear ();
- while (libStore.IterIsValid (iter)) {
- line = (string)libStore.GetValue (iter, 0);
- configuration.Libs.Add (line);
- libStore.IterNext (ref iter);
- }
-
- libPathStore.GetIterFirst (out iter);
- configuration.LibPaths.Clear ();
- while (libPathStore.IterIsValid (iter)) {
- line = (string)libPathStore.GetValue (iter, 0);
- configuration.LibPaths.Add (line);
- libPathStore.IterNext (ref iter);
- }
-
- includePathStore.GetIterFirst (out iter);
- configuration.Includes.Clear ();
- while (includePathStore.IterIsValid (iter)) {
- line = (string)includePathStore.GetValue (iter, 0);
- configuration.Includes.Add (line);
- includePathStore.IterNext (ref iter);
- }
-
- return true;
- }
-
- protected virtual void OnLibAddEntryChanged (object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty (libAddEntry.Text))
- addLibButton.Sensitive = false;
- else
- addLibButton.Sensitive = true;
- }
-
- protected virtual void OnLibTreeViewCursorChanged (object sender, System.EventArgs e)
- {
- removeLibButton.Sensitive = true;
- }
-
- protected virtual void OnRemoveLibButtonClicked (object sender, System.EventArgs e)
- {
- removeLibButton.Sensitive = false;
- }
-
- protected virtual void OnIncludePathEntryChanged (object sender, System.EventArgs e)
- {
- if (string.IsNullOrEmpty (includePathEntry.Text))
- includePathAddButton.Sensitive = false;
- else
- includePathAddButton.Sensitive = true;
- }
-
- protected virtual void OnLibPathEntryChanged (object sender, System.EventArgs e)
- {
- if (string.IsNullOrEmpty (libPathEntry.Text))
- libPathAddButton.Sensitive = false;
- else
- libPathAddButton.Sensitive = true;
- }
-
- protected virtual void OnIncludePathTreeViewCursorChanged (object sender, System.EventArgs e)
- {
- includePathRemoveButton.Sensitive = true;
- }
-
- protected virtual void OnIncludePathRemoveButtonClicked (object sender, System.EventArgs e)
- {
- includePathRemoveButton.Sensitive = false;
- }
-
- protected virtual void OnLibPathTreeViewCursorChanged (object sender, System.EventArgs e)
- {
- libPathRemoveButton.Sensitive = true;
- }
-
- protected virtual void OnLibPathRemoveButtonClicked (object sender, System.EventArgs e)
- {
- libPathRemoveButton.Sensitive = false;
- }
-
- protected virtual void OnLibAddEntryActivated (object sender, System.EventArgs e)
- {
- OnLibAdded (this, new EventArgs ());
- }
-
- protected virtual void OnIncludePathEntryActivated (object sender, System.EventArgs e)
- {
- OnIncludePathAdded (this, new EventArgs ());
- }
-
- protected virtual void OnLibPathEntryActivated (object sender, System.EventArgs e)
- {
- OnLibPathAdded (this, new EventArgs ());
- }
- }
-
- public class CodeGenerationPanelBinding : MultiConfigItemOptionsPanel
- {
- private CodeGenerationPanel panel;
-
- public override Control CreatePanelWidget ()
- {
- return panel = new CodeGenerationPanel ();
- }
-
- public override void LoadConfigData ()
- {
- panel.Load ((CProjectConfiguration)CurrentConfiguration);
- }
-
- public override void ApplyChanges ()
- {
- panel.Store ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/gui/compilerpanel.cs b/compilerpanel.cs
index 1cbd7f4..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/gui/compilerpanel.cs
+++ b/compilerpanel.cs
@@ -1,128 +0,0 @@
-//
-// CompilerPanel.cs: Allows the user to select what compiler to use for their project
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using Mono.Addins;
-
-using MonoDevelop.Components;
-using MonoDevelop.Ide.Gui.Dialogs;
-using MonoDevelop.Ide;
-
-namespace CBinding
-{
- public partial class CompilerPanel : Gtk.Bin
- {
- private CProject project;
- private object[] compilers;
- private ICompiler active_compiler;
-
- public CompilerPanel (CProject project)
- {
- this.Build ();
-
- this.project = project;
-
- compilers = AddinManager.GetExtensionObjects ("/CBinding/Compilers");
-
- foreach (ICompiler compiler in compilers) {
- compilerComboBox.AppendText (compiler.Name);
- }
-
- int active = 0;
- Gtk.TreeIter iter;
- Gtk.ListStore store = (Gtk.ListStore)compilerComboBox.Model;
- store.GetIterFirst (out iter);
- while (store.IterIsValid (iter)) {
- if ((string)store.GetValue (iter, 0) == project.Compiler.Name) {
- break;
- }
- store.IterNext (ref iter);
- active++;
- }
-
- compilerComboBox.Active = active;
-
- useCcacheCheckBox.Active = ((CProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration)).UseCcache;
-
- Update ();
- }
-
- public void Store ()
- {
- if (project == null)
- return;
-
- if (!active_compiler.Equals (project.Compiler)) {
- project.Compiler = active_compiler;
- project.Language = active_compiler.Language;
- }
-
- // Update use_ccache for all configurations
- foreach (CProjectConfiguration conf in project.Configurations)
- conf.UseCcache = useCcacheCheckBox.Active;
- }
-
- protected virtual void OnCompilerComboBoxChanged (object sender, EventArgs e)
- {
- Update ();
- }
-
- private void Update ()
- {
- foreach (ICompiler compiler in compilers) {
- if (compilerComboBox.ActiveText == compiler.Name) {
- active_compiler = compiler;
- break;
- }
- }
-
- if (active_compiler.SupportsCcache)
- useCcacheCheckBox.Sensitive = true;
- else
- useCcacheCheckBox.Sensitive = false;
- }
- }
-
- public class CompilerPanelBinding : ItemOptionsPanel
- {
- CompilerPanel panel;
-
- public override Control CreatePanelWidget ()
- {
- return panel = new CompilerPanel ((CProject)ConfiguredProject);
- }
-
- public override void ApplyChanges ()
- {
- panel.Store ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/parser/cparseddocument.cs b/caddin/cbinding/cbinding/parser/cparseddocument.cs
index d703e53..74107fa 100644
--- a/cbindingreport/cbinding/cbinding/parser/cparseddocument.cs
+++ b/caddin/cbinding/cbinding/parser/cparseddocument.cs
@@ -37,17 +37,17 @@ namespace CBinding.Parser
public class CParsedDocument : DefaultParsedDocument {
public CXTranslationUnit TU;
public CLangManager Manager { get; private set;}
- public CProject Project { get; set;}
+ public CMakeProject Project { get; set; }
List<CXUnsavedFile> unsavedFiles;
- void Initialize (CProject proj)
+ void Initialize (CMakeProject proj)
{
Project = proj;
Manager = proj.ClangManager;
unsavedFiles = new List<CXUnsavedFile> ();
}
- public CParsedDocument(CProject proj, string fileName) : base(fileName)
+ public CParsedDocument (CMakeProject proj, string fileName) : base (fileName)
{
Initialize (proj);
unsavedFiles = Project.UnsavedFiles.Get ();
diff --git a/cbindingreport/cbinding/cbinding/project/cproject.cs b/cproject.cs
index 48ff5c6..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/project/cproject.cs
+++ b/cproject.cs
@@ -1,550 +0,0 @@
-//
-// CProject.cs: C/C++ Project
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.IO;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Xml;
-using Mono.Addins;
-using MonoDevelop.Core;
-using MonoDevelop.Core.Execution;
-using MonoDevelop.Core.Serialization;
-using MonoDevelop.Ide;
-using MonoDevelop.Projects;
-
-namespace CBinding
-{
- public enum Language {
- C,
- CPP,
- OBJC,
- OBJCPP
- }
-
- public enum CProjectCommands {
- AddPackage,
- UpdateClassPad,
- ShowPackageDetails,
- GotoDeclaration,
- }
-
- [ExportProjectType ("{2857B73E-F847-4B02-9238-064979017E93}", Extension="cproj", Alias="C/C++")]
- public class CProject : Project
- {
- [ItemProperty ("Compiler", ValueType = typeof(CCompiler))]
- public ICompiler CompilerManager { get; set; }
-
- [ItemProperty ("Language")]
- public Language Language { get; set; }
-
- [ItemProperty ("OutputType", DefaultValue = CompileTarget.Exe)]
- public CompileTarget target { get; set; }
-
- public bool HasLibClang { get; private set; }
-
- public CLangManager ClangManager { get; private set; }
-
- public SymbolDatabaseMediator DB { get; private set; }
-
- public UnsavedFilesManager UnsavedFiles { get; private set; }
-
- ProjectPackageCollection packages = new ProjectPackageCollection ();
-
- public event ProjectPackageEventHandler PackageAddedToProject;
- public event ProjectPackageEventHandler PackageRemovedFromProject;
-
- /// <summary>
- /// Extensions for C/C++ source files
- /// </summary>
- public static string[] SourceExtensions = { ".C", ".CC", ".CPP", ".CXX", ".M", ".MM" };
-
- /// <summary>
- /// Extensions for C/C++ header files
- /// </summary>
- public static string[] HeaderExtensions = { ".H", ".HH", ".HPP", ".HXX" };
-
- /// <summary>
- /// Initialize this instance.
- /// </summary>
- protected override void OnInitialize ()
- {
- base.OnInitialize ();
- packages.Project = this;
- try {
- ClangManager = new CLangManager (this);
- DB = new SymbolDatabaseMediator (this, ClangManager);
- UnsavedFiles = new UnsavedFilesManager (this);
- HasLibClang = true;
- } catch (DllNotFoundException ex) {
- LoggingService.LogError ("Could not load libclang", ex);
- HasLibClang = false;
- }
- }
-
- /// <summary>
- /// Initializes from template.
- /// </summary>
- /// <param name="projectCreateInfo">Project create info.</param>
- /// <param name="template">Template.</param>
- protected override void OnInitializeFromTemplate (ProjectCreateInformation projectCreateInfo, XmlElement template)
- {
- base.OnInitializeFromTemplate (projectCreateInfo, template);
- string binPath = ".";
- if (projectCreateInfo != null) {
- Name = projectCreateInfo.ProjectName;
- binPath = projectCreateInfo.BinPath;
- }
- Compiler = null; // use default compiler depending on language
- var configuration =
- (CProjectConfiguration)CreateConfiguration ("Debug");
- configuration.DefineSymbols = "DEBUG MONODEVELOP";
- configuration.DebugSymbols = true;
- Configurations.Add (configuration);
-
- configuration =
- (CProjectConfiguration)CreateConfiguration ("Release");
- configuration.DebugSymbols = false;
- configuration.OptimizationLevel = 3;
- configuration.DefineSymbols = "MONODEVELOP";
- Configurations.Add (configuration);
-
- foreach (CProjectConfiguration c in Configurations) {
- c.OutputDirectory = Path.Combine (binPath, c.Id);
- c.SourceDirectory = projectCreateInfo.ProjectBasePath;
- c.Output = Name;
-
- if (template != null) {
- if (template.Attributes ["LanguageName"] != null) {
- string languageName = template.Attributes ["LanguageName"].InnerText;
- switch (languageName) {
- case "C":
- this.Language = Language.C;
- break;
- case "C++":
- this.Language = Language.CPP;
- break;
- case "Objective-C":
- this.Language = Language.OBJC;
- break;
- case "Objective-C++":
- this.Language = Language.OBJCPP;
- break;
- }
- }
- if (template.Attributes ["Target"] != null) {
- c.CompileTarget = (CompileTarget)Enum.Parse (
- typeof(CompileTarget),
- template.Attributes ["Target"].InnerText);
- }
- if (template.GetAttribute ("ExternalConsole") == "True") {
- c.ExternalConsole = true;
- c.PauseConsoleOutput = true;
- }
- if (template.Attributes ["PauseConsoleOutput"] != null) {
- c.PauseConsoleOutput = bool.Parse (
- template.Attributes ["PauseConsoleOutput"].InnerText);
- }
- if (template.Attributes ["CompilerArgs"].InnerText != null) {
- c.ExtraCompilerArguments = template.Attributes ["CompilerArgs"].InnerText;
- }
- if (template.Attributes ["LinkerArgs"].InnerText != null) {
- c.ExtraLinkerArguments = template.Attributes ["LinkerArgs"].InnerText;
- }
- }
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CBinding.CProject"/> class.
- /// Must call Initialize* after.
- /// </summary>
- public CProject ()
- {
- }
-
- /// <summary>
- /// Returns with the languages supported by the project
- /// </summary>
- protected override string[] OnGetSupportedLanguages ()
- {
- return new string[] { "C", "C++", "Objective-C", "Objective-C++" };
- }
-
- /// <summary>
- /// Gets or sets the compile target.
- /// </summary>
- /// <value>The compile target.</value>
- public CompileTarget CompileTarget {
- get { return target; }
- set { target = value; }
- }
-
- /// <summary>
- /// Returns if the file represented by fileName is a compileable file.
- /// </summary>
- /// <param name="fileName">File name.</param>
- protected override bool OnGetIsCompileable (string fileName)
- {
- string ext = Path.GetExtension (fileName.ToUpper ());
- return (-1 != Array.IndexOf (SourceExtensions, ext) || -1 != Array.IndexOf (HeaderExtensions, ext) );
- }
-
- /// <summary>
- /// Returns with the referenced items of the project.
- /// </summary>
- /// <param name="configuration">Configuration.</param>
- protected override IEnumerable<SolutionItem> OnGetReferencedItems (ConfigurationSelector configuration)
- {
- foreach (var p in base.OnGetReferencedItems (configuration))
- yield return p;
-
- if (ParentSolution == null)
- yield break;
-
- foreach (Package p in Packages) {
- if (p.IsProject && p.Name != Name) {
- var cp = ParentSolution.FindProjectByName (p.Name) as CProject;
- if (cp != null)
- yield return cp;
- }
- }
- }
-
- /// <summary>
- /// Determines if a header file is specified by filename.
- /// </summary>
- /// <returns><c>true</c> if a header file is specified by filename; otherwise, <c>false</c>.</returns>
- /// <param name="filename">Filename.</param>
- public static bool IsHeaderFile (string filename)
- {
- return (0 <= Array.IndexOf (HeaderExtensions, Path.GetExtension (filename.ToUpper ())));
- }
-
- /// <summary>
- /// Ths pkg-config package is for internal MonoDevelop use only, it is not deployed.
- /// </summary>
- public void WriteMDPkgPackage (ConfigurationSelector configuration)
- {
- string pkgfile = Path.Combine (BaseDirectory, Name + ".md.pc");
-
- CProjectConfiguration config = (CProjectConfiguration)GetConfiguration (configuration);
- while (config == null) {
- Thread.Sleep (20);
- config = (CProjectConfiguration)GetConfiguration (configuration);
- }
-
- List<string> headerDirectories = new List<string> ();
-
- foreach (ProjectFile f in Files) {
- if (IsHeaderFile (f.Name)) {
- string dir = Path.GetDirectoryName (f.FilePath);
-
- if (!headerDirectories.Contains (dir)) {
- headerDirectories.Add (dir);
- }
- }
- }
-
- using (StreamWriter writer = new StreamWriter (pkgfile)) {
- writer.WriteLine ("Name: {0}", Name);
- writer.WriteLine ("Description: {0}", Description);
- writer.WriteLine ("Version: {0}", Version);
- writer.WriteLine ("Libs: -L\"{0}\" -l{1}", config.OutputDirectory, config.Output.StartsWith ("lib", StringComparison.OrdinalIgnoreCase)?
- config.Output.Substring (3):
- config.Output);
-// writer.WriteLine ("Cflags: -I{0}", BaseDirectory);
- writer.WriteLine ("Cflags: -I\"{0}\"", string.Join ("\" -I\"", headerDirectories.ToArray ()));
- }
-
- // If this project compiles into a shared object we need to
- // export the output path to the LD_LIBRARY_PATH
- string literal = "LD_LIBRARY_PATH";
- string ld_library_path = Environment.GetEnvironmentVariable (literal);
-
- if (string.IsNullOrEmpty (ld_library_path)) {
- Environment.SetEnvironmentVariable (literal, config.OutputDirectory);
- } else if (!ld_library_path.Contains (config.OutputDirectory)) {
- ld_library_path = string.Format ("{0}:{1}", config.OutputDirectory, ld_library_path);
- Environment.SetEnvironmentVariable (literal, ld_library_path);
- }
- }
-
- /// <summary>
- /// This is the pkg-config package that gets deployed.
- /// <returns>The pkg-config package's filename</returns>
- /// </summary>
- string WriteDeployablePgkPackage (Project project, CProjectConfiguration config)
- {
- // FIXME: This should probably be grabed from somewhere.
- string prefix = "/usr/local";
- string pkgfile = Path.Combine (BaseDirectory, Name + ".pc");
-
- using (StreamWriter writer = new StreamWriter (pkgfile)) {
- writer.WriteLine ("prefix={0}", prefix);
- writer.WriteLine ("exec_prefix=${prefix}");
- writer.WriteLine ("libdir=${exec_prefix}/lib");
- writer.WriteLine ("includedir=${prefix}/include");
- writer.WriteLine ();
- writer.WriteLine ("Name: {0}", Name);
- writer.WriteLine ("Description: {0}", Description);
- writer.WriteLine ("Version: {0}", Version);
- writer.WriteLine ("Requires: {0}", string.Join (" ", Packages.ToStringArray ()));
- // TODO: How should I get this?
- writer.WriteLine ("Conflicts: {0}", string.Empty);
- writer.Write ("Libs: -L${libdir} ");
- writer.WriteLine ("-l{0}", config.Output.StartsWith ("lib", StringComparison.OrdinalIgnoreCase)?
- config.Output.Substring (3):
- config.Output);
- writer.Write ("Cflags: -I${includedir}/");
- writer.WriteLine ("{0} {1}", Name, Compiler.GetDefineFlags (project, config));
- }
-
- return pkgfile;
- }
-
- /// <summary>
- /// Builds the project.
- /// </summary>
- /// <returns>The build result.</returns>
- /// <param name="monitor">Progress monitor.</param>
- /// <param name="configuration">Configuration to build.</param>
- /// <remarks>This method is invoked to build the project. Support files such as files with the Copy to Output flag will
- /// be copied before calling this method.</remarks>
- protected override Task<BuildResult> DoBuild (ProgressMonitor monitor, ConfigurationSelector configuration)
- {
- var pc = (CProjectConfiguration) GetConfiguration (configuration);
- pc.SourceDirectory = BaseDirectory;
-
- return Task<BuildResult>.Factory.StartNew (delegate {
- return CompilerManager.Compile (this,
- Files, packages,
- pc,
- monitor);
- });
- }
-
- /// <summary>
- /// Cleans the files produced by this solution item
- /// </summary>
- /// <param name="monitor">A progress monitor</param>
- /// <param name="configuration">Configuration to use to clean the project</param>
- /// <param name="operationContext">Operation context.</param>
- protected async override Task<BuildResult> OnClean (ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
- {
- var conf = (CProjectConfiguration) GetConfiguration (configuration);
-
- var res = await base.OnClean (monitor, configuration, operationContext);
- if (res.HasErrors)
- return res;
-
- await Task.Run (() => Compiler.Clean (Files, conf, monitor));
-
- return res;
- }
-
- /// <summary>
- /// Creates the execution command for the project.
- /// </summary>
- /// <returns>The execution command.</returns>
- /// <param name="conf">Conf.</param>
- protected virtual ExecutionCommand CreateExecutionCommand (CProjectConfiguration conf)
- {
- string app = Path.Combine (conf.OutputDirectory, conf.Output);
- var cmd = new NativeExecutionCommand (app);
- cmd.Arguments = conf.CommandLineParameters;
- cmd.WorkingDirectory = Path.GetFullPath (conf.OutputDirectory);
- cmd.EnvironmentVariables = conf.EnvironmentVariables;
- return cmd;
- }
-
- /// <summary>
- /// Determines whether this solution item can be executed using the specified context and configuration.
- /// </summary>
- /// <param name="context">Context.</param>
- /// <param name="solutionConfiguration">Solution configuration.</param>
- protected override bool OnGetCanExecute (MonoDevelop.Projects.ExecutionContext context, ConfigurationSelector solutionConfiguration)
- {
- var conf = (CProjectConfiguration) GetConfiguration (solutionConfiguration);
- ExecutionCommand cmd = CreateExecutionCommand (conf);
- return (target == CompileTarget.Exe) && context.ExecutionHandler.CanExecute (cmd);
- }
-
- /// <summary>
- /// Executes the project
- /// </summary>
- /// <param name="monitor">Progress monitor.</param>
- /// <param name="context">Execution context.</param>
- /// <param name="configuration">Configuration to execute.</param>
- /// <returns>The execute.</returns>
- protected async override Task DoExecute (ProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, ConfigurationSelector configuration)
- {
- var conf = (CProjectConfiguration) GetConfiguration (configuration);
- bool pause = conf.PauseConsoleOutput;
- OperationConsole console;
-
- if (conf.CompileTarget != CompileTarget.Exe) {
- MessageService.ShowMessage ("Compile target is not an executable!");
- return;
- }
-
- monitor.Log.WriteLine ("Running project...");
-
- if (conf.ExternalConsole)
- console = context.ExternalConsoleFactory.CreateConsole (!pause, monitor.CancellationToken);
- else
- console = context.ConsoleFactory.CreateConsole (monitor.CancellationToken);
-
- try {
- ExecutionCommand cmd = CreateExecutionCommand (conf);
- if (!context.ExecutionHandler.CanExecute (cmd)) {
- monitor.ReportError ("Cannot execute \"" + conf.Output + "\". The selected execution mode is not supported for C projects.", null);
- return;
- }
-
- ProcessAsyncOperation op = context.ExecutionHandler.Execute (cmd, console);
- using (var t = monitor.CancellationToken.Register (op.Cancel))
- await op.Task;
-
- monitor.Log.WriteLine ("The operation exited with code: {0}", op.ExitCode);
- } catch (Exception ex) {
- LoggingService.LogError (string.Format ("Cannot execute \"{0}\"", conf.Output), ex);
- monitor.ReportError ("Cannot execute \"" + conf.Output + "\"", ex);
- } finally {
- console.Dispose ();
- }
- }
-
- /// <summary>
- /// Returns with output bomPresentInFile </summary>
- /// <param name="configuration">Configuration.</param>
- protected override FilePath OnGetOutputFileName (ConfigurationSelector configuration)
- {
- var conf = (CProjectConfiguration) GetConfiguration (configuration);
- return conf.OutputDirectory.Combine (conf.CompiledOutputName);
- }
-
- /// <summary>
- /// Create an empty configuration for project. Must fill configuration after.
- /// </summary>
- /// <param name="id">Name.</param>
- /// <param name="kind">Kind.</param>
- protected override SolutionItemConfiguration OnCreateConfiguration (string id, ConfigurationKind kind)
- {
- return new CProjectConfiguration (id);
- }
-
- /// <summary>
- /// Returns with supported languages as tags. Obligatory for Add files dialog.
- /// </summary>
- /// <param name="types">Types.</param>
- protected override void OnGetTypeTags (HashSet<string> types)
- {
- base.OnGetTypeTags (types);
- types.Add ("C/C++");
- types.Add ("Native");
- }
-
- public ICompiler Compiler {
- get { return CompilerManager; }
- set {
- if (value != null) {
- CompilerManager = value;
- } else {
- object[] compilers = AddinManager.GetExtensionObjects ("/CBinding/Compilers");
- string compiler;
-
- // TODO: This should depend on platform (eg: windows would be mingw or msvc)
- if (Language == Language.C)
- compiler = PropertyService.Get ("CBinding.DefaultCCompiler", new GccCompiler ().Name);
- else
- compiler = PropertyService.Get ("CBinding.DefaultCppCompiler", new GppCompiler ().Name);
-
- foreach (ICompiler c in compilers) {
- if (compiler == c.Name) {
- CompilerManager = c;
- }
- }
- }
- }
- }
-
- // TODO NPM: not supported
- [Browsable(false)]
- [ItemProperty ("Packages")]
- public ProjectPackageCollection Packages {
- get { return packages; }
- set {
- packages = value;
- packages.Project = this;
- }
- }
-
- internal void NotifyPackageRemovedFromProject (Package package)
- {
- Runtime.AssertMainThread ();
- PackageRemovedFromProject (this, new ProjectPackageEventArgs (this, package));
- }
-
- internal void NotifyPackageAddedToProject (Package package)
- {
- Runtime.AssertMainThread ();
- PackageAddedToProject (this, new ProjectPackageEventArgs (this, package));
- }
-
- /// <summary>
- /// Finds the corresponding source or header file
- /// </summary>
- /// <param name="sourceFile">
- /// The name of the file to be matched
- /// <see cref="System.String"/>
- /// </param>
- /// <returns>
- /// The corresponding file, or null if not found
- /// <see cref="System.String"/>
- /// </returns>
- public string MatchingFile (string sourceFile) {
- string filenameStub = Path.GetFileNameWithoutExtension (sourceFile);
- bool wantHeader = !CProject.IsHeaderFile (sourceFile);
-
- foreach (ProjectFile file in this.Files) {
- if (filenameStub == Path.GetFileNameWithoutExtension (file.Name)
- && (wantHeader == IsHeaderFile (file.Name))) {
- return file.Name;
- }
- }
-
- return null;
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/project/cprojectconfiguration.cs b/cprojectconfiguration.cs
index a5cde38..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/project/cprojectconfiguration.cs
+++ b/cprojectconfiguration.cs
@@ -1,232 +0,0 @@
-//
-// CProjectConfiguration.cs: Configuration for C/C++ projects
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-using Mono.Addins;
-
-using MonoDevelop.Projects;
-using MonoDevelop.Core.Serialization;
-
-namespace CBinding
-{
- /// <summary>
- /// C/C++ standard version to use in configuration.
- /// </summary>
- public enum CVersion {
- CustomVersionString,
- ISOC,
- C99,
- C11,
- ISOCPP,
- CPP03,
- CPP11
- }
-
- // TODO: Warning levels should be compiler specific...
- /// <summary>
- /// Warning level.
- /// </summary>
- public enum WarningLevel {
- None,
- Normal,
- All
- }
-
- // I believe it would be in the C/C++ binding's best interest to let the configuration determine
- // which compiler to use... currently the project as a whole does this - which isn't necessarily as flexible
- // as some may require...
- public class CProjectConfiguration : ProjectConfiguration
- {
- public CProjectConfiguration (string id) :base (id)
- {
- }
-
- /// <summary>
- /// The output name.
- /// </summary>
- [ItemProperty("OutputName", DefaultValue = "")]
- public string Output { get; set; }
-
- /// <summary>
- /// The compile target.
- /// </summary>
- [ItemProperty("OutputType", DefaultValue = CompileTarget.Exe)]
- public CompileTarget CompileTarget { get; set; }
-
- [ItemProperty ("Includes")]
- [ItemProperty ("Include", Scope = "*", ValueType = typeof(string))]
- ArrayList includes = new ArrayList ();
-
- [ItemProperty ("LibPaths")]
- [ItemProperty ("LibPath", Scope = "*", ValueType = typeof(string))]
- ArrayList libpaths = new ArrayList ();
-
- [ItemProperty ("Libs")]
- [ItemProperty ("Lib", Scope = "*", ValueType = typeof(string))]
- ArrayList libs = new ArrayList ();
-
- /// <summary>
- /// The C/C++ standard version in use.
- /// </summary>
- [ItemProperty ("CVersion", DefaultValue = CVersion.CustomVersionString)]
- public CVersion CVersion{ get; set; }
-
- /// <summary>
- /// The custom version string.
- /// </summary>
- [ItemProperty ("CustomCVersionString", DefaultValue = "")]
- public string CustomVersionString { get; set; }
-
- /// <summary>
- /// The warning level.
- /// </summary>
- [ItemProperty ("WarningLevel", DefaultValue = WarningLevel.Normal)]
- public WarningLevel WarningLevel { get; set; }
-
- /// <summary>
- /// Specifies if warnings should be treated as errors or not.
- /// </summary>
- [ItemProperty ("WarningsAsErrors", DefaultValue = false)]
- public bool WarningsAsErrors { get; set; }
-
- /// <summary>
- /// The optimization level.
- /// </summary>
- [ItemProperty ("OptimizationLevel", DefaultValue = 0)]
- int optimization;
-
- /// <summary>
- /// Extra compiler arguments given by user.
- /// </summary>
- [ItemProperty ("ExtraCompilerArguments", DefaultValue = "")]
- public string ExtraCompilerArguments { get; set; }
-
- /// <summary>
- /// Extra linker arguments given by user.
- /// </summary>
- [ItemProperty ("ExtraLinkerArguments", DefaultValue = "")]
- public string ExtraLinkerArguments { get; set; }
-
- [ItemProperty ("DefineSymbols", DefaultValue = "")]
- public string DefineSymbols { get; set; }
-
- [ProjectPathItemProperty ("SourceDirectory", DefaultValue = "")]
- public string SourceDirectory { get; set; }
-
- [ItemProperty ("UseCcache", DefaultValue = false)]
- public bool UseCcache { get; set; }
-
- [ItemProperty ("PrecompileHeaders", DefaultValue = true)]
- public bool PrecompileHeaders { get; set; }
-
- public ArrayList Includes {
- get { return includes; }
- set { includes = value; }
- }
-
- public ArrayList LibPaths {
- get { return libpaths; }
- set { libpaths = value; }
- }
-
- public ArrayList Libs {
- get { return libs; }
- set { libs = value; }
- }
-
- // TODO: This should be revised to use the naming conventions depending on OS & compiler...
- /// <summary>
- /// Determines the name of the compiled output.
- /// </summary>
- /// <value>The name of the compiled output.</value>
- public string CompiledOutputName {
- get {
- string suffix = string.Empty;
- string prefix = string.Empty;
-
- //TODO Win&Mac naming
- switch (CompileTarget) {
- case CompileTarget.Exe:
- break;
- case CompileTarget.Module:
- if (!Output.StartsWith ("lib"))
- prefix = "lib";
- if (!Output.EndsWith (".a"))
- suffix = ".a";
- break;
- case CompileTarget.Library:
- if (!Output.StartsWith ("lib"))
- prefix = "lib";
- if (!Output.EndsWith (".so"))
- suffix = ".so";
- break;
- }
-
- return string.Format("{0}{1}{2}", prefix, Output, suffix);
- }
- }
-
- public int OptimizationLevel {
- get { return optimization; }
- set {
- if (value >= 0 && value <= 3)
- optimization = value;
- else
- optimization = 0;
- }
- }
-
- protected override void OnCopyFrom (ItemConfiguration configuration, bool isRename)
- {
- base.OnCopyFrom (configuration, isRename);
-
- var conf = (CProjectConfiguration)configuration;
-
- Output = conf.Output;
- CompileTarget = conf.CompileTarget;
- Includes = conf.Includes;
- LibPaths = conf.LibPaths;
- Libs = conf.Libs;
- SourceDirectory = conf.SourceDirectory;
- UseCcache = conf.UseCcache;
- CVersion = conf.CVersion;
- CustomVersionString = conf.CustomVersionString;
- WarningLevel = conf.WarningLevel;
- WarningsAsErrors = conf.WarningsAsErrors;
- OptimizationLevel = conf.OptimizationLevel;
- ExtraCompilerArguments = conf.ExtraCompilerArguments;
- ExtraLinkerArguments = conf.ExtraLinkerArguments;
- DefineSymbols = conf.DefineSymbols;
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/gui/ctexteditorextension.cs b/caddin/cbinding/cbinding/gui/ctexteditorextension.cs
index 050ecd7..01856f2 100644
--- a/cbindingreport/cbinding/cbinding/gui/ctexteditorextension.cs
+++ b/caddin/cbinding/cbinding/gui/ctexteditorextension.cs
@@ -48,6 +48,7 @@ using MonoDevelop.Ide.Editor.Extension;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.TypeSystem;
+using MonoDevelop.Projects;
using ClangSharp;
using CBinding.Parser;
using CBinding.Refactoring;
@@ -283,7 +284,7 @@ namespace CBinding
public override Task<ICompletionDataList> HandleCodeCompletionAsync (CodeCompletionContext completionContext, CompletionTriggerInfo triggerInfo, CancellationToken token = default (CancellationToken))
{
- var project = (CProject)DocumentContext.Project;
+ var project = (CMakeProject)DocumentContext.Owner;
if (project == null || !project.HasLibClang) {
return Task.FromResult ((ICompletionDataList)null);
}
@@ -396,7 +397,7 @@ namespace CBinding
if (completionChar != '(' && completionChar != ',')
return Task.FromResult ((ParameterHintingResult) null);
- var project = (CProject)DocumentContext.Project;
+ var project = (CMakeProject)(DocumentContext.Owner);
if (project == null || !project.HasLibClang)
return Task.FromResult ((ParameterHintingResult) null);
@@ -535,11 +536,11 @@ namespace CBinding
[CommandHandler (MonoDevelop.DesignerSupport.Commands.SwitchBetweenRelatedFiles)]
protected void Run ()
{
- var cp = (CProject)DocumentContext.Project;
+ var cp = (CMakeProject)(DocumentContext.Owner);
if (cp != null) {
string match = cp.MatchingFile (this.DocumentContext.Name);
if (match != null)
- IdeApp.Workbench.OpenDocument (match, cp, true);
+ IdeApp.Workbench.OpenDocument (match, DocumentContext.Owner, true);
}
}
@@ -550,7 +551,7 @@ namespace CBinding
[CommandUpdateHandler (MonoDevelop.DesignerSupport.Commands.SwitchBetweenRelatedFiles)]
protected void Update (CommandInfo info)
{
- var cp = (CProject)DocumentContext.Project;
+ var cp = (CMakeProject)(DocumentContext.Owner);
info.Visible = info.Visible = cp != null && cp.MatchingFile (this.DocumentContext.Name) != null;
}
@@ -629,7 +630,7 @@ namespace CBinding
if (doc == null || doc.FileName == FilePath.Null)
return;
var findReferencesHandler = new FindReferencesHandler (
- (CProject)DocumentContext.Project,
+ (CMakeProject)(DocumentContext.Owner),
doc
);
findReferencesHandler.Update (ci);
@@ -645,7 +646,7 @@ namespace CBinding
if (doc == null || doc.FileName == FilePath.Null)
return;
var findReferencesHandler = new FindReferencesHandler (
- (CProject)DocumentContext.Project,
+ (CMakeProject)(DocumentContext.Owner),
doc
);
findReferencesHandler.Run ();
@@ -674,7 +675,7 @@ namespace CBinding
var doc = IdeApp.Workbench.ActiveDocument;
if (doc == null || doc.FileName == FilePath.Null)
return;
- var renameHandler = new RenameHandlerDialog ((CProject)DocumentContext.Project, doc);
+ var renameHandler = new RenameHandlerDialog ((CMakeProject)(DocumentContext.Owner), doc);
renameHandler.Update (ci);
}
@@ -687,7 +688,7 @@ namespace CBinding
var doc = IdeApp.Workbench.ActiveDocument;
if (doc == null || doc.FileName == FilePath.Null)
return;
- var renameHandler = new RenameHandlerDialog ((CProject)DocumentContext.Project, doc);
+ var renameHandler = new RenameHandlerDialog ((CMakeProject)(DocumentContext.Owner), doc);
renameHandler.RunRename ();
}
diff --git a/cbindingreport/cbinding/cbinding/gui/editpackagesdialog.cs b/editpackagesdialog.cs
index 823fe57..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/gui/editpackagesdialog.cs
+++ b/editpackagesdialog.cs
@@ -1,569 +0,0 @@
-//
-// EditPackagesDialog.cs: Allows you to add and remove pkg-config packages to the project
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Collections.Generic;
-
-using MonoDevelop.Projects;
-using MonoDevelop.Ide;
-using MonoDevelop.Components;
-
-namespace CBinding
-{
- public partial class EditPackagesDialog : Gtk.Dialog
- {
- private Gtk.ListStore normalPackageListStore = new Gtk.ListStore (typeof(bool), typeof(string), typeof(string));
- private Gtk.ListStore projectPackageListStore = new Gtk.ListStore (typeof(bool), typeof(string), typeof(string));
- private Gtk.ListStore selectedPackageListStore = new Gtk.ListStore (typeof(string), typeof(string));
- private CProject project;
- private ProjectPackageCollection selectedPackages = new ProjectPackageCollection ();
- private List<Package> packagesOfProjects;
- private List<Package> packages = new List<Package> ();
-
- // Column IDs
- const int NormalPackageToggleID = 0;
- const int NormalPackageNameID = 1;
- const int NormalPackageVersionID = 2;
-
- const int ProjectPackageToggleID = 0;
- const int ProjectPackageNameID = 1;
- const int ProjectPackageVersionID = 2;
-
- const int SelectedPackageNameID = 0;
- const int SelectedPackageVersionID = 1;
-
- public EditPackagesDialog(CProject project)
- {
- this.Build();
-
- this.project = project;
-
- selectedPackages.Project = project;
- selectedPackages.AddRange (project.Packages);
-
- Gtk.CellRendererText textRenderer = new Gtk.CellRendererText ();
-
- CellRendererImage pixbufRenderer = new CellRendererImage ();
- pixbufRenderer.StockId = "md-package";
-
- normalPackageListStore.DefaultSortFunc = NormalPackageCompareNodes;
- projectPackageListStore.DefaultSortFunc = ProjectPackageCompareNodes;
- selectedPackageListStore.DefaultSortFunc = SelectedPackageCompareNodes;
-
- normalPackageListStore.SetSortColumnId (NormalPackageNameID, Gtk.SortType.Ascending);
- projectPackageListStore.SetSortColumnId (ProjectPackageNameID, Gtk.SortType.Ascending);
- selectedPackageListStore.SetSortColumnId (SelectedPackageNameID, Gtk.SortType.Ascending);
-
- normalPackageTreeView.SearchColumn = NormalPackageNameID;
- projectPackageTreeView.SearchColumn = ProjectPackageNameID;
- selectedPackageTreeView.SearchColumn = SelectedPackageNameID;
-
- // <!-- Normal packages -->
-
- Gtk.CellRendererToggle normalPackageToggleRenderer = new Gtk.CellRendererToggle ();
- normalPackageToggleRenderer.Activatable = true;
- normalPackageToggleRenderer.Toggled += OnNormalPackageToggled;
- normalPackageToggleRenderer.Xalign = 0;
-
- Gtk.TreeViewColumn normalPackageColumn = new Gtk.TreeViewColumn ();
- normalPackageColumn.Title = "Package";
- normalPackageColumn.PackStart (pixbufRenderer, false);
- normalPackageColumn.PackStart (textRenderer, true);
- normalPackageColumn.AddAttribute (textRenderer, "text", NormalPackageNameID);
-
- normalPackageTreeView.Model = normalPackageListStore;
- normalPackageTreeView.HeadersVisible = true;
- normalPackageTreeView.AppendColumn ("", normalPackageToggleRenderer, "active", NormalPackageToggleID);
- normalPackageTreeView.AppendColumn (normalPackageColumn);
- normalPackageTreeView.AppendColumn ("Version", textRenderer, "text", NormalPackageVersionID);
-
- // <!-- Project packages -->
-
- Gtk.CellRendererToggle projectPackageToggleRenderer = new Gtk.CellRendererToggle ();
- projectPackageToggleRenderer.Activatable = true;
- projectPackageToggleRenderer.Toggled += OnProjectPackageToggled;
- projectPackageToggleRenderer.Xalign = 0;
-
- Gtk.TreeViewColumn projectPackageColumn = new Gtk.TreeViewColumn ();
- projectPackageColumn.Title = "Package";
- projectPackageColumn.PackStart (pixbufRenderer, false);
- projectPackageColumn.PackStart (textRenderer, true);
- projectPackageColumn.AddAttribute (textRenderer, "text", ProjectPackageNameID);
-
- projectPackageTreeView.Model = projectPackageListStore;
- projectPackageTreeView.HeadersVisible = true;
- projectPackageTreeView.AppendColumn ("", projectPackageToggleRenderer, "active", ProjectPackageToggleID);
- projectPackageTreeView.AppendColumn (projectPackageColumn);
- projectPackageTreeView.AppendColumn ("Version", textRenderer, "text", ProjectPackageVersionID);
-
-
- // <!-- Selected packages -->
-
- Gtk.TreeViewColumn selectedPackageColumn = new Gtk.TreeViewColumn ();
- selectedPackageColumn.Title = "Package";
- selectedPackageColumn.PackStart (pixbufRenderer, false);
- selectedPackageColumn.PackStart (textRenderer, true);
- selectedPackageColumn.AddAttribute (textRenderer, "text", SelectedPackageNameID);
-
- selectedPackageTreeView.Model = selectedPackageListStore;
- selectedPackageTreeView.HeadersVisible = true;
- selectedPackageTreeView.AppendColumn (selectedPackageColumn);
- selectedPackageTreeView.AppendColumn ("Version", textRenderer, "text", SelectedPackageVersionID);
-
- // Fill up the project tree view
- packagesOfProjects = GetPackagesOfProjects (project);
-
- foreach (Package p in packagesOfProjects) {
- if (p.Name == project.Name) continue;
-
- packages.Add (p);
- string version = p.Version;
- bool inProject = selectedPackages.Contains (p);
-
- if (!IsPackageInStore (projectPackageListStore, p.Name, version, ProjectPackageNameID, ProjectPackageVersionID)) {
- projectPackageListStore.AppendValues (inProject, p.Name, version);
-
- if (inProject)
- selectedPackageListStore.AppendValues (p.Name, version);
- }
- }
-
- // Fill up the normal tree view
- foreach (string dir in ScanDirs ()) {
- if (Directory.Exists (dir)) {
- DirectoryInfo di = new DirectoryInfo (dir);
- FileInfo[] availablePackages = di.GetFiles ("*.pc");
-
- foreach (FileInfo f in availablePackages) {
- if (!IsValidPackage (f.FullName)) {
- continue;
- }
-
- Package package = new Package (f.FullName);
-
- packages.Add (package);
-
- string name = package.Name;
- string version = package.Version;
- bool inProject = selectedPackages.Contains (package);
-
- if (!IsPackageInStore (normalPackageListStore, name, version, NormalPackageNameID, NormalPackageVersionID)) {
- normalPackageListStore.AppendValues (inProject, name, version);
-
- if (inProject)
- selectedPackageListStore.AppendValues (name, version);
- }
- }
- }
- }
- }
-
- private List<Package> GetPackagesOfProjects (Project project)
- {
- List<Package> packages = new List<Package>();
- Package package;
-
- foreach (SolutionFolderItem c in project.ParentFolder.Items) {
- if (null != c && c is CProject) {
- CProject cproj = (CProject)c;
- CProjectConfiguration conf = (CProjectConfiguration)cproj.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
- if (conf.CompileTarget != CompileTarget.Exe) {
- cproj.WriteMDPkgPackage (conf.Selector);
- package = new Package (cproj);
- packages.Add (package);
- }
- }
- }
-
- return packages;
- }
-
- private bool IsPackageInStore (Gtk.ListStore store, string pname, string pversion, int pname_col, int pversion_col)
- {
- Gtk.TreeIter search_iter;
- bool has_elem = store.GetIterFirst (out search_iter);
-
- if (has_elem) {
- while (true) {
- string name = (string)store.GetValue (search_iter, pname_col);
- string version = (string)store.GetValue (search_iter, pversion_col);
-
- if (name == pname && version == pversion)
- return true;
-
- if (!store.IterNext (ref search_iter))
- break;
- }
- }
-
- return false;
- }
-
- private string[] ScanDirs ()
- {
- List<string> dirs = new List<string> ();
- string pkg_var = Environment.GetEnvironmentVariable ("PKG_CONFIG_PATH");
- string[] pkg_paths;
-
- dirs.Add ("/usr/lib/pkgconfig");
- dirs.Add ("/usr/lib64/pkgconfig");
- dirs.Add ("/usr/share/pkgconfig");
- dirs.Add ("/usr/local/lib/pkgconfig");
- dirs.Add ("/usr/local/share/pkgconfig");
- dirs.Add ("/usr/lib/x86_64-linux-gnu/pkgconfig");
-
- if (pkg_var == null) return dirs.ToArray ();
-
- pkg_paths = pkg_var.Split (':');
-
- foreach (string dir in pkg_paths) {
- if (string.IsNullOrEmpty (dir))
- continue;
- string dirPath = System.IO.Path.GetFullPath (dir);
- if (!dirs.Contains (dirPath) && !string.IsNullOrEmpty (dir)) {
- dirs.Add (dir);
- }
- }
-
- return dirs.ToArray ();
- }
-
- private void OnOkButtonClick (object sender, EventArgs e)
- {
- // Use this instead of clear, since clear seems to not update the packages tree
- while (project.Packages.Count > 0) {
- project.Packages.RemoveAt (0);
- }
-
- project.Packages.AddRange (selectedPackages);
-
- Destroy ();
- }
-
- private void OnCancelButtonClick (object sender, EventArgs e)
- {
- Destroy ();
- }
-
- private void OnRemoveButtonClick (object sender, EventArgs e)
- {
- Gtk.TreeIter iter;
-
- selectedPackageTreeView.Selection.GetSelected (out iter);
-
- if (!selectedPackageListStore.IterIsValid (iter)) return;
-
- string package = (string)selectedPackageListStore.GetValue (iter, SelectedPackageNameID);
- bool isProject = false;
-
- foreach (Package p in selectedPackages) {
- if (p.Name == package) {
- isProject = p.IsProject;
- selectedPackages.Remove (p);
- break;
- }
- }
-
- selectedPackageListStore.Remove (ref iter);
-
- if (!isProject) {
- Gtk.TreeIter search_iter;
- bool has_elem = normalPackageListStore.GetIterFirst (out search_iter);
-
- if (has_elem) {
- while (true) {
- string current = (string)normalPackageListStore.GetValue (search_iter, NormalPackageNameID);
-
- if (current.Equals (package)) {
- normalPackageListStore.SetValue (search_iter, NormalPackageToggleID, false);
- break;
- }
-
- if (!normalPackageListStore.IterNext (ref search_iter))
- break;
- }
- }
- } else {
- Gtk.TreeIter search_iter;
- bool has_elem = projectPackageListStore.GetIterFirst (out search_iter);
-
- if (has_elem) {
- while (true) {
- string current = (string)projectPackageListStore.GetValue (search_iter, ProjectPackageNameID);
-
- if (current.Equals (package)) {
- projectPackageListStore.SetValue (search_iter, ProjectPackageToggleID, false);
- break;
- }
-
- if (!projectPackageListStore.IterNext (ref search_iter))
- break;
- }
- }
- }
- }
-
- private void OnNormalPackageToggled (object sender, Gtk.ToggledArgs args)
- {
- Gtk.TreeIter iter;
- bool old = true;
- string name;
- string version;
-
- if (normalPackageListStore.GetIter (out iter, new Gtk.TreePath (args.Path))) {
- old = (bool)normalPackageListStore.GetValue (iter, NormalPackageToggleID);
- normalPackageListStore.SetValue (iter, NormalPackageToggleID, !old);
- }
-
- name = (string)normalPackageListStore.GetValue (iter, NormalPackageNameID);
- version = (string)normalPackageListStore.GetValue(iter, NormalPackageVersionID);
-
- if (old == false) {
- selectedPackageListStore.AppendValues (name, version);
-
- foreach (Package package in packages) {
- if (package.Name == name && package.Version == version) {
- selectedPackages.Add (package);
- break;
- }
- }
-
- } else {
- Gtk.TreeIter search_iter;
- bool has_elem = selectedPackageListStore.GetIterFirst (out search_iter);
-
- if (has_elem) {
- while (true) {
- string current = (string)selectedPackageListStore.GetValue (search_iter, SelectedPackageNameID);
-
- if (current.Equals (name)) {
- selectedPackageListStore.Remove (ref search_iter);
- foreach (Package p in selectedPackages) {
- if (p.Name == name) {
- selectedPackages.Remove (p);
- break;
- }
- }
-
- break;
- }
-
- if (!selectedPackageListStore.IterNext (ref search_iter))
- break;
- }
- }
- }
- }
-
- private void OnProjectPackageToggled (object sender, Gtk.ToggledArgs args)
- {
- Gtk.TreeIter iter;
- bool old = true;
- string name;
- string version;
-
- if (projectPackageListStore.GetIter (out iter, new Gtk.TreePath (args.Path))) {
- old = (bool)projectPackageListStore.GetValue (iter, ProjectPackageToggleID);
- projectPackageListStore.SetValue (iter, ProjectPackageToggleID, !old);
- }
-
- name = (string)projectPackageListStore.GetValue (iter, ProjectPackageNameID);
- version = (string)projectPackageListStore.GetValue(iter, ProjectPackageVersionID);
-
- if (old == false) {
- selectedPackageListStore.AppendValues (name, version);
-
- foreach (Package p in packagesOfProjects) {
- if (p.Name == name) {
- selectedPackages.Add (p);
- break;
- }
- }
- } else {
- Gtk.TreeIter search_iter;
- bool has_elem = selectedPackageListStore.GetIterFirst (out search_iter);
-
- if (has_elem)
- {
- while (true) {
- string current = (string)selectedPackageListStore.GetValue (search_iter, SelectedPackageNameID);
-
- if (current.Equals (name)) {
- selectedPackageListStore.Remove (ref search_iter);
- foreach (Package p in selectedPackages) {
- if (p.Name == name) {
- selectedPackages.Remove (p);
- break;
- }
- }
-
- break;
- }
-
- if (!selectedPackageListStore.IterNext (ref search_iter))
- break;
- }
- }
- }
- }
-
- private bool IsValidPackage (string package)
- {
- bool valid = false;
- try {
- using (StreamReader reader = new StreamReader (package)) {
- string line;
-
- while ((line = reader.ReadLine ()) != null) {
- if (line.StartsWith ("Libs:", true, null) && line.Contains (" -l")) {
- valid = true;
- break;
- }
- }
- }
- } catch {
- // Invalid file, permission error, broken symlink
- }
-
- return valid;
- }
-
- int NormalPackageCompareNodes (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
- {
- string name1 = (string)model.GetValue (a, NormalPackageNameID);
- string name2 = (string)model.GetValue (b, NormalPackageNameID);
- return string.Compare (name1, name2, true);
- }
-
- int ProjectPackageCompareNodes (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
- {
- string name1 = (string)model.GetValue (a, ProjectPackageNameID);
- string name2 = (string)model.GetValue (b, ProjectPackageNameID);
- return string.Compare (name1, name2, true);
- }
-
- int SelectedPackageCompareNodes (Gtk.TreeModel model, Gtk.TreeIter a, Gtk.TreeIter b)
- {
- string name1 = (string)model.GetValue (a, SelectedPackageNameID);
- string name2 = (string)model.GetValue (b, SelectedPackageNameID);
- return string.Compare (name1, name2, true);
- }
-
- protected virtual void OnSelectedPackagesTreeViewCursorChanged (object sender, System.EventArgs e)
- {
- removeButton.Sensitive = true;
- }
-
- protected virtual void OnRemoveButtonClicked (object sender, System.EventArgs e)
- {
- removeButton.Sensitive = false;
- }
-
- protected virtual void OnDetailsButtonClicked (object sender, System.EventArgs e)
- {
- Gtk.TreeIter iter;
- Gtk.Widget active_tab = notebook1.Children [notebook1.Page];
- string tab_label = notebook1.GetTabLabelText (active_tab);
- string name = string.Empty;
- string version = string.Empty;
- Package package = null;
-
- if (tab_label == "System Packages") {
- normalPackageTreeView.Selection.GetSelected (out iter);
- name = (string)normalPackageListStore.GetValue (iter, NormalPackageNameID);
- version = (string)normalPackageListStore.GetValue (iter, NormalPackageVersionID);
- } else if (tab_label == "Project Packages") {
- projectPackageTreeView.Selection.GetSelected (out iter);
- name = (string)projectPackageListStore.GetValue (iter, ProjectPackageNameID);
- version = (string)projectPackageListStore.GetValue (iter, ProjectPackageVersionID);
- } else {
- return;
- }
-
- foreach (Package p in packages) {
- if (p.Name == name && p.Version == version) {
- package = p;
- break;
- }
- }
-
- if (package == null)
- return;
-
- PackageDetails details = new PackageDetails (package);
- details.Modal = true;
- details.Show ();
- }
-
- protected virtual void OnNonSelectedPackageCursorChanged (object o, EventArgs e)
- {
- Gtk.TreeIter iter;
- Gtk.Widget active_tab = notebook1.Children [notebook1.Page];
- Gtk.Widget active_label = notebook1.GetTabLabel (active_tab);
-
- bool sensitive = false;
-
- if (active_label == this.labelSystemPackages) {
- normalPackageTreeView.Selection.GetSelected (out iter);
- if (normalPackageListStore.IterIsValid (iter))
- sensitive = true;
- } else if (active_label == this.labelProjectPackages) {
- projectPackageTreeView.Selection.GetSelected (out iter);
- if (projectPackageListStore.IterIsValid (iter))
- sensitive = true;
- } else {
- return;
- }
-
- detailsButton.Sensitive = sensitive;
- }
-
- protected virtual void OnNotebook1SwitchPage (object o, Gtk.SwitchPageArgs args)
- {
- Gtk.TreeIter iter;
- Gtk.Widget active_tab = notebook1.Children [notebook1.Page];
-
- switch(notebook1.GetTabLabelText (active_tab))
- {
- case "System Packages":
- normalPackageTreeView.Selection.GetSelected (out iter);
- detailsButton.Sensitive = normalPackageListStore.IterIsValid (iter);
- break;
-
- case "Project Packages":
- projectPackageTreeView.Selection.GetSelected (out iter);
- detailsButton.Sensitive = projectPackageListStore.IterIsValid (iter);
- break;
- }
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/templates/emptycppproject.xpt.xml b/emptycppproject.xpt.xml
index 99ec751..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/templates/emptycppproject.xpt.xml
+++ b/emptycppproject.xpt.xml
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<Template
- originator = "Marcos David Marin Amador"
- created = "04/17/2007"
- lastModified = "06/13/2007">
-
- <!-- Template Header -->
- <TemplateConfiguration>
- <_Name>Empty Project</_Name>
- <Category>other/misc/c</Category>
- <Icon>md-project</Icon>
- <LanguageName>C++</LanguageName>
- <_Description>Creates an empty C++ solution.</_Description>
- <DefaultFilename>EmptyCppProject</DefaultFilename>
- <GroupId>md-empty-project</GroupId>
- </TemplateConfiguration>
-
- <!-- Template Content -->
- <Combine name = "${ProjectName}" directory = ".">
- <Project name = "${ProjectName}" directory = "." type = "C/C++">
- <Options
- Target = "Exe"
- PauseConsoleOutput = "True"
- CompilerArgs = ""
- LinkerArgs = ""/>
- </Project>
- </Combine>
-</Template>
diff --git a/cbindingreport/cbinding/cbinding/templates/emptycproject.xpt.xml b/emptycproject.xpt.xml
index 9278560..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/templates/emptycproject.xpt.xml
+++ b/emptycproject.xpt.xml
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<Template
- originator = "Marcos David Marin Amador"
- created = "04/12/2007"
- lastModified = "06/13/2007">
-
- <!-- Template Header -->
- <TemplateConfiguration>
- <_Name>Empty Project</_Name>
- <Category>other/misc/c</Category>
- <Icon>md-project</Icon>
- <LanguageName>C</LanguageName>
- <_Description>Creates an empty C solution.</_Description>
- <DefaultFilename>EmptyCProject</DefaultFilename>
- <GroupId>md-empty-project</GroupId>
- </TemplateConfiguration>
-
- <!-- Template Content -->
- <Combine name = "${ProjectName}" directory = ".">
- <Project name = "${ProjectName}" directory = "." type = "C/C++">
- <Options
- Target = "Exe"
- PauseConsoleOutput = "True"
- CompilerArgs = ""
- LinkerArgs = ""/>
- </Project>
- </Combine>
-</Template>
diff --git a/cbindingreport/cbinding/cbinding/templates/emptyobjcproject.xpt.xml b/emptyobjcproject.xpt.xml
index 210d478..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/templates/emptyobjcproject.xpt.xml
+++ b/emptyobjcproject.xpt.xml
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<Template
- originator = "Levi Bard"
- created = "07/30/2010"
- lastModified = "07/30/2010">
-
- <!-- Template Header -->
- <TemplateConfiguration>
- <_Name>Console Project</_Name>
- <_Category>C</_Category>
- <Icon>md-project-console|res:c-icon-32.png</Icon>
- <LanguageName>Objective C</LanguageName>
- <_Description>Creates simple hello world Objective C project.</_Description>
- </TemplateConfiguration>
-
- <!-- Template Content -->
- <Combine name = "${ProjectName}" directory = ".">
- <Project name = "${ProjectName}" directory = "." type = "C/C++">
- <Options
- Target = "Bin"
- ExternalConsole = "True"
- CompilerArgs = ""
- LinkerArgs = ""/>
-
- <Files>
- <File name = "main.m" AddStandardHeader="True"><![CDATA[#import <stdio.h>
-
-int main( int argc, const char *argv[] ) {
- printf( "hello world\n" );
- return 0;
-}
-]]></File>
- </Files>
- </Project>
- </Combine>
-</Template>
diff --git a/cbindingreport/cbinding/cbinding/parser/enumeration.cs b/caddin/cbinding/cbinding/parser/enumeration.cs
index 6c52ce6..dafc90c 100644
--- a/cbindingreport/cbinding/cbinding/parser/enumeration.cs
+++ b/caddin/cbinding/cbinding/parser/enumeration.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Enumeration : Symbol
{
- public Enumeration (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Enumeration (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/parser/function.cs b/caddin/cbinding/cbinding/parser/function.cs
index 844c141..d5955b0 100644
--- a/cbindingreport/cbinding/cbinding/parser/function.cs
+++ b/caddin/cbinding/cbinding/parser/function.cs
@@ -6,7 +6,7 @@ namespace CBinding.Parser
{
public class Function : Symbol
{
- public Function (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Function (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/parser/field.cs b/caddin/cbinding/cbinding/parser/field.cs
index 6e54061..26df602 100644
--- a/cbindingreport/cbinding/cbinding/parser/field.cs
+++ b/caddin/cbinding/cbinding/parser/field.cs
@@ -5,7 +5,7 @@ namespace CBinding.Parser
{
public class Field : Symbol
{
- public Field (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Field (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
diff --git a/cbindingreport/cbinding/cbinding/refactoring/findreferenceshandler.cs b/caddin/cbinding/cbinding/refactoring/findreferenceshandler.cs
index 588deb0..f1ba5c6 100644
--- a/cbindingreport/cbinding/cbinding/refactoring/findreferenceshandler.cs
+++ b/caddin/cbinding/cbinding/refactoring/findreferenceshandler.cs
@@ -6,6 +6,7 @@ using ClangSharp;
using System.Collections.Generic;
using MonoDevelop.Ide.FindInFiles;
using MonoDevelop.Ide.Gui;
+using MonoDevelop.Projects;
using CBinding.Parser;
namespace CBinding.Refactoring
@@ -16,7 +17,7 @@ namespace CBinding.Refactoring
/// </summary>
public class FindReferencesHandler
{
- CProject project;
+ CMakeProject project;
CXCursor cursorReferenced;
string UsrReferenced;
public string File;
@@ -27,7 +28,7 @@ namespace CBinding.Refactoring
/// </summary>
/// <param name="proj">Proj.</param>
/// <param name="doc">Document.</param>
- public FindReferencesHandler (CProject proj, Document doc)
+ public FindReferencesHandler (CMakeProject proj, Document doc)
{
project = proj;
if (!proj.HasLibClang)
@@ -79,7 +80,7 @@ namespace CBinding.Refactoring
/// Finds the references and reports them to the IDE.
/// </summary>
/// <param name="project">Project.</param>
- public void FindRefs (CProject project)
+ public void FindRefs (CMakeProject project)
{
var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
try {
diff --git a/cbindingreport/cbinding/cbinding/project/folderbasedproject.cs b/caddin/cbinding/cbinding/project/folderbasedproject.cs
index d8c661a..fe387c7 100644
--- a/cbindingreport/cbinding/cbinding/project/folderbasedproject.cs
+++ b/caddin/cbinding/cbinding/project/folderbasedproject.cs
@@ -7,6 +7,7 @@ namespace CBinding
{
public class FolderBasedProject : SolutionItem
{
+
virtual public List<FilePath> GetExcludedPaths ()
{
return new List<FilePath> ();
@@ -61,5 +62,10 @@ namespace CBinding
virtual public void OnFilesRenamed (List<FilePath> oldFiles, List<FilePath> newFiles)
{
}
+
+ virtual public void OnFileChanged (FilePath file)
+ {
+ }
+
}
}
diff --git a/cbindingreport/cbinding/cbinding/parser/function.cs b/caddin/cbinding/cbinding/parser/function.cs
index 844c141..d5955b0 100644
--- a/cbindingreport/cbinding/cbinding/parser/function.cs
+++ b/caddin/cbinding/cbinding/parser/function.cs
@@ -6,7 +6,7 @@ namespace CBinding.Parser
{
public class Function : Symbol
{
- public Function (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Function (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/parser/functiontemplate.cs b/caddin/cbinding/cbinding/parser/functiontemplate.cs
index bef2909..58bae96 100644
--- a/cbindingreport/cbinding/cbinding/parser/functiontemplate.cs
+++ b/caddin/cbinding/cbinding/parser/functiontemplate.cs
@@ -8,7 +8,7 @@ namespace CBinding.Parser
{
public class FunctionTemplate : Function
{
- public FunctionTemplate (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public FunctionTemplate (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
diff --git a/cbindingreport/cbinding/cbinding/compiler/GccCompiler.cs b/GccCompiler.cs
index fb9fb40..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/compiler/GccCompiler.cs
+++ b/GccCompiler.cs
@@ -1,55 +0,0 @@
-//
-// GccCompiler.cs: Provides functionality to compile using gcc
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using Mono.Addins;
-
-
-namespace CBinding
-{
- [Extension ("/CBinding/Compilers")]
- public class GccCompiler : GNUCompiler
- {
- public override string Name {
- get { return "gcc"; }
- }
-
- public override Language Language {
- get { return Language.C; }
- }
-
- public GccCompiler ()
- {
- compilerCommand = "gcc";
- linkerCommand = "gcc";
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/gui/generaloptionspanel.cs b/caddin/cbinding/cbinding/gui/generaloptionspanel.cs
index c48f491..1e3958e 100644
--- a/cbindingreport/cbinding/cbinding/gui/generaloptionspanel.cs
+++ b/caddin/cbinding/cbinding/gui/generaloptionspanel.cs
@@ -42,55 +42,40 @@ namespace CBinding
{
public partial class GeneralOptionsPanel : Gtk.Bin
{
- ICompiler default_c_compiler;
- List<ICompiler> c_compilers = new List<ICompiler> ();
- ICompiler default_cpp_compiler;
- List<ICompiler> cpp_compilers = new List<ICompiler> ();
+ CMakeToolchain default_toolchain;
+ List<CMakeToolchain> toolchain = new List<CMakeToolchain> ();
public GeneralOptionsPanel ()
{
this.Build ();
- object[] compilers = AddinManager.GetExtensionObjects ("/CBinding/Compilers");
+ object [] toolchains = AddinManager.GetExtensionObjects ("/CBinding/Toolchains");
+ foreach (CMakeToolchain Toolchain in toolchains) {
+ toolchain.Add (Toolchain);
+ }
- foreach (ICompiler compiler in compilers) {
- if (compiler.Language == Language.C) {
- c_compilers.Add (compiler);
- } else if (compiler.Language == Language.CPP) {
- cpp_compilers.Add (compiler);
+ foreach (CMakeToolchain Toolchain in toolchain) {
+ if (Toolchain.IsSupported) {
+ cCombo.AppendText (Toolchain.ToolchainName);
}
}
- foreach (ICompiler compiler in c_compilers)
- cCombo.AppendText (compiler.Name);
-
- foreach (ICompiler compiler in cpp_compilers)
- cppCombo.AppendText (compiler.Name);
- string c_compiler = PropertyService.Get<string> ("CBinding.DefaultCCompiler", new GccCompiler ().Name);
- string cpp_compiler = PropertyService.Get<string> ("CBinding.DefaultCppCompiler", new GppCompiler ().Name);
+ string toolchainName = PropertyService.Get<string> ("CBinding.DefaultToolchain", null)
+ ?? CMakeToolchain.GetDefaultToolchain ().ToolchainName;
ctagsEntry.Text = PropertyService.Get<string> ("CBinding.CTagsExecutable", "ctags");
parseSystemTagsCheck.Active = PropertyService.Get<bool> ("CBinding.ParseSystemTags", true);
parseLocalVariablesCheck.Active = PropertyService.Get<bool> ("CBinding.ParseLocalVariables", false);
- foreach (ICompiler compiler in c_compilers) {
- if (compiler.Name == c_compiler) {
- default_c_compiler = compiler;
- }
- }
-
- if (default_c_compiler == null)
- default_c_compiler = new GccCompiler ();
-
- foreach (ICompiler compiler in cpp_compilers) {
- if (compiler.Name == cpp_compiler) {
- default_cpp_compiler = compiler;
+ foreach (CMakeToolchain Toolchain in toolchains) {
+ if (Toolchain.ToolchainName == toolchainName) {
+ default_toolchain = Toolchain;
}
}
- if (default_cpp_compiler == null)
- default_cpp_compiler = new GppCompiler ();
+ if (default_toolchain == null)
+ default_toolchain = new MinGW32Toolchain ();
int active;
Gtk.TreeIter iter;
@@ -101,7 +86,7 @@ namespace CBinding
store.GetIterFirst (out iter);
while (store.IterIsValid (iter)) {
- if ((string)store.GetValue (iter, 0) == default_c_compiler.Name) {
+ if ((string)store.GetValue (iter, 0) == default_toolchain.ToolchainName) {
break;
}
store.IterNext (ref iter);
@@ -110,25 +95,10 @@ namespace CBinding
cCombo.Active = active;
- active = 0;
- store = (Gtk.ListStore)cppCombo.Model;
- store.GetIterFirst (out iter);
-
- while (store.IterIsValid (iter)) {
- if ((string)store.GetValue (iter, 0) == default_cpp_compiler.Name) {
- break;
- }
- store.IterNext (ref iter);
- active++;
- }
-
- cppCombo.Active = active;
}
-
public bool Store ()
{
- PropertyService.Set ("CBinding.DefaultCCompiler", default_c_compiler.Name);
- PropertyService.Set ("CBinding.DefaultCppCompiler", default_cpp_compiler.Name);
+ PropertyService.Set ("CBinding.DefaultToolchain", default_toolchain.ToolchainName);
PropertyService.Set ("CBinding.CTagsExecutable", ctagsEntry.Text.Trim ());
PropertyService.Set ("CBinding.ParseSystemTags", parseSystemTagsCheck.Active);
PropertyService.Set ("CBinding.ParseLocalVariables", parseLocalVariablesCheck.Active);
@@ -138,30 +108,16 @@ namespace CBinding
protected virtual void OnCComboChanged (object sender, System.EventArgs e)
{
- string activeCompiler = cCombo.ActiveText;
-
- foreach (ICompiler compiler in c_compilers) {
- if (compiler.Name == activeCompiler) {
- default_c_compiler = compiler;
- }
- }
-
- if (default_c_compiler == null)
- default_c_compiler = new GccCompiler ();
- }
-
- protected virtual void OnCppComboChanged (object sender, System.EventArgs e)
- {
- string activeCompiler = cppCombo.ActiveText;
+ string activeToolchain = cCombo.ActiveText;
- foreach (ICompiler compiler in cpp_compilers) {
- if (compiler.Name == activeCompiler) {
- default_cpp_compiler = compiler;
+ foreach (CMakeToolchain Toolchain in toolchain) {
+ if (Toolchain.ToolchainName == activeToolchain) {
+ default_toolchain = Toolchain;
}
}
- if (default_cpp_compiler == null)
- default_cpp_compiler = new GppCompiler ();
+ if (default_toolchain == null)
+ default_toolchain = new MinGW32Toolchain ();
}
protected virtual void OnCtagsBrowseClicked (object sender, EventArgs e)
diff --git a/cbindingreport/cbinding/cbinding/compiler/GNUCompiler.cs b/GNUCompiler.cs
index 6d77510..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/compiler/GNUCompiler.cs
+++ b/GNUCompiler.cs
@@ -1,866 +0,0 @@
-//
-// GNUCompiler.cs: Provides most functionality to compile using a GNU compiler (gcc and g++)
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-// Mitchell Wheeler <mitchell.wheeler@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.CodeDom.Compiler;
-
-using MonoDevelop.Core;
-using MonoDevelop.Core.Execution;
-using MonoDevelop.Core.ProgressMonitoring;
-using MonoDevelop.Projects;
-
-namespace CBinding
-{
- public abstract class GNUCompiler : CCompiler
- {
- bool appsChecked;
- bool compilerFound;
- bool linkerFound;
-
- public override BuildResult Compile (
- Project project,
- ProjectFileCollection projectFiles,
- ProjectPackageCollection packages,
- CProjectConfiguration configuration,
- ProgressMonitor monitor)
- {
- if (!appsChecked) {
- appsChecked = true;
- compilerFound = CheckApp (compilerCommand);
- linkerFound = CheckApp (linkerCommand);
- }
-
- if (!compilerFound) {
- BuildResult cres = new BuildResult ();
- cres.AddError ("Compiler not found: " + compilerCommand);
- return cres;
- }
-
- if (!linkerFound) {
- BuildResult cres = new BuildResult ();
- cres.AddError ("Linker not found: " + linkerCommand);
- return cres;
- }
-
- CompilerResults cr = new CompilerResults (new TempFileCollection ());
- bool success = true;
- string compilerArgs = GetCompilerFlags (project, configuration) + " " + GeneratePkgCompilerArgs (packages);
-
- string outputName = Path.Combine (configuration.OutputDirectory,
- configuration.CompiledOutputName);
-
- // Precompile header files and place them in prec/<config_name>/
- if (configuration.PrecompileHeaders) {
- string precDir = Path.Combine (configuration.IntermediateOutputDirectory, "prec");
- string precConfigDir = Path.Combine (precDir, configuration.Id);
- if (!Directory.Exists (precDir))
- Directory.CreateDirectory (precDir);
- if (!Directory.Exists (precConfigDir))
- Directory.CreateDirectory (precConfigDir);
-
- if (!PrecompileHeaders (projectFiles, configuration, compilerArgs, monitor, cr))
- success = false;
- } else {
- //old headers could interfere with the build
- CleanPrecompiledHeaders (configuration);
- }
-
- //compile source to object files
- monitor.BeginTask (GettextCatalog.GetString ("Compiling source to object files"), 1);
- foreach (ProjectFile f in projectFiles) {
- if (!success) break;
- if (f.Subtype == Subtype.Directory || f.BuildAction != BuildAction.Compile || CProject.IsHeaderFile (f.FilePath))
- continue;
-
- if (configuration.UseCcache || NeedsCompiling (f, configuration))
- success = DoCompilation (f, configuration, compilerArgs, monitor, cr, configuration.UseCcache);
- }
- if (success)
- monitor.Step (1);
- monitor.EndTask ();
-
- if (success) {
- switch (configuration.CompileTarget)
- {
- case CompileTarget.Exe:
- MakeBin (project, projectFiles, configuration, packages, cr, monitor, outputName);
- break;
- case CompileTarget.Library:
- MakeStaticLibrary (project, projectFiles, configuration, packages, cr, monitor, outputName);
- break;
- case CompileTarget.Module:
- MakeSharedLibrary (project, projectFiles, configuration, packages, cr, monitor, outputName);
- break;
- }
- }
-
- return new BuildResult (cr, "");
- }
-
- public override bool SupportsCcache {
- get { return true; }
- }
-
- public override bool SupportsPrecompiledHeaders {
- get { return true; }
- }
-
- Dictionary<string, string> GetStringTags (Project project)
- {
- Dictionary<string, string> result = new Dictionary<string, string> (StringComparer.InvariantCultureIgnoreCase);
- result["PROJECTDIR"] = project.BaseDirectory;
- result["PROJECTFILENAME"] = project.FileName;
- return result;
- }
-
- public string[] GetCompilerFlagsAsArray (Project project, CProjectConfiguration configuration)
- {
- List<string> args = new List<string> ();
-
- if (configuration.DebugSymbols)
- args.Add ("-g");
-
- if (configuration.CompileTarget == CompileTarget.Module)
- args.Add ("-fPIC");
-
- switch (configuration.WarningLevel) {
- case WarningLevel.None:
- args.Add ("-w");
- break;
- case WarningLevel.Normal:
- break;
- case WarningLevel.All:
- args.Add ("-Wall");
- break;
- }
- switch (configuration.CVersion) {
- case CVersion.ISOC:
- args.Add ("-std=c90");
- break;
- case CVersion.C99:
- args.Add ("-std=c99");
- break;
- case CVersion.C11:
- args.Add ("-std=c11");
- break;
- case CVersion.ISOCPP:
- args.Add ("-std=c++99");
- break;
- case CVersion.CPP03:
- args.Add ("-std=c++03");
- break;
- case CVersion.CPP11:
- args.Add ("-std=c++11");
- break;
- case CVersion.CustomVersionString:
- args.Add (configuration.CustomVersionString);
- break;
- }
-
- if (configuration.WarningsAsErrors)
- args.Add ("-Werror");
-
- args.Add ("-O" + configuration.OptimizationLevel);
-
- if (configuration.ExtraCompilerArguments != null && configuration.ExtraCompilerArguments.Length > 0) {
- string extraCompilerArgs = ExpandBacktickedParameters (configuration.ExtraCompilerArguments.Replace ('\n', ' '));
- args.Add (extraCompilerArgs);
- }
-
- if (configuration.DefineSymbols != null && configuration.DefineSymbols.Length > 0)
- args.Add (ProcessDefineSymbols (configuration.DefineSymbols));
-
- if (configuration.Includes != null)
- foreach (string inc in configuration.Includes)
- args.Add ("-I\"" + StringParserService.Parse (inc, GetStringTags (project)) + "\"");
-
- if (configuration.PrecompileHeaders) {
- string precdir = Path.Combine (configuration.IntermediateOutputDirectory, "prec");
- precdir = Path.Combine (precdir, configuration.Id);
- args.Add ("-I\"" + precdir + "\"");
- }
-
- return args.ToArray ();
- }
-
- public override string GetCompilerFlags (Project project, CProjectConfiguration configuration)
- {
- StringBuilder args = new StringBuilder ();
-
- if (configuration.DebugSymbols)
- args.Append ("-g ");
-
- if (configuration.CompileTarget == CompileTarget.Library)
- args.Append ("-fPIC ");
-
- switch (configuration.WarningLevel)
- {
- case WarningLevel.None:
- args.Append ("-w ");
- break;
- case WarningLevel.Normal:
- // nothing
- break;
- case WarningLevel.All:
- args.Append ("-Wall ");
- break;
- }
-
- if (configuration.WarningsAsErrors)
- args.Append ("-Werror ");
-
- args.Append ("-O" + configuration.OptimizationLevel + " ");
-
- if (configuration.ExtraCompilerArguments != null && configuration.ExtraCompilerArguments.Length > 0) {
- string extraCompilerArgs = ExpandBacktickedParameters(configuration.ExtraCompilerArguments.Replace ('\n', ' '));
- args.Append (extraCompilerArgs + " ");
- }
-
- if (configuration.DefineSymbols != null && configuration.DefineSymbols.Length > 0)
- args.Append (ProcessDefineSymbols (configuration.DefineSymbols) + " ");
-
- if (configuration.Includes != null)
- foreach (string inc in configuration.Includes)
- args.Append ("-I\"" + StringParserService.Parse (inc, GetStringTags (project)) + "\" ");
-
- if (configuration.PrecompileHeaders) {
- string precdir = Path.Combine (configuration.IntermediateOutputDirectory, "prec");
- precdir = Path.Combine (precdir, configuration.Id);
- args.Append ("-I\"" + precdir + "\"");
- }
-
- return args.ToString ();
- }
-
- public override string GetDefineFlags (Project project, CProjectConfiguration configuration)
- {
- return ProcessDefineSymbols (configuration.DefineSymbols);
- }
-
- private bool NeedsCompiling (ProjectFile file, CProjectConfiguration configuration)
- {
- string objectFile = Path.Combine(configuration.OutputDirectory, Path.GetFileName(file.Name));
- objectFile = Path.ChangeExtension(objectFile, ".o");
- if (!File.Exists (objectFile))
- return true;
-
- string[] dependedOnFiles = DependedOnFiles (file, configuration);
- if (dependedOnFiles == null) {
- return true;
- }
-
- DateTime lastObjectTime = File.GetLastWriteTime (objectFile);
-
- try {
- foreach (string depfile in dependedOnFiles) {
- if (File.GetLastWriteTime (depfile) > lastObjectTime) {
- return true;
- }
- }
- } catch (IOException e) {
- // This means the dependency file is telling us our source file
- // depends on a file that no longer exists, all this means is that
- // the dependency file is outdated. We should just ignore this
- // since the dependency file will be automatically updated when
- // the source file is compiled.
- e.ToString (); // suppress warning.
- }
-
- return false;
- }
-
- /// <summary>
- /// Returns an array of depended on files or null if the
- /// file containing the depended on files (.d) does does not exist.
- /// </summary>
- private string[] DependedOnFiles (ProjectFile file, CProjectConfiguration configuration)
- {
- List<string> dependencies = new List<string> ();
- string dependenciesFile = Path.Combine(configuration.OutputDirectory, Path.GetFileName(file.Name));
- dependenciesFile = Path.ChangeExtension(dependenciesFile, ".d");
-
- if (!File.Exists (dependenciesFile))
- return null;
-
- // It always depends on itself ;)
- dependencies.Add (file.Name);
-
- string temp;
- using (StreamReader reader = new StreamReader (dependenciesFile)) {
- while ((temp = reader.ReadLine ()) != null) {
- // TODO: We really should be using a regex here,
- // this will have issues with pathnames containing double spaces.
- string depfile = temp.Replace(" \\", String.Empty).Trim();
-
- // Ignore empty strings & object files...
- if(String.IsNullOrEmpty(depfile) ||
- depfile.EndsWith(".o:") || depfile.EndsWith(".o"))
- continue;
-
- dependencies.Add(depfile.Replace(@"\ ", " "));
- }
- }
-
- return dependencies.ToArray();
- }
-
- private bool PrecompileHeaders (ProjectFileCollection projectFiles,
- CProjectConfiguration configuration,
- string args,
- ProgressMonitor monitor,
- CompilerResults cr)
- {
- monitor.BeginTask (GettextCatalog.GetString ("Precompiling headers"), 1);
- bool success = true;
-
- foreach (ProjectFile file in projectFiles) {
- if (file.Subtype == Subtype.Code && CProject.IsHeaderFile (file.Name)) {
- string precomp = Path.Combine (configuration.IntermediateOutputDirectory, "prec");
- precomp = Path.Combine (precomp, configuration.Id);
- precomp = Path.Combine (precomp, Path.GetFileName (file.Name) + ".ghc");
- if (file.BuildAction == BuildAction.Compile) {
- if (!File.Exists (precomp) || configuration.UseCcache || File.GetLastWriteTime (file.Name) > File.GetLastWriteTime (precomp)) {
- if (DoPrecompileHeader (file, precomp, args, monitor, cr) == false) {
- success = false;
- break;
- }
- }
- } else {
- //remove old files or they'll interfere with the build
- if (File.Exists (precomp))
- File.Delete (precomp);
- }
- }
-
- }
- if (success)
- monitor.Step (1);
- monitor.EndTask ();
- return success;
- }
-
- private bool DoPrecompileHeader (ProjectFile file, string output, string args, ProgressMonitor monitor, CompilerResults cr)
- {
- string completeArgs = String.Format ("\"{0}\" {1} -o {2}", file.Name, args, output);
- string errorOutput;
- int exitCode = ExecuteCommand (compilerCommand, completeArgs, Path.GetDirectoryName (output), monitor, out errorOutput);
- ParseCompilerOutput (errorOutput, cr);
- return (exitCode == 0);
- }
-
- static readonly string[] libraryExtensions = { ".so", ".a", ".dll", ".dylib" };
- /// <summary>
- /// Checks whether a library can be linked with -lbasename
- /// </summary>
- /// <remarks>
- /// This should return true iff directory is empty or in
- /// the configured library paths, and library is of the form blah
- /// or libblah.(a|so|dll|dylib),
- /// </remarks>
- internal bool IsStandardLibrary(CProjectConfiguration configuration,
- string directory, string library,
- ref string std_lib)
- {
- std_lib = library;
-
- if(!(String.IsNullOrEmpty(directory) ||
- configuration.LibPaths.Contains(directory)))
- return false;
-
- string libraryExtension = Path.GetExtension (library);
-
- foreach (string extension in libraryExtensions)
- {
- if (libraryExtension.Equals (extension, StringComparison.OrdinalIgnoreCase)) {
- if (library.StartsWith("lib", StringComparison.OrdinalIgnoreCase)) {
- std_lib = std_lib.Substring(3);
- return true;
- } else {
- return false;
- }
- }
- }
-
- return true;
- }
-
- private void MakeBin (Project project,
- ProjectFileCollection projectFiles,
- CProjectConfiguration configuration,
- ProjectPackageCollection packages,
- CompilerResults cr,
- ProgressMonitor monitor, string outputName)
- {
- if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
-
- string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
- string pkgargs = GeneratePkgLinkerArgs (packages);
- StringBuilder args = new StringBuilder ();
-
- if (configuration.ExtraLinkerArguments != null && configuration.ExtraLinkerArguments.Length > 0) {
- string extraLinkerArgs = ExpandBacktickedParameters(configuration.ExtraLinkerArguments.Replace ('\n', ' '));
- args.Append (extraLinkerArgs + " ");
- }
-
- if (configuration.LibPaths != null)
- foreach (string libpath in configuration.LibPaths)
- args.Append ("-L\"" + StringParserService.Parse (libpath, GetStringTags (project)) + "\" ");
-
- if (configuration.Libs != null) {
- foreach (string lib in configuration.Libs) {
- string directory = Path.GetDirectoryName(lib);
- string library = Path.GetFileName(lib);
-
- // Is this a 'standard' (as in, uses an orthodox naming convention) library..?
- string link_lib = String.Empty;
- if(IsStandardLibrary(configuration, directory, library, ref link_lib))
- args.Append ("-l\"" + link_lib + "\" ");
- // If not, reference the library by it's full pathname.
- else
- args.Append ("\"" + lib + "\" ");
- }
- }
-
- string linker_args = string.Format ("-o \"{0}\" {1} {2} {3}",
- outputName, objectFiles, pkgargs, args.ToString ());
-
- monitor.BeginTask (GettextCatalog.GetString ("Generating binary \"{0}\" from object files", Path.GetFileName (outputName)), 1);
-
- string errorOutput;
- int exitCode = ExecuteCommand (linkerCommand, linker_args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
- if (exitCode == 0)
- monitor.Step (1);
- monitor.EndTask ();
-
- ParseCompilerOutput (errorOutput, cr);
- ParseLinkerOutput (errorOutput, cr);
- CheckReturnCode (exitCode, cr);
- }
-
- private void MakeStaticLibrary (Project project,
- ProjectFileCollection projectFiles,
- CProjectConfiguration configuration,
- ProjectPackageCollection packages,
- CompilerResults cr,
- ProgressMonitor monitor, string outputName)
- {
- if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
-
- string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
- string args = string.Format ("rcs \"{0}\" {1}", outputName, objectFiles);
-
- monitor.BeginTask (GettextCatalog.GetString ("Generating static library {0} from object files", Path.GetFileName (outputName)), 1);
-
- string errorOutput;
- int exitCode = ExecuteCommand ("ar", args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
- if (exitCode == 0)
- monitor.Step (1);
- monitor.EndTask ();
-
- ParseCompilerOutput (errorOutput, cr);
- ParseLinkerOutput (errorOutput, cr);
- CheckReturnCode (exitCode, cr);
- }
-
- private void MakeSharedLibrary(Project project,
- ProjectFileCollection projectFiles,
- CProjectConfiguration configuration,
- ProjectPackageCollection packages,
- CompilerResults cr,
- ProgressMonitor monitor, string outputName)
- {
- if (!NeedsUpdate (projectFiles, configuration, outputName)) return;
-
- string objectFiles = string.Join (" ", ObjectFiles (projectFiles, configuration, true));
- string pkgargs = GeneratePkgLinkerArgs (packages);
- StringBuilder args = new StringBuilder ();
-
- if (configuration.ExtraLinkerArguments != null && configuration.ExtraLinkerArguments.Length > 0) {
- string extraLinkerArgs = ExpandBacktickedParameters(configuration.ExtraLinkerArguments.Replace ('\n', ' '));
- args.Append (extraLinkerArgs + " ");
- }
-
- if (configuration.LibPaths != null)
- foreach (string libpath in configuration.LibPaths)
- args.Append ("-L\"" + StringParserService.Parse (libpath, GetStringTags (project)) + "\" ");
-
- if (configuration.Libs != null) {
- foreach (string lib in configuration.Libs) {
- string directory = Path.GetDirectoryName(lib);
- string library = Path.GetFileName(lib);
-
- // Is this a 'standard' (as in, uses an orthodox naming convention) library..?
- string link_lib = String.Empty;
- if(IsStandardLibrary(configuration, directory, library, ref link_lib))
- args.Append ("-l\"" + link_lib + "\" ");
- // If not, reference the library by it's full pathname.
- else
- args.Append ("\"" + lib + "\" ");
- }
- }
-
- string linker_args = string.Format ("-shared -o \"{0}\" {1} {2} {3}",
- outputName, objectFiles, pkgargs, args.ToString ());
-
- monitor.BeginTask (GettextCatalog.GetString ("Generating shared object \"{0}\" from object files", Path.GetFileName (outputName)), 1);
-
- string errorOutput;
- int exitCode = ExecuteCommand (linkerCommand , linker_args, Path.GetDirectoryName (outputName), monitor, out errorOutput);
- if (exitCode == 0)
- monitor.Step (1);
- monitor.EndTask ();
-
- ParseCompilerOutput (errorOutput, cr);
- ParseLinkerOutput (errorOutput, cr);
- CheckReturnCode (exitCode, cr);
- }
-
- int ExecuteCommand (string command, string args, string baseDirectory, ProgressMonitor monitor, out string errorOutput)
- {
- errorOutput = string.Empty;
- int exitCode = -1;
-
- using (var swError = new StringWriter ()) {
- using (var chainedError = new LogTextWriter ()) {
- chainedError.ChainWriter (monitor.Log);
- chainedError.ChainWriter (swError);
-
- monitor.Log.WriteLine ("{0} {1}", command, args);
-
- using (ProcessWrapper p = Runtime.ProcessService.StartProcess (command, args, baseDirectory, monitor.Log, chainedError, null))
- using (monitor.CancellationToken.Register (p.Cancel)) {
- p.WaitForOutput ();
- chainedError.UnchainWriter (monitor.Log);
- chainedError.UnchainWriter (swError);
-
- errorOutput = swError.ToString ();
- exitCode = p.ExitCode;
-
- if (monitor.CancellationToken.IsCancellationRequested) {
- monitor.Log.WriteLine (GettextCatalog.GetString ("Build cancelled"));
- monitor.ReportError (GettextCatalog.GetString ("Build cancelled"), null);
- if (exitCode == 0)
- exitCode = -1;
- }
- }
- }
- }
-
- return exitCode;
- }
-
- private string ProcessDefineSymbols (string symbols)
- {
- StringBuilder processed = new StringBuilder (symbols);
-
- // Take care of multi adyacent spaces
- for (int i = 0; i < processed.Length; i++) {
- if (i + 1 < processed.Length &&
- processed[i] == ' ' &&
- processed[i + 1] == ' ') {
- processed.Remove (i--, 1);
- }
- }
-
- return processed.ToString ()
- .Trim ()
- .Replace (" ", " -D")
- .Insert (0, "-D");
- }
-
- /// <summary>
- /// Compiles a single source file into object code
- /// and creates a file with it's dependencies.
- /// </summary>
- private bool DoCompilation (ProjectFile file,
- CProjectConfiguration configuration,
- string args,
- ProgressMonitor monitor,
- CompilerResults cr,
- bool use_ccache)
- {
-
- string outputName = Path.Combine(configuration.OutputDirectory, Path.GetFileName(Path.ChangeExtension (file.Name, ".o")));
-
- string compiler_args = string.Format ("{0} -MMD \"{1}\" {2} -c -o \"{3}\"",
- (use_ccache ? compilerCommand : string.Empty), file.Name, args, outputName);
-
- string errorOutput;
- int exitCode = ExecuteCommand ((use_ccache ? "ccache" : compilerCommand), compiler_args, configuration.OutputDirectory, monitor, out errorOutput);
-
- ParseCompilerOutput (errorOutput, cr);
- CheckReturnCode (exitCode, cr);
- return exitCode == 0;
- }
-
- /// <summary>
- /// Gets the files that get compiled into object code.
- /// </summary>
- /// <param name="projectFiles">
- /// A <see cref="ProjectFileCollection"/>
- /// The project's files, extracts from here the files that get compiled into object code.
- /// </param>
- /// <param name="configuration">
- /// A <see cref="CProjectConfiguration"/>
- /// The configuration to get the object files for...
- /// </param>
- /// <param name="withQuotes">
- /// A <see cref="System.Boolean"/>
- /// If true, it will surround each object file with quotes
- /// so that gcc has no problem with paths that contain spaces.
- /// </param>
- /// <returns>
- /// An array of strings, each string is the name of a file
- /// that will get compiled into object code. The file name
- /// will already have the .o extension.
- /// </returns>
- private string[] ObjectFiles (ProjectFileCollection projectFiles, CProjectConfiguration configuration, bool withQuotes)
- {
- if(projectFiles.Count == 0)
- return new string[] {};
-
- List<string> objectFiles = new List<string> ();
-
- foreach (ProjectFile f in projectFiles) {
- if (f.BuildAction == BuildAction.Compile) {
- string PathName = Path.Combine(configuration.OutputDirectory, Path.GetFileNameWithoutExtension(f.Name) + ".o");
-
- if(File.Exists(PathName) == false)
- continue;
-
- if (!withQuotes)
- objectFiles.Add (PathName);
- else
- objectFiles.Add ("\"" + PathName + "\"");
- }
- }
-
- return objectFiles.ToArray ();
- }
-
- public override void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProgressMonitor monitor)
- {
- //clean up object files
- foreach (string oFile in ObjectFiles(projectFiles, configuration, false)) {
- if (File.Exists (oFile))
- File.Delete (oFile);
-
- string dFile = Path.ChangeExtension (oFile, ".d");
- if (File.Exists (dFile))
- File.Delete (dFile);
- }
-
- CleanPrecompiledHeaders (configuration);
- }
-
- void CleanPrecompiledHeaders (CProjectConfiguration configuration)
- {
- if (string.IsNullOrEmpty (configuration.IntermediateOutputDirectory))
- return;
-
- string precDir = Path.Combine (configuration.IntermediateOutputDirectory, "prec");
-
- if (Directory.Exists (precDir))
- Directory.Delete (precDir, true);
- }
-
- private bool NeedsUpdate (ProjectFileCollection projectFiles, CProjectConfiguration configuration, string target)
- {
- if (!File.Exists (target))
- return true;
-
- foreach (string obj in ObjectFiles (projectFiles, configuration, false))
- if (File.GetLastWriteTime (obj) > File.GetLastWriteTime (target))
- return true;
-
- return false;
- }
-
- protected override void ParseCompilerOutput (string errorString, CompilerResults cr)
- {
- TextReader reader = new StringReader (errorString);
- string next;
-
- while ((next = reader.ReadLine ()) != null) {
- CompilerError error = CreateErrorFromErrorString (next, reader);
- if (error != null)
- cr.Errors.Add (error);
- }
-
- reader.Close ();
- }
-
- private static Regex withColRegex = new Regex (
- @"^\s*(?<file>.*):(?<line>\d*):(?<column>\d*):\s*(?<level>.*)\s*:\s(?<message>.*)",
- RegexOptions.Compiled | RegexOptions.ExplicitCapture);
- private static Regex noColRegex = new Regex (
- @"^\s*(?<file>.*):(?<line>\d*):\s*(?<level>.*)\s*:\s(?<message>.*)",
- RegexOptions.Compiled | RegexOptions.ExplicitCapture);
- private static Regex linkerRegex = new Regex (
- @"^\s*(?<file>[^:]*):(?<line>\d*):\s*(?<message>.*)",
- RegexOptions.Compiled | RegexOptions.ExplicitCapture);
-
- private CompilerError CreateErrorFromErrorString (string errorString, TextReader reader)
- {
- CompilerError error = new CompilerError ();
- string warning = GettextCatalog.GetString ("warning");
- string note = GettextCatalog.GetString ("note");
-
- Match match = withColRegex.Match (errorString);
-
- if (match.Success)
- {
- error.FileName = match.Groups["file"].Value;
- error.Line = int.Parse (match.Groups["line"].Value);
- error.Column = int.Parse (match.Groups["column"].Value);
- error.IsWarning = (match.Groups["level"].Value.Equals (warning, StringComparison.Ordinal) ||
- match.Groups["level"].Value.Equals (note, StringComparison.Ordinal));
- error.ErrorText = match.Groups["message"].Value;
-
- return error;
- }
-
- match = noColRegex.Match (errorString);
-
- if (match.Success)
- {
- error.FileName = match.Groups["file"].Value;
- error.Line = int.Parse (match.Groups["line"].Value);
- error.IsWarning = (match.Groups["level"].Value.Equals (warning, StringComparison.Ordinal) ||
- match.Groups["level"].Value.Equals (note, StringComparison.Ordinal));
- error.ErrorText = match.Groups["message"].Value;
-
- // Skip messages that begin with ( and end with ), since they're generic.
- //Attempt to capture multi-line versions too.
- if (error.ErrorText.StartsWith ("(")) {
- string error_continued = error.ErrorText;
- do {
- if (error_continued.EndsWith (")"))
- return null;
- } while ((error_continued = reader.ReadLine ()) != null);
- }
-
- return error;
- }
-
- return null;
- }
-
- protected override void ParseLinkerOutput (string errorString, CompilerResults cr)
- {
- TextReader reader = new StringReader (errorString);
- string next;
-
- while ((next = reader.ReadLine ()) != null) {
- CompilerError error = CreateLinkerErrorFromErrorString (next);
- if (error != null)
- cr.Errors.Insert (0, error);
- }
-
- reader.Close ();
- }
-
- private CompilerError CreateLinkerErrorFromErrorString (string errorString)
- {
- CompilerError error = new CompilerError ();
-
- Match linkerMatch = linkerRegex.Match (errorString);
-
- if (linkerMatch.Success)
- {
- error.FileName = linkerMatch.Groups["file"].Value;
- error.Line = int.Parse (linkerMatch.Groups["line"].Value);
- error.ErrorText = linkerMatch.Groups["message"].Value;
-
- return error;
- }
-
- return null;
- }
-
- // expands backticked portions of the parameter-list using "sh" and "echo"
- // TODO: Do this ourselves, relying on sh/echo - and launching an entire process just for this is ... excessive.
- public string ExpandBacktickedParameters (string tmp)
- {
- // 1) Quadruple \ required, to escape both echo's and sh's escape character filtering
- // 2) \\\" required inside of echo, to translate into \" in sh, so it translates back as a " to MD...
- string parameters = "-c \"echo " + tmp.Replace("\\", "\\\\\\\\").Replace("\"", "\\\\\\\"") + "\"";
-
- var p = Process.Start (new ProcessStartInfo ("sh", parameters) {
- UseShellExecute = false,
- RedirectStandardOutput = true
- });
- p.Start ();
- p.WaitForExit ();
-
- //TODO: use async reads so we don't deadlock if stdout fills up
- //TODO: check return code
- return p.StandardOutput.ReadToEnd ().Trim ();
- }
-
- bool CheckApp (string app)
- {
- try {
- ProcessWrapper p = Runtime.ProcessService.StartProcess (app, "--version", null, null);
- p.WaitForOutput ();
- return true;
- } catch {
- return false;
- }
- }
-
- /// <summary>
- /// Checks a compilation return code,
- /// and adds an error result if the compiler results
- /// show no errors.
- /// </summary>
- /// <param name="returnCode">
- /// A <see cref="System.Int32"/>: A process return code
- /// </param>
- /// <param name="cr">
- /// A <see cref="CompilerResults"/>: The return code from a compilation run
- /// </param>
- void CheckReturnCode (int returnCode, CompilerResults cr)
- {
- cr.NativeCompilerReturnValue = returnCode;
- if (0 != returnCode && 0 == cr.Errors.Count) {
- cr.Errors.Add (new CompilerError (string.Empty, 0, 0, string.Empty,
- GettextCatalog.GetString ("Build failed - check build output for details")));
- }
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/refactoring/gotodeclarationhandler.cs b/caddin/cbinding/cbinding/refactoring/gotodeclarationhandler.cs
index 64a92d0..38d77d7 100644
--- a/cbindingreport/cbinding/cbinding/refactoring/gotodeclarationhandler.cs
+++ b/caddin/cbinding/cbinding/refactoring/gotodeclarationhandler.cs
@@ -3,6 +3,7 @@ using ClangSharp;
using MonoDevelop.Ide;
using CBinding.Parser;
using MonoDevelop.Core;
+using MonoDevelop.Projects;
using System;
using MonoDevelop.Ide.FindInFiles;
@@ -21,7 +22,7 @@ namespace CBinding.Refactoring
var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
try {
var doc = IdeApp.Workbench.ActiveDocument;
- var project = (CProject)doc.Project;
+ var project = (CMakeProject)(doc.Project as SolutionItem);
CXCursor cursor = project.ClangManager.GetCursor (doc.FileName, doc.Editor.CaretLocation);
CXCursor referredCursor = project.ClangManager.GetCursorReferenced (cursor);
bool leastOne = false;
@@ -36,7 +37,7 @@ namespace CBinding.Refactoring
}
if (!leastOne) {
var loc = project.ClangManager.GetCursorLocation (referredCursor);
- IdeApp.Workbench.OpenDocument (loc.FileName, project, loc.Line, loc.Column);
+ IdeApp.Workbench.OpenDocument (loc.FileName, doc.Project, loc.Line, loc.Column);
}
} catch (Exception ex) {
if (monitor != null)
@@ -56,8 +57,8 @@ namespace CBinding.Refactoring
public void Update (CommandInfo info)
{
var doc = IdeApp.Workbench.ActiveDocument;
- CProject project;
- if (doc == null || (project = doc.Project as CProject) == null || !project.HasLibClang) {
+ CMakeProject project;
+ if (doc == null || (project = (CMakeProject)(doc.Project as SolutionItem)) == null || !project.HasLibClang) {
info.Enabled = info.Visible = false;
return;
}
diff --git a/cbindingreport/cbinding/cbinding/refactoring/gotodefinitionhandler.cs b/caddin/cbinding/cbinding/refactoring/gotodefinitionhandler.cs
index 1171824..99a4fc8 100644
--- a/cbindingreport/cbinding/cbinding/refactoring/gotodefinitionhandler.cs
+++ b/caddin/cbinding/cbinding/refactoring/gotodefinitionhandler.cs
@@ -3,6 +3,7 @@ using ClangSharp;
using MonoDevelop.Ide;
using CBinding.Parser;
using MonoDevelop.Core;
+using MonoDevelop.Projects;
using MonoDevelop.Ide.FindInFiles;
using System;
@@ -21,7 +22,7 @@ namespace CBinding.Refactoring
var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
try {
var doc = IdeApp.Workbench.ActiveDocument;
- var project = (CProject)doc.Project;
+ var project = (CMakeProject)(doc.Project as SolutionItem);
CXCursor cursor = project.ClangManager.GetCursor (doc.FileName, doc.Editor.CaretLocation);
CXCursor referredCursor = project.ClangManager.GetCursorReferenced (cursor);
bool leastOne = false;
@@ -37,7 +38,7 @@ namespace CBinding.Refactoring
if (!leastOne) {
CXCursor defCursor = project.ClangManager.GetCursorDefinition (referredCursor);
var loc = project.ClangManager.GetCursorLocation (defCursor);
- IdeApp.Workbench.OpenDocument (loc.FileName, project, loc.Line, loc.Column);
+ IdeApp.Workbench.OpenDocument (loc.FileName, doc.Project, loc.Line, loc.Column);
}
} catch (Exception ex) {
if (monitor != null)
@@ -58,8 +59,8 @@ namespace CBinding.Refactoring
protected override void Update (CommandInfo info)
{
var doc = IdeApp.Workbench.ActiveDocument;
- CProject project;
- if (doc == null || (project = doc.Project as CProject) == null || !project.HasLibClang) {
+ CMakeProject project;
+ if (doc == null || (project = (CMakeProject)(doc.Project as SolutionItem)) == null || !project.HasLibClang) {
info.Enabled = info.Visible = false;
return;
}
diff --git a/cbindingreport/cbinding/cbinding/compiler/GppCompiler.cs b/GppCompiler.cs
index cdaa66c..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/compiler/GppCompiler.cs
+++ b/GppCompiler.cs
@@ -1,55 +0,0 @@
-//
-// GppCompiler.cs: Provides functionality to compile using g++
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using Mono.Addins;
-
-
-namespace CBinding
-{
- [Extension ("/CBinding/Compilers")]
- public class GppCompiler : GNUCompiler
- {
- public override string Name {
- get { return "g++"; }
- }
-
- public override Language Language {
- get { return Language.CPP; }
- }
-
- public GppCompiler ()
- {
- compilerCommand = "g++";
- linkerCommand = "g++";
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/compiler/ICompiler.cs b/ICompiler.cs
index a3b7ad7..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/compiler/ICompiler.cs
+++ b/ICompiler.cs
@@ -1,76 +0,0 @@
-//
-// ICompiler.cs: interface that must be implemented by any class that wants
-// to provide a compiler for the CBinding addin.
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using Mono.Addins;
-
-using MonoDevelop.Core;
-using MonoDevelop.Projects;
-
-namespace CBinding
-{
- [TypeExtensionPoint ("/CBinding/Compilers")]
- public interface ICompiler
- {
- string Name {
- get;
- }
-
- Language Language {
- get;
- }
-
- string CompilerCommand {
- get;
- }
-
- bool SupportsCcache {
- get;
- }
-
- bool SupportsPrecompiledHeaders {
- get;
- }
-
- string GetCompilerFlags (Project project, CProjectConfiguration configuration);
-
- string GetDefineFlags (Project project, CProjectConfiguration configuration);
-
- BuildResult Compile (
- Project project,
- ProjectFileCollection projectFiles,
- ProjectPackageCollection packages,
- CProjectConfiguration configuration,
- ProgressMonitor monitor);
-
- void Clean (ProjectFileCollection projectFiles, CProjectConfiguration configuration, ProgressMonitor monitor);
- }
-}
diff --git a/macmaketoolchain.cs b/caddin/cbinding/cbinding/compiler/macmaketoolchain.cs
index e69de29..3ee1b1b 100644
--- a/macmaketoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/macmaketoolchain.cs
@@ -0,0 +1,59 @@
+//
+// MacMakeToolchain.cs: Provides functionality to compile using MAC Make Toolchain.
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Threading.Tasks;
+using System.IO;
+
+using Mono.Addins;
+
+using MonoDevelop.Core;
+
+namespace CBinding
+{
+ [Extension ("/CBinding/Toolchains")]
+ public class MacMakeToolchain : CMakeToolchain
+ {
+ /// <summary>
+ /// The name of this Toolchain.
+ /// </summary>
+ /// <value>The name.</value>
+ public override string ToolchainName {
+ get {
+ return "Mac Make Toolchain";
+ }
+ }
+
+ public override bool IsSupported {
+ get {
+ return Platform.IsMac;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/parser/macro.cs b/caddin/cbinding/cbinding/parser/macro.cs
index 55c7e30..b827478 100644
--- a/cbindingreport/cbinding/cbinding/parser/macro.cs
+++ b/caddin/cbinding/cbinding/parser/macro.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Macro : Symbol
{
- public Macro (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Macro (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/properties/manifest.addin.xml b/caddin/cbinding/cbinding/properties/manifest.addin.xml
index 1cf15cd..948513b 100644
--- a/cbindingreport/cbinding/cbinding/properties/manifest.addin.xml
+++ b/caddin/cbinding/cbinding/properties/manifest.addin.xml
@@ -168,8 +168,6 @@
<Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
<NodeBuilder id = "CBinding.ProjectPad.ProjectReferencesExtension" class = "CBinding.ProjectPad.ProjectReferencesExtension"/>
<NodeBuilder id = "CBinding.ProjectPad.ProjectNodeExtension" class = "CBinding.ProjectPad.ProjectNodeExtension"/>
- <NodeBuilder id = "CBinding.ProjectPad.ProjectPackagesFolderNodeBuilder" class = "CBinding.ProjectPad.ProjectPackagesFolderNodeBuilder"/>
- <NodeBuilder id = "CBinding.ProjectPad.ProjectPackageNodeBuilder" class = "CBinding.ProjectPad.ProjectPackageNodeBuilder"/>
<NodeBuilder id = "CBinding.ProjectPad.FolderBasedProjectNodeBuilder" class = "CBinding.ProjectPad.FolderBasedProjectNodeBuilder"/>
<NodeBuilder id = "CBinding.ProjectPad.CMakeProjectNodeBuilder" class = "CBinding.ProjectPad.CMakeTargetNodeBuilder"/>
<NodeBuilder id = "CBinding.ProjectPad.SystemFileNodeBuilder" class = "CBinding.ProjectPad.SystemFileNodeBuilder"/>
diff --git a/cbindingreport/cbinding/cbinding/parser/memberfunction.cs b/caddin/cbinding/cbinding/parser/memberfunction.cs
index 2f4622a..8fc348e 100644
--- a/cbindingreport/cbinding/cbinding/parser/memberfunction.cs
+++ b/caddin/cbinding/cbinding/parser/memberfunction.cs
@@ -5,7 +5,7 @@ namespace CBinding.Parser
public class MemberFunction : Function
{
- public MemberFunction (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public MemberFunction (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/mingw32toolchain.cs b/caddin/cbinding/cbinding/compiler/mingw32toolchain.cs
index e69de29..9bf3dda 100644
--- a/mingw32toolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/mingw32toolchain.cs
@@ -0,0 +1,72 @@
+//
+// MinGW32Toolchain.cs: Provides functionality to compile using MinGW32 Toolchain.
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Threading.Tasks;
+using System.IO;
+
+using Mono.Addins;
+
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+
+namespace CBinding
+{
+ [Extension ("/CBinding/Toolchains")]
+ public class MinGW32Toolchain : CMakeToolchain
+ {
+ /// <summary>
+ /// The name of this Toolchain.
+ /// </summary>
+ /// <value>The name.</value>
+ public override string ToolchainName {
+ get {
+ return "MinGW32 Toolchain";
+ }
+ }
+
+ public override string GeneratorID {
+ get {
+ return "MinGW Makefiles";
+ }
+ }
+
+ public override string CMakeCacheEntry {
+ get {
+ return "CMAKE_EXPORT_COMPILE_COMMANDS=1";
+ }
+ }
+
+ public override bool IsSupported {
+ get {
+ return Platform.IsWindows;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/parser/namespace.cs b/caddin/cbinding/cbinding/parser/namespace.cs
index c015eac..a417bb1 100644
--- a/cbindingreport/cbinding/cbinding/parser/namespace.cs
+++ b/caddin/cbinding/cbinding/parser/namespace.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Namespace : Symbol
{
- public Namespace (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Namespace (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
}
diff --git a/cbindingreport/cbinding/cbinding/gui/outputoptionspanel.cs b/outputoptionspanel.cs
index da55414..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/gui/outputoptionspanel.cs
+++ b/outputoptionspanel.cs
@@ -1,112 +0,0 @@
-//
-// OutputOptionsPanel.cs: configure output options
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-using Mono.Addins;
-
-using MonoDevelop.Core;
-using MonoDevelop.Components;
-using MonoDevelop.Ide.Projects;
-using MonoDevelop.Ide.Gui.Dialogs;
-
-namespace CBinding
-{
- public partial class OutputOptionsPanel : Gtk.Bin
- {
- private CProjectConfiguration configuration;
-
- public OutputOptionsPanel ()
- {
- this.Build ();
- table1.RowSpacing = 3;
- }
-
- public void Load (CProjectConfiguration configuration)
- {
- this.configuration = configuration;
-
- outputNameTextEntry.Text = configuration.Output;
- outputEntry.Path = configuration.OutputDirectory;
- parametersTextEntry.Text = configuration.CommandLineParameters;
-
- if (externalConsoleCheckbox.Active)
- pauseCheckbox.Sensitive = true;
-
- externalConsoleCheckbox.Active = configuration.ExternalConsole;
- pauseCheckbox.Active = configuration.PauseConsoleOutput;
- }
-
- public void Store ()
- {
- if (configuration == null)
- return;
-
- if (outputNameTextEntry != null && outputNameTextEntry.Text.Length > 0)
- configuration.Output = outputNameTextEntry.Text.Trim ();
-
- var newPath = outputEntry.Path.Trim ();
- if (!string.IsNullOrEmpty (newPath))
- configuration.OutputDirectory = newPath;
-
- if (parametersTextEntry.Text != null && parametersTextEntry.Text.Length > 0)
- configuration.CommandLineParameters = parametersTextEntry.Text.Trim ();
-
- configuration.ExternalConsole = externalConsoleCheckbox.Active;
- configuration.PauseConsoleOutput = pauseCheckbox.Active;
- }
-
- protected virtual void OnExternalConsoleCheckboxClicked (object sender, System.EventArgs e)
- {
- pauseCheckbox.Sensitive = externalConsoleCheckbox.Active;
- }
- }
-
- public class OutputOptionsPanelBinding : MultiConfigItemOptionsPanel
- {
- private OutputOptionsPanel panel;
-
- public override Control CreatePanelWidget ()
- {
- return panel = new OutputOptionsPanel ();
- }
-
- public override void LoadConfigData ()
- {
- panel.Load ((CProjectConfiguration) CurrentConfiguration);
- }
-
- public override void ApplyChanges ()
- {
- panel.Store ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/gui/packagedetails.cs b/packagedetails.cs
index c35b7f8..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/gui/packagedetails.cs
+++ b/packagedetails.cs
@@ -1,89 +0,0 @@
-//
-// PackageDetails.cs
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace CBinding
-{
- public partial class PackageDetails : Gtk.Dialog
- {
- Gtk.ListStore requiresStore = new Gtk.ListStore (typeof(string));
- Gtk.ListStore libPathsStore = new Gtk.ListStore (typeof(string));
- Gtk.ListStore libsStore = new Gtk.ListStore (typeof(string));
- Gtk.ListStore cflagsStore = new Gtk.ListStore (typeof(string));
-
- public PackageDetails (Package package)
- {
- this.Build();
-
- package.ParsePackage ();
-
- Gtk.CellRendererText textRenderer = new Gtk.CellRendererText ();
-
- requiresTreeView.Model = requiresStore;
- requiresTreeView.AppendColumn ("Requires", textRenderer, "text", 0);
- requiresTreeView.HeadersVisible = false;
-
- libPathsTreeView.Model = libPathsStore;
- libPathsTreeView.AppendColumn ("LibPaths", textRenderer, "text", 0);
- libPathsTreeView.HeadersVisible = false;
-
- libsTreeView.Model = libsStore;
- libsTreeView.AppendColumn ("Libs", textRenderer, "text", 0);
- libsTreeView.HeadersVisible = false;
-
- cflagsTreeView.Model = cflagsStore;
- cflagsTreeView.AppendColumn ("CFlags", textRenderer, "text", 0);
- cflagsTreeView.HeadersVisible = false;
-
- nameLabel.Text = package.Name;
- descriptionLabel.Text = package.Description;
- versionLabel.Text = package.Version;
-
- foreach (string req in package.Requires)
- requiresStore.AppendValues (req);
-
- foreach (string libpath in package.LibPaths)
- libPathsStore.AppendValues (libpath);
-
- foreach (string lib in package.Libs)
- libsStore.AppendValues (lib);
-
- foreach (string cflag in package.CFlags)
- cflagsStore.AppendValues (cflag);
- }
-
- protected virtual void OnButtonOkClicked (object sender, System.EventArgs e)
- {
- Destroy ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/gui/renamehandlerdialog.cs b/caddin/cbinding/cbinding/gui/renamehandlerdialog.cs
index a0dd8d0..2d5c7a0 100644
--- a/cbindingreport/cbinding/cbinding/gui/renamehandlerdialog.cs
+++ b/caddin/cbinding/cbinding/gui/renamehandlerdialog.cs
@@ -7,6 +7,7 @@ using MonoDevelop.Ide;
using MonoDevelop.Core;
using MonoDevelop.Components.Commands;
using MonoDevelop.Core.Text;
+using MonoDevelop.Projects;
using System.Text;
using System.Text.RegularExpressions;
using CBinding.Parser;
@@ -15,7 +16,7 @@ namespace CBinding
{
public partial class RenameHandlerDialog : Gtk.Dialog
{
- protected CProject project;
+ protected CMakeProject project;
protected CXCursor cursorReferenced;
protected string UsrReferenced;
protected string spelling;
@@ -23,7 +24,7 @@ namespace CBinding
protected Document document;
public string File;
- public RenameHandlerDialog (CProject proj, Document doc)
+ public RenameHandlerDialog (CMakeProject proj, Document doc)
{
project = proj;
cursorReferenced = project.ClangManager.GetCursorReferenced(
@@ -90,7 +91,7 @@ namespace CBinding
/// </summary>
/// <param name="project">Project.</param>
/// <param name="cursor">Cursor.</param>
- public async void FindRefsAndRename (CProject project, CXCursor cursor)
+ public async void FindRefsAndRename (CMakeProject project, CXCursor cursor)
{
try {
diff --git a/cbindingreport/cbinding/cbinding/gui/outputoptionspanel.cs b/outputoptionspanel.cs
index da55414..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/gui/outputoptionspanel.cs
+++ b/outputoptionspanel.cs
@@ -1,112 +0,0 @@
-//
-// OutputOptionsPanel.cs: configure output options
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-using Mono.Addins;
-
-using MonoDevelop.Core;
-using MonoDevelop.Components;
-using MonoDevelop.Ide.Projects;
-using MonoDevelop.Ide.Gui.Dialogs;
-
-namespace CBinding
-{
- public partial class OutputOptionsPanel : Gtk.Bin
- {
- private CProjectConfiguration configuration;
-
- public OutputOptionsPanel ()
- {
- this.Build ();
- table1.RowSpacing = 3;
- }
-
- public void Load (CProjectConfiguration configuration)
- {
- this.configuration = configuration;
-
- outputNameTextEntry.Text = configuration.Output;
- outputEntry.Path = configuration.OutputDirectory;
- parametersTextEntry.Text = configuration.CommandLineParameters;
-
- if (externalConsoleCheckbox.Active)
- pauseCheckbox.Sensitive = true;
-
- externalConsoleCheckbox.Active = configuration.ExternalConsole;
- pauseCheckbox.Active = configuration.PauseConsoleOutput;
- }
-
- public void Store ()
- {
- if (configuration == null)
- return;
-
- if (outputNameTextEntry != null && outputNameTextEntry.Text.Length > 0)
- configuration.Output = outputNameTextEntry.Text.Trim ();
-
- var newPath = outputEntry.Path.Trim ();
- if (!string.IsNullOrEmpty (newPath))
- configuration.OutputDirectory = newPath;
-
- if (parametersTextEntry.Text != null && parametersTextEntry.Text.Length > 0)
- configuration.CommandLineParameters = parametersTextEntry.Text.Trim ();
-
- configuration.ExternalConsole = externalConsoleCheckbox.Active;
- configuration.PauseConsoleOutput = pauseCheckbox.Active;
- }
-
- protected virtual void OnExternalConsoleCheckboxClicked (object sender, System.EventArgs e)
- {
- pauseCheckbox.Sensitive = externalConsoleCheckbox.Active;
- }
- }
-
- public class OutputOptionsPanelBinding : MultiConfigItemOptionsPanel
- {
- private OutputOptionsPanel panel;
-
- public override Control CreatePanelWidget ()
- {
- return panel = new OutputOptionsPanel ();
- }
-
- public override void LoadConfigData ()
- {
- panel.Load ((CProjectConfiguration) CurrentConfiguration);
- }
-
- public override void ApplyChanges ()
- {
- panel.Store ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/gui/packagedetails.cs b/packagedetails.cs
index c35b7f8..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/gui/packagedetails.cs
+++ b/packagedetails.cs
@@ -1,89 +0,0 @@
-//
-// PackageDetails.cs
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace CBinding
-{
- public partial class PackageDetails : Gtk.Dialog
- {
- Gtk.ListStore requiresStore = new Gtk.ListStore (typeof(string));
- Gtk.ListStore libPathsStore = new Gtk.ListStore (typeof(string));
- Gtk.ListStore libsStore = new Gtk.ListStore (typeof(string));
- Gtk.ListStore cflagsStore = new Gtk.ListStore (typeof(string));
-
- public PackageDetails (Package package)
- {
- this.Build();
-
- package.ParsePackage ();
-
- Gtk.CellRendererText textRenderer = new Gtk.CellRendererText ();
-
- requiresTreeView.Model = requiresStore;
- requiresTreeView.AppendColumn ("Requires", textRenderer, "text", 0);
- requiresTreeView.HeadersVisible = false;
-
- libPathsTreeView.Model = libPathsStore;
- libPathsTreeView.AppendColumn ("LibPaths", textRenderer, "text", 0);
- libPathsTreeView.HeadersVisible = false;
-
- libsTreeView.Model = libsStore;
- libsTreeView.AppendColumn ("Libs", textRenderer, "text", 0);
- libsTreeView.HeadersVisible = false;
-
- cflagsTreeView.Model = cflagsStore;
- cflagsTreeView.AppendColumn ("CFlags", textRenderer, "text", 0);
- cflagsTreeView.HeadersVisible = false;
-
- nameLabel.Text = package.Name;
- descriptionLabel.Text = package.Description;
- versionLabel.Text = package.Version;
-
- foreach (string req in package.Requires)
- requiresStore.AppendValues (req);
-
- foreach (string libpath in package.LibPaths)
- libPathsStore.AppendValues (libpath);
-
- foreach (string lib in package.Libs)
- libsStore.AppendValues (lib);
-
- foreach (string cflag in package.CFlags)
- cflagsStore.AppendValues (cflag);
- }
-
- protected virtual void OnButtonOkClicked (object sender, System.EventArgs e)
- {
- Destroy ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/packages.config b/caddin/cbinding/cbinding/packages.config
index a11d77c..9325d8c 100644
--- a/cbindingreport/cbinding/cbinding/packages.config
+++ b/caddin/cbinding/cbinding/packages.config
@@ -1,4 +1,6 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="MonoDevelop.Addins" version="0.3.10" targetFramework="net45" />
+ <package id="Microsoft.CSharp" version="4.3.0" targetFramework="net461" />
+ <package id="Mono.Data.Sqlite.Portable" version="1.0.3.5" targetFramework="net45" />
+ <package id="MonoDevelop.Addins" version="0.3.16" targetFramework="net45" />
</packages>
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/project/package.cs b/package.cs
index 33a91ce..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/project/package.cs
+++ b/package.cs
@@ -1,323 +0,0 @@
-//
-// ProjectPackage.cs: A pkg-config package
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-
-using Mono.Addins;
-
-using MonoDevelop.Core;
-using MonoDevelop.Core.Serialization;
-
-namespace CBinding
-{
- public class Package
- {
- [ItemProperty ("file")]
- private string file;
-
- [ItemProperty ("name")]
- private string name;
-
- [ItemProperty ("IsProject")]
- private bool is_project;
-
- private string description;
- private string version;
- private List<string> requires = new List<string>();
- private List<string> libPaths = new List<string>();
- private List<string> libs = new List<string>();
- private List<string> cflags = new List<string>();
- private Dictionary<string, string> vars = new Dictionary<string,string> ();
-
- public Package (string file)
- {
- this.file = file;
- this.is_project = false;
-
- ParsePackageEssentials ();
- }
-
- public Package (CProject project)
- {
- name = project.Name;
- file = Path.Combine (project.BaseDirectory, name + ".md.pc");
- is_project = true;
-
- ParsePackageEssentials ();
- }
-
- public Package ()
- {
- }
-
- void ParsePackageEssentials ()
- {
- string line;
-
- using (StreamReader reader = new StreamReader (file)) {
- while ((line = reader.ReadLine ()) != null) {
- if (line.StartsWith ("Name")) {
- name = line.Split (':')[1].TrimStart ();
- continue;
- }
-
- if (line.StartsWith ("Version")) {
- version = line.Split (':')[1].TrimStart ();
- }
- }
- }
- }
-
- bool parsed = false;
- public void ParsePackage ()
- {
- if (parsed)
- return;
-
- string line;
-
- using (StreamReader reader = new StreamReader (file)) {
- while ((line = reader.ReadLine ()) != null) {
- if (line.StartsWith ("#"))
- continue;
-
- if (line.IndexOf ('=') >= 0)
- ParseVar (line);
-
- if (line.IndexOf (':') >= 0)
- ParseProperty (line);
- }
- }
-
- parsed = true;
- }
-
- void ParseVar (string line)
- {
- int i = line.IndexOf ('=');
- string key = line.Substring (0, i);
- string value = line.Substring (i+1, line.Length - i-1).Trim ();
- string parsedValue = StringParserService.Parse (value, CustomTags ());
-
- vars.Add (key, parsedValue);
- }
-
- void ParseProperty (string line)
- {
- int i = line.IndexOf (':');
- string key = line.Substring (0, i);
- string value = StringParserService.Parse (line.Substring (i+1, line.Length - i-1).Trim (), CustomTags ());
-
- if (value.Length <= 0)
- return;
-
- switch (key) {
- case "Name":
- name = value;
- break;
- case "Description":;
- description = ProcessDescription (value);
- break;
- case "Version":
- version = value;
- break;
- case "Requires":
- ParseRequires (value);
- break;
- case "Libs":
- ParseLibs (value);
- break;
- case "Cflags":
- ParseCFlags (value);
- break;
- }
- }
-
- void ParseRequires (string reqsline)
- {
- string[] splitted = reqsline.Split (' ');
-
- foreach (string str in splitted) {
- if (str.Trim () == string.Empty)
- continue;
- Requires.Add (str);
- }
- }
-
- void ParseLibs (string libline)
- {
- int i = 0;
- string lib;
-
- while (true) {
- i = libline.IndexOf ('-', i);
-
- if (i < 0)
- break;
-
- int count = 0;
-
- while (libline.Length > (count+i+2) && libline[count+i+2] != ' ')
- count++;
-
- lib = libline.Substring (i+2, count);
-
- if (libline[i+1] == 'L') {
- libPaths.Add (lib);
- } else if (libline[i+1] == 'l') {
- libs.Add (lib);
- }
-
- i++;
- }
- }
-
- void ParseCFlags (string cflagsline)
- {
- string[] splitted = cflagsline.Split (' ');
-
- foreach (string str in splitted) {
- if (str.Trim () == string.Empty)
- continue;
- CFlags.Add (str);
- }
- }
-
- /// <summary>
- /// Insert '\n's to make sure string isn't too long.
- /// </summary>
- /// <param name="desc">
- /// The unprocessed description.
- /// A <see cref="System.String"/>
- /// </param>
- /// <returns>
- /// The processed description.
- /// A <see cref="System.String"/>
- /// </returns>
- string ProcessDescription (string desc)
- {
- int length = 80;
-
- if (desc.Length <= length)
- return desc;
-
- StringBuilder builder = new StringBuilder (desc);
- int i = 0;
- int lines = 1;
-
- while (i < desc.Length) {
- i++;
-
- if (i > lines * length) {
- lines++;
-
- do {
- i--;
- } while (desc [i] != ' ');
-
- builder.Replace (' ', '\n', i, 1);
- }
- }
-
- return builder.ToString ();
- }
-
- Dictionary<string, string> CustomTags ()
- {
- Dictionary<string, string> customTags = new Dictionary<string, string> (StringComparer.InvariantCultureIgnoreCase);
- int i = 0;
-
- foreach (KeyValuePair<string, string> kvp in vars) {
- customTags.Add (kvp.Key, kvp.Value);
- i++;
- }
-
- return customTags;
- }
-
- public string File {
- get { return file; }
- set { file = value; }
- }
-
- public string Name {
- get { return name; }
- set { name = value; }
- }
-
- public bool IsProject {
- get { return is_project; }
- set { is_project = value; }
- }
-
- public string Version {
- get { return version; }
- set { version = value; }
- }
-
- public string Description {
- get { return description; }
- }
-
- public List<string> Requires {
- get { return requires; }
- }
-
- public List<string> LibPaths {
- get { return libPaths; }
- }
-
- public List<string> Libs {
- get { return libs; }
- }
-
- public List<string> CFlags {
- get { return cflags; }
- }
-
- public override bool Equals (object o)
- {
- Package other = o as Package;
-
- if (other == null) return false;
-
- return other.File.Equals (file);
- }
-
- public override int GetHashCode ()
- {
- return (name + version).GetHashCode ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/project/projectpackagecollection.cs b/projectpackagecollection.cs
index 3a29ee5..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/project/projectpackagecollection.cs
+++ b/projectpackagecollection.cs
@@ -1,110 +0,0 @@
-//
-// ProjectPackageCollection.cs: Collection of pkg-config packages for the prject
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-using Mono.Addins;
-
-namespace CBinding
-{
- [Serializable()]
- public class ProjectPackageCollection : Collection<Package>
- {
- private CProject project;
-
- internal CProject Project {
- get { return project; }
- set { project = value; }
- }
-
- public ProjectPackageCollection ()
- {
- }
-
- public void AddRange (IEnumerable<Package> packages)
- {
- foreach (Package p in packages)
- Add (p);
- }
-
- protected override void ClearItems()
- {
- if (project != null) {
- List<Package> list = new List<Package> (Items);
- base.ClearItems ();
- foreach (Package p in list) {
- project.NotifyPackageRemovedFromProject (p);
- }
- }
- }
-
- protected override void InsertItem (int index, Package value)
- {
- base.InsertItem (index, value);
- if (project != null) {
- project.NotifyPackageAddedToProject (value);
- }
- }
-
- protected override void RemoveItem (int index)
- {
- Package p = Items [index];
- base.RemoveItem (index);
- if (project != null) {
- project.NotifyPackageRemovedFromProject (p);
- }
- }
-
- protected override void SetItem (int index, Package item)
- {
- Package oldValue = Items [index];
- base.SetItem (index, item);
- if (project != null) {
- project.NotifyPackageRemovedFromProject (oldValue);
- project.NotifyPackageAddedToProject (item);
- }
- }
-
- public string[] ToStringArray ()
- {
- string[] array = new string[Count];
- int i = 0;
-
- foreach (Package p in Items)
- array[i++] = p.Name;
-
- return array;
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/project/projectpackageeventargs.cs b/caddin/cbinding/cbinding/project/projectpackageeventargs.cs
index 492ba85..581a70d 100644
--- a/cbindingreport/cbinding/cbinding/project/projectpackageeventargs.cs
+++ b/caddin/cbinding/cbinding/project/projectpackageeventargs.cs
@@ -37,21 +37,15 @@ namespace CBinding
public class ProjectPackageEventArgs : EventArgs
{
- CProject project;
- Package package;
+ CMakeProject project;
- public ProjectPackageEventArgs(CProject project, Package package)
+ public ProjectPackageEventArgs(CMakeProject project)
{
this.project = project;
- this.package = package;
}
- public CProject Project {
+ public CMakeProject Project {
get { return project; }
}
-
- public Package Package {
- get { return package; }
- }
}
}
diff --git a/cbindingreport/cbinding/cbinding/project/unsavedfilesmanager.cs b/caddin/cbinding/cbinding/project/unsavedfilesmanager.cs
index 4ac3dfd..4d8a8db 100644
--- a/cbindingreport/cbinding/cbinding/project/unsavedfilesmanager.cs
+++ b/caddin/cbinding/cbinding/project/unsavedfilesmanager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using MonoDevelop.Ide;
using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Gui;
@@ -12,10 +12,10 @@ namespace CBinding
public class UnsavedFilesManager : IDisposable
{
Document current;
- CProject Project { get; }
+ CMakeProject Project { get; }
ConcurrentDictionary<string, UnsavedFile> UnsavedFileCollection { get; }
- public UnsavedFilesManager (CProject proj)
+ public UnsavedFilesManager (CMakeProject proj)
{
Project = proj;
IdeApp.Workbench.ActiveDocumentChanged += HandleChange;
diff --git a/cbindingreport/cbinding/cbinding/projectpad/projectnodeextension.cs b/caddin/cbinding/cbinding/projectpad/projectnodeextension.cs
index 10b6fbb..4116826 100644
--- a/cbindingreport/cbinding/cbinding/projectpad/projectnodeextension.cs
+++ b/caddin/cbinding/cbinding/projectpad/projectnodeextension.cs
@@ -44,16 +44,16 @@ namespace CBinding.ProjectPad
{
public override bool CanBuildNode (Type dataType)
{
- return typeof(CProject).IsAssignableFrom (dataType);
+ return typeof(CMakeProject).IsAssignableFrom (dataType);
}
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
- CProject p = dataObject as CProject;
+ CMakeProject p = dataObject as CMakeProject;
if (p == null) return;
- builder.AddChild (p.Packages);
+// builder.AddChild (p.Packages);
}
}
}
diff --git a/cbindingreport/cbinding/cbinding/project/projectpackagecollection.cs b/projectpackagecollection.cs
index 3a29ee5..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/project/projectpackagecollection.cs
+++ b/projectpackagecollection.cs
@@ -1,110 +0,0 @@
-//
-// ProjectPackageCollection.cs: Collection of pkg-config packages for the prject
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-using Mono.Addins;
-
-namespace CBinding
-{
- [Serializable()]
- public class ProjectPackageCollection : Collection<Package>
- {
- private CProject project;
-
- internal CProject Project {
- get { return project; }
- set { project = value; }
- }
-
- public ProjectPackageCollection ()
- {
- }
-
- public void AddRange (IEnumerable<Package> packages)
- {
- foreach (Package p in packages)
- Add (p);
- }
-
- protected override void ClearItems()
- {
- if (project != null) {
- List<Package> list = new List<Package> (Items);
- base.ClearItems ();
- foreach (Package p in list) {
- project.NotifyPackageRemovedFromProject (p);
- }
- }
- }
-
- protected override void InsertItem (int index, Package value)
- {
- base.InsertItem (index, value);
- if (project != null) {
- project.NotifyPackageAddedToProject (value);
- }
- }
-
- protected override void RemoveItem (int index)
- {
- Package p = Items [index];
- base.RemoveItem (index);
- if (project != null) {
- project.NotifyPackageRemovedFromProject (p);
- }
- }
-
- protected override void SetItem (int index, Package item)
- {
- Package oldValue = Items [index];
- base.SetItem (index, item);
- if (project != null) {
- project.NotifyPackageRemovedFromProject (oldValue);
- project.NotifyPackageAddedToProject (item);
- }
- }
-
- public string[] ToStringArray ()
- {
- string[] array = new string[Count];
- int i = 0;
-
- foreach (Package p in Items)
- array[i++] = p.Name;
-
- return array;
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/project/projectpackageeventargs.cs b/caddin/cbinding/cbinding/project/projectpackageeventargs.cs
index 492ba85..581a70d 100644
--- a/cbindingreport/cbinding/cbinding/project/projectpackageeventargs.cs
+++ b/caddin/cbinding/cbinding/project/projectpackageeventargs.cs
@@ -37,21 +37,15 @@ namespace CBinding
public class ProjectPackageEventArgs : EventArgs
{
- CProject project;
- Package package;
+ CMakeProject project;
- public ProjectPackageEventArgs(CProject project, Package package)
+ public ProjectPackageEventArgs(CMakeProject project)
{
this.project = project;
- this.package = package;
}
- public CProject Project {
+ public CMakeProject Project {
get { return project; }
}
-
- public Package Package {
- get { return package; }
- }
}
}
diff --git a/cbindingreport/cbinding/cbinding/projectpad/projectpackagenodebuilder.cs b/projectpackagenodebuilder.cs
index 2e4d0ae..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/projectpad/projectpackagenodebuilder.cs
+++ b/projectpackagenodebuilder.cs
@@ -1,103 +0,0 @@
-//
-// ProjectPackageNodeBuilder.cs
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Reflection;
-
-using MonoDevelop.Ide.Gui;
-using MonoDevelop.Components.Commands;
-using MonoDevelop.Ide.Gui.Components;
-using MonoDevelop.Ide;
-
-namespace CBinding.ProjectPad
-{
- public class ProjectPackageNodeBuilder : TypeNodeBuilder
- {
- public override Type NodeDataType {
- get { return typeof(Package); }
- }
-
- public override Type CommandHandlerType {
- get { return typeof(PackageNodeCommandHandler); }
- }
-
- public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
- {
- return ((Package)dataObject).File;
- }
-
- public override string ContextMenuAddinPath {
- get { return "/CBinding/Views/ProjectBrowser/ContextMenu/PackageNode"; }
- }
-
- public override void BuildNode (ITreeBuilder treeBuilder,
- object dataObject,
- NodeInfo nodeInfo)
- {
- nodeInfo.Label = ((Package)dataObject).Name;
-
- if (((Package)dataObject).IsProject)
- nodeInfo.Icon = Context.GetIcon ("md-reference-project");
- else
- nodeInfo.Icon = Context.GetIcon (Stock.Reference);
- }
- }
-
- public class PackageNodeCommandHandler : NodeCommandHandler
- {
- public override void DeleteItem ()
- {
- Package package = (Package)CurrentNode.DataItem;
- CProject project = (CProject)CurrentNode.GetParentDataItem (
- typeof(CProject), false);
-
- project.Packages.Remove (package);
-
- IdeApp.ProjectOperations.SaveAsync (project);
- }
-
- public override DragOperation CanDragNode ()
- {
- return DragOperation.Copy;
- }
-
- [CommandHandler (CBinding.CProjectCommands.ShowPackageDetails)]
- public void ShowPackageDetails ()
- {
- Package package = (Package)CurrentNode.DataItem;
-
- package.ParsePackage ();
-
- PackageDetails details = new CBinding.PackageDetails (package);
- details.Show ();
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/projectpad/projectpackagesfoldernodebuilder.cs b/projectpackagesfoldernodebuilder.cs
index 72080a9..e69de29 100644
--- a/cbindingreport/cbinding/cbinding/projectpad/projectpackagesfoldernodebuilder.cs
+++ b/projectpackagesfoldernodebuilder.cs
@@ -1,192 +0,0 @@
-//
-// ProjectPackagesFolderNodeBuilder.cs: Node to control the packages in the project
-//
-// Authors:
-// Marcos David Marin Amador <MarcosMarin@gmail.com>
-//
-// Copyright (C) 2007 Marcos David Marin Amador
-//
-//
-// This source code is licenced under The MIT License:
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-using MonoDevelop.Components.Commands;
-using MonoDevelop.Ide.Gui;
-using MonoDevelop.Ide.Gui.Components;
-using MonoDevelop.Ide;
-using MonoDevelop.Projects;
-using System.Collections.Generic;
-
-namespace CBinding.ProjectPad
-{
- public class ProjectPackagesFolderNodeBuilder : TypeNodeBuilder
- {
- public override Type NodeDataType {
- get { return typeof(ProjectPackageCollection); }
- }
-
- public override void OnNodeAdded (object dataObject)
- {
- CProject project = ((ProjectPackageCollection)dataObject).Project;
- if (project == null) return;
- project.PackageAddedToProject += OnAddPackage;
- project.PackageRemovedFromProject += OnRemovePackage;
- }
-
- public override void OnNodeRemoved (object dataObject)
- {
- CProject project = ((ProjectPackageCollection)dataObject).Project;
- if (project == null) return;
- project.PackageAddedToProject -= OnAddPackage;
- project.PackageRemovedFromProject -= OnRemovePackage;
- }
-
- public override Type CommandHandlerType {
- get { return typeof(ProjectPackagesFolderNodeCommandHandler); }
- }
-
- public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
- {
- return "Packages";
- }
-
- public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
- {
- nodeInfo.Label = "Packages";
- nodeInfo.Icon = Context.GetIcon (Stock.OpenReferenceFolder);
- nodeInfo.ClosedIcon = Context.GetIcon (Stock.ClosedReferenceFolder);
- }
-
- public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
- {
- return ((ProjectPackageCollection)dataObject).Count > 0;
- }
-
- public override void BuildChildNodes (ITreeBuilder treeBuilder, object dataObject)
- {
- ProjectPackageCollection packages = (ProjectPackageCollection)dataObject;
-
- foreach (Package p in packages)
- treeBuilder.AddChild (p);
- }
-
- public override string ContextMenuAddinPath {
- get { return "/CBinding/Views/ProjectBrowser/ContextMenu/PackagesFolderNode"; }
- }
-
- public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode)
- {
- return -1;
- }
-
- private void OnAddPackage (object sender, ProjectPackageEventArgs e)
- {
- ITreeBuilder builder = Context.GetTreeBuilder (e.Project.Packages);
- if (builder != null)
- builder.UpdateAll ();
- }
-
- private void OnRemovePackage (object sender, ProjectPackageEventArgs e)
- {
- ITreeBuilder builder = Context.GetTreeBuilder (e.Project.Packages);
- if (builder != null)
- builder.UpdateAll ();
- }
- }
-
- public class ProjectPackagesFolderNodeCommandHandler : NodeCommandHandler
- {
- [CommandHandler (CBinding.CProjectCommands.AddPackage)]
- public void AddPackageToProject ()
- {
- CProject project = (CProject)CurrentNode.GetParentDataItem (
- typeof(CProject), false);
-
- MessageService.ShowCustomDialog (new EditPackagesDialog (project));
-
- IdeApp.ProjectOperations.SaveAsync (project);
- CurrentNode.Expanded = true;
- }
-
- // Currently only accepts packages and projects that compile into a static library
- public override bool CanDropNode (object dataObject, DragOperation operation)
- {
- if (dataObject is Package)
- return true;
-
- if (dataObject is CProject) {
- CProject project = (CProject)dataObject;
-
- if (((ProjectPackageCollection)CurrentNode.DataItem).Project.Equals (project))
- return false;
-
- CProjectConfiguration config = (CProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
-
- if (config.CompileTarget != CompileTarget.Exe)
- return true;
- }
-
- return false;
- }
-
- public override DragOperation CanDragNode ()
- {
- return DragOperation.Copy | DragOperation.Move;
- }
-
- public override void OnNodeDrop (object dataObject, DragOperation operation)
- {
- List<IWorkspaceFileObject> toSave = new List<IWorkspaceFileObject> ();
- if (dataObject is Package) {
- Package package = (Package)dataObject;
- ITreeNavigator nav = CurrentNode;
-
- CProject dest = nav.GetParentDataItem (typeof(CProject), true) as CProject;
- nav.MoveToObject (dataObject);
- CProject source = nav.GetParentDataItem (typeof(CProject), true) as CProject;
-
- dest.Packages.Add (package);
- toSave.Add (dest);
-
- if (operation == DragOperation.Move) {
- source.Packages.Remove (package);
- toSave.Add (source);
- }
- } else if (dataObject is CProject) {
- CProject draggedProject = (CProject)dataObject;
- CProject destProject = (CurrentNode.DataItem as ProjectPackageCollection).Project;
-
- draggedProject.WriteMDPkgPackage (IdeApp.Workspace.ActiveConfiguration);
-
- Package package = new Package (draggedProject);
-
- if (!destProject.Packages.Contains (package)) {
- destProject.Packages.Add (package);
- toSave.Add (destProject);
- }
- }
- IdeApp.ProjectOperations.SaveAsync (toSave);
- }
- }
-}
diff --git a/cbindingreport/cbinding/cbinding/projectpad/projectreferencesextension.cs b/caddin/cbinding/cbinding/projectpad/projectreferencesextension.cs
index 8ca4e4a..b169994 100644
--- a/cbindingreport/cbinding/cbinding/projectpad/projectreferencesextension.cs
+++ b/caddin/cbinding/cbinding/projectpad/projectreferencesextension.cs
@@ -50,7 +50,7 @@ namespace CBinding.ProjectPad
{
Project p = parentNode.DataItem as Project;
- if (p is CProject)
+ if (p is CMakeProject)
attributes |= NodeAttributes.Hidden;
}
}
diff --git a/cbindingreport/cbinding/cbinding/refactoring/reference.cs b/caddin/cbinding/cbinding/refactoring/reference.cs
index b87bd5e..8270b9f 100644
--- a/cbindingreport/cbinding/cbinding/refactoring/reference.cs
+++ b/caddin/cbinding/cbinding/refactoring/reference.cs
@@ -10,7 +10,7 @@ namespace CBinding.Refactoring
/// </summary>
public class Reference : IComparable
{
- CProject project;
+ CMakeProject project;
public SourceLocation Begin { get; }
public SourceLocation End { get; }
public CXSourceRange SourceRange { get; set; }
@@ -25,7 +25,7 @@ namespace CBinding.Refactoring
/// <param name="proj">Project.</param>
/// <param name="cursor">Cursor referenced.</param>
/// <param name="sourceRange">Source location and range.</param>
- public Reference(CProject proj, CXCursor cursor, CXSourceRange sourceRange) {
+ public Reference(CMakeProject proj, CXCursor cursor, CXSourceRange sourceRange) {
project = proj;
Cursor = cursor;
SourceRange = sourceRange;
diff --git a/cbindingreport/cbinding/cbinding/gui/renamehandlerdialog.cs b/caddin/cbinding/cbinding/gui/renamehandlerdialog.cs
index a0dd8d0..2d5c7a0 100644
--- a/cbindingreport/cbinding/cbinding/gui/renamehandlerdialog.cs
+++ b/caddin/cbinding/cbinding/gui/renamehandlerdialog.cs
@@ -7,6 +7,7 @@ using MonoDevelop.Ide;
using MonoDevelop.Core;
using MonoDevelop.Components.Commands;
using MonoDevelop.Core.Text;
+using MonoDevelop.Projects;
using System.Text;
using System.Text.RegularExpressions;
using CBinding.Parser;
@@ -15,7 +16,7 @@ namespace CBinding
{
public partial class RenameHandlerDialog : Gtk.Dialog
{
- protected CProject project;
+ protected CMakeProject project;
protected CXCursor cursorReferenced;
protected string UsrReferenced;
protected string spelling;
@@ -23,7 +24,7 @@ namespace CBinding
protected Document document;
public string File;
- public RenameHandlerDialog (CProject proj, Document doc)
+ public RenameHandlerDialog (CMakeProject proj, Document doc)
{
project = proj;
cursorReferenced = project.ClangManager.GetCursorReferenced(
@@ -90,7 +91,7 @@ namespace CBinding
/// </summary>
/// <param name="project">Project.</param>
/// <param name="cursor">Cursor.</param>
- public async void FindRefsAndRename (CProject project, CXCursor cursor)
+ public async void FindRefsAndRename (CMakeProject project, CXCursor cursor)
{
try {
diff --git a/cbindingreport/cbinding/cbinding/clang/serializationmanager.cs b/caddin/cbinding/cbinding/clang/serializationmanager.cs
index f2b58eb..46a73cd 100644
--- a/cbindingreport/cbinding/cbinding/clang/serializationmanager.cs
+++ b/caddin/cbinding/cbinding/clang/serializationmanager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using ClangSharp;
using MonoDevelop.Ide;
@@ -11,11 +11,11 @@ namespace CBinding
public class SerializationManager
{
CLangManager Manager { get; }
- CProject project { get; }
+ CMakeProject project { get; }
CXIndex Index { get; }
public List<string> Headers { get; } = new List<string> ();
- public SerializationManager (CProject proj, CLangManager man, CXIndex ind)
+ public SerializationManager (CMakeProject proj, CLangManager man, CXIndex ind)
{
Manager = man;
project = proj;
@@ -33,7 +33,7 @@ namespace CBinding
public static string SerializedName (string name)
{
- return CProject.HeaderExtensions.Any (o => o.Equals (new FilePath (name).Extension.ToUpper ())) ?
+ return CMakeProject.IsCFile (new FilePath (name).Extension.ToUpper ()) ?
name + ".pch"
:
name + ".ser";
@@ -72,7 +72,7 @@ namespace CBinding
void AddToIncludes (string name)
{
- if (!CProject.HeaderExtensions.Any (o => o.Equals (new FilePath (name).Extension.ToUpper ())))
+ if (!CMakeProject.IsCFile (new FilePath (name).Extension.ToUpper ()))
return;
Headers.Add (name);
}
@@ -94,7 +94,6 @@ namespace CBinding
Headers.Remove (name);
if (File.Exists (SerializedName (name)))
File.Delete (SerializedName(name));
-
}
public void Rename (string oldName, string newName, string [] args)
diff --git a/cbindingreport/cbinding/cbinding/parser/struct.cs b/caddin/cbinding/cbinding/parser/struct.cs
index 228ca42..d24b3b3 100644
--- a/cbindingreport/cbinding/cbinding/parser/struct.cs
+++ b/caddin/cbinding/cbinding/parser/struct.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Struct: Symbol
{
- public Struct (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Struct (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
diff --git a/cbindingreport/cbinding/cbinding/parser/symbol.cs b/caddin/cbinding/cbinding/parser/symbol.cs
index 3388b1a..92ecb0d 100644
--- a/cbindingreport/cbinding/cbinding/parser/symbol.cs
+++ b/caddin/cbinding/cbinding/parser/symbol.cs
@@ -17,7 +17,7 @@ namespace CBinding.Parser
public bool Def { get; }
- public Symbol (CProject project, CXCursor cursor)
+ public Symbol (CMakeProject project, CXCursor cursor)
{
lock (project.ClangManager.SyncRoot) {
Represented = cursor;
diff --git a/cbindingreport/cbinding/cbinding/parser/symboldatabasemediator.cs b/caddin/cbinding/cbinding/parser/symboldatabasemediator.cs
index c6ecc10..5cf5617 100644
--- a/cbindingreport/cbinding/cbinding/parser/symboldatabasemediator.cs
+++ b/caddin/cbinding/cbinding/parser/symboldatabasemediator.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
@@ -11,16 +11,16 @@ using MonoDevelop.Projects;
namespace CBinding
{
- public class SymbolDatabaseMediator : IDisposable
+ public class SymbolDatabaseMediator : CMakeProject, IDisposable
{
public object Lock { get; } = new object ();
- CProject ContainingProject { get; }
+ CMakeProject ContainingProject { get; }
CLangManager Manager { get; }
public SqliteConnection Connection { get; private set; }
Dictionary<string, SqliteCommand> InsertCommands { get; } = new Dictionary <string, SqliteCommand>();
bool Initialized { get; set; } = false;
- public SymbolDatabaseMediator (CProject proj, CLangManager manager)
+ public SymbolDatabaseMediator (CMakeProject proj, CLangManager manager)
{
ContainingProject = proj;
Manager = manager;
@@ -236,14 +236,14 @@ namespace CBinding
public IEnumerable<SourceLocation> getDeclarations (CXCursor cursor)
{
- foreach (var file in ContainingProject.Files) {
+ foreach (var file in OnGetItemFiles (false)) {
using (var selectDeclarations = Connection.CreateCommand ()) {
- selectDeclarations.CommandText = "SELECT OFFSET FROM " + TableName (file.Name) + " WHERE USR=@USR;";
+ selectDeclarations.CommandText = "SELECT OFFSET FROM " + TableName (file.FileName) + " WHERE USR=@USR;";
selectDeclarations.CommandType = CommandType.Text;
selectDeclarations.Parameters.AddWithValue ("@USR", Manager.GetCursorUsrString (cursor));
using(var result = selectDeclarations.ExecuteReader ()) {
while (result.Read ()) {
- yield return new SourceLocation (file.Name, 0, 0, (uint)result.GetInt32 (0));
+ yield return new SourceLocation (file.FileName, 0, 0, (uint)result.GetInt32 (0));
}
}
}
@@ -252,14 +252,14 @@ namespace CBinding
public IEnumerable<SourceLocation> GetDefinitionLocation (CXCursor cursor)
{
- foreach (var file in ContainingProject.Files) {
+ foreach (var file in OnGetItemFiles (false)) {
using (var selectDeclarations = Connection.CreateCommand ()) {
- selectDeclarations.CommandText = "SELECT OFFSET FROM " + TableName (file.Name) + " WHERE USR=@USR AND ISDEF=1;";
+ selectDeclarations.CommandText = "SELECT OFFSET FROM " + TableName (file.FileName) + " WHERE USR=@USR AND ISDEF=1;";
selectDeclarations.CommandType = CommandType.Text;
selectDeclarations.Parameters.AddWithValue ("@USR", Manager.GetCursorUsrString (cursor));
using (var result = selectDeclarations.ExecuteReader ()) {
while (result.Read ()) {
- yield return new SourceLocation (file.Name, 0, 0, (uint)result.GetInt32 (0));
+ yield return new SourceLocation (file.FileName, 0, 0, (uint)result.GetInt32 (0));
}
}
}
diff --git a/cbindingreport/cbinding/cbinding/projectpad/systemfilenodebuilder.cs b/caddin/cbinding/cbinding/projectpad/systemfilenodebuilder.cs
index 672ffa8..8c030fb 100644
--- a/cbindingreport/cbinding/cbinding/projectpad/systemfilenodebuilder.cs
+++ b/caddin/cbinding/cbinding/projectpad/systemfilenodebuilder.cs
@@ -4,6 +4,7 @@ using System.IO;
using MonoDevelop.Core;
using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Projects;
namespace CBinding
@@ -22,7 +23,7 @@ namespace CBinding
namespace CBinding.ProjectPad
{
- class SystemFileNodeBuilder : MonoDevelop.Ide.Gui.Pads.ProjectPad.SystemFileNodeBuilder
+ class SystemFileNodeBuilder : TypeNodeBuilder
{
public override Type CommandHandlerType {
get {
@@ -30,6 +31,11 @@ namespace CBinding.ProjectPad
}
}
+ public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
+ {
+ return ((SolutionFolder)dataObject).Name;
+ }
+
public override Type NodeDataType {
get {
return typeof (SystemFile);
@@ -37,7 +43,7 @@ namespace CBinding.ProjectPad
}
}
- class SystemFileNodeCommandHandler : MonoDevelop.Ide.Gui.Pads.ProjectPad.SystemFileNodeCommandHandler
+ class SystemFileNodeCommandHandler : NodeCommandHandler
{
public override void RenameItem (string newName)
{
diff --git a/cbindingreport/cbinding/cbinding/projectpad/systemfoldernodebuilder.cs b/caddin/cbinding/cbinding/projectpad/systemfoldernodebuilder.cs
index 98f411b..0eab9b7 100644
--- a/cbindingreport/cbinding/cbinding/projectpad/systemfoldernodebuilder.cs
+++ b/caddin/cbinding/cbinding/projectpad/systemfoldernodebuilder.cs
@@ -19,7 +19,7 @@ using MonoDevelop.Ide;
namespace CBinding.ProjectPad
{
- class SystemFolderNodeBuilder : FolderNodeBuilder
+ class SystemFolderNodeBuilder : TypeNodeBuilder
{
public override Type NodeDataType {
get {
@@ -72,11 +72,6 @@ namespace CBinding.ProjectPad
var folder = (SystemFolder)dataObject;
return new SystemFolder (folder.Path.ParentDirectory, folder.ParentWorkspaceObject, false);
}
-
- public override string GetFolderPath (object dataObject)
- {
- return ((SystemFolder)dataObject).Path;
- }
}
class SystemFolderCommandHandler : NodeCommandHandler
diff --git a/cbindingreport/cbinding/cbinding/parser/typedef.cs b/caddin/cbinding/cbinding/parser/typedef.cs
index 45b77c3..044e994 100644
--- a/cbindingreport/cbinding/cbinding/parser/typedef.cs
+++ b/caddin/cbinding/cbinding/parser/typedef.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Typedef : Symbol
{
- public Typedef (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Typedef (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
diff --git a/cbindingreport/cbinding/cbinding/parser/union.cs b/caddin/cbinding/cbinding/parser/union.cs
index 4369b9b..2de81f4 100644
--- a/cbindingreport/cbinding/cbinding/parser/union.cs
+++ b/caddin/cbinding/cbinding/parser/union.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Union : Symbol
{
- public Union (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Union (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
diff --git a/unixmaketoolchain.cs b/caddin/cbinding/cbinding/compiler/unixmaketoolchain.cs
index e69de29..39b8bda 100644
--- a/unixmaketoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/unixmaketoolchain.cs
@@ -0,0 +1,60 @@
+//
+// UnixMakeToolchain.cs: Provides functionality to compile using Unix Make Toolchain.
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Threading.Tasks;
+using System.IO;
+
+using Mono.Addins;
+
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+
+namespace CBinding
+{
+ [Extension ("/CBinding/Toolchains")]
+ public class UnixMakeToolchain : CMakeToolchain
+ {
+ /// <summary>
+ /// The name of this Toolchain.
+ /// </summary>
+ /// <value>The name.</value>
+ public override string ToolchainName {
+ get {
+ return "Unix Make Toolchain";
+ }
+ }
+
+ public override bool IsSupported {
+ get {
+ return Platform.IsLinux;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/cbindingreport/cbinding/cbinding/project/unsavedfilesmanager.cs b/caddin/cbinding/cbinding/project/unsavedfilesmanager.cs
index 4ac3dfd..4d8a8db 100644
--- a/cbindingreport/cbinding/cbinding/project/unsavedfilesmanager.cs
+++ b/caddin/cbinding/cbinding/project/unsavedfilesmanager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using MonoDevelop.Ide;
using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Gui;
@@ -12,10 +12,10 @@ namespace CBinding
public class UnsavedFilesManager : IDisposable
{
Document current;
- CProject Project { get; }
+ CMakeProject Project { get; }
ConcurrentDictionary<string, UnsavedFile> UnsavedFileCollection { get; }
- public UnsavedFilesManager (CProject proj)
+ public UnsavedFilesManager (CMakeProject proj)
{
Project = proj;
IdeApp.Workbench.ActiveDocumentChanged += HandleChange;
diff --git a/cbindingreport/cbinding/cbinding/parser/variable.cs b/caddin/cbinding/cbinding/parser/variable.cs
index b05f5a9..93b1f08 100644
--- a/cbindingreport/cbinding/cbinding/parser/variable.cs
+++ b/caddin/cbinding/cbinding/parser/variable.cs
@@ -4,7 +4,7 @@ namespace CBinding.Parser
{
public class Variable : Symbol
{
- public Variable (CProject proj, CXCursor cursor) : base (proj, cursor)
+ public Variable (CMakeProject proj, CXCursor cursor) : base (proj, cursor)
{
}
diff --git a/visualstudiotoolchain.cs b/caddin/cbinding/cbinding/compiler/visualstudiotoolchain.cs
index e69de29..e989da4 100644
--- a/visualstudiotoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/visualstudiotoolchain.cs
@@ -0,0 +1,66 @@
+//
+// MSBuildToolchain.cs: Abstract class that provides functionality to Build using Visual Studio Toolchains
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Threading.Tasks;
+using System.IO;
+
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+
+namespace CBinding
+{
+ public class VisualStudioToolchain : CMakeToolchain
+ {
+ public override string ProjectToBuild {
+ get {
+ return projectToBuild;
+ }
+ set {
+ projectToBuild = value;
+ }
+ }
+ public string projectToBuild = "";
+
+ public override bool IsSupported {
+ get {
+ return Platform.IsWindows;
+ }
+ }
+
+ public override Task<Stream> Build (string projectName, FilePath outputDirectory, ProgressMonitor monitor)
+ {
+ monitor.BeginStep ("Building...");
+ projectToBuild = $"{projectName}.\"sln\"";
+ Stream buildResult = ExecuteCommand ("msbuild", projectToBuild, outputDirectory, monitor);
+ monitor.EndStep ();
+ return Task.FromResult (buildResult);
+ }
+ }
+}
diff --git a/vs12msbuildtoolchain.cs b/caddin/cbinding/cbinding/compiler/vs12msbuildtoolchain.cs
index e69de29..5025adb 100644
--- a/vs12msbuildtoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/vs12msbuildtoolchain.cs
@@ -0,0 +1,55 @@
+//
+// VS12MSBuildToolchain.cs: Provides functionality to compile using VS12 MSBuild Toolchain.
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Mono.Addins;
+
+namespace CBinding
+{
+ [Extension ("/CBinding/Toolchains")]
+ public class VS12MSBuildToolchain : VisualStudioToolchain
+ {
+
+ /// <summary>
+ /// The name of this Toolchain.
+ /// </summary>
+ /// <value>The name.</value>
+ public override string ToolchainName {
+ get {
+ return "VS12 MSBuild Toolchain";
+ }
+ }
+
+ public override string GeneratorID {
+ get {
+ return "Visual Studio 12 2013";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs14msbuildtoolchain.cs b/caddin/cbinding/cbinding/compiler/vs14msbuildtoolchain.cs
index e69de29..264f059 100644
--- a/vs14msbuildtoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/vs14msbuildtoolchain.cs
@@ -0,0 +1,55 @@
+//
+// VS14MSBuildToolchain.cs: Provides functionality to compile using VS14 MSBuild Toolchain.
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Mono.Addins;
+
+namespace CBinding
+{
+ [Extension ("/CBinding/Toolchains")]
+ public class VS14MSBuildToolchain : VisualStudioToolchain
+ {
+
+ /// <summary>
+ /// The name of this Toolchain.
+ /// </summary>
+ /// <value>The name.</value>
+ public override string ToolchainName {
+ get {
+ return "VS14 MSBuild Toolchain";
+ }
+ }
+
+ public override string GeneratorID {
+ get {
+ return "Visual Studio 14 2015";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vs15msbuildtoolchain.cs b/caddin/cbinding/cbinding/compiler/vs15msbuildtoolchain.cs
index e69de29..21335d2 100644
--- a/vs15msbuildtoolchain.cs
+++ b/caddin/cbinding/cbinding/compiler/vs15msbuildtoolchain.cs
@@ -0,0 +1,55 @@
+//
+// VS15MSBuildToolchain.cs: Provides functionality to compile using VS15 MSBuild Toolchain.
+//
+// Authors:
+// Anubhav Singh <mailtoanubhav02@gmail.com>
+// Copyright (C) 2017 Anubhav Singh
+//
+//
+// This source code is licenced under The MIT License:
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using Mono.Addins;
+
+namespace CBinding
+{
+ [Extension ("/CBinding/Toolchains")]
+ public class VS15MSBuildToolchain : VisualStudioToolchain
+ {
+
+ /// <summary>
+ /// The name of this Toolchain.
+ /// </summary>
+ /// <value>The name.</value>
+ public override string ToolchainName {
+ get {
+ return "VS15 MSBuild Toolchain";
+ }
+ }
+
+ public override string GeneratorID {
+ get {
+ return "Visual Studio 15 2017";
+ }
+ }
+ }
+}
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment