OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Setup and Build

Getting the Source Code

https://github.com/GENIVI/open-adress-book

Building OpenAB

In the main source tree, the file autogen.sh can be used to generate all the required files (Makefiles, Configure)

Local OpenAB build

This example explain the few steps required to build and install OpenAB in any folder (i.e. /tmp/OpenAB_inst)

Setup the Environment

As reference I'm using this folder structure:

  • /tmp/OpenAB_src : folder where the sources are stored
  • /tmp/OpenAB_build : build folder (there is no restriction to use the same source folder)
  • /tmp/OpenAB_examples : build folder (there is no restriction to use the same source folder)
  • /tmp/OpenAB_inst : the folder where everything will be installed (if not specified "/usr/local" is the default one)
mkdir /tmp/OpenAB_src
mkdir /tmp/OpenAB_build
mkdir /tmp/OpenAB_examples
mkdir /tmp/OpenAB_inst

First configuration (autogen.sh)

The autogen.sh script is responsible to launch the autoreconf and the configure script.

It accept all the parameters that will be passed to the configure script.

To show the configure options, just type:

cd /tmp/OpenAB_build
../OpenAB_src/autogen.sh --help

To start creating the building environment, use all the required configure parameters with autogen.

Note
In this example I'm enabling the EDS backend and the doxygen documentation build (these may not be available in the target system), please be aware of all the options that can be chosen using the –help command.
The prefix where all the packages will be installed is defined in this phase. All the libraries, include, .pc and other files will reference this as base folder.
cd /tmp/OpenAB_build
../OpenAB_src/autogen.sh --enable-eds-backend --enable-doc --prefix=/tmp/OpenAB_inst

Build and Install

All the Makefiles are generated using the previous command, it is time to build and install.

cd /tmp/OpenAB_build
make install

Tests and Examples

1) Copy the source examples in the OpenAB_examples folder

cd /tmp/OpenAB_examples
cp ../OpenAB_src/test/plugin/example/* .
*

2) Since the package has been installed in a non standard folder, the pkg-config tool is not able to find it unless specified in the PKG_CONFIG_PATH variable

export PKG_CONFIG_PATH=/tmp/OpenAB_inst/lib/pkgconfig

all the OpenAB libraries have their own .pc file defined. A full list of OpenAB libraries can be retrieved using:

pkg-config --list-all | grep OpenAB

3) Everything is on place to build any source code using the OpenAB tools

These files are explained in Detailed Example

To build the plugin object, use:

g++ plugin*.cpp `pkg-config OpenAB_plugin --libs --cflags` -shared -fPIC -o libPlugin.so

To build the executable, use:

g++ main.cpp genericInterface.cpp \
`pkg-config OpenAB_plugin --libs --cflags` \
-DEXAMPLE_SHARED \
-o sharedExample.out

Quality checks

Unit Tests

Running Unit Tests

To enable unit tests build provide –enable-tests option to configure script (enabled by default). Unit tests require GTest to be installed, in case where it won't be detected, unit tests will be simply disabled. To build and run unit tests just type make check after configuring project with unit tests support.

cd /tmp/OpenAB_build
../OpenAB_src/autogen.sh --enable-eds-backend --enable-doc --enable-tests --prefix=/tmp/OpenAB_inst
make check

Generating coverage report

To be able to generate coverage report provide –enable-coverage option to configure script (disabled by default). This feature requires LCov and Genhtml tools to be installed, simillar like in case of unit tests, if one of these tools won't ba available, coverage will be automatically disabled. To generate coverage report just type make generate-coverage, it will build unit tests, run them and generate HTML coverage report in tests/coveragereport folder. To clear coverage calculations use make clean-coverage.

cd /tmp/OpenAB_build
../OpenAB_src/autogen.sh --enable-eds-backend --enable-doc --enable-tests --enable-coverage --prefix=/tmp/OpenAB_inst
make generate-coverage
#coverage report will be generated in /tmp/OpenAB_build/tests/coveragereport

Cppcheck

If Cppcheck if installed additional make taget will be available - cppcheck - that will run static code analysis using Cppcheck

cd /tmp/OpenAB_build
make cppcheck

Plugins

  1. Plugin Interface (Overview and Examples)
  2. List of available plugins