Repository navigation
Basic Guide
Here you can find out about both the cli tool and the toml table reference. You can also find details about the cli tool by running
builder_cpp -h or builder_cpp --help.
The project can have only one binary and as many libraries as you like.
You need to write a config_linux.toml for linux (and android if compiling inside tmux) and config_win32.toml for windows.
The config has two top level fields - build and and an array of targets
| Field | Type | Details | Valid entries | Optional |
|---|---|---|---|---|
| compiler | string | Specifies the compiler to be used | gcc, clang, g++, clang++ | No |
| cstandard | string | Specifies the C standard to be used | c89, c99, c11, c17,... | Yes |
| cppstandard | string | Specifies the C++ standard to be used | c++98, c++03, c++11,... | Yes |
| packages | string | github repo of the package in the format "author/repo, branch" | any | Yes |
| pre_build | string | Command to run before every build | any | Yes |
| post_build | string | Command to run before every build | any | Yes |
This section defines individual build targets. You can have multiple targets with different configurations. It is a toml array.
| Field | Type | Details | Valid entries | Optional |
|---|---|---|---|---|
| name | string | Name of the target | any (for dll must start with lib | No |
| src | string | Path to the source code directory for the target | any | No |
| include_dir | string | Path to the directory containing header files for the target | any | No |
| type | string | Specifies the type of target | exe, dll | No |
| cflags | string | Compiler flags used for building the target | any (can be an empty string) | No |
| libs | string | External libraries to link against, separated by spaces | any (can be an empty string) | No |
| deps | array of strings | Names of other targets within the same toml file that this target depends on | any (can be an empty array) | Yes |
The cli tool is used to build the project. It has the following options
Usage: builder_cpp [OPTIONS] [COMMAND]
| Command | Description |
|---|---|
| init | Initialize a new project Defaults to C++ if no language is specified |
| config | Configuration settings (Details below) |
| help | Print this message or the help of the given subcommand(s) |
| Short | Long | Description |
|---|---|---|
| -b | --build | Build your project |
| -c | --clean | Clean the obj and bin intermediates |
| -r | --run | Run the executable |
| --gen-cc | Generate compile_commands.json | |
| --gen-vsc | Generate .vscode/c_cpp_properties.json | |
| --clean-packages | Clean packages | |
| --update-packages | Update packages | |
| --restore-packages | Restore packages | |
| -h | --help | Print help |
| -V | --version | Print version |
You can pass arguments to the running binary by using the -- separator. For example:
builder_cpp run -- arg1 arg2or
builder_cpp -r -- arg1 arg2Usage: builder_cpp config <PARAMETER> <VALUE>
This set the default compiler, language and license for the init command
| Parameter | Value | Description | Valid entries |
|---|---|---|---|
| default_compiler | compiler | Sets the default compiler to use | gcc, clang |
| default_language | language | Sets the default language to use | c, cpp |
| license | path/to/license/file | Sets the license to use | any |