Add support for vcpkg for managing build dependencies
The status quo makes us manage the dependencies simultaneously in 3 ways:
- in craft blueprint for building binary packages in http://binary-factory.kde.org
- in kde-build-metadata by http://build.kde.org CI builds and kdesrc-build tool
- directly in repository in 3rd party folder, used by a script that prepares and builds AppImage
And yet none of these can be realistically used to prepare a dev environment and make things easier for the actual developers themselves. This could be for the most part solved by leveraging vcpkg to automatically handle as many dependencies as possible.
The advantages are:
- easy onboarding for new developers with coherent, platform-agnostic instructions: the only single thing they explicitly have to do is to pass a cmake switch (
-DCMAKE_TOOLCHAIN_FILE=/Users/dev/vcpkg/scripts/buildsystems/vcpkg.cmake
) - cross-platform support for each library out-of-the-box (Windows, Linux and MacOS), as opposed to having to use a platform-specific manager, e.g.
apt
(Debian/Ubuntu Linux) orHomebrew
(macOS) - reduced maintenance overhead
- AppImage would only require a build-script, the dependencies would be handled
by the main CMakeList.txt file in a standard wayautomatically by passing vcpkg-specific cmake switches. - craft blueprint would only define
KDE's own packages as dependenciesbuild and packaging instructions, the rest would be handled by the main CMakeList.txt file in a standard way - once added to vcpkg repository, due to its popularity, the packages that only we (KMM) use in KDE world would receive attention and contributions from the outside of it (see e.g. a request for sqlcipher) or their actual project owners.
- AppImage would only require a build-script, the dependencies would be handled
- integration with build systems
- integration with IDEs (VS)
- designed to be used with cmake
- open-source, maintained by Microsoft
- Well-supported by QT itself: https://resources.qt.io/youtube-all-videos-2/using-cmake-and-vcpkg-in-qt-application-development
- 1400 packages in centralized (i.e. not prone to npm-like issues with several (un)maintained, crowd-sourced copies of the same package) vcpkg repository at the time of writing this
- The modern DevOps-as-Code approach to maintaining dependencies, as opposed to relying on decentralized external sources.
- This allows to maintain branch-specific list of dependencies and their required versions without affecting other branches, which is currently impossible with craft blueprint residing in a separate project's repository
- Reduction of "Not Invented Here" technical debt
- Potentially enabling CI builds on build.kde.org for Windows and macOS
- Making CI builds compile using all dependencies and plugins, not just the bare minimum
- Support for binary builds, library versioning and private repositories is on the roadmap.
Krita is also in the process of migrating to vcpkg, too, and they added a bunch of ports for KF5 libraries:
Related issues:
Required tasks:
-
create recipes for libraries currently missing in vcpkg repository, e.g. libaqbanking
orlibgwenhywfar
and requesting their addition-
worth reaching out to AqBanking themselves, hopefully they'd be interested in maintaining their own recipes and are best suited to do so (DONE: https://www.aquamaniac.de/rdm/issues/214) -
also to libofx maintainers -
potentially also worth reaching out to GnuCash, since they use a similar set of dependencies and have discussed vcpkg in recent past -
update existing and add all missing KF5 ports: https://invent.kde.org/wrobelda/vcpkg/-/milestones
-
-
adding vcpkg toCMakeLists.txtbuild scripts for automatic downloadingIt needs to be verified with distro packagers if and how this is possible. Some distros do not have internet access during package creationvcpkg usage can also be simply not be enabled to make the KMM build chain default to distro's system-wide -dev packages: https://vcpkg.readthedocs.io/en/latest/examples/installing-and-using-packages/#cmake-toolchain-file- the 2020.07 version of vcpkg supports
vcpkg.json
manifest file. Once included in the source code, it contains a branch-specific list of the dependencies that are to be installed and bootstrapped. The only single thing a dev has to explicitly do is to add a cmake switch (-DCMAKE_TOOLCHAIN_FILE=/Users/dev/vcpkg/scripts/buildsystems/vcpkg.cmake
), the rest is handled automatically.
The fine-grained tasks are tracked here: https://invent.kde.org/wrobelda/vcpkg/-/milestones
Edited by Dawid Wrobel