Crates.io | cargo-newcpp |
lib.rs | cargo-newcpp |
version | 0.6.5 |
source | src |
created_at | 2023-08-02 04:06:06.738439 |
updated_at | 2024-11-30 23:13:52.976492 |
description | A cargo plugin for creating new C++ projects. |
homepage | https://github.com/sjbeskur/cargo-newcpp |
repository | https://github.com/sjbeskur/cargo-newcpp |
max_upload_size | |
id | 932401 |
size | 69,034 |
This tool extends Cargo to allow for the creation of new C++ projects in the spirit of cargo new <project>
cargo install cargo-newcpp
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
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.
If you have git
installed this will also initialize your new project as a git repo.
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
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