Developer Guide

This guide is for those who want contribute code to petrel. It describes how to setup a development environment, some conventions and instructions to submit patches.

Development Environment

The Installation Guide describes the general procedure of building petrel and it’s dependencies. Here we show only how to get valgrind working, as valgrind has problems with stack switching.

  1. Boost

    To enable valgrind support in the context and fiber libraries, recompile boost with the valgrind=on option:

    $ sudo ./b2 -q --user-config=user-config.jam cxxflags="-std=c++11 -fPIC" threading=multi link=static valgrind=on install
    
  2. Petrel

    For petrel you have to enable valgrind support by passing -DVALGRIND=on to cmake:

    $ cmake -DBOOST_ROOT=/usr/local/boost_head -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DVALGRIND=on ..
    

Contributions

We accept patches via github pull requests. A brief description of how to get started can be found below.

First Steps

  • Fork the petrel repo on github
  • Follow the guide to setup your dev environment
  • Write code

Workflow

The workflow to submit a patch would usually look like this:

  1. Create a topic branch from master or develop
  2. Commit your changes to the topic brnach
  3. Add unit tests for new code and make sure all tests pass
  4. Push the changes to the topic branch in your forked repo on github
  5. Submit a pull request to apohl79/petrel

The pull request will trigger a build on travis which has to succeed before we will review your patch.

Thanks a lot for your contributions!

Code Formating

We use clang-format. The configuration file .clang-format is located the the root directory of the repository. You can integrate it into your editor or you setup a pre-commit hook in git (see here for an example script).