build.sh 917 Bytes
Newer Older
James Clark's avatar
James Clark committed
1 2 3 4 5
#!/bin/bash
set -e

INSTALL_PREFIX=$1

6 7 8 9 10 11 12 13 14 15 16 17
# Get cmake
if hash cmake 2>/dev/null; then
  CMAKE=cmake

  # Check version >2
  CMAKE_VERSION=$(${CMAKE} --version | head -1 | awk '{print $3}')
  CMAKE_VERSION=( ${CMAKE_VERSION//./ } )
  CMAKE_MAJOR_VERSION=${CMAKE_VERSION[0]}

  if [ ${CMAKE_MAJOR_VERSION} -lt 3 ]; then
    echo "cmake executable is version ${CMAKE_VERSION}, checking for cmake3 executable..."
    if hash cmake3 2> /dev/null; then
18
      CMAKE=cmake3
19 20
    else 
      echo "cmake3 not found"
21
      exit 1
22 23 24 25 26 27 28 29 30
    fi
  fi
elif hash cmake3 2>/dev/null; then
  CMAKE=cmake3
else
  echo "No cmake detected.  BayesWave requires cmake version 3."
  exit 1
fi
${CMAKE} --version
31

James Clark's avatar
James Clark committed
32 33 34
rm -rf build
mkdir -p build
pushd build
35
${CMAKE} .. \
James Clark's avatar
James Clark committed
36 37 38
	-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_EXPORT_COMPILE_COMMANDS=true
39 40
${CMAKE} --build . -- VERBOSE=1
${CMAKE} --build . --target install
James Clark's avatar
James Clark committed
41
popd