#build-system #cpp #build-tool #c

build embargo

A simple and fast opinionated build system for c/c++

3 unstable releases

0.1.1 May 1, 2023
0.1.0 Apr 2, 2023
0.0.1 Mar 24, 2023

#302 in Build Utils

Download history 15/week @ 2024-02-18 19/week @ 2024-02-25 34/week @ 2024-03-10

68 downloads per month

GPL-3.0 license

25KB
580 lines

Embargo

Embargo is a simple and fast opinionated build system for c/c++

Install or update

Install rust

Then install embargo with rust package manager :

cargo install embargo

Embargo uses the llvm toolchain by default (clang, lldb, clang-tidy)

Debian dependencies :

apt install clang lldb clang-tidy

Usage

Create a new project

First create a project folder, then type the following command inside it:

embargo init

This will create a default "Hello World"

Build your app

Debug build :

embargo build

Release build :

embargo release-build

Builds can be found in the build/debug or build/release folder

Run your app

Debug run :

embargo run

Release run :

embargo release-run

Embargo will build your app before running it so that you always run the latest version of your app

embargo run runs your app inside a debugger so that you can easily find where a crash happened in your code.

Debug your app

embargo debug

This will start the debugger with your app attached to it

Lint your app

embargo lint

This will use clang-tidy to find common mistakes in your code

Generate clangd configuration

embargo clangd-config

This will create the compile_flags.txt that can the be used by the clangd language server

Clean build folder

embargo clean

This will remove the build folder

Show configuration

embargo show-config

This will show Embargo configuration for the current project

Configuration

Embargo project configuration is read from the Embargo.toml file at the root of your project

Here is an example configuration with Embargo default settings

compiler = "clang++"
debugger = "lldb"
linter = "clang-tidy"
flags = ["-Wall", "-Wextra", "-pedantic"]
debug-flags = ["-g"]
release-flags = ["-O2"]
linker-flags = []
linter-checks = ["clang-analyzer-*"]

If a key is missing in the configuration Embargo will use these as default settings

Alternatives

If you don't want to install the rust toolchain, but still want similar functionality, you may have a look at PyBargo

Dependencies

~1.6–2.5MB
~45K SLoC