Skip to content

Installation (Build)

Jean-Francois Baffier edited this page Mar 28, 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, ConvexHull and TestRun, of problems are given in the /examples folder. The makefile provided 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.

# Convex Hulls : 8, 16, 32 or 64 bits and the version with extras
file(GLOB SOURCES "examples/convexhull/convexHull8.cpp")
add_executable(convexhull8 ${SOURCES})
file(GLOB SOURCES "examples/convexhull/convexHull16.cpp")
add_executable(convexhull16 ${SOURCES})
file(GLOB SOURCES "examples/convexhull/convexHull32.cpp")
add_executable(convexhull32 ${SOURCES})
file(GLOB SOURCES "examples/convexhull/convexHull64.cpp")
add_executable(convexhull64 ${SOURCES})
file(GLOB SOURCES "examples/convexhull/convexHullExtras.cpp")
add_executable(convexhullextras ${SOURCES})
file(GLOB SOURCES "examples/convexhull/generateInputConvexHull.cpp")
add_executable(generateInputConvexHull ${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 of ConvexHull 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

  • 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 developpers. Their use makes easiers frequent call 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

Mac OS

The behavior should be similar to the one above in the Linux section. If differences are noted or issued, this section will be updated accordingly.

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.

Clone this wiki locally