3

We're starting to look at porting some of our plugins over from ArcMap to QGIS and we're pretty excited about it.

Currently everything we have is written in C++ so it would be nice to use that on QGIS too.

So far the resources that I've found: Writing C++ Plugins, QGIS Coding and Compilation Guide seem good but they didn't answer my specific questions.

Can C++ plugins be deployed in the plugin store? If so, how do you do this in a multi-platform environment? Is there a cookbook for deploying C++ plugins across platforms?

4

It's generally discouraged to write c++ QGIS plugins, for the following reasons:

  • They can't be distributed via the plugin library (only python plugins with no binary dependencies are accepted)
  • The c++ API is not stable between QGIS releases (including point releases), so you need to update and recompile c++ plugins for each QGIS version used. (In contrast, the PyQGIS API is fixed for the duration of a major release. Eg PyQGIS plugins written for QGIS 2.0 should still work under 2.14).
  • Cross compilation of c++ plugins (outside of the main QGIS source tree) is difficult. You'll need a separate build environment for each targeted platform and separate binaries for each.

It's worth noting that even in the QGIS codebase itself there is a strong movement away from c++ plugins to either including code directly within core QGIS or to use of python plugins.

  • Awesome. This was my impression too after a bit more research. Nice to see it outlined so clearly though. – Raychaser Apr 12 '16 at 16:42
  • 1
    So here's my suggestion: if it's functionality which you think could be of widespread use, then explore getting those parts merged into the QGIS code. Then port the rest to python. Ie if you've got specific c++ methods for handling geometries, operations etc there's a good chance these could be of value in the main codebase and this would also simplify the porting process somewhat! – ndawson Apr 12 '16 at 19:04
  • Good suggestion. Thinking this way is relatively new to us since we've been ESRI / ArcMap / Closed Source developers for a while but I love the idea of giving back. There's a good chance that everything we need is already inside QGIS so python seem like the right way to go for sure. – Raychaser Apr 12 '16 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.