From 34acddc25975d54c5686d27964a0b1024753ec2c Mon Sep 17 00:00:00 2001 From: edgarriba Date: Mon, 16 Nov 2015 13:47:29 +0000 Subject: [PATCH] add configuration script Former-commit-id: 42bfe278f089f25b9d2e18efcbeda9db6d72f89b --- configure.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 configure.sh diff --git a/configure.sh b/configure.sh new file mode 100644 index 00000000..40ac2a14 --- /dev/null +++ b/configure.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +# Check OS +if [ ! $(command -v apt-get) ]; then + echo -e "\e[1;31mERROR: Not a Debian-based linux system. + Impossible to install OpenCV with this script\e[0;39m" + exit 1 +fi + +## Before installing +echo -e "\e[1;34mUpdating the system\e[0;39m" +sudo apt-get update +END_CMD1=$? +sudo apt-get upgrade -y +END_CMD2=$? +if [ $END_CMD1 -ne 0 -o $END_CMD2 -ne 0 ] +then + echo -e "\e[1;31mERROR: \e[39mWhen Updating the system\e[0m" + exit 1 +fi + +## Install Required Requisites +echo -e "\e[1;34mInstalling Required Requisites\e[0;39m" +sudo apt-get install build-essential \ + cmake \ + git \ + python-pip \ + pkg-config \ + libavcodec-dev \ + libavformat-dev \ + libswscale-dev -y +if [ $? -ne 0 ] +then + echo -e "\e[1;31mERROR: \e[39mWhen Installing Required Requisites\e[0m" + exit 1 +fi + +## Installing Optional Requisites +echo -e "\e[1;34mInstalling Optional Requisites\e[0;39m" +sudo apt-get install python-dev \ + python-numpy \ + libtbb2 \ + libtbb-dev \ + libjpeg-dev \ + libpng-dev \ + libtiff-dev \ + libjasper-dev \ + libdc1394-22-dev \ + libboost-all-dev \ + libboost-python-dev \ + libxext-dev \ + liblapack-dev \ + libeigen3-dev \ + libgtk2.0-dev \ + libvtk5-dev \ + libgoogle-glog-dev \ + libsuitesparse-dev -y +if [ $? -ne 0 ] +then + echo -e "\e[1;33mWARNING: \e[39mError when Installing Optional Requisites\e[0m" +fi + +## Get sys vars +NUM_CORES=`grep -c processor /proc/cpuinfo` + +## Compile SuperBuild +cd SuperBuild +mkdir -p build && cd build +cmake .. && make -j ${NUM_CORES}