Skip to content

Building

AlphaOne1 edited this page Nov 8, 2016 · 2 revisions

This page shows how to build the sortbench from sources using CMake

Introduction

The sortbench uses CMake as its build system. CMake is available for a wide variety of platforms.It will generate the files for the respecitive platform to "really" build the software. Currently it is tested for Linux (Gentoo, Raspian) and Windows (Visual Studio 2012). CMake is a meta build system.

Details

Linux / MacOS X

Setup Build Environment

For Linux you need cmake, make and a working compiler. After this is complete, the build can be done with these easy steps:

  1. $ tar -xjf sortbench-1.2.0_src.tar.bz2
  2. $ cd sortbench/
  3. $ mkdir build
  4. $ cd build/
  5. $ cmake ../
  6. $ make

Compile Options

To setup the compile flags, one can type make edit_cache. A console configuration dialog opens and lets one change many options. You navigate using the arrow keys and press on the option you want to change. After having changed it, you press again to set it. When everything is configured pressing will configure the projects internal variables and a following will write everything in the build environment to use.

A particularly useful one is to set CMAKE_BUILD_TYPE=Release. Another useful setting is to set

  • CMAKE_CXX_FLAGS=-march=native The latter will optimize for the CPU detected at compile time.

For new algorithms it is strongly encouraged to set also the following flags:

  • -Wall
  • -Wextra
  • -pedantic
  • -Wfloat-equal
  • -Werror=uninitialized

Windows

Setup Visual Studio Project

For Windows currently only Visual Studio 2012 is tested, but the following steps should also apply to older versions. It should also work in cygwin, but this is so far untested. You need, of course, CMake and Visual Studio.

  1. unpack the archive with an unpacker of your choice, WinRAR will do
  2. start CMake GUI
  3. for the project directory you choose the extracted directory
  4. as the build directory you can choose an arbitrary one
  5. as the target build system you choose Visual Studio 11
  6. click on configure
  7. click on generate
  8. CMake will generate a solution for Visual Studio that can be opened. It contains a project for every target.
  9. Build the "ALL" target.

Compile Options

Venturing through the options of Visual Studio it is encouraged to test out how they behave. What may provide useful is to set to use SSE/AVX instructions newer processors support. If you are familiar with the compiler options of cl you also can set them using the graphical cmake interface mentioned already for generating the Visual Studio project files.

Clone this wiki locally