vcpkg/ports/opencv2/portfile.cmake
Stefano Sinigardi ca1501f4b2
[opencv] update to 4.9 (#38928)
Co-authored-by: Howard Su <howard0su@gmail.com>
Co-authored-by: Nick Logozzo <nlogozzo225@gmail.com>
Co-authored-by: sidy3d <sidy3d@users.noreply.github.com>
Co-authored-by: c8ef <c8ef@outlook.com>
Co-authored-by: autoantwort <41973254+autoantwort@users.noreply.github.com>
Co-authored-by: jim wang <122244446+jimwang118@users.noreply.github.com>
Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>
Co-authored-by: Lily Wang <v-lilywang@microsoft.com>
Co-authored-by: Matthias Kuhn <matthias@opengis.ch>
Co-authored-by: Mark Harmstone <mark@harmstone.com>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
Co-authored-by: Alexandre Bique <bique.alexandre@gmail.com>
Co-authored-by: Peter Adam Korodi <52385411+kp-cat@users.noreply.github.com>
Co-authored-by: Jakub Melka <mgr.jakub.melka@gmail.com>
Co-authored-by: LE GARREC Vincent <github@le-garrec.fr>
Co-authored-by: Josh Harris <126129571+harris-josh@users.noreply.github.com>
Co-authored-by: Theodore Tsirpanis <theodore.tsirpanis@tiledb.com>
Co-authored-by: Kaoru <shiinasama2001@gmail.com>
Co-authored-by: Javier Matos Denizac <javier.matosd@gmail.com>
Co-authored-by: Javier Matos <javiermatos@Javiers-Laptop.local>
Co-authored-by: Pravila <pravila0011@gmail.com>
Co-authored-by: JacobBarthelmeh <jacob@wolfssl.com>
Co-authored-by: myd7349 <myd7349@gmail.com>
Co-authored-by: Billy O'Neal <bion@microsoft.com>
Co-authored-by: Frank <65999885+FrankXie05@users.noreply.github.com>
Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com>
Co-authored-by: 王太阳 <wangfangkai@qq.com>
Co-authored-by: 王方凯 <fk.wang@hydro-tech.cn>
Co-authored-by: Chuck Walbourn <walbourn@users.noreply.github.com>
Co-authored-by: Jaap Aarts <JAicewizard@users.noreply.github.com>
2024-11-05 11:17:22 -08:00

131 lines
4.1 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO opencv/opencv
REF "${VERSION}"
SHA512 de7d24ac7ed78ac14673011cbecc477cae688b74222a972e553c95a557b5cb8e5913f97db525421d6a72af30998ca300112fa0b285daed65f65832eb2cf7241a
HEAD_REF master
PATCHES
0001-install-options.patch
0002-fix-paths-containing-symbols.patch
0003-force-package-requirements.patch
0006-fix-jasper.patch
0007-fix-config.patch
0019-fix-openexr.patch
0020-missing-include.patch
)
# Disallow accidental build of vendored copies
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr")
file(REMOVE "${SOURCE_PATH}/cmake/FindCUDA.cmake")
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindCUDA")
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"eigen" WITH_EIGEN
"gtk" WITH_GTK
"jasper" WITH_JASPER
"jpeg" WITH_JPEG
"msmf" WITH_MSMF
"openexr" WITH_OPENEXR
"opengl" WITH_OPENGL
"png" WITH_PNG
"qt" WITH_QT
"tiff" WITH_TIFF
"world" BUILD_opencv_world
"dc1394" WITH_1394
)
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT_LNK)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
###### ocv_options
-DCMAKE_DEBUG_POSTFIX=d
-DBUILD_WITH_STATIC_CRT=${STATIC_CRT_LNK}
-DINSTALL_TO_MANGLED_PATHS=OFF
# Do not build docs/examples
-DBUILD_DOCS=OFF
-DBUILD_EXAMPLES=OFF
###### Disable build 3rd party libs
-DBUILD_JASPER=OFF
-DBUILD_JPEG=OFF
-DBUILD_OPENEXR=OFF
-DBUILD_PNG=OFF
-DBUILD_TIFF=OFF
-DBUILD_TBB=OFF
-DBUILD_ZLIB=OFF
###### OpenCV Build components
-DBUILD_opencv_apps=OFF
-DBUILD_PACKAGE=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_TESTS=OFF
-DBUILD_WITH_DEBUG_INFO=ON
# CMAKE
-DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON
###### customized properties
## Options from vcpkg_check_features()
${FEATURE_OPTIONS}
-DWITH_1394=OFF
-DWITH_IPP=OFF
-DWITH_LAPACK=OFF
-DWITH_OPENCLAMDBLAS=OFF
-DWITH_OPENMP=OFF
-DWITH_PYTHON=OFF
-DWITH_FFMPEG=OFF
-DWITH_ZLIB=ON
-DWITH_CUBLAS=OFF
-DWITH_CUDA=OFF
-DOPENCV_LAPACK_FIND_PACKAGE_ONLY=ON
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup()
vcpkg_copy_pdbs()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(READ "${CURRENT_PACKAGES_DIR}/share/opencv2/OpenCVModules.cmake" OPENCV_MODULES)
set(DEPS_STRING "include(CMakeFindDependencyMacro)
find_dependency(Threads)")
if("tiff" IN_LIST FEATURES)
string(APPEND DEPS_STRING "\nfind_dependency(TIFF)")
endif()
if("openexr" IN_LIST FEATURES)
string(APPEND DEPS_STRING "\nfind_dependency(Imath CONFIG)\nfind_dependency(OpenEXR CONFIG)")
endif()
if("png" IN_LIST FEATURES)
string(APPEND DEPS_STRING "\nfind_dependency(PNG)")
endif()
if("qt" IN_LIST FEATURES)
string(APPEND DEPS_STRING "
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_dependency(Qt5 COMPONENTS Core Gui Widgets Test Concurrent)")
if("opengl" IN_LIST FEATURES)
string(APPEND DEPS_STRING "
find_dependency(Qt5 COMPONENTS OpenGL)")
endif()
endif()
string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)"
"set(CMAKE_IMPORT_FILE_VERSION 1)\n${DEPS_STRING}" OPENCV_MODULES "${OPENCV_MODULES}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv2/OpenCVModules.cmake" "${OPENCV_MODULES}")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE "${CURRENT_PACKAGES_DIR}/LICENSE")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/LICENSE")
vcpkg_fixup_pkgconfig()
configure_file("${CURRENT_PORT_DIR}/usage.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY)
file(GLOB extra_license_files "${CURRENT_PACKAGES_DIR}/share/licenses/opencv2/*")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" ${extra_license_files})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/licenses")