Warning, /graphics/digikam/project/bundles/3rdparty/ext_opencv/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # Script to build OpenCV for digiKam bundle.
0002 #
0003 # SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier  <caulier dot gilles at gmail dot com>
0004 #
0005 # SPDX-License-Identifier: BSD-3-Clause
0006 #
0007 #
0008 
0009 set(EXTPREFIX_opencv "${EXTPREFIX}" )
0010 
0011 set(Opencv_Conf -DBUILD_EXAMPLES=OFF
0012                 -DBUILD_TESTS=OFF
0013                 -DBUILD_DOCS=OFF
0014                 -DBUILD_PERF_TESTS=OFF
0015                 -DBUILD_NEW_PYTHON_SUPPORT=OFF
0016                 -DBUILD_ZLIB=OFF
0017                 -DOPENCV_BUILD_3RDPARTY_LIBS=OFF
0018                 -DINSTALL_C_EXAMPLES=OFF
0019                 -DINSTALL_PYTHON_EXAMPLES=OFF
0020                 -DBUILD_opencv_core=ON
0021                 -DBUILD_opencv_imgproc=ON
0022                 -DBUILD_opencv_imgcodecs=ON
0023                 -DBUILD_opencv_objdetect=ON
0024                 -DBUILD_opencv_calib3d=ON
0025                 -DBUILD_opencv_features2d=ON
0026                 -DBUILD_opencv_flann=ON
0027                 -DBUILD_opencv_dnn=ON
0028                 -DBUILD_opencv_photo=OFF
0029                 -DBUILD_opencv_java=OFF
0030                 -DBUILD_opencv_java_bindings_generator=OFF
0031                 -DBUILD_opencv_js=OFF
0032                 -DBUILD_opencv_python2=OFF
0033                 -DBUILD_opencv_python3=OFF
0034                 -DBUILD_opencv_python_bindings_generator=OFF
0035                 -DBUILD_opencv_ml=ON
0036                 -DBUILD_opencv_shape=ON
0037                 -DBUILD_opencv_highgui=ON
0038                 -DBUILD_opencv_superres=ON
0039                 -DBUILD_opencv_stitching=ON
0040                 -DBUILD_opencv_videostab=OFF
0041                 -DBUILD_opencv_videoio=OFF
0042                 -DBUILD_opencv_video=OFF
0043                 -DBUILD_opencv_apps=OFF
0044                 -DBUILD_opencv_gapi=OFF
0045                 -DWITH_PROTOBUF=ON
0046                 -DWITH_1394=OFF
0047                 -DWITH_VTK=OFF
0048                 -DWITH_DIRECTX=OFF
0049                 -DWITH_DSHOW=OFF
0050                 -DWITH_EIGEN=OFF
0051                 -DWITH_FFMPEG=OFF
0052                 -DWITH_GSTREAMER=OFF
0053                 -DWITH_GTK=OFF
0054                 -DWITH_IPP=OFF
0055                 -DWITH_JASPER=OFF
0056                 -DWITH_JPEG=OFF
0057                 -DWITH_MATLAB=OFF
0058                 -DWITH_OPENEXR=OFF
0059                 -DWITH_OPENNI=OFF
0060                 -DWITH_OPENMP=OFF
0061                 -DWITH_OPENJPEG=OFF
0062                 -DWITH_PNG=OFF
0063                 -DWITH_PVAPI=OFF
0064                 -DWITH_WIN32UI=OFF
0065                 -DWITH_QT=OFF
0066                 -DWITH_QUICKTIME=OFF
0067                 -DWITH_QT_OPENGL=OFF
0068                 -DWITH_TBB=OFF
0069                 -DWITH_TIFF=OFF
0070                 -DWITH_UNICAP=OFF
0071                 -DWITH_V4L=OFF
0072                 -DWITH_VFW=OFF
0073                 -DWITH_VIDEOINPUT=OFF
0074                 -DWITH_XINE=OFF
0075                 -DWITH_VA_INTEL=OFF
0076                 -DWITH_GPHOTO2=OFF
0077                 -DWITH_WEBP=OFF
0078                 -DWITH_IMGCODEC_HDR=OFF
0079                 -DWITH_IMGCODEC_SUNRASTER=OFF
0080                 -DWITH_IMGCODEC_PXM=OFF
0081                 -DCV_TRACE=OFF
0082                 -DCV_ENABLE_INTRINSICS=OFF
0083                 -DCV_DISABLE_OPTIMIZATION=ON
0084                 -DWITH_CUDA=OFF
0085                 -DWITH_CUFFT=OFF
0086                 -DWITH_CUBLAS=OFF
0087                 -DWITH_NVCUVID=OFF
0088                 -DWITH_OPENCL=ON
0089                 -DWITH_OPENCLAMDFFT=ON
0090                 -DWITH_OPENCLAMDBLAS=ON
0091                 -DWITH_OPENCL_D3D11_NV=ON
0092 )
0093 
0094 # See https://github.com/opencv/opencv/issues/23458#issuecomment-1495841155
0095 # OPenCL SVM support under MacOS is not functional.
0096 
0097 if(APPLE)
0098 
0099     set(Opencv_Conf ${Opencv_Conf}
0100                     -DWITH_OPENCL_SVM=OFF
0101     )
0102 else()
0103 
0104     set(Opencv_Conf ${Opencv_Conf}
0105                     -DWITH_OPENCL_SVM=ON
0106     )
0107 
0108 endif()
0109 
0110 JoinListAsString("${Opencv_Conf}" " " BASH_OPTIONS)
0111 
0112 if(MINGW)
0113 
0114     ExternalProject_Add(ext_opencv
0115 
0116         GIT_REPOSITORY https://github.com/opencv/opencv.git
0117         GIT_TAG 4.9.0
0118 
0119         CMAKE_ARGS -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE}
0120                    -DCMAKE_TOOLCHAIN_FILE=${MXE_TOOLCHAIN}
0121                    -DCMAKE_INSTALL_PREFIX=${MXE_INSTALL_PREFIX}
0122                    -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
0123                    ${GLOBAL_PROFILE}
0124                    ${Opencv_Conf}
0125 
0126         UPDATE_COMMAND ""
0127         ALWAYS 0
0128     )
0129 
0130 elseif(APPLE)
0131 
0132     ExternalProject_Add(ext_opencv
0133         DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
0134 
0135         GIT_REPOSITORY https://github.com/opencv/opencv.git
0136         GIT_TAG 4.9.0
0137 
0138         CONFIGURE_COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/../../../../bootstrap.macports <SOURCE_DIR>/. &&
0139                           <SOURCE_DIR>/bootstrap.macports ${EXTPREFIX_opencv} RelWithDebInfo x86_64 "${BASH_OPTIONS}"
0140 
0141         BUILD_COMMAND cd <SOURCE_DIR>/build && $(MAKE)
0142 
0143         INSTALL_COMMAND cd <SOURCE_DIR>/build && make install/fast
0144 
0145         BUILD_IN_SOURCE 1
0146 
0147         UPDATE_COMMAND ""
0148         ALWAYS 0
0149     )
0150 
0151 else() # Linux
0152 
0153     ExternalProject_Add(ext_opencv
0154         DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
0155 
0156         GIT_REPOSITORY https://github.com/opencv/opencv.git
0157         GIT_TAG 4.9.0
0158 
0159         INSTALL_DIR ${EXTPREFIX_opencv}
0160 
0161         CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTPREFIX_opencv}
0162                    -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE}
0163                    ${GLOBAL_PROFILE}
0164                    ${Opencv_Conf}
0165 
0166         UPDATE_COMMAND ""
0167         ALWAYS 0
0168     )
0169 
0170 endif()