Skip to main content

NPM for Qt (Finally!)

Survival of a Language



To have a thriving ecosystem, what does a programming language need?

Short Answer:

A Good Package Manager

A package manager is a set of tools that help automate the installation, configuration, removal, and updating of libraries and programs. Package managers are key to an effective build system because they take the pain out of loading and organizing the correct versions of dependencies to create a consistent build. They can also be a gateway for module exploration. This discovery method can save developers loads of time they would have spent re-inventing the wheel.

What Makes a Good One?

A good program manager should have the following attributes:
  • Cross-platform
  • Free
  • Easy
  • Fast
  • Deterministic
  • Browse-able
  • Promotes quick evaluation

Examples

C#

  • Nuget

JavaScript / Node

  • NPM / Yarn

Python

  • PIP
  • Anaconda
  • PyPl

Go

  • go get

Ruby

  • RubyGems

Rust

  • Cargo
  • Crates.IO

Java

  • Maven
  • Gradle

PHP

  • PEAR
  • PECL
  • Packagist

Haskell

  • Cabal

Erlang / Elixer

  • Hex.pm

2017 Module Counts

What About C++ / QML?

This question gets posed often, especially by developers coming to C++ from the web development world where they have been pampered by NPM and the likes. They get answers like:
 Welcome to the big leagues, where there are approximately 74 different build systems and a patchwork framework of 28 various package managers, most of which only support a certain platform/environment and are useless outside of it.
Yup. Nothin' to protect ya out here except yer text editor and yer wits.


It can be kind of discouraging but there have been a few to crop up out there:
Out of these Buckaroo seems to have the most promise, especially since it is a Facebook project and supposedly now supports Windows. Unfortunately for it, so far, available packages seem to be a bit scarce.

QPM - A New Hope

There is finally a package manager available for Qt and QML called QPM. It was developed by a group at CuteHacks (way to drop the ball Digia!). Obviously it has a long ways to go to catch up with NPM but it's a great start I think.

Getting Started

There are 4 ways to install documented here. I installed via Go and it worked great.
To install a module just run...
qpm install [package]
In your Qt .pro file you simply add...
include(vendor/vendor.pri)
If it has a QML library then add the appropriate import statement.
It's that easy!

Onward

The module index can be found here. There are quite a few useful tools and components in there already. I'm excited and hopeful for more developers to contribute. I plan to myself in the days ahead.



Comments