Skip to content

A C project template, with support for essential development features

License

Notifications You must be signed in to change notification settings

jballoffet/c-template

Repository files navigation

Build Status Coverage Status License: GPLv3

C Project Template

This template provides everything you need to start a new C project. It supports essential features, such as:

Getting Started

Prerequisites

To build the sample project from source, the following tools are needed:

  • git
  • make
  • gcc
  • clang
  • clang-format
  • clang-tidy
  • doxygen
  • graphviz
  • valgrind

On Ubuntu/Debian, you can install them with:

  sudo apt-get install git build-essential clang clang-format clang-tidy doxygen graphviz valgrind

On other platforms, please use the corresponding package managing tool to install them before proceeding.

Building

You can get the source by "git clone" this git repository.

  git clone https://github.com/jballoffet/c-template.git

To build the sample application execute the following:

  cd c-template
  make

Running

To run the sample application execute the following:

  ./bin/app.out

You should see something like this:

  Hello World!
  foo.c -> foo_function(0): 0
  bar.c -> bar_function_abs(-1): 1
  bar.c -> bar_function_double(1): 2
  libbaz.a -> baz_function(): 3

Running the tests

This template supports Unity framework for unit testing, and includes a few tests to show how to use it. To build and run the tests execute the following:

  make test

After the building output, you should see something like this:

  Unity test run 1 of 1
  ...

  -----------------------
  3 Tests 0 Failures 0 Ignored
  OK

To run the tests again without rebuilding, execute:

  ./bin/test.out

Directory Structure

.
├── bin*                    # Application and tests binaries
├── build*                  # Compiled files
├── doc*                    # Generated documentation
├── include                 # Third-party libraries header files
├── lib                     # Third-party libraries
├── src                     # Application source code
├── scripts                 # Continuous Integration scripts
└── test                    # Unit testing directory
    ├── src                 # Unit tests source code
    └── unity               # Unity framework directory
        ├── include         # Unity framework header files
        └── src             # Unity framework source code

The directories marked with an '*' are generated by the build system.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

See also the list of contributors who participated in this project.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

Maintainers

License

This project is licensed under the GPLv3 License. See the LICENSE file for details.

Unity is distributed under the MIT license. See LICENSE.txt for details.

About

A C project template, with support for essential development features

Resources

License

Stars

Watchers

Forks

Packages

No packages published