1 1 #!/bin/bash
2 2 echo "compiling $1"
3 3 if [[ $1 == *.c ]]
4 4 then
5 5 gcc -ggdb `pkg-config --cflags opencv` -o `basename $1 .c` $1 `pkg-config --libs opencv`;
6 6 elif [[ $1 == *.cpp ]]
7 7 then
8 8 g++ -ggdb `pkg-config --cflags opencv` -o `basename $1 .cpp` $1 `pkg-config --libs opencv`;
9 9 else
10 10 echo "Please compile only .c or .cpp files"
11 11 fi
12 12 echo "Output file => ${1%.*}"
13
1 1 $ alias opencv="~/.compile_opencv.sh"
2 2 $ opencv opencvtest.c
3 3 $ ./opencvtest
4