Open pizthewiz opened 10 years ago
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 ..
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?
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.
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 ..
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.
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:
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
andi386
(for the simulator). Any ideas?MSW
Not being particularly Windows-savvy, could someone contribute a build recipe and binaries for
x64
andx86
?