Skip to content

Simple cpp boilerplate with cmake and gtest

Notifications You must be signed in to change notification settings

akhopkar01/PID_controller

 
 

Repository files navigation

PID Controller (Test Driven Development)

Build Status Coverage Status

Overview

This project is worked in groups to carry out TDD. We have implemented a PID controller with Unit Tests to validate software quality.

Authors:

[ Part 1 ] Aditya Khopkar (driver), Rajeshwar N S (navigator)

[ Part 2 ] Spencer Elyard (driver), Daniel Sahu (navigator)

TO-DO for future:

Investigate additional test-cases for compute

Standard install via command-line

git clone --recursive https://github.com/akhopkar01/PID_controller
cd PID_controller
mkdir build
cd build
cmake ..
make
Run tests: ./test/cpp-test
Run program: ./app/shell-app

Building for code coverage (for assignments beginning in Week 4)

sudo apt-get install lcov
cmake -D COVERAGE=ON -D CMAKE_BUILD_TYPE=Debug ../
make
make code_coverage

This generates a index.html page in the build/coverage sub-directory that can be viewed locally in a web browser.

Working with Eclipse IDE

Installation

In your Eclipse workspace directory (or create a new one), checkout the repo (and submodules)

mkdir -p ~/workspace
cd ~/workspace
git clone --recursive https://github.com/danielmohansahu/mobile-pid-controller

In your work directory, use cmake to create an Eclipse project for an [out-of-source build] of mobile-pid-controller

cd ~/workspace
mkdir -p boilerplate-eclipse
cd boilerplate-eclipse
cmake -G "Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug -D CMAKE_ECLIPSE_VERSION=4.7.0 -D CMAKE_CXX_COMPILER_ARG1=-std=c++14 ../mobile-pid-controller/

Import

Open Eclipse, go to File -> Import -> General -> Existing Projects into Workspace -> Select "boilerplate-eclipse" directory created previously as root directory -> Finish

Edit

Source files may be edited under the "[Source Directory]" label in the Project Explorer.

Build

To build the project, in Eclipse, unfold boilerplate-eclipse project in Project Explorer, unfold Build Targets, double click on "all" to build all projects.

Run

  1. In Eclipse, right click on the boilerplate-eclipse in Project Explorer, select Run As -> Local C/C++ Application

  2. Choose the binaries to run (e.g. shell-app, cpp-test for unit testing)

Debug

  1. Set breakpoint in source file (i.e. double click in the left margin on the line you want the program to break).

  2. In Eclipse, right click on the boilerplate-eclipse in Project Explorer, select Debug As -> Local C/C++ Application, choose the binaries to run (e.g. shell-app).

  3. If prompt to "Confirm Perspective Switch", select yes.

  4. Program will break at the breakpoint you set.

  5. Press Step Into (F5), Step Over (F6), Step Return (F7) to step/debug your program.

  6. Right click on the variable in editor to add watch expression to watch the variable in debugger window.

  7. Press Terminate icon to terminate debugging and press C/C++ icon to switch back to C/C++ perspetive view (or Windows->Perspective->Open Perspective->C/C++).

About

Simple cpp boilerplate with cmake and gtest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CMake 47.2%
  • Python 26.4%
  • C++ 26.4%