Coder Social home page Coder Social logo

c_example's Introduction

C Example

This is just a basic example project, so you can see how you would set up documentation and CMake.

This is so I don't need to answer 1000 questions on how to structure your projects, build docs, or how to test :)

  • Documentation: Doxygen
  • Build: CMake
  • Test: CTest (examples with no library or Unity)

At a low level you need to do two things.

Tell CMake where your files are, and tell it where and how you want it built

For example for this project uses ninja in debug, and Unix Makefiles for the release.

cd c_example

#Setup debug build dir
Cmake -G Ninja -S . -B build/debug

#Setup release build dir
Cmake -G "Unix Makefiles" -S . -B build/release

#Build debug directory
Cmake --build build/debug
#Build release directory
Cmake --build build/release

#Clean debug directory then build
cmake --build build/debug/ --clean-first

To run the tests I have set up in this directory

#For example to test the debug release
cd build/debug
ctest

one will fail and one will succeed. It's as simple as an assert statement and returning zero if it succeeds.

To build the docs you'll need Doxygen

sudo apt install doxygen
sudo apt install doxygen-gui

To use the gui just type in

doxygui

and it is relatively straightforward. Make sure to save your Doxyfile after you set it up so you can just run it like this without reconfiguring

cd docs
doxygen Doxyfile

then just open the index.html file made in the /build/html/ folder and see your site :)

c_example's People

Contributors

patrickcpe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.