Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/bash
BUILDTYPE=Release
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
BUILD_PATH=$HOME/raspberrypi/hpx_install_$BUILDTYPE
INSTALL_PATH=$HOME/raspberrypi/local_install_$BUILDTYPE
REPO_PATH=$HOME/raspberrypi/hpx
#module load gcc/6.3.0 cmake/3.2.2 hwloc/1.11.3 boost/1.63.0-gcc6.3.0 openmpi/1.10.5-gcc6.3.0
NUM_BUILDCORES=16
if [ "$1" = "clean" ]; then
rm -rf $BUILD_PATH
exit 0
fi
if [ ! -d "$BUILD_PATH" ]; then
echo "Creating build path..."
mkdir -p "$BUILD_PATH"
cd "$BUILD_PATH"
############################################
# MODIFY CMAKE FLAGS AS YOU WISH
#
cmake \
-DCMAKE_TOOLCHAIN_FILE=$HOME/raspberrypi/pi.cmake \
-DCMAKE_BUILD_TYPE=$BUILDTYPE \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PATH \
-DHPX_WITH_GENERIC_CONTEXT_COROUTINES=On \
-DHPX_WITH_THREAD_IDLE_RATES=On \
-DBOOST_ROOT=$HOME/raspberrypi/rootfs/lib/boost \
-DBOOST_INCLUDE_DIR=$HOME/raspberrypi/rootfs/lib/boost/include \
-DBOOST_LIBRARY_DIR=$HOME/raspberrypi/rootfs/lib/boost/lib \
-DBOOST_UNDERLYING_THREAD_LIBRARY=$HOME/raspberrypi/rootfs/lib/arm-linux-gnueabihf/libpthread-2.19.so \
-DBOOST_COMPILER=-gcc \
-DHWLOC_ROOT=$HOME/raspberrypi/rootfs/usr/local \
-DHWLOC_LIBRARY=$HOME/raspberrypi/rootfs/usr/local/lib/libhwloc.so \
-DHWLOC_INCLUDE_DIR=$HOME/raspberrypi/rootfs/usr/local/include \
-DHPX_WITH_MALLOC="jemalloc" \
-DJEMALLOC_LIBRARY=$HOME/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/libjemalloc.so.1 \
$REPO_PATH
#-DBOOST_ROOT=$HOME/raspberrypi/rootfs/lib/boost \
#
############################################
# 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
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_CROSSCOMPILING ON)
SET(CMAKE_C_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER $ENV{HOME}/raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++)
SET(CMAKE_FIND_ROOT_PATH $ENV{HOME}/raspberrypi/rootfs)
SET(HPX_WITH_GENERIC_CONTEXT_COROUTINES ON CACHE BOOL "enable generic coroutines")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment