mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 10:33:27 +08:00
34 lines
814 B
Bash
Executable File
34 lines
814 B
Bash
Executable File
#!/bin/bash
|
|
|
|
BUILD_TYPE=${1:-Release}
|
|
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} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
|
|
|
echo "TimescaleDB build system initialized in ${BUILD_DIR}. To compile, do:"
|
|
echo -e "\033[1mcd ${BUILD_DIR} && make\033[0m"
|