155 lines
4.2 KiB
Bash
155 lines
4.2 KiB
Bash
#!/bin/sh sudo
|
|
#Pour compiler pensé a installer : qt4, opencv-dev, ... mingw pour la cross-compilation
|
|
#sous ubuntu : apt-get installe qt4-lib qt4-dev opencv-core opencv-dev mingw64
|
|
#sous freebsd faire : pkg install opencv-2.* opencv-core qt4-*
|
|
#sous windows : voir intall de qt+mingw et télécharger opencv précompiler et ...
|
|
|
|
#seul la plateforme et le compilateur faire:
|
|
# qmake -r -spec plateforme-compilateur *.pro
|
|
# make
|
|
|
|
#exemple: plateforme-compilateur freebsd-clang
|
|
# * = le nom du ficher .pro à généré
|
|
|
|
|
|
|
|
|
|
|
|
#full_path
|
|
cpath=`pwd`
|
|
CXX= c++
|
|
#=======================================================================
|
|
set_mac_arch() {
|
|
# First check to see if maci64 is even possible on this hardware
|
|
if [ "`/usr/sbin/sysctl -n hw.cpu64bit_capable`" = "0" ]; then
|
|
# maci64 is not possible. So set the arch to maci.
|
|
ARCH="maci"
|
|
CXX = "clang++"
|
|
return
|
|
fi
|
|
|
|
# Now check to see if maci64 is asked for
|
|
if [ "$MACI64" = "0" ]; then
|
|
# only maci is wanted, so arch is maci.
|
|
ARCH="maci"
|
|
CXX= "clang++"
|
|
return
|
|
fi
|
|
}
|
|
|
|
#
|
|
#=======================================================================
|
|
set_arch(){
|
|
if [ -f /bin/uname ]; then
|
|
case "`/bin/uname`" in
|
|
Freebsd) # Solaris
|
|
case "`/bin/uname -p`" in
|
|
amd64)
|
|
ARCH="freebsd"
|
|
CXX="c++"
|
|
;;
|
|
i386)
|
|
ARCH="freebsd"
|
|
CXX= "c++"
|
|
;;
|
|
esac
|
|
;;
|
|
Linux)
|
|
case "`/bin/uname -m`" in
|
|
i*86)
|
|
ARCH="linux"
|
|
CXX="g++"
|
|
;;
|
|
x86_64)
|
|
ARCH="linux"
|
|
CXX= "g++"
|
|
;;
|
|
esac
|
|
;;
|
|
# Usually uname lives in /usr/bin on the Mac, but sometimes people
|
|
# have links in /bin that link uname to /usr/bin. Because of this
|
|
# Mac needs to be listed in the checks for both /bin/uname and /usr/bin/uname
|
|
Darwin) # Mac OS X
|
|
case "`/bin/uname -p`" in
|
|
i386)
|
|
set_mac_arch
|
|
;;
|
|
esac
|
|
;;
|
|
*)
|
|
:
|
|
;;
|
|
esac
|
|
elif [ -f /usr/bin/uname ]; then
|
|
case "`/usr/bin/uname`" in
|
|
Darwin) # Mac OS X
|
|
case "`/usr/bin/uname -p`" in
|
|
i386)
|
|
set_mac_arch
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
fi
|
|
return 0;
|
|
}
|
|
#
|
|
#=======================================================================
|
|
packet_install(){
|
|
if[ "$ARCH" == "Ubuntu"]
|
|
apt-get installe qt4-lib qt4-dev opencv-core opencv-dev mingw64
|
|
;;
|
|
elif[ "$ARCH" == "Freebsd"]
|
|
pkg install opencv-2.* opencv-core qt4-*
|
|
;;
|
|
elif[ "$ARCH" == "maci"]
|
|
install opencv opencv-core qt4
|
|
fi
|
|
return 0;
|
|
}
|
|
tp_install(){
|
|
thisDir = "`pwd`"
|
|
list = "tp1_rendu_IM6 tp2_rendu_IM6 tp3_rendu_IM6 tp4_rendu_IM6"
|
|
for i in list;
|
|
do
|
|
qmake -spec $ARCH-$CXX ./$i/*.pro && make && make clean
|
|
done
|
|
|
|
}
|
|
help(){
|
|
echo ""
|
|
echo "usage : sh $0 <x> <y>"
|
|
echo " x : 0 - automatique;"
|
|
echo " 1 - compilation direct"
|
|
echo " 2 - exécution de binaire"
|
|
echo " y: si x=2, numéros du tp a exécuter"
|
|
}
|
|
check(){
|
|
stat = "Ok"
|
|
if[["$1" ==""]]
|
|
stat = ""
|
|
return
|
|
fi
|
|
if[["$1" == "0" | "$1" =="1"] & ["$2" != ""]]
|
|
stat=""
|
|
return
|
|
fi
|
|
if[["$2" =="1" | "$2" =="2"| "$2" =="3"| "$2" =="4"]]
|
|
stat = ""
|
|
return
|
|
fi
|
|
}
|
|
run(){
|
|
check()
|
|
if [$stat ==""]
|
|
help()
|
|
exit 1
|
|
fi
|
|
if ["$1" == "0"]
|
|
packet_install()
|
|
tp_install()
|
|
|
|
|
|
|
|
fi
|
|
} |