Spock is a project generator for C++. It generates an standard shared library or executable project using CMake as its build tool. The project generation is configurable through commandline options.
The core of spock is written in Rust, combined with the Tera template engine and the Clap command line argument parser.
Every file generated is a Tera template. Each template has an extension which is used to decide whether or not the template should be generated into the project depending on the command line options. The extensions are:
- all is included in every project
- test is included if a test suite was selected
- lib is included if the project is a library
- exec is included if the project is an executable
- Download the PKGBUILD file and from the same directory run
makepkg -i
-
Install rust
-
Install using cargo
cargo install --git https://github.com/simonvpe/spock
-
Add the stuff to your path as instructed by the installation
-
Clone the repo and install the templates
git clone https://github.com/simonvpe/spock && cd spock sudo install -d -m 755 /usr/share/spock sudo cp -R templates/cpp /usr/share/spock/ sudo chmod -R 755 /usr/share/spock
Discover spock
spock help
Scaffold a new C++ executable project with catch for running tests
mkdir my-awesome-project && spock -C ./my-awesome-project create --tesing catch --exec c++ my-awesome-project
Scaffold a new C++ shared library project with catch for running tests
mkdir my-awesome-project && spock -C ./my-awesome-project create --tesing catch --lib c++ my-awesome-project
Pull requestes are accepted. The most appreciated PR's are the following
- Enhancing the interface of the
cpp
module. - Error handling
- Enhance the templates (I am not particularily good with CMake)
Possible features in the future
- Spock modules
spock add https://github.com/user/some-cool-spock-lib
- Querying CMake files to re-generate as new teplates are released