Tool calling and interaction in toolchain-plugin for Eclipse CDT

时间:2015-09-14 15:49:12

标签: c eclipse eclipse-plugin eclipse-cdt toolchain

I need to write a plugin for Eclipse to tie it with my custom clang-based toolchain. I tried to follow this recipe (scroll to the middle of page). It seems to be sort of working: I can create a special type project and view described tools. However when I try to build it I receive "no rule to make target 'all'". Generated makefile contains this strings:

# All Target
all: TestProject

# Tool invocations
    @echo 'No tool found that can build the extension specified with the build artifact name $@'
# Other Targets
clean:
    -$(RM) $(OBJS) TestProject
    -@echo ' '

So no tool is actually called. I figured out that tool which is supposed to build final artifact is described by "targetTool" field of toolChain Extension Point. When I set ID of my compiler these strings change to

# All Target
all: TestProject

# Tool invocations
T9: $(C_SRCS)
    @echo 'Building target: $@'
    @echo 'Invoking: Compiler'
    mycompilertool -c -Wall -o "TestProject"
    @echo 'Finished building target: $@'
    @echo ' '

# Other Targets
clean:
    -$(RM) $(OBJS) TestProject
    -@echo ' '

But nothing gets compiled anyway: "No input files for tool". I suppose DependencyCalculator doesn't recognize my main.c as source file. I don't think it's correct path anyway because theese strings practically duplicate string in subdir.mk. As I noticed there is a linker call in other toolchains in this place. I confused. Is it nececcary? What about one-tool-toolchains then?

So problems:

1) No tool is actually called with empty "targetTool". Is it correct behaviour?

2) org.eclipse.cdt.managedbuilder.makegen.internal.DefaultIndexerDependencyCalculator adviced in that tutorial doesn't seem to recognize .c files as sources.

3) Is DefaultIndexerDependencyCalculator able to map these files to output .o files to pass them further to linker anyway?

Could anybody give me a hint here or redirect to more verbose tutorial?

My plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         id="ru.mipt.designcenter.tigersharc.toolchainplugin.buildDefinitions"
         name="TigerSHARC Toolchain Definitions"
         point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
      <projectType
            id="ru.mipt.designcenter.tigersharc.toolchainplugin.executable"
            isAbstract="false"
            isTest="false"
            name="TigetSHARC Executable">
         <configuration
               cleanCommand="rm -rf"
               errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.VCErrorParser"
               id="ru.mipt.designcenter.tigersharc.toolchainplugin.configuration"
               name="Test TS Release">
            <toolChain
                  id="ru.mipt.designcenter.tigersharc.toolchainplugin.toolchain"
                  isAbstract="false"
                  name="TigerSHARC Toolchain"
                  osList="win32,win64,linux"
                  supportsManagedBuild="true"
                  targetTool="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler">
               <builder
                     command="make"
                     id="ru.mipt.designcenter.tigersharc.toolchainplugin.builder"
                     isAbstract="false"
                     name="TigerSHARC Builder">
               </builder>
               <targetPlatform
                     binaryParser="org.eclipse.cdt.core.ELF"
                     id="ru.mipt.designcenter.tigersharc.toolchainplugin.targetPlatform"
                     isAbstract="false"
                     name="Test Target Platform"
                     osList="win32,win64,linux">
               </targetPlatform>
               <tool
                     command="clang"
                     commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT} ${INPUT}"
                     id="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler"
                     isAbstract="false"
                     name="TigerSHARC Compiler"
                     natureFilter="cnature"
                     outputFlag="-o">
                  <inputType
                        buildVariable="C_SRCS"
                        dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultIndexerDependencyCalculator"
                        dependencyContentType="org.eclipse.cdt.core.cHeader"
                        dependencyExtensions="c, h"
                        id="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.inputtype"
                        name="Compiler Input"
                        primaryInput="true"
                        sourceContentType="org.eclipse.cdt.core.cSource"
                        sources="c, h">
                  </inputType>
                  <outputType
                        buildVariable="OBJS"
                        id="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.outputtype"
                        name="Compiler Output"
                        outputs="o"
                        primaryInputType="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.inputtype"
                        primaryOutput="true">
                  </outputType>
                  <optionCategory
                        id="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.generalcompilercategory"
                        name="General Compiler Settings"
                        owner="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler">
                  </optionCategory>
                  <option
                        browseType="directory"
                        category="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.generalcompilercategory"
                        command="-I"
                        id="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.includepaths"
                        isAbstract="false"
                        name="Include paths"
                        resourceFilter="all"
                        valueType="includePath">
                  </option>
                  <option
                        category="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.generalcompilercategory"
                        defaultValue="-c -Wall"
                        id="ru.mipt.designcenter.tigersharc.toolchainplugin.tools.compiler.otherflags"
                        isAbstract="false"
                        name="Other Flags"
                        valueType="string">
                  </option>
               </tool>
            </toolChain>
         </configuration>
      </projectType>
   </extension>

</plugin>

0 个答案:

没有答案