[Qt-creator] .pro files parser Interface

Konstantin Tokarev annulen at yandex.ru
Wed Dec 12 13:55:29 CET 2012



12.12.2012, 16:50, "Jeandet alexis" <alexis.jeandet at lpp.polytechnique.fr>:
> Le 12/12/2012 13:23, Konstantin Tokarev a écrit :
>
>>  12.12.2012, 14:23, "Jeandet alexis" <alexis.jeandet at lpp.polytechnique.fr>:
>>>  Hello,
>>>
>>>  I would like to write a Qt-creator plugin for flashing some
>>>  microcontrollers(such as CortexM family or Leon3) because I also use
>>>  Qt-creator as standalone IDE without Qt library. I've read this good
>>>  introduction
>>>  http://www.vcreatelogic.com/downloads/files/Writing-Qt-Creator-Plugins.pdf
>>>  and I'm able to run a simple plugin.
>>>  But in my case I would like to access pro/pri files from my plugin, I've
>>>  looked inside Qt-creator source and specially inside Qt4ProjectManager
>>>  plugin, I've found some informations in Qt4ProFileNode class and
>>>  Qt4Project::update*Model.
>>  It would be great if your plugin was NOT bound to Qt4ProjectManager by design.
>
> Yes this is also my feeling.
>
>>  This may require adding new APIs to ProjectExplorer, depending on data you'd
>>  like to access.
>
> In my case I need to get some customs variables in pro/pri files. They
> look like:
>
> CPU=stm32f4xxxG
> BSP=STM32F4Discovery
> DESTDIR=somepath
>
> My plugin would use them to find the binary file to load (This could be
> done with /ProjectExplorer::RunConfigurations/  I think), but it need to
> know the CPU target and the the BSP to use the good tool and protocol to
> flash the target.
>
> The problem is that they are in different files => I need to follow
> inclusion and sometime I need to evaluate qmake functions such as
> "contains(variablename, value)". I would prefer to use the same API as
> QtCreator,qmake,...  if there is one?

I think the best API here would be "Unix way". E.g. make an executable (or script)
implementing flashing process which takes CPU, BSP, and DESTDIR as
command line parameters or (slightly worse) environment variables.

Then you will be able to add flashing step to your qmake project (or any other project
kind) as a custom target, or set up custom deployment step in Qt Creator. If you want
to configure CPU, BSP, and DESTDIR in .pro file, you create variables and then use
them to run your flashing application.

No plugin is needed.

-- 
Regards,
Konstantin



More information about the Qt-creator mailing list