[QGIS-Developer] Building QGIS with Visual Studio 2019 CE and vcpkg

Uhrig, Stefan stefan.uhrig at sap.com
Fri Jan 29 06:18:18 PST 2021


TL;DR: It is currently possible to build the QGIS core app with Visual Studio 2019 and vcpkg, which makes debugging QGIS dependencies easy.


Hi all,

Some time ago I discovered vcpkg (https://github.com/microsoft/vcpkg). vcpkg is a package manager that downloads package source code to your local machine and builds the package locally. Recently, I discovered that vcpkg should be able to provide all dependencies to build at least the QGIS core application. Hence, I gave it a try.

Basically, it worked out of the box. I started with a fresh Windows 10 installation, installed Visual Studio 2019 Community Edition, Git, vcpkg, Python 3 and flex and bison for Windows. I fetched all other dependencies via vcpkg. It was not necessary to even touch a single file in the repository. I could just open the main CMakeLists.txt file in Visual Studio and only had to tweak the CMake cache (the CMake find macros that come with QGIS are not aware of vcpkg, so I had to set some paths manually). I had to switch off some extensions though as the required dependencies were not available via vcpkg (WITH_BINDINGS, WITH_QGIS_PROCESS, WITH_QTWEBKIT). The build did not report any errors, I could start the application and it seems to work, but I did some light testing only.

I mainly tried it because I enjoy debugging with Visual Studio more than with gdb (or gdb wrapped in some IDE). In my experience, the performance of the Visual Studio debugger is better and it is more stable, especially in long debug sessions.

I don't want to promote official building support of QGIS with vcpkg. Providing the dependencies via OSGeo4W is much more reliable. However, if you don't mind the experimental nature of this setup and you want to be able to debug into QGIS' dependencies, you might give it a try. Especially, if you want to track the cause of a crash in one of QGIS' dependencies, this setup might be helpful. You have the source code and debug versions of the dependencies, so the debugger will jump to the crashing code line and you can inspect all the variables of the dependency.

If someone is interested in trying it, give me a note. I can then assemble detailed instructions on how to make it work. It took me a while to figure out which packages are needed and how the CMake cache needs to be tweaked.

Best regards,
Stefan



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210129/2ca67698/attachment-0001.html>


More information about the QGIS-Developer mailing list