cbt (C++ Build Tool) is a postmodern build tool intended towards developing applications in C++ effortlessly.
cbt or "C++ Build Tool" is a postmodern build tool intended towards developing applications in C++ effortlessly.
The one thing lacking in the C++ ecosystem is a simple and lucid build system. While the flexibility of C++ and the low-level target nature of this language has enabled/forced multiple vendors to create their own (both platform-agnostic and platform-dependent) build systems, it is really difficult to interact with such tools due to one or more of the following (a non-enhaustive list) issues:
- Different syntax to learn
- Some such tools generate output which is then to be fed to some other tool which then builds your application, e.g. Meson, Ninja
- The language itself (owing to its development history) demanding understanding of intrinsic low-level or operating system specific features which then needs to be made portable
- Different tools having different folder layout structure adding to cognitive load
- Need to understand flow of commands in Make and family of build tools, e.g. CMake; and also continuously update the MakeFile (and variants) with cryptic glob patterns
- Some build tools being written in some other interpreted language requiring the end-developer to download extra runtime environments, e.g. SCons
- Some tools require knowledge of the GUI (**G**raphical User Interface) IDE (**I**ntegrated Development Environment) that interacts with the underlying build tool (e.g. Visual C++ Build Tool); while some CLI (**C**ommand Line Interface) tools are so complex that considerable effort has to be made to first understand cryptic flags and arguments (e.g. clang, g++)
- And lot more ...
One reason why proliferation of JavaScript has been so prominent is due to npm (later other package managers followed suite) and the one unified package.json, both of which have catapulted a once browser-only language to be used in almost all (sometimes even inappropriately) domains.
cbt is similar in spirit to npm and package.json, except it is more about making software development with C++ more approachable to beginners and seasoned developers alike; and equally not raising C++ to such higher abstraction language(s) like Java, C#, etc.
cbt is a very simple yet powerful build tool made from first principles:
Entirely command driven, e.g. cbt create-application my_app, cbt create-library my_lib, cbt create-file some_module/some_util
Simple commands to compile, test and build the project
Native support for timestamp-aware compilation and testing without any extra involvement/effort from developer's end
Simple, intuitive and maintainable project configuration through project.cfg
Unlike an npm project, ensure that all projects created with cbt strictly have the same directory structure
Automatically create proper scaffold upon invocation of cbt create-file <file_name> (descriptions given below), and thereby reduce cognitive load
First-class (and type-safe) support for env file(s)
Decentralised dependency management via cbt resolve-dependencies
Unobtrusive and transparent cbt_tools offered to bring quality-of-life improvements as well as enable flexible customisation(s) as per project requirements
Interface with C files through dedicated headers/c/ and src/c directory allowing you to code in C (when absolutely required) and seamlessly invoke from C++ file
First-class support for containerisation technologies (like Docker and Podman) allowing you to develop, test and ship applications/libraries from day one
Leverage cppcheck to perform static analysis through a simple cppcheck{} interface available in project.cfg