Commit 3ddc54a6 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed handling of --build parameter in the install script

parent 058aa8a9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -108,7 +108,12 @@ else
   export CC=gcc
fi

if hash ninja 2>/dev/null; then
if [[ ! $(command -v cmake) ]]; then
   echo "Error: cmake is not installed. See http://www.cmake.org/download/" >&2
   exit 1
fi

if [[ $(command -v ninja) ]]; then
   generator=Ninja
   make=ninja
   check_file="build.ninja"
+37 −45
Original line number Diff line number Diff line
#!/bin/bash

set -e

BUILD_DEBUG="yes"
BUILD_RELEASE="yes"

OPTIONS=""

CMAKE_TEST=`which cmake`    
if test x${CMAKE_TEST} = "x";
then
    echo "Cmake is not installed on your system. Please install it by:"
    echo ""
    echo "   sudo apt-get install cmake     on Ubuntu and Debian based systems"
    echo "   sudo yum install cmake         on RedHat, Fedora or CentOS"
    echo "   sudo zypper install cmake      on OpenSuse"
    echo ""
    echo "You may also install it from the source code at:"
    echo " http://www.cmake.org/download/"
    exit 1
fi

for option in "$@"
do
for option in "$@"; do
   case $option in
        --no-debug                    ) BUILD_DEBUG="no" ;;
        --no-release                  ) BUILD_RELEASE="no" ;;        
        *                             ) OPTIONS="${OPTIONS} ${option}" ;;
      --no-debug)
         BUILD_DEBUG="no"
         ;;
      --no-release)
         BUILD_RELEASE="no"
         ;;
      --build=*                     )
         BUILD="${option#*=}"
         if [[ "$BUILD" != "Release" ]]; then
            BUILD_RELEASE="no"
         fi
         if [[ "$BUILD" != "Debug" ]]; then
            BUILD_DEBUG="no"
         fi
         ;;
      *)
         OPTIONS="${OPTIONS} ${option}"
         ;;
   esac
done

if test ${BUILD_DEBUG} = "yes";
then
    if [ ! -d Debug ];
    then
if [[ ${BUILD_DEBUG} == "yes" ]]; then
   if [[ ! -d Debug ]]; then
      mkdir Debug
   fi
    cd Debug
    if ! ../build --root-dir=.. --build=Debug --install=yes ${OPTIONS}
    then
       exit 1
    fi
    cd ..
   pushd Debug
   ../build --root-dir=.. --build=Debug --install=yes ${OPTIONS}
   popd
fi

if test ${BUILD_RELEASE} = "yes";
then
    if [ ! -d Release ];
    then
if [[ ${BUILD_RELEASE} == "yes" ]]; then
   if [[ ! -d Release ]]; then
      mkdir Release
   fi
    cd Release
    if ! ../build --root-dir=.. --build=Release --install=yes ${OPTIONS};
    then
        exit 1
    fi
    cd ..
   pushd Release
   ../build --root-dir=.. --build=Release --install=yes ${OPTIONS};
   popd
fi