[Qgis-developer] Plugin Development C++ Windows - Any response?

Julien Malik julien.malik at c-s.fr
Fri Mar 4 12:57:23 EST 2011


Hello,

I'm a little late, but still :

Le 23/02/2011 22:13, Tim Sutton a écrit :
> Hi
>
> On Wed, Feb 23, 2011 at 8:05 PM, Julien Malik<julien.malik at c-s.fr>  wrote:
>> Hello,
>>
>> Having written some C++ plugins (for Orfeo Toolbox), I have some feedback to
>> give.
>>
>> The current recommended procedure is to have a source build of qgis, add
>> your plugin inside qgis source tree, hack a QGis CMakeLists to add the new
>> plugin dir, and recompile Qgis.
>>
>> In my opinion, a better approach is to build them as external project.
>> The idea is to be able to build a plugin on top of a prebuilt Qgis
>> (libqgis-dev on ubuntu/debian, and the OSGeo4W build on windows)
>>
>> That's what I have set up for the plugins I wrote, but ran into the
>> following problem :
>> - There is no FindQgis.cmake or QGisConfig.cmake exported in the qgis
>> development package (either OSGeo4W or ubuntu/debian), so importing QGis
>> inside a CMake project must be done "by hand". It's ok with the QGis include
>> path and the path to libqgis_core. But you have to take care of importing Qt
>> also, which should be done by a FindQgis.cmake
> I added the FindQGIS cmake file that I wrote for openModeller some
> years ago into qgis/src/cmake
>
Nice !
Will it make its way into the binary packages (more exactly the 
libqgis-dev package) ?

In external projects, I'd like to do find_package(QGIS), but i don't 
want to include the FindQGIS file in the external project sources.

For example, this is what we do for an application written on top of OTB :
http://hg.orfeo-toolbox.org/Monteverdi/file/f4f1c170dec6/CMakeLists.txt#l74

The OTB exports these main CMake files in the dev package :
/usr/lib/otb/UseOTB.cmake
/usr/lib/otb/OTBConfig.cmake

The INCLUDE(${OTB_USE_FILE}) command is used to add the include dirs, 
compiler definitions, etc...

The idea of separating the find_package and the actual 
include_directories/add_definitions seems nice to me.
With all the possibilities offered by QGis, there might be different 
"use file" (for plugins, for applications built on top of QGis lib, ...)


>> - I had to hack some QGis #define to make it build on windows (GUI_EXPORT
>> and CORE_EXPORT). Again, this should be handled by a ADD_DEFINITION inside a
>> FindQgis.cmake
>>
>> One other thing : it would be nice if the C++ plugins could be loaded from
>> another directory than the official one.
> Ok I added support for this - see the bottom of the general options
> tab in QGIS Options dialog.
>
> Available in trunk as of r15250.
>
> I have only tested on linux but it should work on linux&  mac too.

I just seen it after an source update, I'll test it soon.

But what I would have expected is different : something like a 
ld.conf.so.d directory, where simple text files contain paths to other 
directories.
If we manage to have a working otb-qgisplugins debian package, I'd like 
it to just drop a file in this directory, containing something like 
/usr/lib/otb/qgisplugins.

The advantages I see :
- at install time, the package would just drop a file in this directory, 
and would not install all the files inside the qgis plugin dir.
- uninstalling the package would be just a matter of deleting this 
little text file
- those steps would be run for all users automatically

Having two layers (one system layer/ one per-user layer as you 
implemented it) seems useful at first sight.

Do you think it could complicate things too much ?

> Some time maybe you can return the favour and help me to get my otb
> plugins to compile properly - I never did get them to build by
> following the instructions on your wiki.... I'd have to write back to
> this list with more specifics of the problem first though.
No problem. Drop a mail on our list and we will try to help.


Best regards,
Julien



> Regards
>
> Tim
>
>> Let's say I wrote a bunch of plugins for a specific software, I would like
>> to store them in their own directory instead of messing up with the official
>> plugins. Maybe it's already supported but I don't know how to do it...
>>
>> Regards,
>> Julien
>>
>>
>> Le 23/02/2011 14:12, Barend Gehrels a écrit :
>>> Hi,
>>>
>>>
>>>> Yes as Martin notes, and as I mentioned in my last email in this
>>>> thread "If you are able to use linux, you can even more easily just
>>>> use the plugin_builder.py script in that src/plugins directory and it
>>>> will generate for you a 'hello world' C++ plugin."
>>>>
>>>> Perhaps the linux part is not relevant though as you should be able to
>>>> use it on widows with python, but I've never tried. As an interesting
>>>> history note, we have had a plugin builder script (in one form or
>>>> another) in QGIS for c++ plugins from very early on in the life of
>>>> QGIS's plugin support.
>>>>
>>> On Windows the plugin_builder.py works also perfectly.
>>>
>>> Regards, Barend
>>>
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>


More information about the Qgis-developer mailing list