cargo-newcpp

Crates.iocargo-newcpp
lib.rscargo-newcpp
version0.6.5
sourcesrc
created_at2023-08-02 04:06:06.738439
updated_at2024-11-30 23:13:52.976492
descriptionA cargo plugin for creating new C++ projects.
homepagehttps://github.com/sjbeskur/cargo-newcpp
repositoryhttps://github.com/sjbeskur/cargo-newcpp
max_upload_size
id932401
size69,034
sam (sjbeskur)

documentation

https://github.com/sjbeskur/cargo-newcpp

README

cargo newcpp

This tool extends Cargo to allow for the creation of new C++ projects in the spirit of cargo new <project>

cargo install cargo-newcpp

Required Prereqs

Ensure that you have a fairly recent version of Rust/Cargo installed.

In order to build projects using cargo buildcpp you will also want to install recent versions of standard C++ build tools:

sudo apt install gcc, g++, ninja-build, build-essential, cmake

Create a new project

To create a new C++ project:

cargo newcpp <your_project_name> [--lib]

This will output to the following default project scaffolding under the <project_name> folder.

scaffolding

If you have git installed this will also initialize your new project as a git repo.

Building the CPP project with cargo

Once you've created the project, you can build it using the command below:

cd <your_project_name> 
cargo buildcpp [--debug | --release]

By default, buildcpp will place cmake buildtree artifacts into the target/debug folder. Specifying the --release flag will generate the buildtree artifacts in target/release

Cleaning the CPP project with cargo-cleancpp

This is functionally equivilant to "rm -rf target/". I struggled with whether or not I should do something more idiomatic to modern cmake (e.g. cmake --build <target> -t clean or cmake --fresh ...) but these did not feel right and chose to default to what ```cargo clean`` does instead.

cargo cleancpp 
Commit count: 65

cargo fmt