Skip to content
/ fun Public

A repository for having fun with code (Primarily C for now)

Notifications You must be signed in to change notification settings

shiva/fun

Repository files navigation

Build Status Code Climate Join the chat at https://gitter.im/shiva/fun

Summary of Contents

  • th-stor - Thread local storage
  • fwc_stdlib - A standard library (based on Linux Programming Interface stdlib) that provides basic types, error functions, etc
  • ds - Reference implementation of data-structures and algorithms
  • nim - A set of simple programs using nim language
  • ooc - Basic framework and library for object-oriented programming in C

Coming Soon

  • locks - Examples for thread locking (coming soon)
  • cplug - A C framework for loading multiple c-libraries as plugins - using a config file (coming soon)

Compiling the examples

This project uses cmake to generate makefiles. The generated makefiles are used to build the targets for your platform.

Out-of-source builds are supported and the instructions below will build everything within the build directory. On linux machines, you will need the following

  • cmake - version 2.6 or greater (you can install this using apt-get)
  • make/gmake - the default should suffice
  • gcc/something other c compiler - the default should suffice
  • nim-lang - version 0.9.6 or greater
  • cpputest - version 3.7+

To install pre-packaged cpputest:

Linux - There is an Debian and Ubuntu package available for CppUTest. This is by far the easiest way to install it, via:

# apt-get install cpputest

MacOSX - For Mac, a Homebrew package is available too. You can install via:

# brew install cpputest

To install cpputest via source:

# wget https://github.com/cpputest/cpputest.github.io/blob/master/releases/cpputest-3.7.1.tar.gz?raw=true --output-document=cpputest-3.7.1.tar.gz
# tar -xzf cpputest-3.7.1.tar.gz
# pushd cpputest-3.7.1/build && autoreconf .. -i && ../configure --prefix=$HOME/cpputest && make && make install
# export CPPUTEST_HOME=$HOME/cpputest
# popd

Steps to compile all targets:

# cd $CHECKOUT/../build
# cmake ../$CHECKOUT/
# make

The above commands generate binaries and libraries in $CHECKOUT/build/bin and $CHECKOUT/build/lib respectively.

Unit-tests

This project uses cpputest to implement tests for C. In order to use this, you need to

# cd $CHECKOUT/../build
# cmake ../$CHECKOUT/
# make
# make unit-test

Developing using eclipse

You can use cmake CDT generator, to create a fully functional eclipse project.

# cd $CHECKOUT/../build
# cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../fun

Note: the eclipse generator does not work, if the build directory shares the same root as the source. To avoid an error, just generate build to be a sibling of $CHECKOUT.

You can use a [test-runner][1] to run unit-tests via eclipse.

Bitdeli Badge

TODO

  • Remove need to source install cpputest on Travis
  • Switch to docker-based builds

[1] : https://github.com/tcmak/CppUTestEclipseJunoTestRunner

About

A repository for having fun with code (Primarily C for now)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •