Reference
You can configure the BuildZri program execution via two approches: editing the configuration file or providing CLI arguments.
#
Configuration fileThe buildzri.config.json
file holds all build configurations of the particular C++ project. This file
is mandatory to start compilation with the BuildZri tool.
std: string
#
Defines the standard C++ version. i.e.,: c++17
version: string
#
Project version. i.e.,: 1.0.0
. The BZ_VERSION
global variable receives this value before the compilation
process. The version string won't be validated, so you use any preferred version number format.
output: string
#
Binary file output of the C++ project. BuildZri automatically appends .exe
to this value on Windows.
include: object
#
Directories to be included into the compiler execution for searching for header files.
Example:
source: object
#
Source files to be included into the compiler execution. Supports wildcard definitions with the Python glob syntax.
Example:
options: object
#
Additional compiler flags for each compiler implementation. Check the following documentations to learn more about compiler flags:
- GNU C/C++ compiler flags: manual
- Apple Clang LLVM compiler flags: manual
- Microsoft Visual C++ compiler flags: manual
Example:
definitions: object
#
C/C++ preprocessor macro defnitions.
Example:
#
Command-line argumentsCommand-line arguments help you to change the build tool execution behavior without changing the configuration file.
--verbose
#
Prints build tool progress into the console. This CLI argument is helpful for diagnosing errors in the pre-compilation stages.
#
Global variablesGlobal variables can be used to change the configuration values dynamically before the compilation process.
You can use global variables with output
, definitions
, and options
configuration keys.
Global variables come with the following syntax.
BuildZri supports the following global variables:
BZ_VERSION
#
Project version from the configuration file.
BZ_OS
#
Operating system shortname: linux
, mac
, or win
BZ_ARCHL
#
The current machine's CPU architecture. This value is obtained with the platform.machine().lower()
Python code snippet.
BZ_ARCH
#
Shortname of the BZ_ARCHL
value. i.e.,: This variable will return x64
instead of amd64
or x86_64
.
BZ_COMMIT
#
The latest commit hash of the Git repository. This value is extracted by using the following Git command via the Python script:
Example usage:
#
Cross-platform definitionsBuildZri is a cross-platform C/C++ build tool, so how to define configuration values for each operating system? Cross-platform configuration objects typically accept the following properties:
*
: For all operating systemslinux
: For GNU/Linux platformsdarwin
: For macOSwindows
: For Windows
You can define configurations for each operating system by using the above properties.
For example, the following JSON snippet set platform-specific macros for each operating system and set one generic macro for all operating systems:
This cross-platform definition syntax works with source
, include
, definitions
, and options
configuration
objects.