builder_cpp

Crates.iobuilder_cpp
lib.rsbuilder_cpp
version0.8.4
sourcesrc
created_at2023-03-09 03:11:34.434022
updated_at2024-04-29 05:55:20.637479
descriptionA simple build tool for building C and C++ applications
homepagehttps://github.com/Dr-42/builder_cpp
repositoryhttps://github.com/Dr-42/builder_cpp
max_upload_size
id805313
size124,851
(Dr-42)

documentation

README

BUILDER_CPP

A simple build tool for building C and C++ applications

The tool is still in development. Do not use for production code.

Installation

The tool requires cargo for installation

cargo install builder_cpp

For subcommands run with -h flag

Features

  • Create new project
  • Multithreaded
  • Can generate compile_commands.json
  • Can generate .vscode/c_cpp_properties.json
  • Auto add project libraries to other targets
  • Get libraries as packages from github

Limitations

  • Only supports clang and gcc compilers

Usage

Write a config_win32.toml for windows and config_linux.toml for linux

To create a new project

builder_cpp init <project-name> [--c|--cpp]

For help

builder_cpp --help

The help command will show you the following

A simple build tool for building C and C++ applicati
ons

Usage: builder_cpp.exe [OPTIONS] [COMMAND]

Commands:
  init    Initialize a new project Defaults to C++ if no language is specified
  config  Configuration settings
  help    Print this message or the help of the given subcommand(s)

Options:
  -b, --build                   Build your project  
  -c, --clean                   Clean the obj and bi
n intermediates
  -r, --run                     Run the executable  
      --bin-args <BIN_ARGS>...  Arguments to pass to
 the executable when running
      --gen-cc                  Generate compile_com
mands.json
      --gen-vsc                 Generate .vscode/c_c
pp_properties.json
      --clean-packages          Clean packages      
      --update-packages         Update packages     
      --restore-packages        Restore packages    
  -h, --help                    Print help
  -V, --version                 Print version       

Sample file with a library and an executable

[build]
compiler = "g++"

[[targets]]
name = "libengine"
src = "./Nomu_Engine/Engine/src/"
include_dir = "./Nomu_Engine/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 = "./Nomu_Engine/Game/src/"
include_dir = "./Nomu_Engine/Game/src"
type = "exe"
cflags = "-g -Wall"
libs = "-static-libstdc++"
deps = ["libengine"]

Sample file with an added package and an executable

[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"]

Optional keys in toml are packages in build and deps in targets

To see a real project being built with the tool Nomu_Engine Heim_Engine Imeye

And lots more.
Commit count: 96

cargo fmt