Skip to content

Instantly share code, notes, and snippets.

@unot
Created March 5, 2013 05:24
Show Gist options
  • Save unot/5088229 to your computer and use it in GitHub Desktop.
Save unot/5088229 to your computer and use it in GitHub Desktop.
OpenCV の samples/c にある build_all.sh を MinGW で使えるようにしてみました。Windows で pkg-config をセットアップするのが面倒くさかっただけですが。OCVDIRは環境に合わせて変更して下さい。
#!/bin/sh
OCVDIR="/c/opencv"
CFLAGS="-I${OCVDIR}/build/include"
LIBS="-L${OCVDIR}/build/x86/mingw/lib"
for a in ${OCVDIR}/build/x86/mingw/lib/*.dll.a ; do
LIBS="${LIBS} -l`basename ${a} .dll.a | sed -e 's/libopencv/opencv/g'`"
done
if [ $# -gt 0 ] ; then
base=`basename $1 .c`
echo "compiling $base"
gcc -ggdb ${CFLAGS} ${LIBS} $base.c -o $base
else
for i in *.c; do
echo "compiling $i"
gcc -ggdb ${CFLAGS} -o `basename $i .c` $i ${LIBS};
done
for i in *.cpp; do
echo "compiling $i"
g++ -ggdb ${CFLAGS} -o `basename $i .cpp` $i ${LIBS};
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment