Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

C/C++

Extending the Eclipse CDT Managed Build System


Defining a Tool-chain for MBS

You provide a tool-chain definition by plugging into the MBS tool definition extension point, org.eclipse.cdt.managedbuilder.core.buildDefinitions. The extension point defines an XML schema that lets you describe the tools in your tool-chain. See Figure 1 for the object model used by the schema. If you have access to the CDT source code, see org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd.

[Click image to view at full size]
Figure 1: The MBS Object Model

The schema is used both by the MBS extension point and by the MBS-specific project file that stores the user's modifications to a project's properties. If you have an MBS project, examine the .CDtbuild file (see Listing Two for an example). MBS provides reference tool-chain definitions for GNU C/C++ on many different development platforms. If you have access to the CDT source code, see org.eclipse.cdt.managedbuilder.gnu.ui/plugin.xml.


<?xml version="1.0" encoding="UTF-8" ?>
<?fileVersion 3.0.0?>

<ManagedProjectBuildInfo>
<project
   id="HelloWorld.cdt.managedbuild.target.gnu.cygwin.exe.554942561"
   name="Executable (Gnu on Windows)"
   projectType="cdt.managedbuild.target.gnu.cygwin.exe">
   <configuration
     id="cdt.managedbuild.config.gnu.cygwin.exe.debug.2090460160"
     name="Debug"
     parent="cdt.managedbuild.config.gnu.cygwin.exe.debug"
     artifactName="HelloWorld"
     errorParsers=  "org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParse r;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParse r"
     artifactExtension="exe"
     cleanCommand="rm -rf">
     <toolChain
       superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug"
       id="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug.273781351"
       name="GCC Tool Chain">
       <tool
          superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug"
         id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug. 1350170342"
         name="GCC C Compiler">
         <option
           superClass="gnu.c.compiler.option.preprocessor.def.symbols"
           id="gnu.c.compiler.option.preprocessor.def.symbols. 228974839"
           valueType="definedSymbols">
           <listOptionValue
              value="DEBUG"
              builtIn="false" />
         </option>
       </tool>
       <tool
           superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug"
          id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug. 686918536"
          name="GCC C Linker" />
       <tool
           superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug"
          id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug. 416825853"
          name="GCC Assembler" />
     </toolChain>
   </configuration>
</project>
</ManagedProjectBuildInfo>

Listing Two: An Example .cdtbuild File

You define the majority of your tool-chain integration statically in your XML implementation of the schema. MBS defines a number of attributes in the schema where you can specify a Java class that provides dynamic behavior for your tool-chain. You don't have to implement any of the dynamic behavior, but some may be desirable to your users. For instance, you could implement a Java class that defines the environment variables that must be set up in order to run the tools in your tool-chain. This relieves users from having to set up your tool environment before invoking Eclipse.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.