Skip to main content

How to Use

Add BuildZri to your C++ project with the following steps.

Add the BuildZri script#

BuildZri comes as a Python v3 script that you can execute on GNU/Linux, macOS, and Windows. Copy-paste scripts/bz.py into your scripts directory. Next, add required execution permissions on Unix or Unix-like platforms.

Create the configuration file#

Create the buildzri.config.json file for your project according to the reference. Look at the following minimal C++ project.

{
"std": "c++17",
"name": "BuildZri Sample",
"version": "1.0.1",
"output": "./bin/bzsample-${BZ_OS}_${BZ_ARCH}",
"source": {
"*": [
"main.cpp"
],
},
"definitions": {
"*": [
"BZ_PROJ_VERSION=\\\"${BZ_VERSION}\\\""
]
}
}

The above project consists of one C++ source file, but you can add multiple source files easily with the wildcard syntax. As show above, you can configure BuildZri to automatically set version details via a macro definition.

Inspect the build configuration file of the Neutralinojs framework to learn how to integrate BuildZri for medium-scale projects.

Start building binaries#

After configuring your project, run the bz.py script file to start the compilation process. For example, on Unix or Unix-like platforms, you can use the following command:

./scripts/bz.py

The compilation warnings and error messages will appear on the terminal as usual. Also, you can use the --verbose flag to identify pre-compilation issues. The BuildZri tool is built for both developers and CI/CD environments, so you can use the same build command on GitHub Actions, as shown below:

- name: Build
run: ./scripts/bz.py