2016-10-27 10:23:55 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
2016-11-09 06:38:47 +08:00
|
|
|
message(STATUS "Warning: Static building not supported yet. Building dynamic.")
|
|
|
|
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
2016-10-27 10:23:55 +08:00
|
|
|
endif()
|
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
|
|
|
|
REF 3.3.0
|
2017-09-22 23:16:06 +08:00
|
|
|
SHA512 13dee5c1c5fec1dccdbb05879d299b93ef8ddeb87f561a6c4178e33a4cf5ae919765119068d0387a3efea0e09a625ca993cffac60a772159690fcbee4e8d70fb
|
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"
|
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
|
|
|
|
REF 3.3.0
|
|
|
|
SHA512 ebe3dbe6c754c6fbaabbf6b0d2a4209964e625fd68e593f30ce043792740c8c1d4440d7870949b5b33f488fd7e2e05f3752287b7f50dd24c29202e268776520e
|
|
|
|
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
|
|
|
|
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
|
|
|
|
-DBUILD_ZLIB=OFF
|
2016-10-01 07:48:12 +08:00
|
|
|
-DBUILD_TIFF=OFF
|
|
|
|
-DBUILD_JPEG=OFF
|
|
|
|
-DBUILD_PNG=OFF
|
2016-09-19 11:50:08 +08:00
|
|
|
-DBUILD_opencv_python2=OFF
|
|
|
|
-DBUILD_opencv_python3=OFF
|
2017-07-28 02:20:20 +08:00
|
|
|
-DBUILD_opencv_flann=ON
|
2016-09-19 11:50:08 +08:00
|
|
|
-DBUILD_opencv_apps=OFF
|
|
|
|
-DBUILD_DOCS=OFF
|
2016-09-28 06:49:41 +08:00
|
|
|
-DBUILD_EXAMPLES=OFF
|
|
|
|
-DBUILD_PACKAGE=OFF
|
2016-09-19 11:50:08 +08:00
|
|
|
-DBUILD_PERF_TESTS=OFF
|
2016-09-28 06:49:41 +08:00
|
|
|
-DBUILD_TESTS=OFF
|
|
|
|
-DBUILD_WITH_DEBUG_INFO=ON
|
2016-09-19 11:50:08 +08:00
|
|
|
-DOpenCV_DISABLE_ARCH_PATH=ON
|
2017-08-20 15:37:08 +08:00
|
|
|
-DWITH_FFMPEG=ON
|
2016-09-28 06:49:41 +08:00
|
|
|
-DINSTALL_FORCE_UNIX_PATHS=ON
|
|
|
|
-DOPENCV_CONFIG_INSTALL_PATH=share/opencv
|
|
|
|
-DOPENCV_OTHER_INSTALL_PATH=share/opencv
|
|
|
|
-DINSTALL_LICENSE=OFF
|
2017-09-06 06:31:36 +08:00
|
|
|
# Optional: change to ON to build with CUDA
|
2016-09-29 03:12:04 +08:00
|
|
|
-DWITH_CUDA=OFF
|
2017-05-03 19:21:43 +08:00
|
|
|
-DWITH_CUBLAS=OFF
|
|
|
|
-DWITH_OPENCLAMDBLAS=OFF
|
|
|
|
-DWITH_LAPACK=OFF
|
2017-08-21 01:33:39 +08:00
|
|
|
-DBUILD_opencv_dnn=ON
|
2017-08-09 05:26:13 +08:00
|
|
|
-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules
|
|
|
|
-DBUILD_PROTOBUF=OFF
|
|
|
|
-DUPDATE_PROTO_FILES=ON
|
2017-08-21 01:33:39 +08:00
|
|
|
-DPROTOBUF_UPDATE_FILES=ON
|
2017-09-06 06:31:36 +08:00
|
|
|
# Optional: change to ON to build with VTK
|
|
|
|
-DWITH_VTK=OFF
|
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-08-16 09:20:28 +08:00
|
|
|
if(${VCPKG_PLATFORM_TOOLSET} STREQUAL "v150")
|
|
|
|
set(OpenCV_RUNTIME vc15)
|
|
|
|
else()
|
|
|
|
set(OpenCV_RUNTIME vc14)
|
|
|
|
endif()
|
|
|
|
if(${VCPKG_TARGET_ARCHITECTURE} STREQUAL "x64")
|
|
|
|
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})
|
|
|
|
|
|
|
|
file(GLOB SHARE_LIB ${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/*)
|
|
|
|
file(COPY ${SHARE_LIB} DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/opencv/${OpenCV_ARCH})
|
|
|
|
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake OPENCV_CONFIG)
|
|
|
|
string(REPLACE "\${OpenCV_ARCH}/\${OpenCV_RUNTIME}/"
|
|
|
|
"" OPENCV_CONFIG "${OPENCV_CONFIG}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVConfig.cmake "${OPENCV_CONFIG}")
|
|
|
|
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/lib/OpenCVConfig.cmake OPENCV_CONFIG_LIB)
|
|
|
|
string(REPLACE "get_filename_component(OpenCV_INSTALL_PATH \"\${OpenCV_CONFIG_PATH}/../../../../../"
|
|
|
|
"get_filename_component(OpenCV_INSTALL_PATH \"\${OpenCV_CONFIG_PATH}/../../../" OPENCV_CONFIG_LIB "${OPENCV_CONFIG_LIB}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/lib/OpenCVConfig.cmake "${OPENCV_CONFIG_LIB}")
|
|
|
|
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/lib/OpenCVModules.cmake OPENCV_MODULES)
|
|
|
|
string(REPLACE "get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n"
|
|
|
|
"get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" OPENCV_MODULES "${OPENCV_MODULES}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/lib/OpenCVModules.cmake "${OPENCV_MODULES}")
|
|
|
|
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/lib/OpenCVModules-release.cmake OPENCV_MODULES_RELEASE)
|
|
|
|
string(REPLACE "${OpenCV_ARCH}/${OpenCV_RUNTIME}/"
|
|
|
|
"" OPENCV_MODULES_RELEASE "${OPENCV_MODULES_RELEASE}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/lib/OpenCVModules-release.cmake "${OPENCV_MODULES_RELEASE}")
|
|
|
|
|
|
|
|
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/opencv/${OpenCV_ARCH}/${OpenCV_RUNTIME}/lib/OpenCVModules-debug.cmake OPENCV_MODULES_DEBUG)
|
|
|
|
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" OPENCV_MODULES_DEBUG "${OPENCV_MODULES_DEBUG}")
|
|
|
|
string(REPLACE "${OpenCV_ARCH}/${OpenCV_RUNTIME}/"
|
|
|
|
"" OPENCV_MODULES_DEBUG "${OPENCV_MODULES_DEBUG}")
|
|
|
|
file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/lib/OpenCVModules-debug.cmake "${OPENCV_MODULES_DEBUG}")
|
|
|
|
|
|
|
|
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()
|