From 17033cc0c63d913a56f8c66c97cc73d2d4372b63 Mon Sep 17 00:00:00 2001 From: jasjuang Date: Tue, 8 Aug 2017 14:26:13 -0700 Subject: [PATCH 1/6] update opencv to 3.3.0 --- ports/opencv/CONTROL | 8 +++--- ports/opencv/portfile.cmake | 50 ++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index 7dbaf64c21..9360d64edf 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,6 +1,6 @@ Source: opencv -Version: 3.2.0-3 -Build-Depends: zlib, libpng, libjpeg-turbo, tiff -#Use the following line instead for optional features from OpenCV-contrib that require protobuf -#Build-Depends: zlib, libpng, libjpeg-turbo, tiff, protobuf +Version: 3.3.0 +Build-Depends: zlib, libpng, libjpeg-turbo, tiff, vtk, protobuf, ceres +# Uncomment the following line if building without opencv_contrib is desired +# Build-Depends: zlib, libpng, libjpeg-turbo, tiff, vtk Description: computer vision library diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 3323fb0f48..4e946a4633 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -3,11 +3,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) set(VCPKG_LIBRARY_LINKAGE dynamic) endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-3.2.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-3.3.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/opencv/opencv/archive/3.2.0.zip" - FILENAME "opencv-3.2.0.zip" - SHA512 c6418d2a7654fe9d50611e756778df4c6736f2de76b85773efbf490bb475dd95ec1041fe57a87163ce11a7db44430cd378c8416af3319f979ced92532bf5ebb5 + URLS "https://github.com/opencv/opencv/archive/3.3.0.zip" + FILENAME "opencv-3.3.0.zip" + SHA512 14430c6225926e5118daccb57c7276d9f9160c90a034b2c73a09b73ac90ba7ebd3ae78cccffb4a10b58bb0e5e16ebd03bf617030fa74cc67d9d18366bf6b4951 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -19,19 +19,19 @@ vcpkg_apply_patches( ) file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/libjpeg ${SOURCE_PATH}/3rdparty/libpng ${SOURCE_PATH}/3rdparty/zlib ${SOURCE_PATH}/3rdparty/libtiff) -# Uncomment the following lines and the lines under OPTIONS to build opencv_contrib -# Important: after uncommenting you've add protobuf dependency within CONTROL file -#SET(CONTRIB_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv_contrib-3.2.0) -#vcpkg_download_distfile(CONTRIB_ARCHIVE -# URLS "https://github.com/opencv/opencv_contrib/archive/3.2.0.zip" -# FILENAME "opencv_contrib-3.2.0.zip" -# SHA512 da6cda7a7ae1d722967e18f9b8d60895b93bbc3664dfdb1645cb4d8b337a9c4207b9073fd546a596c48a489f92d15191aa34c7c607167b536fbe4937b8424b43 -#) -#vcpkg_extract_source_archive(${CONTRIB_ARCHIVE}) -#vcpkg_apply_patches( -# SOURCE_PATH ${CONTRIB_SOURCE_PATH} -# PATCHES "${CMAKE_CURRENT_LIST_DIR}/open_contrib-remove-waldboost.patch" -#) +# Comment out the following 11 lines if you don't want to build with opencv_contrib +# Important: remember to also update the CONTROL file +SET(CONTRIB_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv_contrib-3.3.0) +vcpkg_download_distfile(CONTRIB_ARCHIVE + URLS "https://github.com/opencv/opencv_contrib/archive/3.3.0.zip" + FILENAME "opencv_contrib-3.3.0.zip" + SHA512 1c76d49689459708117acfbd0893cbfb915fbd0defff95702fb388a29d12b50fb53fbf246e64e68aa3adb347aa45ff478df5e2e8c6d9cfa57a628744bbb1bd04 +) +vcpkg_extract_source_archive(${CONTRIB_ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${CONTRIB_SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/open_contrib-remove-waldboost.patch" +) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} @@ -60,11 +60,12 @@ vcpkg_configure_cmake( -DWITH_CUBLAS=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_LAPACK=OFF + -DBUILD_opencv_dnn=OFF - # uncomment the following 3 lines to build opencv_contrib modules - #-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules - #-DBUILD_PROTOBUF=OFF - #-DUPDATE_PROTO_FILES=ON + # comment the following 3 lines if you don't want to build opencv_contrib modules + -DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules + -DBUILD_PROTOBUF=OFF + -DUPDATE_PROTO_FILES=ON OPTIONS_DEBUG -DINSTALL_HEADERS=OFF -DINSTALL_OTHER=OFF @@ -72,13 +73,12 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -file(READ ${CURRENT_PACKAGES_DIR}/debug/share/opencv/OpenCVModules-debug.cmake OPENCV_DEBUG_MODULE) -string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" OPENCV_DEBUG_MODULE "${OPENCV_DEBUG_MODULE}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake "${OPENCV_DEBUG_MODULE}") - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv) file(RENAME ${CURRENT_PACKAGES_DIR}/share/opencv/LICENSE ${CURRENT_PACKAGES_DIR}/share/opencv/copyright) +file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE) vcpkg_copy_pdbs() From 66ac9bb63a32603aa3d7a4903e79962eb937e565 Mon Sep 17 00:00:00 2001 From: jasjuang Date: Tue, 15 Aug 2017 18:20:28 -0700 Subject: [PATCH 2/6] fix debug build, fix dll copy problem --- ports/opencv/portfile.cmake | 60 +++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 4e946a4633..8405f1e1a9 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -19,8 +19,8 @@ vcpkg_apply_patches( ) file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/libjpeg ${SOURCE_PATH}/3rdparty/libpng ${SOURCE_PATH}/3rdparty/zlib ${SOURCE_PATH}/3rdparty/libtiff) -# Comment out the following 11 lines if you don't want to build with opencv_contrib -# Important: remember to also update the CONTROL file +# Uncomment the following lines and the lines under OPTIONS to build opencv_contrib +# Important: after uncommenting you've add protobuf dependency within CONTROL file SET(CONTRIB_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv_contrib-3.3.0) vcpkg_download_distfile(CONTRIB_ARCHIVE URLS "https://github.com/opencv/opencv_contrib/archive/3.3.0.zip" @@ -62,7 +62,7 @@ vcpkg_configure_cmake( -DWITH_LAPACK=OFF -DBUILD_opencv_dnn=OFF - # comment the following 3 lines if you don't want to build opencv_contrib modules + # uncomment the following 3 lines to build opencv_contrib modules -DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules -DBUILD_PROTOBUF=OFF -DUPDATE_PROTO_FILES=ON @@ -73,12 +73,60 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv) file(RENAME ${CURRENT_PACKAGES_DIR}/share/opencv/LICENSE ${CURRENT_PACKAGES_DIR}/share/opencv/copyright) file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE) +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) + vcpkg_copy_pdbs() From c23e69b00895a7672d0f4fd4ccedcbb4d58d4c2a Mon Sep 17 00:00:00 2001 From: jasjuang Date: Sun, 20 Aug 2017 00:25:43 -0700 Subject: [PATCH 3/6] use vcpkg_from_github --- ports/opencv/CONTROL | 2 -- ports/opencv/portfile.cmake | 30 ++++++++++++++---------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index 9360d64edf..8063511a7f 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,6 +1,4 @@ Source: opencv Version: 3.3.0 Build-Depends: zlib, libpng, libjpeg-turbo, tiff, vtk, protobuf, ceres -# Uncomment the following line if building without opencv_contrib is desired -# Build-Depends: zlib, libpng, libjpeg-turbo, tiff, vtk Description: computer vision library diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 8405f1e1a9..ace4c9fa6f 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -3,13 +3,14 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) set(VCPKG_LIBRARY_LINKAGE dynamic) endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-3.3.0) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/opencv/opencv/archive/3.3.0.zip" - FILENAME "opencv-3.3.0.zip" - SHA512 14430c6225926e5118daccb57c7276d9f9160c90a034b2c73a09b73ac90ba7ebd3ae78cccffb4a10b58bb0e5e16ebd03bf617030fa74cc67d9d18366bf6b4951 + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO opencv/opencv + REF 3.3.0 + SHA512 b69923c9809d5533764b5db73db4f0be17f72b6d53643ee773824cfe8a98261d7dc5b4033895693bfd1454bc474c7f6152a5d0023a6f495324dd2b4b4a058e0d + HEAD_REF master ) -vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} @@ -19,15 +20,14 @@ vcpkg_apply_patches( ) file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/libjpeg ${SOURCE_PATH}/3rdparty/libpng ${SOURCE_PATH}/3rdparty/zlib ${SOURCE_PATH}/3rdparty/libtiff) -# Uncomment the following lines and the lines under OPTIONS to build opencv_contrib -# Important: after uncommenting you've add protobuf dependency within CONTROL file -SET(CONTRIB_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv_contrib-3.3.0) -vcpkg_download_distfile(CONTRIB_ARCHIVE - URLS "https://github.com/opencv/opencv_contrib/archive/3.3.0.zip" - FILENAME "opencv_contrib-3.3.0.zip" - SHA512 1c76d49689459708117acfbd0893cbfb915fbd0defff95702fb388a29d12b50fb53fbf246e64e68aa3adb347aa45ff478df5e2e8c6d9cfa57a628744bbb1bd04 +vcpkg_from_github( + OUT_SOURCE_PATH CONTRIB_SOURCE_PATH + REPO opencv/opencv_contrib + REF 3.3.0 + SHA512 ebe3dbe6c754c6fbaabbf6b0d2a4209964e625fd68e593f30ce043792740c8c1d4440d7870949b5b33f488fd7e2e05f3752287b7f50dd24c29202e268776520e + HEAD_REF master ) -vcpkg_extract_source_archive(${CONTRIB_ARCHIVE}) + vcpkg_apply_patches( SOURCE_PATH ${CONTRIB_SOURCE_PATH} PATCHES "${CMAKE_CURRENT_LIST_DIR}/open_contrib-remove-waldboost.patch" @@ -61,8 +61,6 @@ vcpkg_configure_cmake( -DWITH_OPENCLAMDBLAS=OFF -DWITH_LAPACK=OFF -DBUILD_opencv_dnn=OFF - - # uncomment the following 3 lines to build opencv_contrib modules -DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules -DBUILD_PROTOBUF=OFF -DUPDATE_PROTO_FILES=ON From b501937942cd05db41b4b6f1fdf8e7d7ecd2139b Mon Sep 17 00:00:00 2001 From: jasjuang Date: Sun, 20 Aug 2017 00:37:08 -0700 Subject: [PATCH 4/6] build with ffmpeg --- ports/opencv/CONTROL | 2 +- ports/opencv/portfile.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index 8063511a7f..91efce30ab 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,4 +1,4 @@ Source: opencv Version: 3.3.0 -Build-Depends: zlib, libpng, libjpeg-turbo, tiff, vtk, protobuf, ceres +Build-Depends: zlib, libpng, libjpeg-turbo, tiff, vtk, protobuf, ceres, ffmpeg Description: computer vision library diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index ace4c9fa6f..5e4e1da1a7 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -51,7 +51,7 @@ vcpkg_configure_cmake( -DBUILD_TESTS=OFF -DBUILD_WITH_DEBUG_INFO=ON -DOpenCV_DISABLE_ARCH_PATH=ON - -DWITH_FFMPEG=OFF + -DWITH_FFMPEG=ON -DINSTALL_FORCE_UNIX_PATHS=ON -DOPENCV_CONFIG_INSTALL_PATH=share/opencv -DOPENCV_OTHER_INSTALL_PATH=share/opencv From 2b178b3cb6e166cec2fa7fe3741017ac49a71d04 Mon Sep 17 00:00:00 2001 From: jasjuang Date: Sun, 20 Aug 2017 10:33:39 -0700 Subject: [PATCH 5/6] fix dnn compilation --- ports/opencv/portfile.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 5e4e1da1a7..989a43608c 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -60,10 +60,11 @@ vcpkg_configure_cmake( -DWITH_CUBLAS=OFF -DWITH_OPENCLAMDBLAS=OFF -DWITH_LAPACK=OFF - -DBUILD_opencv_dnn=OFF + -DBUILD_opencv_dnn=ON -DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules -DBUILD_PROTOBUF=OFF -DUPDATE_PROTO_FILES=ON + -DPROTOBUF_UPDATE_FILES=ON OPTIONS_DEBUG -DINSTALL_HEADERS=OFF -DINSTALL_OTHER=OFF From 46db0f03fcb42d9f738474885fda372160362e44 Mon Sep 17 00:00:00 2001 From: jasjuang Date: Tue, 5 Sep 2017 15:31:36 -0700 Subject: [PATCH 6/6] disable vtk and cuda by default --- ports/opencv/CONTROL | 3 ++- ports/opencv/portfile.cmake | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index 91efce30ab..cb27622270 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,4 +1,5 @@ Source: opencv Version: 3.3.0 -Build-Depends: zlib, libpng, libjpeg-turbo, tiff, vtk, protobuf, ceres, ffmpeg +# Optional: Add in vtk to build with VTK and cuda to build with CUDA +Build-Depends: zlib, libpng, libjpeg-turbo, tiff, protobuf, ceres, ffmpeg Description: computer vision library diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 989a43608c..ade8560a51 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -56,6 +56,7 @@ vcpkg_configure_cmake( -DOPENCV_CONFIG_INSTALL_PATH=share/opencv -DOPENCV_OTHER_INSTALL_PATH=share/opencv -DINSTALL_LICENSE=OFF + # Optional: change to ON to build with CUDA -DWITH_CUDA=OFF -DWITH_CUBLAS=OFF -DWITH_OPENCLAMDBLAS=OFF @@ -65,6 +66,8 @@ vcpkg_configure_cmake( -DBUILD_PROTOBUF=OFF -DUPDATE_PROTO_FILES=ON -DPROTOBUF_UPDATE_FILES=ON + # Optional: change to ON to build with VTK + -DWITH_VTK=OFF OPTIONS_DEBUG -DINSTALL_HEADERS=OFF -DINSTALL_OTHER=OFF