Building the varikn toolkit requires the CMake tool.  CMake is a
makefile generator (like Autoconf). The build script is in
CMakeLists.txt.

The convention for CMake is to build "out-of-source", where all the
work is done in a separate directory from your source directory.
First, we configure the build (we only need to do this once):

  mkdir build
  cd build
  cmake .. -DCMAKE_BUILD_TYPE=Release
  cmake --build .

Useful tricks:
* By default, the makefiles generated by cmake are 'quiet'. To make
  them verbose (so you can see what's being passed to gcc, etc) use
  the VERBOSE variable like this: make VERBOSE=1

* You can make a debug build with

  cmake .. -DCMAKE_BUILD_TYPE=Debug

* If you're experimenting with alternate build flags, you can define
  them as environment variables before configuring.  For example:

  cd build
  export CXXFLAGS=-fmudflap
  cmake ..
  make

* If you are reconfiguring cmake with very different settings (for
  example, switching from Debug to Release), you should start in a
  new build folder or delete everything in your current build folder.

* CMake also supports generating IDE project files (MSVC, XCode,
  etc). To get a list of what it supports, do "cmake -h".  For
  example, to create an MSVC project:

  mkdir .build
  cd .build
  cmake .. -G "Visual Studio 9 2008"
  start Project.sln

  or to create an XCode project:

  mkdir .build
  cd .build
  cmake .. -G Xcode
  open Project.xcodeproj

* Note on Eclipse CDT.  Eclipse is finicky about the way its
  projects are laid out.  Instead of creating a "build" folder as
  a child of your source dir you'll need to create it as a *sibling*.
  You'll also need to tell cmake to link the build dir to the source
  dir in the Eclipse project. (See http://tinyurl.com/28zuhqb for
  more information.)  For example:

  cd trunk
  mkdir ../.build-trunk
  cd ../.build-trunk
  cmake ../trunk/ -G "Eclipse CDT4 - Unix Makefiles" -DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE

  Then in Eclipse you'll do File->Import the project in .trunk-build.
  Inside this project you'll see a link to "[Source Directory]".

* Language wrappers DLLs can be built for Python using Swig.
  These are built automatically if the languages are detected by
  cmake. You can explicitly enable or disable building for these
  wrappers by passing -DENABLE_PYTHON_WRAPPER=1 or 0. On Mac OS X, you can
  force the python version to macports with -DMACPORTS_PYTHON_VERSION=2.6 .
  The default target is python3, see python_wrappers/Cmakelists.txt
  if you want to compile for python2.

PYTHON INSTALL:

The Python wrapper package (varikn) can be installed directly using pip:

  pip install .

Note that this installs only the Python wrapper, not the executables
of the toolkit.

TEST:

Building Unit tests can be enabled with "-DENABLE_TESTING=1". The tests
do not work on Windows yet. Unit tests can be run with "make test" or
"ctest --verbose". Unit tests require the unit test library from Boost.

RUNNING IN DOCKER:

# Set up docker env (only needed if you use command line docker-machine)
docker-machine start
eval $(docker-machine env default)

# Create container
docker build -t varikn_test_container .
# Log in container
docker container run --interactive --tty  varikn_test_container
# Inside container
mkdir build; (cd build; cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=1 && make && ctest --verbose)

# clean up
docker image rm varikn_test_container
docker machine stop


NOTES FOR MAC DOCKER SETUP

# Instal needed Homebrew packages
brew install docker docker-machine
brew cask install virtualbox
# Create VM
docker-machine create default
