STP is built with [CMake](http://cmake.org/), version 2.8.8 or newer.

CMake is a meta build system that generates build files for other tools such as
make(1), Visual Studio, Xcode, etc. For a list of generators supported on your
platform, consult `cmake --help`.

Useful configuration variables
==============================
Here are a few interesting configuration variables. These apply to all
generators.

    BUILD_SHARED_LIBS : Build shared libraries rather than static
    CMAKE_BUILD_TYPE : The build type (e.g. Release)
    CMAKE_INSTALL_PREFIX : The prefix for install (e.g. /usr/local )
    ENABLE_TESTING : Enable running tests
    SANITIZE : Use Clang's sanitization checks
    TEST_QUERY_FILES: Test STP externally by passing it query files in tests/query-files
    TUNE_NATIVE : Tune compilation to native architecture

Makefile
========

Quick start
-----------
To build STP run

    mkdir build && cd build
    cmake -G 'Unix Makefiles' /path/to/stp/source/root
    make

If you'd prefer a more in-depth explanation of how to configure, build
and install STP read on...

Dependencies
------------
STP relies on a few dependencies, namely boost and flex/bison. Installing
the required header files and binaries can be achieved through the following.
(Tested on Ubuntu 13.04.)

    sudo apt-get install bison flex libboost-all-dev

Build directory
---------------
CMake supports building in and out of source. It is recommended that 
you build out of source. For example in a directory outside of the
STP root source directory run

    mkdir build

Configuration
-------------
The simplest thing you can do is use the default configuration by running

    cd build/
    cmake -G 'Unix Makefiles' /path/to/stp/source/root

You can easily tweak the build configuration in several ways

* Run `cmake-gui /path/to/stp/source/root` instead of `cmake`. This
  user interface lets you control the value of various configuration
  variables and lets you pick the build system generator.

* Run `ccmake` instead of `cmake`. This provides an ncurses terminal
  interface for changing configuration variables.

* Pass "-D<VARIABLE>=<VALUE>" options to `cmake` (not very user friendly).
  It is probably best if you **only** configure this way if you are writing
  scripts.

You can also tweak configuration later by running

    make edit_cache

Then edit any configuration variables, reconfigure and then regenerate the
build system.

Build, test and install
-----------------------
After configuration you can build by running

    make

Remember you can use the `-j<n>` flag to significantly to decrease build
time by running `<n>` jobs in parallel (e.g. `make -j4`).

To run tests (optinal) you will need to setup the OutputCheck submodule if you
have not done so.

    cd /path/to/stp/source/root
    git submodule init
    git submodule update
    cd build
    cmake -G 'Unix Makefiles' ENABLE_TESTING=ON ..
    make

You can then run the tests by running

    make check

You can find out more about testing in STP at https://github.com/stp/stp/wiki/Testing .

Installation (optional) can be done by running

    make install

and files can be uninstalled by running

    make uninstall

The root of installation is controlled by the CMAKE_INSTALL_PREFIX variable
at configure time. Remember you can easily change this at anytime by running

    make edit_cache

and editing the value of CMAKE_INSTALL_PREFIX.

Visual Studio
=============

TODO
