OpenCV 2.4.12.2 on Cygwin 2.2.1 environment

>> Japanese page
>> version 3.0.0

my built libraries for 64bit Cygwin:
opencv-2.4.12.2-cygwin64-g++-4.9.3-shared-release-20150921.tar.bz2
(required runtime libraries: libIlmImf7, libjasper1, libjpeg8, libpng16, libtiff6, liblzma5, libbz2_1, zlib0)

output of cv::getBuildInformation()


1) preparation #1
Install required packages using Cygwin's setup.exe.
In my opinion, the following packages (and their depending packages) are needed:

 "unzip"
 "cmake"
 "gcc-g++"
 "make"
 "patch"
 "libIlmImf-devel"
 "libjasper-devel"
 "libjpeg-devel"
 "libpng-devel"
 "libtiff-devel"
 "libbz2-devel"
 "zlib-devel"


2) preparation #2 (recommended)
Build ffmpeg.

for example:

$ cd /tmp/
$ tar xvjf ffmpeg-2.8.tar.bz2
$ cd ffmpeg-2.8/
$ ./configure --disable-yasm --disable-iconv --enable-avresample
$ make -j 4


3) preparation #3 (optional: You can skip this if you do not need viz module of OpenCV.)
Build VTK following my instruction page.
Please note, you do not have to "install" VTK. You can use your working directory (ex. /tmp/vtk_build/) as is. In that case, building VTK as "static library" is strongly recommended.


4) apply patch
Get opencv-2.4.12.2.tar.gz, and apply my patch for Cygwin.

for example:

$ cd /tmp/
$ tar xvzf opencv-2.4.12.2.tar.gz
$ gunzip opencv-2.4.12.2-cygwin-patch-20150921.txt.gz
$ cd opencv-2.4.12.2/
$ patch -p1 < ../opencv-2.4.12.2-cygwin-patch-20150921.txt


5) build and install

for example:

$ mkdir build_shared_release/
$ cd build_shared_release/
$ cmake -Wno-dev \
        -D CMAKE_LEGACY_CYGWIN_WIN32=0 \
        -D CMAKE_BUILD_TYPE=RELEASE \
        -D BUILD_SHARED_LIBS:BOOL=TRUE \
        -D WITH_IPP:BOOL=FALSE \
        -D WITH_OPENMP:BOOL=TRUE \
        -D WITH_OPENGL:BOOL=TRUE \
        -D ENABLE_FAST_MATH:BOOL=TRUE \
        -D ENABLE_SSE:BOOL=TRUE \
        -D ENABLE_SSE2:BOOL=TRUE \
        -D ENABLE_AVX:BOOL=TRUE \
        -D ENABLE_AVX2:BOOL=TRUE \
        -D BUILD_TESTS:BOOL=FALSE \
        -D BUILD_PERF_TESTS:BOOL=FALSE \
        -D BUILD_EXAMPLES:BOOL=FALSE \
        -D CYGWIN_FFMPEG_BUILT_DIR=/tmp/ffmpeg-2.8/ \
        -D WITH_VTK:BOOL=TRUE \
        -D VTK_DIR=/tmp/vtk_static_release/ \
        -D CMAKE_INSTALL_PREFIX=/usr/local/opencv-2.4.12.2/ \
        /tmp/opencv-2.4.12.2/
$ make -j 4 install