Last active
December 31, 2015 17:38
-
-
Save mkassner/8021192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Opencv < Formula | |
homepage 'http://opencv.org/' | |
url 'https://github.com/mkassner/opencv/archive/2.4.8.2.tar.gz' | |
sha1 '5a23ad0c587d6a7fe00d79dfdea0199d7c584923' | |
option '32-bit' | |
option 'with-qt', 'Build the Qt4 backend to HighGUI' | |
option 'with-tbb', 'Enable parallel code in OpenCV using Intel TBB' | |
option 'without-opencl', 'Disable gpu code in OpenCV using OpenCL' | |
depends_on 'cmake' => :build | |
depends_on 'pkg-config' => :build | |
depends_on 'numpy' => :python | |
depends_on :python | |
depends_on 'eigen' => :optional | |
depends_on 'libtiff' => :optional | |
depends_on 'jasper' => :optional | |
depends_on 'tbb' => :optional | |
depends_on 'qt' => :optional | |
depends_on :libpng | |
# Can also depend on ffmpeg, but this pulls in a lot of extra stuff that | |
# you don't need unless you're doing video analysis, and some of it isn't | |
# in Homebrew anyway. Will depend on openexr if it's installed. | |
env :std | |
def patches | |
#fixes compilation errors if ffmpeg is installed | |
DATA | |
end | |
def install | |
args = std_cmake_args + %W[ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET= | |
-DWITH_CUDA=OFF | |
-DBUILD_ZLIB=OFF | |
-DBUILD_TIFF=OFF | |
-DBUILD_PNG=OFF | |
-DBUILD_JPEG=OFF | |
-DBUILD_JASPER=OFF | |
-DBUILD_TESTS=OFF | |
-DBUILD_PERF_TESTS=OFF | |
-DPYTHON_INCLUDE_DIR='#{python.incdir}' | |
-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib' | |
-DPYTHON_EXECUTABLE='#{python.binary}' | |
] | |
if build.build_32_bit? | |
args << "-DCMAKE_OSX_ARCHITECTURES=i386" | |
args << "-DOPENCV_EXTRA_C_FLAGS='-arch i386 -m32'" | |
args << "-DOPENCV_EXTRA_CXX_FLAGS='-arch i386 -m32 -Wunsequenced'" | |
else | |
args << "-DOPENCV_EXTRA_CXX_FLAGS='-Wunsequenced'" | |
end | |
args << '-DWITH_QT=ON' if build.with? 'qt' | |
args << '-DWITH_TBB=ON' if build.with? 'tbb' | |
# OpenCL 1.1 is required, but Snow Leopard and older come with 1.0 | |
args << '-DWITH_OPENCL=OFF' if build.without? 'opencl' or MacOS.version < :lion | |
args << '..' | |
mkdir 'macbuild' do | |
system 'cmake', *args | |
system "make" | |
system "make install" | |
end | |
end | |
def caveats | |
python.standard_caveats if python | |
end | |
end | |
__END__ | |
--- /modules/highgui/CMakeLists.txt | |
+++ /modules/highgui/CMakeLists.txt | |
@@ -191,7 +191,10 @@ | |
list(APPEND HIGHGUI_LIBRARIES ${BZIP2_LIBRARIES}) | |
endif() | |
if(APPLE) | |
- list(APPEND HIGHGUI_LIBRARIES "-framework VideoDecodeAcceleration" bz2) | |
+ EXEC_PROGRAM(pkg-config | |
+ ARGS "--libs --static 'libavcodec'" | |
+ OUTPUT_VARIABLE LIBAVCODEC_LIBS) | |
+ list(APPEND HIGHGUI_LIBRARIES "-framework VideoDecodeAcceleration" bz2 ${LIBAVCODEC_LIBS}) | |
endif() | |
endif(HAVE_FFMPEG) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BTW I'm getting this error, any fix?