Cinder-OpenCV icon indicating copy to clipboard operation
Cinder-OpenCV copied to clipboard

Upgrade OpenCV binaries

Open pizthewiz opened this issue 11 years ago • 6 comments

In an effort to update OpenCV binaries, I thought we could document the recipe used to build OpenCV per platform and offload later updates to others via pull requests (the actual Cinder shim seems pretty thin and unlikely to require much modification version-to-version).

OS X

After installing CMake via Homebrew, I built for OS X via:

% cd opencv-2.4.8
% mkdir build && cd build
% cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/tmp/purgatorio -DCMAKE_OSX_DEPLOYMENT_TARGET= -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DBUILD_SHARED_LIBS=OFF -DWITH_CUDA=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF
% make -j8
% make install

The includes, OS X binaries and samples are updated in my fork's opencv-2.4.8 branch. In a quick run of each sample, they all seem to run as expected.

iOS

It isn't entirely clear which settings need to be tweaked to compile targeting the iOS SDKs for arm7, arm7s, arm64 and i386 (for the simulator). Any ideas?

MSW

Not being particularly Windows-savvy, could someone contribute a build recipe and binaries for x64 and x86?

pizthewiz avatar Jan 11 '14 03:01 pizthewiz

Thanks for this initiative. I also rebuilt OpenCV on OSX for the Cinder dev branch, and I had to add other options to make it work. Especially the -stdlib=libc++ switch is important:

cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_ocl=OFF -DBUILD_opencv_superres=OFF -D"CMAKE_OSX_ARCHITECTURES=i386;x86_64" -DENABLE_FAST_MATH=ON -DCMAKE_CXX_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++" -DWITH_1394=OFF -DWITH_CARBON=OFF -DWITH_FFMPEG=OFF -DWITH_IMAGEIO=OFF -DWITH_IPP=OFF -DWITH_OPENNI=OFF -DWITH_QT=OFF -DWITH_QUICKTIME=OFF -DWITH_V4L=OFF -DWITH_PVAPI=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo ..

gaborpapp avatar Jan 14 '14 15:01 gaborpapp

Hey Gabor, thanks for the suggestions, I'll be sure to rebuild my fork's binaries with at least libc++.

Could I ask why you disabled the OpenCL and Super Res modules? Did you disable native and third-party video/image handling (1394, carbon, ffmpeg, imageio, ipp, openni, qt, quicktime, v4l) for consistency with Cinder's specific needs?

pizthewiz avatar Jan 14 '14 20:01 pizthewiz

I think they didn't build and/or they were not part of the original Cinder OpenCV libs, so I disabled them, to make it build faster.

gaborpapp avatar Jan 14 '14 20:01 gaborpapp

Great, I ended up with the following to use libc++ as suggested but also built the OpenCL and Super Res modules, as they might be useful moving forward:

$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/tmp/purgatorio -DCMAKE_OSX_DEPLOYMENT_TARGET= -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DENABLE_FAST_MATH=ON -DCMAKE_CXX_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++" -DBUILD_SHARED_LIBS=OFF -DWITH_CUDA=OFF -DWITH_FFMPEG=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF ..

pizthewiz avatar Jan 27 '14 07:01 pizthewiz

on Windows, I've found you need need to disable BUILD_SHARED_LIBS and BUILD_WITH_STATIC_CRT, then manually set the Runtime Library in Visual Studio to MT for release and MTd for debug. The Runtime Library needs to be set for all projects within the solution.

I wonder if there's any way to set the Runtime Library through CMake? I couldn't find one.

heisters avatar Apr 21 '14 18:04 heisters

  • OS X v2.4.9 binaries and recipe in PR#8
  • Windows/VC12 v2.4.9 binaries and recipe in PR#7 (though it isn't loading for me)

pizthewiz avatar May 22 '14 23:05 pizthewiz