'2009/07/03'에 해당되는 글 1건

  1. Creating an universal static OpenCV library with iPhone support 2009/07/03
출처: http://ildan.blogspot.com/2008/07/creating-universal-static-opencv.html

We will create a minimal static universal OpenCV library with 3 architectures: Intel, PowerPC and Arm for the iPhone. I've been testing it on Leopard but it should work on any Mac OS X version.

First checkout or untar the OpenCV sources in the opencv directory. Then, on the same level (not inside) create a build directory with 3 subdirectories: ppc, i686 and armv6. (Download the code from Sourceforge)

Then set the global configure settings:
$ export CONFFLAGS="--without-imageio --without-python --without-swig --disable-apps --disable-dependency-tracking --without-carbon --without-quicktime --enable-shared=no --without-gtk"
in the ppc dir:
$ ../../opencv/configure ${CONFFLAGS} --host=ppc-apple-darwin9
$ make CXXFLAGS="-arch ppc"
in the i686 dir:
$ ../../opencv/configure ${CONFFLAGS} --host=i686-apple-darwin9
$
make CXXFLAGS="-arch i686"
in the arm dir:
$ ../../opencv/configure ${CONFFLAGS} --host=arm-apple-darwin9 CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.0.1 CXXFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk" CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
$ make
the last one is tough, so let's see the variables one by one:
CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin9-g++-4.0.1
CXXFLAGS="-arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk"
CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp
Ok. Now for the universal static libs:
$ lipo -create i686/cv/src/.libs/libcv.a ppc/cv/src/.libs/libcv.a armv6/cv/src/.libs/libcv.a -output libcv.a
$ lipo -create i686/cxcore/src/.libs/libcxcore.a ppc/cxcore/src/.libs/libcxcore.a armv6/cxcore/src/.libs/libcxcore.a -output libcxcore.a
$ lipo -create i686/cvaux/src/.libs/libcvaux.a ppc/cvaux/src/.libs/libcvaux.a armv6/cvaux/src/.libs/libcvaux.a -output libcvaux.a
$ lipo -create i686/ml/src/.libs/libml.a ppc/ml/src/.libs/libml.a armv6/ml/src/.libs/libml.a -output libml.a
$ lipo -create i686/otherlibs/highgui/.libs/libhighgui.a ppc/otherlibs/highgui/.libs/libhighgui.a armv6/otherlibs/highgui/.libs/libhighgui.a -output libhighgui.a

That's all. Oh, try
$ make -j 2
2009/07/03 15:29 2009/07/03 15:29

댓글을 달아 주세요