thilinarmtb / ttt

Template for a CMake based C project (a library and a binary which calls it).

Home Page:https://thilinarmtb.github.io/ttt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TTT

TTT is a template for a CMake based C project to help easily bootstrap C projects. This started as an effort to put all boilerplate code that I ended up writing whenever I created a new project.

Setup a new project

Simply use setup.sh to replace instances of ttt and TTT with your project specific names and/or prefixes. This script also renames the files.

./setup.sh --rename mylib

Then mylib.sh (Initially ttt.sh before calling setup), can be used to build and install the library mylib.so and the executable mylib-driver.

If the option -n or --nuke is also passed to the script, setup.sh self-deletes itself, deletes git history and this README.md as well.

./setup.sh --rename mylib --nuke

Use -h or --help to print the full help message.

./setup.sh --help

Build this project

This project uses conda to manage dependencies (CMake, clang-format, clang-tidy and other dependencies for documentation). Dependencies can be installed by executing following commands after installing conda.

conda env create -f environment-dev.yml
conda activate mylib-dev

You can format the source code with clang-format (.c and .h files are likely to be messy after renaming from ttt to mylib) using the option --format.

./mylib.sh -format

Then you can initialize git, add the files and do the initial commit for the new project.

git init
git add .
git commit

Then simply run mylib.sh script to build and install the library.

./mylib.sh -enable-docs -install

Use -help to see all the options supported by mylib.sh script.

./mylib.sh -help

About

Template for a CMake based C project (a library and a binary which calls it).

https://thilinarmtb.github.io/ttt


Languages

Language:C 66.6%Language:Shell 19.5%Language:CMake 14.0%