Building the Intel(R) Processor Trace (Intel PT) Decoder Library and Samples

This chapter gives step-by-step instructions for building the library and the sample tools using cmake. For detailed information on cmake, see http://www.cmake.org.

Configuration

Besides the standard cmake options of build type and install directory, you will find project-specific options for enabling optional features, optional components, or optional build variants.

Optional Components

By default, only the decoder library is built. Other components can be enabled by setting the respective cmake variable to ON.

The following optional components are availble:

PTUNIT             A simple unit test framework.
                   A collection of unit tests for libipt.

Optional Features

Features are enabled by setting the respective FEATURE_ cmake variable. This causes the FEATURE_ pre-processor macro to be defined and may also cause additional source files to be compiled and additional libraries to be linked.

The following features are supported:

FEATURE_THREADS     Support some amount of multi-threading.

                    This feature makes image functions thread-safe.

Build Variants

Some build variants depend on libraries or header files that may not be available on all supported platforms.

GCOV                Support for code coverage using libgcov.

                    This build variant requires libgcov and is not availble
                    on Windows.


DEVBUILD            Enable compiler warnings and turn them into errors.

Version Settings

The major and minor version numbers are set in the sources and must be changed there. You can set the build number and an arbitrary extension string. build.

PT_VERSION_BUILD    The build number.

                    Defaults to zero.


PT_VERSION_EXT      An arbitrary version extension string.

                    Defaults to the empty string.

Building on Linux* and OS X*

We recommend out-of-tree builds. Start by creating the destination directory and navigating into it:

$ mkdir -p /path/to/dest
$ cd /path/to/dest

From here, call cmake with the top-level source directory as argument. You may already pass some or all of the cmake variables as arguments to cmake. Without arguments, cmake uses default values.

$ cmake /path/to/src

To change the configuration use:

$ make edit_cache

After configuring the cmake cache, you can build either specific targets or everything using one of:

$ make <target>
$ make

Use the help make target to learn about available make targets:

$ make help

Building on Windows*

We recommend using the cmake GUI. After starting the cmake GUI, fill in the following fields:

Where is the source code:       Path to the top-level source directory.

Where to build the binaries:    Path to the destination directory.

We recommend out-of-tree builds, so the build directory should not be the same as or below the source directory. After this first configuration step, press the

Configure

button and select the builder you want to use.

Cmake will now populate the remainder of the window with configuration options. After completing the configuration, press the

Generate

button. If you selected a Visual Studio generator in the first step, cmake will now generate a Visual Studio solution. You can repeat this step if you want to change the configuration later on. Beware that you always need to press the Generate button after changing the configuration.

In the case of a Visual Studio generator, you may now open the generated Visual Studio solution and build the library and samples.