Skip to content

Installation (Build)

Jean-Francois Baffier edited this page Jun 15, 2017 · 6 revisions

A makefile, using CMake 3.1.0+, is available in the repository as /CMakeLists.txt. It can be used directly to build Compressed Stacks programs as standalone or used as a base or an inspiration to construct wider projects.

The easiest way to use this library is to install CMake and Git. The explanations below suppose that both tools are installed.

Standalone

This library can be used as a standalone program. Two examples, UpperHull and TestRun, of problems are given in the /examples folder. The provided makefile builds a set of executables for both problems. If some executables are not required or wanted, it is sufficient to comment the related add_executable lines.

# Upper Hulls : 8, 16, 32 or 64 bits and the version with extras
file(GLOB SOURCES "examples/upperhull/upperHull8.cpp")
add_executable(upperhull8 ${SOURCES})
file(GLOB SOURCES "examples/upperhull/upperHull16.cpp")
add_executable(upperhull16 ${SOURCES})
file(GLOB SOURCES "examples/upperhull/upperHull32.cpp")
add_executable(upperhull32 ${SOURCES})
file(GLOB SOURCES "examples/upperhull/upperHull64.cpp")
add_executable(upperhull64 ${SOURCES})
file(GLOB SOURCES "examples/upperhull/upperHullExtras.cpp")
add_executable(upperhullextras ${SOURCES})
file(GLOB SOURCES "examples/upperhull/generateInputUpperHull.cpp")
add_executable(generateInputUpperHull ${SOURCES})

# Test Run : 8, 16, 32 or 64 bits and the version with extras
file(GLOB SOURCES "examples/testrun/testrun8.cpp")
add_executable(testrun8 ${SOURCES})
file(GLOB SOURCES "examples/testrun/testrun16.cpp")
add_executable(testrun16 ${SOURCES})
file(GLOB SOURCES "examples/testrun/testrun32.cpp")
add_executable(testrun32 ${SOURCES})
file(GLOB SOURCES "examples/testrun/testrun64.cpp")
add_executable(testrun64 ${SOURCES})
file(GLOB SOURCES "examples/testrun/testrunExtras.cpp")
add_executable(testrunextras ${SOURCES})
file(GLOB SOURCES "examples/testrun/generateInputTestRun.cpp")
add_executable(generateInputTestRun ${SOURCES})

External header-only library

The whole CompressedStack.cpp library is conceived as a header-only library (neither static nor dynamic). The source code needs to be incorporated into the project building path and build along the rest of the user code. The two problems, UpperHull and TestRun, are provided as examples on how to do it.

Please note that the content of the /extras folder should not be linked unless some specific functionality is required, as it adds some memory overhead.

Platform guide

Linux & Mac OS (and probably any UNIX)

  • Clone the git repository
git clone https://github.com/Azzaare/CompressedStacks.cpp.git
  • Optional: creating aliases. Each alias provided corresponds to a meaningful use for users and developers. Their use makes easier frequent calls to cmake.

Description of the different builds

#+---------------+--------------+--------------+----------|
#|               | optimization | assert works | stripped |
#+---------------+--------------+--------------+----------|
#|     Debug     |     no       |     yes      |    no    |
#|    Release    |    full      |      no      |   yes    |
#| RelWithDebInfo|    good      |      no      |    no    |
#|   MinSizeRel  |    size      |      no      |   yes    |
#+---------------+--------------+--------------+----------|
alias cmakedebug='cmake $1 -DCMAKE_BUILD_TYPE=DEBUG'
alias cmakerelease='cmake $1 -DCMAKE_BUILD_TYPE=RELEASE'
alias cmakerelwithdebinfo='cmake $1 -DCMAKE_BUILD_TYPE=RELWITHDEBINFO'
alias cmakeminsizerel='cmake $1 -DCMAKE_BUILD_TYPE=MINSIZEREL'
  • Make a build directory
mkdir build_directory
cd build_directory
  • Generate makefile with CMake
cmakerelease ..

or

cmake .. -DCMAKE_BUILD_TYPE=RELEASE
  • Build the executable
make

Windows (Visual Studio)

To generate a Visual Studio project (use cmake or cmake.exe or path_to_cmake/cmake.exe depending on your configuration), please follow the example below. More instructions for other variants of Visual Studio are available in /CMakeLists.txt.

mkdir build_directory
cd build_directory

followed by

cmake .. -G "Visual Studio 10 Win64"

or

cmake.exe .. -G "Visual Studio 14 2015"

Solutions (.sln file) will be built for each configuration.