aboutsummaryrefslogtreecommitdiff
path: root/ports/opencv3
diff options
context:
space:
mode:
authorStefano Sinigardi <stesinigardi@hotmail.com>2019-09-24 21:58:38 +0200
committerPhil Christensen <philc@microsoft.com>2019-09-24 12:58:38 -0700
commit3532a7cf3cb81ad4c56775a2b02039ee77a96eb2 (patch)
tree4b75fb74ca896434453d3bcd2f8420254ba1d15c /ports/opencv3
parente9047ef77133cde979dc9594d089e0109702675e (diff)
downloadvcpkg-3532a7cf3cb81ad4c56775a2b02039ee77a96eb2.tar.gz
vcpkg-3532a7cf3cb81ad4c56775a2b02039ee77a96eb2.zip
[cudnn] add port and enable it in darknet (#7536)
* [cudnn] add port and enable it in darknet * [OpenCV4] fix ffmpeg feature on uwp * [darknet] enable integration with cuda/cudnn also with opencv3 * [darknet] update to latest revision
Diffstat (limited to 'ports/opencv3')
-rw-r--r--ports/opencv3/0009-fix-uwp.patch13
-rw-r--r--ports/opencv3/CONTROL6
-rw-r--r--ports/opencv3/portfile.cmake109
3 files changed, 82 insertions, 46 deletions
diff --git a/ports/opencv3/0009-fix-uwp.patch b/ports/opencv3/0009-fix-uwp.patch
index b57e49ea1..cba3963dc 100644
--- a/ports/opencv3/0009-fix-uwp.patch
+++ b/ports/opencv3/0009-fix-uwp.patch
@@ -11,6 +11,19 @@ index c2fda8f..3f7dfdc 100644
# removing APPCONTAINER from modules to run from console
# in case of usual starting of WinRT test apps output is missing
# so starting of console version w/o APPCONTAINER is required to get test results
+diff --git a/modules/core/src/utils/datafile.cpp b/modules/core/src/utils/datafile.cpp
+index f1107b0..c613ca2 100644
+--- a/modules/core/src/utils/datafile.cpp
++++ b/modules/core/src/utils/datafile.cpp
+@@ -108,7 +108,7 @@ static cv::String getModuleLocation(const void* addr)
+ CV_UNUSED(addr);
+ #ifdef _WIN32
+ HMODULE m = 0;
+-#if _WIN32_WINNT >= 0x0501
++#if (_WIN32_WINNT >= 0x0501) && (!WINRT_STORE)
+ ::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
+ reinterpret_cast<LPCTSTR>(addr),
+ &m);
diff --git a/modules/highgui/include/opencv2/highgui/highgui_winrt.hpp b/modules/highgui/include/opencv2/highgui/highgui_winrt.hpp
index f4147f3..b92efdd 100644
--- a/modules/highgui/include/opencv2/highgui/highgui_winrt.hpp
diff --git a/ports/opencv3/CONTROL b/ports/opencv3/CONTROL
index 16776381d..10a02db66 100644
--- a/ports/opencv3/CONTROL
+++ b/ports/opencv3/CONTROL
@@ -12,7 +12,7 @@ Feature: flann
Description: opencv_flann module
Feature: contrib
-Build-Depends: hdf5 (!uwp)
+Build-Depends: opencv3[dnn], hdf5 (!uwp)
Description: opencv_contrib module
Feature: cuda
@@ -20,6 +20,7 @@ Build-Depends: opencv3[contrib], cuda
Description: CUDA support for opencv
Feature: dnn
+Build-Depends: opencv3[flann]
Description: Enable dnn module
Feature: eigen
@@ -53,7 +54,6 @@ Feature: opengl
Build-Depends: opengl
Description: opengl support for opencv
-
Feature: ovis
Build-Depends: opencv3[contrib], ogre
Description: opencv_ovis module
@@ -67,7 +67,7 @@ Build-Depends: qt5
Description: Qt GUI support for opencv
Feature: sfm
-Build-Depends: opencv3[contrib], opencv3[flann], eigen3, glog, gflags, ceres
+Build-Depends: opencv3[contrib], eigen3, glog, gflags, ceres
Description: opencv_sfm module
Feature: tbb
diff --git a/ports/opencv3/portfile.cmake b/ports/opencv3/portfile.cmake
index 9f1e4788d..bd4f1c4bb 100644
--- a/ports/opencv3/portfile.cmake
+++ b/ports/opencv3/portfile.cmake
@@ -74,7 +74,18 @@ if("dnn" IN_LIST FEATURES)
)
endif()
+# Build image quality module when building with 'contrib' feature and not UWP.
+set(BUILD_opencv_quality OFF)
if("contrib" IN_LIST FEATURES)
+ if (VCPKG_TARGET_IS_UWP)
+ set(BUILD_opencv_quality OFF)
+ message(WARNING "The image quality module (quality) does not build for UWP, the module has been disabled.")
+ # The hdf module is silently disabled by OpenCVs buildsystem if HDF5 is not detected.
+ message(WARNING "The hierarchical data format module (hdf) depends on HDF5 which doesn't support UWP, the module has been disabled.")
+ else()
+ set(BUILD_opencv_quality CMAKE_DEPENDS_IN_PROJECT_ONLY)
+ endif()
+
vcpkg_from_github(
OUT_SOURCE_PATH CONTRIB_SOURCE_PATH
REPO opencv/opencv_contrib
@@ -90,12 +101,6 @@ if("contrib" IN_LIST FEATURES)
SHA512 c16e60a6c4bb4de3ab39b876ae3c3f320ea56f69c93e9303bd2dff8760841dcd71be4161fff8bc71e8fe4fe8747fa8465d49d6bd8f5ebcdaea161f4bc2da7c93
)
- vcpkg_download_distfile(TINYDNN_ARCHIVE
- URLS "https://github.com/tiny-dnn/tiny-dnn/archive/v1.0.0a3.tar.gz"
- FILENAME "opencv-cache/tiny_dnn/adb1c512e09ca2c7a6faef36f9c53e59-v1.0.0a3.tar.gz"
- SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b
- )
-
function(download_opencv_3rdparty ID COMMIT HASH)
if(NOT EXISTS "${DOWNLOADS}/opencv-cache/${ID}/${COMMIT}.stamp")
vcpkg_download_distfile(OCV_DOWNLOAD
@@ -184,11 +189,38 @@ if(WITH_IPP)
endif()
set(WITH_MSMF ON)
-if(VCPKG_TARGET_IS_UWP)
+if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP)
set(WITH_MSMF OFF)
endif()
-set(WITH_ZLIB ON)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ if (WITH_TBB)
+ message(WARNING "TBB is currently unsupported in this build configuration, turning it off")
+ set(WITH_TBB OFF)
+ endif()
+
+ if (WITH_VTK)
+ message(WARNING "VTK is currently unsupported in this build configuration, turning it off")
+ set(WITH_VTK OFF)
+ endif()
+
+ if (VCPKG_TARGET_IS_WINDOWS AND BUILD_opencv_ovis)
+ message(WARNING "OVIS is currently unsupported in this build configuration, turning it off")
+ set(BUILD_opencv_ovis OFF)
+ endif()
+endif()
+
+if("ffmpeg" IN_LIST FEATURES)
+ if(VCPKG_TARGET_IS_UWP)
+ set(VCPKG_C_FLAGS "/sdl- ${VCPKG_C_FLAGS}")
+ set(VCPKG_CXX_FLAGS "/sdl- ${VCPKG_CXX_FLAGS}")
+ endif()
+endif()
+
+if("qt" IN_LIST FEATURES)
+ list(APPEND ADDITIONAL_BUILD_FLAGS "-DCMAKE_AUTOMOC=ON")
+endif()
+
set(BUILD_opencv_line_descriptor ON)
set(BUILD_opencv_saliency ON)
set(BUILD_opencv_bgsegm ON)
@@ -197,14 +229,11 @@ if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(BUILD_opencv_saliency OFF)
set(BUILD_opencv_bgsegm OFF)
endif()
-if (VCPKG_TARGET_IS_UWP)
- set(BUILD_opencv_quality OFF)
-endif()
vcpkg_configure_cmake(
PREFER_NINJA
SOURCE_PATH ${SOURCE_PATH}
- OPTIONS ${FEATURE_OPTIONS}
+ OPTIONS
###### ocv_options
-DOpenCV_INSTALL_BINARIES_PREFIX=
-DOPENCV_LIB_INSTALL_PATH=lib
@@ -216,63 +245,57 @@ vcpkg_configure_cmake(
# Do not build docs/examples
-DBUILD_DOCS=OFF
-DBUILD_EXAMPLES=OFF
- # Do not build integrated libraries, use external ones whenever possible
+ ###### Disable build 3rd party libs
-DBUILD_JASPER=OFF
-DBUILD_JPEG=OFF
-DBUILD_OPENEXR=OFF
- -DBUILD_PACKAGE=OFF
- -DBUILD_PERF_TESTS=OFF
-DBUILD_PNG=OFF
- -DBUILD_PROTOBUF=OFF
- -DBUILD_TESTS=OFF
-DBUILD_TIFF=OFF
-DBUILD_WEBP=OFF
- -DBUILD_WITH_DEBUG_INFO=ON
- -DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT}
-DBUILD_ZLIB=OFF
- # Select which OpenCV modules should be built
+ ###### Disable build 3rd party components
+ -DBUILD_PROTOBUF=OFF
+ ###### OpenCV Build components
-DBUILD_opencv_apps=OFF
-DBUILD_opencv_bgsegm=${BUILD_opencv_bgsegm}
-DBUILD_opencv_line_descriptor=${BUILD_opencv_line_descriptor}
- -DBUILD_opencv_ovis=${BUILD_opencv_ovis}
- -DBUILD_opencv_python2=OFF
- -DBUILD_opencv_python3=OFF
-DBUILD_opencv_saliency=${BUILD_opencv_saliency}
- # PROTOBUF
+ -DBUILD_PACKAGE=OFF
+ -DBUILD_PERF_TESTS=OFF
+ -DBUILD_TESTS=OFF
+ -DBUILD_WITH_DEBUG_INFO=ON
+ -DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT}
+ ###### PROTOBUF
-DPROTOBUF_UPDATE_FILES=ON
-DUPDATE_PROTO_FILES=ON
- -DWITH_PROTOBUF=ON
# CMAKE
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON
-DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON
# ENABLE
-DENABLE_CXX11=ON
- -DENABLE_PYLINT=OFF
- -DOPENCV_ENABLE_NONFREE=${OPENCV_ENABLE_NONFREE}
- # INSTALL
- -DINSTALL_FORCE_UNIX_PATHS=ON
- -DINSTALL_LICENSE=OFF
- # OPENCV
- -DOPENCV_CONFIG_INSTALL_PATH=share/opencv
- -DOPENCV_OTHER_INSTALL_PATH=share/opencv
+ ###### OPENCV vars
"-DOPENCV_DOWNLOAD_PATH=${DOWNLOADS}/opencv-cache"
${BUILD_WITH_CONTRIB_FLAG}
-DOPENCV_OTHER_INSTALL_PATH=share/opencv
- # WITH
- ${FEATURE_OPPTIONS}
+ ###### customized properties
+ ## Options from vcpkg_check_features()
+ ${FEATURE_OPTIONS}
+ -DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR}
-DWITH_IPP=${WITH_IPP}
- -DWITH_LAPACK=OFF
-DWITH_MATLAB=OFF
-DWITH_MSMF=${WITH_MSMF}
+ -DWITH_PROTOBUF=ON
-DWITH_OPENCLAMDBLAS=OFF
-DWITH_TBB=${WITH_TBB}
-DWITH_VTK=${WITH_VTK}
- -DWITH_ZLIB=${WITH_ZLIB}
- -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}
- -DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR}
- OPTIONS_DEBUG
- -DINSTALL_HEADERS=OFF
- -DINSTALL_OTHER=OFF
+ ###### WITH PROPERTIES explicitly disabled, they have problems with libraries if already installed by user and that are "involuntarily" found during install
+ -DWITH_LAPACK=OFF
+ ###### BUILD_options (mainly modules which require additional libraries)
+ -DBUILD_opencv_ovis=${BUILD_opencv_ovis}
+ ###### The following modules are disabled for UWP
+ -DBUILD_opencv_quality=${BUILD_opencv_quality}
+ ###### Additional build flags
+ ${ADDITIONAL_BUILD_FLAGS}
)
vcpkg_install_cmake()
@@ -321,4 +344,4 @@ file(REMOVE ${CURRENT_PACKAGES_DIR}/setup_vars_opencv3.cmd)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/setup_vars_opencv3.cmd)
file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE)
-file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencv3 RENAME copyright)
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)