Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Extending GNU GCC Toolchain(Is it possible to extend the gcc toolchain and reorganize the build order?)
icon5.gif  Extending GNU GCC Toolchain [message #488742] Wed, 30 September 2009 05:59 Go to next message
gg  is currently offline gg Friend
Messages: 5
Registered: September 2009
Junior Member
Hallo.
I am trying to create an Eclipse Plugin in order to "embed" the Oracle ProC* (Oracle Precompiler which transforms embedded sql in a .pc file to c code).
So, for example, the typical build order is the following


  1. Write code in .pc file
  2. Invoke Oracle Precompiler with input the previous file. The output is a .c file
  3. Invoke GCC


So, what i need is somehow instruct my plugin that the first build tool which should be invoked is the precompiler, and then continue with the gcc toolchain.

Is it possible, to "inherit" the GCC toolchain and invoke it after the precompiler tool?
Re: Extending GNU GCC Toolchain [message #488754 is a reply to message #488742] Wed, 30 September 2009 06:53 Go to previous messageGo to next message
Derek is currently offline DerekFriend
Messages: 60
Registered: July 2009
Member
On 30/09/2009 06:59, gg wrote:
> Hallo.
> I am trying to create an Eclipse Plugin in order to "embed" the Oracle
> ProC* (Oracle Precompiler which transforms embedded sql in a .pc file to
> c code).
> So, for example, the typical build order is the following
>
>
> Write code in .pc file
> Invoke Oracle Precompiler with input the previous file. The output is a
> .c file
> Invoke GCC
>
>
> So, what i need is somehow instruct my plugin that the first build tool
> which should be invoked is the precompiler, and then continue with the
> gcc toolchain.
>
> Is it possible, to "inherit" the GCC toolchain and invoke it after the
> precompiler tool?
Have you read the Managed Build System Extensibility Document? It is
provided with the CDT SDK. You can then base you toolchain on the GNU
toolchain.

--
Derek
Re: Extending GNU GCC Toolchain [message #488755 is a reply to message #488742] Wed, 30 September 2009 07:06 Go to previous messageGo to next message
Harald    is currently offline Harald Friend
Messages: 37
Registered: July 2009
Member
Quote:
So, what i need is somehow instruct my plugin that the first build tool which should be invoked is the precompiler, and then continue with the gcc toolchain.

Is it possible, to "inherit" the GCC toolchain and invoke it after the precompiler tool?


I could imagine that you have to write your own builder that is derived from org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenera tor. Define a toolchain that inherits most from the the GCC toolchain, except the builder.

Alternatives:
- Define a "external builder" and use ENV ${build_files} to get a set of changed files (i didn't tried ${build_files}, just a guess)
- Write your own toolchain (for details how to do this see org.eclipse.cdt.managedbuilder.gnu.ui). This way you can use the internal builder (managed build system). That's what I did.

Harald
Re: Extending GNU GCC Toolchain [message #488801 is a reply to message #488755] Wed, 30 September 2009 09:39 Go to previous messageGo to next message
gg  is currently offline gg Friend
Messages: 5
Registered: September 2009
Junior Member
Harald K wrote on Wed, 30 September 2009 03:06
Define a toolchain that inherits most from the the GCC toolchain, except the builder.



Sorry if this is a dumb question, but can this be done (the bold part)? I have not found any info concerning this matter, Sad And what's more I cannot find the superclass or something relevant

[Updated on: Wed, 30 September 2009 09:43]

Report message to a moderator

Re: Extending GNU GCC Toolchain [message #488895 is a reply to message #488801] Wed, 30 September 2009 15:52 Go to previous messageGo to next message
Harald    is currently offline Harald Friend
Messages: 37
Registered: July 2009
Member
gg wrote on Wed, 30 September 2009 05:39

Sorry if this is a dumb question, but can this be done (the bold part)? I have not found any info concerning this matter, Sad And what's more I cannot find the superclass or something relevant


It should be all in the plugin.xml of the plugin you have to write. Again the gcc plugin org.eclipse.cdt.managedbuilder.gnu.ui is a good example:

<tool
  id="your.cpp.gnu.compiler"
  superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
</tool>


Just use the gcc id as superclass.

But I never tried this Wink
In my toolchain I only reference the MBS internal builder:

<builder
  id="mybuilder"
  superClass="org.eclipse.cdt.build.core.internal.builder">
</builder>



Harald
Re: Extending GNU GCC Toolchain [message #488991 is a reply to message #488895] Thu, 01 October 2009 07:02 Go to previous messageGo to next message
gg  is currently offline gg Friend
Messages: 5
Registered: September 2009
Junior Member
superClass="org.eclipse.cdt.build.core.internal.builder">


Is there any such class like 'org.eclipse.cdt.build.core.toolchain.gnu' ?
Re: Extending GNU GCC Toolchain [message #491100 is a reply to message #488991] Tue, 13 October 2009 09:22 Go to previous messageGo to next message
gg  is currently offline gg Friend
Messages: 5
Registered: September 2009
Junior Member
gg wrote on Thu, 01 October 2009 03:02
superClass="org.eclipse.cdt.build.core.internal.builder">


Is there any such class like 'org.eclipse.cdt.build.core.toolchain.gnu' ?


Sorry for this dumb message.

I have tried to create a plugin which is here http://pastebin.ca/1617553
It doesn't work as it doesn't recognize the .pc files (i think). If anyone could take a look and suggest anything, i would be grateful!
icon14.gif  Re: Extending GNU GCC Toolchain [message #491618 is a reply to message #488742] Thu, 15 October 2009 09:31 Go to previous messageGo to next message
gg  is currently offline gg Friend
Messages: 5
Registered: September 2009
Junior Member
I have a working effort. It needs improvements but it is a base start.
I have tested it successfully on Eclipse 3.2. Any improvements are welcome

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>

<!-- Managed Make Builder Tool Specifications -->

   <extension
		name="Gcc with Oracle Precompiler"
		id="OraclePreCompiler.gcc.info"
        point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
        <tool
              command="proc.exe"
              commandLinePattern="${COMMAND} ${FLAGS} ${INPUTS} ${OUTPUT}"
              customBuildStep="false"
              id="OraclePreCompiler.tool"
              name="Oracle PreCompiler"
              natureFilter="both"
              supportsManagedBuild="true">
            <optionCategory
                  id="OraclePreCompiler.tool.category.general"
                  name="OptionCategory.General"
                  owner="OraclePreCompiler.tool">
            </optionCategory>
            <option
                  category="OraclePreCompiler.tool.category.general"
                  command="dynamic=ansi oraca=yes parse=full sys_include=PUT_SOMETHING"
                  id="Option.OraclePreCompiler.tool.Flags.Standar"
                  name="Option.OraclePreCompiler.tool.Flags"
                  value="true"
                  valueType="boolean">
            </option>
            <inputType
                  id="OraclePreCompiler.tool.inputType"
                  multipleOfType="false"
                  name="PC Sources"
                  primaryInput="false"
                  sources="pc">
            </inputType>
            <outputType
                  buildVariable="C_SRCS"
                  id="OraclePreCompiler.tool.outputType"
                  name="PreCompiled C Files"
                  namePattern="%.c"
                  outputContentType="org.eclipse.cdt.core.cSource"
                  outputs="c">
            </outputType>
         </tool>                                 
         <projectType
              id="OraclePreCompiler.projectType1"
              isAbstract="false"
              buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
              name="Gcc With Oracle">
              <configuration
              	id="OraclePreCompiler.configuration1"
              	name="Debug"
				description="GCC with Oracle Precompiler"
              	cleanCommand="rm -rf"
				artifactExtension="exe">
                <toolChain
                    archList="all"
                    id="cdt.managedbuild.toolchain.gnu.cygwin.base.oracletool"
                    name="ToolChainName.Cygwin"
                    osList="win32"
                    targetTool="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.oracletool;cdt.managedbuild.tool.gnu.c.linker.cygwin.base.oracletool;cdt.managedbuild.tool.gnu.archiverOraclePreCompiler.tool.cygwin.base;">
                  	<targetPlatform
					  id="cdt.managedbuild.target.gnu.platform.cygwin.base.oracletool"
				 	  name="PlatformName.Dbg"
                      binaryParser="org.eclipse.cdt.core.Cygwin_PE"            					  
					  osList="win32"					  
					  archList="all">
				  	</targetPlatform>
			  		<builder
					  id="OraclePreCompiler.tool.builder.cygwin.base"
					  name="GNU PC Files Builder"
					  isAbstract="false"
					  superClass="cdt.managedbuild.target.gnu.builder">
		     	  	</builder>    
				  	<tool
						id="OraclePreCompiler.tool.cygwin.base"
						superClass="OraclePreCompiler.tool">
				  	</tool>
				  	<tool
						id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.oracletool"
					  	superClass="cdt.managedbuild.tool.gnu.assembler">
				  	</tool> 		               		         
			      	<tool
		    			id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.oracletool"
			          	superClass="cdt.managedbuild.tool.gnu.archiver">
			  			<enablement 
              				type="ALL">
				  			<checkBuildProperty 
				  				property="org.eclipse.cdt.build.core.buildArtefactType"
				  				value="org.eclipse.cdt.build.core.buildArtefactType.staticLib"/>
			  			</enablement>
					</tool>                 
                  	<tool
                    	id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base.oracletool"
                      	superClass="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin">
                  	</tool>
                  	<tool
                        id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.oracletool"
                        superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin">
                  	</tool>
                  	<tool
                    	id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.oracletool"
                      	superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin">
               			<enablement 
              				type="ALL">
              				<not>
			  					<checkBuildProperty 
			  						property="org.eclipse.cdt.build.core.buildArtefactType"
			  						value="org.eclipse.cdt.build.core.buildArtefactType.staticLib"/>
			  				</not>
			  			</enablement>
			  			<optionCategory
               				owner="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.oracletool"
               				name="OptionCategory.Libs"
               				id="oracletool.gnu.c.link.category.libs">
         				</optionCategory>
			  			<option
               				name="Option.Posix.Libs"
               				category="oracletool.gnu.c.link.category.libs"
               				command="-lORASQL9"
               				id="oracletool.gnu.c.link.option.libs"
               				valueType="boolean"
               				value="true">
         				</option>
         				<option
               				name="%Option.Posix.Libsearch"
               				category="oracletool.gnu.c.link.category.libs"
               				command="-LC:\\oracle\\ora92\\bin\\"
               				id="oracletool.gnu.c.link.option.paths"
               				valueType="boolean"
               				value="true">
         				</option>
                  	</tool>
                  	<tool
                    	id="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base.oracletool"
                      	superClass="cdt.managedbuild.tool.gnu.cpp.linker.cygwin">
               			<enablement 
              				type="ALL">
              				<not>
			  					<checkBuildProperty 
			  						property="org.eclipse.cdt.build.core.buildArtefactType"
			  						value="org.eclipse.cdt.build.core.buildArtefactType.staticLib"/>
			  				</not>
			  			</enablement>
		  			</tool>
	   			</toolChain>
        	</configuration>
		</projectType>       
	</extension>
</plugin>

[Updated on: Thu, 15 October 2009 09:32]

Report message to a moderator

Re: Extending GNU GCC Toolchain [message #627425 is a reply to message #488742] Thu, 23 September 2010 00:40 Go to previous message
François Trudel is currently offline François TrudelFriend
Messages: 1
Registered: September 2010
Junior Member
I would like to add a custom preprocessing tool to the standard C/C++ GCC toolchain and I would like to know if you have refined your solution since and also what your META-INF/MANIFEST.MF files look like.

Thanks!
Previous Topic:Debug configuration problem: GDB Hardware debugging - ARM -Qemu
Next Topic:Debugging using preprocessed code
Goto Forum:
  


Current Time: Fri Apr 26 15:07:30 GMT 2024

Powered by FUDForum. Page generated in 0.03551 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top