2016-09-19 11:50:08 +08:00
|
|
|
include(vcpkg_common_functions)
|
2017-08-20 15:25:43 +08:00
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO opencv/opencv
|
2017-10-28 08:41:59 +08:00
|
|
|
REF 3.3.1
|
|
|
|
SHA512 ee228953b621be022c203e3d60b06be524bd134ba6188c447216ee89e14dfddeac7d6aaf85c5a0b0008b010254e2aa711813bfdb691a77b0bdba33682c6ca68c
|
2017-08-20 15:25:43 +08:00
|
|
|
HEAD_REF master
|
2016-09-28 06:49:41 +08:00
|
|
|
)
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2016-09-28 06:49:41 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES "${CMAKE_CURRENT_LIST_DIR}/opencv-installation-options.patch"
|
2017-04-19 19:30:08 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/001-fix-uwp.patch"
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/002-fix-uwp.patch"
|
2017-10-28 18:07:18 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/no-double-expand-enable-pylint.patch"
|
2017-11-05 06:11:48 +08:00
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/msvs-fix-2017-u5.patch"
|
2016-09-28 06:49:41 +08:00
|
|
|
)
|
2016-10-01 07:48:12 +08:00
|
|
|
file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/libjpeg ${SOURCE_PATH}/3rdparty/libpng ${SOURCE_PATH}/3rdparty/zlib ${SOURCE_PATH}/3rdparty/libtiff)
|
|
|
|
|
2017-08-20 15:25:43 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH CONTRIB_SOURCE_PATH
|
|
|
|
REPO opencv/opencv_contrib
|
2017-10-28 08:41:59 +08:00
|
|
|
REF 3.3.1
|
|
|
|
SHA512 b5f35f68faab811a440b6af6b33c766dcdf4cc8547c0a4ed3a6a3da80ca8ae77618039d94bee6d249e96899765bdbb34c997bd7ee53d864c43427eff92f7ea34
|
2017-08-20 15:25:43 +08:00
|
|
|
HEAD_REF master
|
2017-08-09 05:26:13 +08:00
|
|
|
)
|
2017-08-20 15:25:43 +08:00
|
|
|
|
2017-08-09 05:26:13 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${CONTRIB_SOURCE_PATH}
|
|
|
|
PATCHES "${CMAKE_CURRENT_LIST_DIR}/open_contrib-remove-waldboost.patch"
|
|
|
|
)
|
2017-03-28 16:44:56 +08:00
|
|
|
|
2017-09-23 12:39:20 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT)
|
|
|
|
|
2017-11-02 00:30:07 +08:00
|
|
|
set(BUILD_opencv_sfm OFF)
|
|
|
|
if("sfm" IN_LIST FEATURES)
|
|
|
|
set(BUILD_opencv_sfm ON)
|
2017-11-01 22:08:10 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(WITH_CUDA OFF)
|
|
|
|
if("cuda" IN_LIST FEATURES)
|
|
|
|
set(WITH_CUDA ON)
|
|
|
|
endif()
|
|
|
|
|
2017-11-02 00:30:07 +08:00
|
|
|
set(WITH_FFMPEG OFF)
|
|
|
|
if("ffmpeg" IN_LIST FEATURES)
|
|
|
|
set(WITH_FFMPEG ON)
|
|
|
|
endif()
|
|
|
|
|
2017-11-02 00:07:26 +08:00
|
|
|
set(WITH_QT OFF)
|
|
|
|
if("qt" IN_LIST FEATURES)
|
|
|
|
set(WITH_QT ON)
|
|
|
|
endif()
|
|
|
|
|
2017-11-01 22:08:10 +08:00
|
|
|
set(WITH_VTK OFF)
|
|
|
|
if("vtk" IN_LIST FEATURES)
|
|
|
|
set(WITH_VTK ON)
|
|
|
|
endif()
|
|
|
|
|
2017-11-11 23:31:38 +08:00
|
|
|
set(WITH_GDCM OFF)
|
|
|
|
if("gdcm" IN_LIST FEATURES)
|
|
|
|
set(WITH_GDCM ON)
|
|
|
|
endif()
|
|
|
|
|
2017-11-04 05:44:11 +08:00
|
|
|
set(WITH_MSMF ON)
|
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
|
|
set(WITH_MSMF OFF)
|
|
|
|
endif()
|
|
|
|
|
2016-09-19 11:50:08 +08:00
|
|
|
vcpkg_configure_cmake(
|
2016-09-28 06:49:41 +08:00
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2016-09-19 11:50:08 +08:00
|
|
|
OPTIONS
|
2017-11-02 00:30:07 +08:00
|
|
|
# Ungrouped Entries
|
|
|
|
-DOpenCV_DISABLE_ARCH_PATH=ON
|
|
|
|
-DPROTOBUF_UPDATE_FILES=ON
|
|
|
|
-DUPDATE_PROTO_FILES=ON
|
|
|
|
# BUILD
|
2016-09-19 11:50:08 +08:00
|
|
|
-DBUILD_DOCS=OFF
|
2016-09-28 06:49:41 +08:00
|
|
|
-DBUILD_EXAMPLES=OFF
|
2017-11-02 00:30:07 +08:00
|
|
|
-DBUILD_JPEG=OFF
|
2016-09-28 06:49:41 +08:00
|
|
|
-DBUILD_PACKAGE=OFF
|
2016-09-19 11:50:08 +08:00
|
|
|
-DBUILD_PERF_TESTS=OFF
|
2017-11-02 00:30:07 +08:00
|
|
|
-DBUILD_PNG=OFF
|
|
|
|
-DBUILD_PROTOBUF=OFF
|
2016-09-28 06:49:41 +08:00
|
|
|
-DBUILD_TESTS=OFF
|
2017-11-02 00:30:07 +08:00
|
|
|
-DBUILD_TIFF=OFF
|
2016-09-28 06:49:41 +08:00
|
|
|
-DBUILD_WITH_DEBUG_INFO=ON
|
2017-11-02 00:30:07 +08:00
|
|
|
-DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT}
|
|
|
|
-DBUILD_ZLIB=OFF
|
|
|
|
-DBUILD_opencv_apps=OFF
|
2017-11-01 22:08:10 +08:00
|
|
|
-DBUILD_opencv_dnn=ON
|
2017-11-02 00:30:07 +08:00
|
|
|
-DBUILD_opencv_flann=ON
|
2017-11-01 22:08:10 +08:00
|
|
|
-DBUILD_opencv_python2=OFF
|
|
|
|
-DBUILD_opencv_python3=OFF
|
|
|
|
-DBUILD_opencv_sfm=${BUILD_opencv_sfm}
|
2017-11-02 00:30:07 +08:00
|
|
|
# CMAKE
|
|
|
|
-DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON
|
|
|
|
# ENABLE
|
2017-11-02 22:08:25 +08:00
|
|
|
-DENABLE_CXX11=ON
|
2017-11-02 00:30:07 +08:00
|
|
|
-DENABLE_PYLINT=OFF
|
|
|
|
# INSTALL
|
|
|
|
-DINSTALL_FORCE_UNIX_PATHS=ON
|
|
|
|
-DINSTALL_LICENSE=OFF
|
|
|
|
# OPENCV
|
|
|
|
-DOPENCV_CONFIG_INSTALL_PATH=share/opencv
|
|
|
|
"-DOPENCV_DOWNLOAD_PATH=${DOWNLOADS}/opencv-cache"
|
|
|
|
-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules
|
|
|
|
-DOPENCV_OTHER_INSTALL_PATH=share/opencv
|
|
|
|
# WITH
|
|
|
|
-DWITH_CUBLAS=OFF
|
2017-11-01 22:08:10 +08:00
|
|
|
-DWITH_CUDA=${WITH_CUDA}
|
2017-11-02 00:30:07 +08:00
|
|
|
-DWITH_FFMPEG=${WITH_FFMPEG}
|
|
|
|
-DWITH_LAPACK=OFF
|
2017-11-04 05:44:11 +08:00
|
|
|
-DWITH_MSMF=${WITH_MSMF}
|
2017-11-02 00:30:07 +08:00
|
|
|
-DWITH_OPENCLAMDBLAS=OFF
|
2017-11-02 00:03:34 +08:00
|
|
|
-DWITH_OPENGL=ON
|
2017-11-02 00:07:26 +08:00
|
|
|
-DWITH_QT=${WITH_QT}
|
2017-11-01 22:08:10 +08:00
|
|
|
-DWITH_VTK=${WITH_VTK}
|
2017-11-11 23:31:38 +08:00
|
|
|
-DWITH_GDCM=${WITH_GDCM}
|
2016-09-19 11:50:08 +08:00
|
|
|
OPTIONS_DEBUG
|
|
|
|
-DINSTALL_HEADERS=OFF
|
|
|
|
-DINSTALL_OTHER=OFF
|
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
|
2016-09-29 03:12:04 +08:00
|
|
|
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv)
|
2016-09-28 06:49:41 +08:00
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/opencv/LICENSE ${CURRENT_PACKAGES_DIR}/share/opencv/copyright)
|
2017-08-09 05:26:13 +08:00
|
|
|
file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE)
|
|
|
|
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE)
|
2017-03-28 16:44:56 +08:00
|
|
|
|
2017-09-23 07:51:44 +08:00
|
|
|
if(VCPKG_PLATFORM_TOOLSET STREQUAL "v141")
|
2017-08-16 09:20:28 +08:00
|
|
|
set(OpenCV_RUNTIME vc15)
|
|
|
|
else()
|
|
|
|
set(OpenCV_RUNTIME vc14)
|
|
|
|
endif()
|
2017-09-23 07:51:44 +08:00
|
|
|
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
2017-08-16 09:20:28 +08:00
|
|
|
set(OpenCV_ARCH x64)
|
|
|
|
else()
|
|
|
|
set(OpenCV_ARCH x86)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB BIN_AND_LIB ${CURRENT_PACKAGES_DIR}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/*)
|
|
|
|
file(COPY ${BIN_AND_LIB} DESTINATION ${CURRENT_PACKAGES_DIR})
|
|
|
|
file(GLOB DEBUG_BIN_AND_LIB ${CURRENT_PACKAGES_DIR}/debug/${OpenCV_ARCH}/${OpenCV_RUNTIME}/*)
|
|
|
|
file(COPY ${DEBUG_BIN_AND_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}/debug)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/${OpenCV_ARCH})
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/${OpenCV_ARCH})
|
|
|
|
|
2017-09-23 07:51:44 +08:00
|
|
|
file(GLOB STATICLIB ${CURRENT_PACKAGES_DIR}/staticlib/*)
|
|
|
|
if(STATICLIB)
|
2017-09-23 13:09:39 +08:00
|
|
|
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib)
|
2017-09-23 07:51:44 +08:00
|
|
|
file(COPY ${STATICLIB} DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/staticlib)
|
|
|
|
endif()
|
|
|
|
file(GLOB STATICLIB ${CURRENT_PACKAGES_DIR}/debug/staticlib/*)
|
|
|
|
if(STATICLIB)
|
2017-09-23 13:09:39 +08:00
|
|
|
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)
|
2017-09-23 07:51:44 +08:00
|
|
|
file(COPY ${STATICLIB} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/staticlib)
|
|
|
|
endif()
|
2017-08-16 09:20:28 +08:00
|
|
|
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake OPENCV_CONFIG)
|
2017-09-23 07:51:44 +08:00
|
|
|
string(REPLACE " vc15"
|
|
|
|
" ${OpenCV_RUNTIME}" OPENCV_CONFIG "${OPENCV_CONFIG}")
|
|
|
|
string(REPLACE " vc14"
|
|
|
|
" ${OpenCV_RUNTIME}" OPENCV_CONFIG "${OPENCV_CONFIG}")
|
2017-08-16 09:20:28 +08:00
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake "${OPENCV_CONFIG}")
|
|
|
|
|
2017-09-23 13:09:39 +08:00
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib ${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib)
|
|
|
|
endif()
|
2017-09-23 07:51:44 +08:00
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVModules-release.cmake OPENCV_CONFIG_LIB)
|
|
|
|
string(REPLACE "/staticlib/"
|
|
|
|
"/lib/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
string(REPLACE "/${OpenCV_ARCH}/${OpenCV_RUNTIME}/"
|
|
|
|
"/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
string(REPLACE "${CURRENT_INSTALLED_DIR}"
|
|
|
|
"\${_IMPORT_PREFIX}" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVModules-release.cmake "${OPENCV_CONFIG_LIB}")
|
|
|
|
|
2017-09-23 13:09:39 +08:00
|
|
|
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib")
|
|
|
|
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib ${CURRENT_PACKAGES_DIR}/debug/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib)
|
|
|
|
endif()
|
2017-09-23 07:51:44 +08:00
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVModules-debug.cmake OPENCV_CONFIG_LIB)
|
|
|
|
string(REPLACE "/staticlib/"
|
|
|
|
"/lib/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
string(REPLACE "/${OpenCV_ARCH}/${OpenCV_RUNTIME}/"
|
|
|
|
"/" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
string(REPLACE "PREFIX}/lib"
|
|
|
|
"PREFIX}/debug/lib" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
string(REPLACE "PREFIX}/bin"
|
|
|
|
"PREFIX}/debug/bin" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
string(REPLACE "${CURRENT_INSTALLED_DIR}"
|
|
|
|
"\${_IMPORT_PREFIX}" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVModules-debug.cmake "${OPENCV_CONFIG_LIB}")
|
2017-08-16 09:20:28 +08:00
|
|
|
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
|
|
|
|
2016-09-19 11:50:08 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2017-09-23 13:09:39 +08:00
|
|
|
|
2017-11-26 05:45:33 +08:00
|
|
|
set(VCPKG_LIBRARY_LINKAGE "dynamic")
|
|
|
|
|
|
|
|
set(VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT enabled)
|