2014-03-02 21:20:49 +01:00
|
|
|
#!/bin/sh
|
2014-06-13 02:41:03 +02:00
|
|
|
ROOT=$(pwd)
|
|
|
|
while [ ! -d $ROOT/.git ]; do
|
|
|
|
ROOT=$(dirname $ROOT)
|
|
|
|
if [ "$ROOT" == "/" ; then
|
|
|
|
echo "could not find root, are you in the git repository?"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2014-06-29 01:54:10 +02:00
|
|
|
[ -z $BUILD ] && BUILD=Debug
|
2014-06-13 02:41:03 +02:00
|
|
|
MACHINE=`uname -m`
|
|
|
|
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
|
|
|
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
|
|
|
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
2014-06-29 01:54:10 +02:00
|
|
|
BIN_DIR="build-$MACHINE-$CC-$BUILD"
|
|
|
|
mkdir -p $BIN_DIR
|
2014-06-13 02:41:03 +02:00
|
|
|
cd $BIN_DIR
|
|
|
|
|
2014-03-02 21:20:49 +01:00
|
|
|
if [ ! -e ../CMakeLists.txt ]; then
|
|
|
|
echo "are you sure you are in the build directory?"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
MACHINE=$(gcc -dumpmachine)
|
|
|
|
rm -f CMakeCache.txt
|
|
|
|
|
|
|
|
# use anything installed in /opt or /usr
|
|
|
|
LIBRARY_PATH=/opt/lib:/opt/lib/$MACHINE:/usr/lib/$MACHINE
|
|
|
|
INCLUDE_PATH=/opt/include:/usr/include
|
|
|
|
PREFIX_PATH=/opt
|
|
|
|
|
|
|
|
# I like to put stuff in ~/usr if I don't have permission to install packages on the machine:
|
|
|
|
if [ -d $HOME/usr ]; then
|
|
|
|
LIBRARY_PATH=$HOME/usr/lib:$HOME/usr/lib/$MACHINE:$LIBRARY_PATH
|
|
|
|
INCLUDE_PATH=$HOME/usr/include:$HOME/usr/include/$MACHINE:$INCLUDE_PATH
|
|
|
|
PREFIX_PATH=$HOME/usr:$HOME/usr/local:$PREFIX_PATH
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_MODULE_PATH=$PWD/../cmake/Modules \
|
2014-06-29 01:54:10 +02:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD \
|
2014-03-02 21:20:49 +01:00
|
|
|
-DCMAKE_LIBRARY_PATH=$LIBRARY_PATH \
|
|
|
|
-DCMAKE_INCLUDE_PATH=$INCLUDE_PATH \
|
|
|
|
-DCMAKE_PREFIX_PATH=$PREFIX_PATH \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=$HOME/eressea $*
|
2014-06-13 02:41:03 +02:00
|
|
|
cd -
|