timescaledb/bootstrap
Rob Kiefer e8eabf4278 Add support for passing flags to cmake
Changing things like the location of pg_config and other macros,
additional cmake flags, etc require modifying bootstrap file. This
PR instead passes any flags given to bootstrap onto cmake itself.
2018-01-03 11:15:56 -05:00

37 lines
919 B
Bash
Executable File

#!/bin/bash
# This bootstrap scripts set up the build environment for TimescaleDB
# Any flags will be passed on to CMake, e.g.,
# ./bootstrap -DCMAKE_BUILD_TYPE="Debug"
BUILD_DIR=${BUILD_DIR:-./build}
BUILD_FORCE_REMOVE=${BUILD_FORCE_REMOVE:-false}
SRC_DIR=$(dirname $0)
if [[ ! ${SRC_DIR} == /* ]]; then
SRC_DIR=$(pwd)/${SRC_DIR}
fi
if [ ${BUILD_FORCE_REMOVE} == "true" ]; then
rm -fr ${BUILD_DIR}
elif [ -d ${BUILD_DIR} ]; then
echo "Build system already initialized in ${BUILD_DIR}"
read -n 1 -p "Do you want to remove it (this is IMMEDIATE and PERMANENT), y/n? " choice
echo ""
if [ $choice == "y" ]; then
rm -fr ${BUILD_DIR}
else
exit
fi
fi
set -e
set -u
mkdir -p ${BUILD_DIR} && \
cd ${BUILD_DIR} && \
cmake ${SRC_DIR} "$@"
echo "TimescaleDB build system initialized in ${BUILD_DIR}. To compile, do:"
echo -e "\033[1mcd ${BUILD_DIR} && make\033[0m"