From 65d7bd443316618e8c760964db17db604003537f Mon Sep 17 00:00:00 2001 From: Zeh Rizzatti Date: Wed, 6 Feb 2013 13:16:49 -0300 Subject: [PATCH] Add install.sh for easily building --- install.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..4f61b9b4 --- /dev/null +++ b/install.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +set -e + +function cmake_install { + if [[ `uname -s` == "Darwin" ]]; then + homebrew_cmake_install + else + linux_cmake_install + fi +} + +function homebrew_cmake_install { + if [[ `which brew &> /dev/null` ]]; then + brew install cmake + else + echo "Go get homebrew, lazy! And retry." + exit 1 + fi +} + +function install { + ycm_dir=`pwd` + build_dir=`mktemp -d -t ycm_build` + pushd $build_dir + cmake $ycm_dir/cpp + make + popd +} + +function linux_cmake_install { + echo "Please install 'cmake' using your package manager and retry." + exit 1 +} + +if [[ ! -z `which cmake &> /dev/null` ]]; then + cmake_install +fi +install