Skip to content

Instantly share code, notes, and snippets.

@zbyerly
Created January 19, 2016 17:13

Revisions

  1. zbyerly created this gist Jan 19, 2016.
    57 changes: 57 additions & 0 deletions build_lgd_debug.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    #!/bin/bash

    SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
    BUILD_PATH=$HOME/build/lgd_build_debug
    INSTALL_PATH=$HOME/local_install_debug
    REPO_PATH=$HOME/libgeodecomp
    HPX_ROOT=$HOME/hpx_install_debug

    BOOST_PATH=/opt/boost/1.58.0-gcc-5.2-release

    NUM_BUILDCORES=16

    if [ "$1" = "clean" ]; then
    rm -rf $BUILD_PATH
    exit 0
    fi

    if [ ! -d "$BUILD_PATH" ]; then
    mkdir -p "$BUILD_PATH"
    cd "$BUILD_PATH"

    ############################################
    # MODIFY CMAKE FLAGS AS YOU WISH
    #

    echo "HPX_ROOT = ${HPX_ROOT}"
    echo "HPX_DIR = ${HPX_ROOT}/share/hpx/cmake"

    cmake \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \
    -DWITH_HPX=true \
    -DWITH_CUDA=false \
    -DCMAKE_CXX_COMPILER=/opt/gcc/5.2/bin/g++ \
    -DCMAKE_PREFIX_PATH=$HOME/local_install_debug/ \
    -DBOOST_ROOT=${BOOST_PATH} \
    -DHPX_BUILD_TYPE=Debug \
    $REPO_PATH

    #
    ############################################


    # cleanup on failure
    rc=$?
    if [[ $rc != 0 ]] ; then
    cd "$SCRIPTPATH"
    rm -rf "$BUILD_PATH"
    exit $rc
    fi

    fi

    # the actual build command
    cd "$BUILD_PATH"
    nice make "$@" -k -j$NUM_BUILDCORES || exit 1
    make install