Crate builder_cpp

source ·
Expand description

A library for building and packaging C and C++ projects.

This library automatically configures various targets in your project and gives an easy interface to grab packages from github.

The library uses config_linux.toml or config_win32.toml file to configure the project.

§Installation

To install this library, you need to have rust installed on your system.

cargo install builder_cpp

§Examples

To get the various flags that can be passed to builder_cpp

builder_cpp -h

or

builder_cpp --help

§Sample toml files

Optional keys in toml are packages in build and deps in targets Project contains an executable and a library from a github repo

# config_linux.toml
[build]
compiler = "g++"
packages = ["Dr-42/Nomu_Engine, master"]

[[targets]]
name = "main"
src = "./src"
include_dir = "./src"
type = "exe"
cflags = "-g -Wall "
libs = ""
deps = ["libengine"]

Projects contains a library and an executable

 # config_win32.toml
[build]
let compiler = "g++"
build_dir = "./bin"
obj_dir = "./obj_win"

[[targets]]
name = "libengine"
src = "./Engine/src/"
include_dir = "./Engine/src/include"
type = "dll"
cflags = "-g -Wall -Wunused `pkg-config --cflags freetype2` -std=c++17"
libs = "-lm -lglew32 -lglfw3 -lopengl32 -static-libstdc++ `pkg-config --libs freetype2`"

[[targets]]
name = "main"
src = "./Game/src/"
include_dir = "./Game/src"
type = "exe"
cflags = "-g -Wall"
libs = "-static-libstdc++"
deps = ["libengine"]

Modules§

  • Contains code that handles various binary flags
  • Contains code to build projects This module contains the buiild related functions
  • Handles global config
  • Contains hashing related functions This module contains functions for hashing files and checking if they have changed.
  • Contains logger and config parser This module contains various logging and toml parsing functions used by the builder_cpp library