“Hello, World” is a hallowed and useful tradition in software projects. Get a simple program working first, then start building on that initial confidence.
“Hello, World” is version 0 of your application. But what about “Hello, World” for the tools you use to build that application? Little-known fact: having a template toolchain at the ready can save days (even weeks!) at the kickoff of a project. Read on; let us show you how.
When our tools work well, they fade into the background. Thankfully, humans have been compiling C++ for decades. As seasoned C++ developers, we at 219 Design can comfortably spend our time laying down quality lines of code without putting much thought into the build toolchain.
There is, however, a particular point in time when thoughts of the build toolchain are all-consuming: the beginning. At the very beginning of any project, there is no toolchain. In the initial git history of a project, you’re likely to find that commits relating to makefiles and build artifacts and helper scripts outnumber commits relating to application logic by a good number.
What exactly are we developers doing in these initial commits?
While many of these steps might be considered optional for small projects, they are all mandatory for robust commercial projects.
At 219 Design, we initiate multiple C++ projects per year. Thanks to our accumulated experience with the above, we can bring all these robust features to any project virtually instantaneously. We consider all of the above part of our “Hello, World” C++ project baseline.
To show exactly what we mean, we have open-sourced our project template for a specific platform: Qt5/QML on Linux. We welcome anyone starting a C++ project on Linux to freely consume our template as a starting point. Replace the main function with whatever you like. Or, to continue using QML, leave main alone and replace our QML file instead.
By starting from our template toolchain repository, you will immediately enjoy: strict compiler warnings, clang-format style enforcement, googletest availability, and a stub test-suite already running in GitHub CI. To care for your qml code, qmlfmt is provided to keep the code readable, as well as a script that launches the app and auto-verifies the absence of common issues (such as the all-too-common QML “ReferenceError”).
A project that is born robust has a great chance of building on that strength. Hopefully you will find this as useful as we do. Please reach out via GitHub if you have questions about this template or click “Get Started” if you’d like to partner up and create something great together!
Date published: 03/04/2020