adding a custom script in the project Builders tab of your project should do it.
----- Mail original -----
De: "Lambros Petrou" <lambrospower@...>
À: "CDT General developers list." <cdt-dev@...>
Envoyé: Vendredi 15 Juin 2012 12:55:02
Objet: Re: [cdt-dev] Call a custom preprocessor and display its results in console
I have been reading a lot about the toolchains in cdt. I made a custom project template ( that copies some files necessary for my project into the project dir ) and I tried to make a toolchain where I have a tool definition with a command that calls a binary that is located in a dir inside the project ( it is one of the files I copy with my project template ). And at the end I set a builder that is just a subclass of the " org.eclipse.cdt.build.core.internal.builder ".
Is there a way to make a configuration JUST TO RUN MY PREPROCESSOR with a single file as input that is located in a dir inside the project ? Or the best way to do it is just make a class that adds a button somewhere and calls the preprocessor manually and then display its output to the console ?
The problem is that I cannot define the toolchain completely because of some other tools used externally to make the final build of the project. I just want to call my preprocessor, that's all.
About the preprocessor calling, I am looking into the MBS configurations and I am trying to make a custom buildConfiguration but it seems that I need to define the WHOLE toolchain that's going to be used.
Is there any way to make a configuration that calls ONLY the preprocessor and display its results ?
I am making a plugin to support more preprocessor commands in C/C++. I made the Content Assist features to work as expected ( with the help of this mailing list ) and I made a Panel for some additional things. Now I'd like to have a button in my panel with the following functionality.
1) Get the text from the open and active editor
2) Call my custom preprocessor executable with some arguments given by a wizard or defaults at first
3) Display the results of the preprocessor at the Console Output or somewhere to be read by the user
In CDT, console functionality is implemented using CommandLauncher. I implemented CDT console fairly recently for scanner discovery to detect compiler built-in settings. It starts at AbstractBuiltinSpecsDetector.runForLanguage(), then you can take a look at BuildRunnerHelper.build() and CommandLauncher code.
The code in AbstractBuiltinSpecsDetector:
- Creates CDT build console which manages separate consoles for each project (like it is done for regular build)
- Connects ErrorParsers and scanner discovery parsers to parse console output
- Provides progress monitor for user to see progress or cancel the build
My main problem is the 2-3 points. As for the 3rd one I think this will suffice:
It's the 2nd part which I do not know how to do. Is there any easy way to do this or should I make my own Build System for CDT using my preprocessor ? If I have to, is there any tutorial or guide or even an example I can read ?