Skip to content

Commit

Permalink
[ffmpeg/opencv4] Update opencv4 feature dependency and remove ffmpeg …
Browse files Browse the repository at this point in the history
…feature 'postproc' from default feature (#19358)

* [ffmpeg/opencv4] Update opencv4 feature dependency and remove ffmpeg feature 'postproc' from default feature

* Update the baseline version

* [opencv3] Update the feature dependency

* Update the baseline

* [opencv2] Update the feature dependency

* Update the baseline version

* Fix uwp build failures

* Update the baseline version

* Fix opencv2 version

* update the baseline version

* update the baseline version

* Un-edit git-tree.

* Update cuda feature

* Update the baseline

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
  • Loading branch information
PhoebeHui and BillyONeal authored Aug 13, 2021
1 parent 7bdf2f8 commit eb9cb29
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 104 deletions.
3 changes: 1 addition & 2 deletions ports/ffmpeg/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ffmpeg",
"version": "4.4",
"port-version": 13,
"port-version": 14,
"description": [
"a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
"FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations."
Expand All @@ -22,7 +22,6 @@
"avdevice",
"avfilter",
"avformat",
"postproc",
"swresample",
"swscale"
],
Expand Down
49 changes: 0 additions & 49 deletions ports/opencv2/CONTROL

This file was deleted.

26 changes: 13 additions & 13 deletions ports/opencv2/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ file(REMOVE "${SOURCE_PATH}/cmake/FindCUDA.cmake")
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindCUDA")

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"cuda" WITH_CUDA
"eigen" WITH_EIGEN
"ffmpeg" WITH_FFMPEG
Expand All @@ -57,9 +58,8 @@ if("ffmpeg" IN_LIST FEATURES)
endif()
endif()

vcpkg_configure_cmake(
PREFER_NINJA
SOURCE_PATH ${SOURCE_PATH}
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
###### ocv_options
-DCMAKE_DEBUG_POSTFIX=d
Expand Down Expand Up @@ -95,12 +95,12 @@ vcpkg_configure_cmake(
-DWITH_CUBLAS=OFF # newer libcublas cannot be found by the old cuda cmake script in opencv2, requires a fix
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/opencv" TARGET_PATH "share/opencv")
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME opencv CONFIG_PATH "share/opencv")
vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES)
file(READ "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" OPENCV_MODULES)
string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)"
"set(CMAKE_IMPORT_FILE_VERSION 1)
find_package(CUDA QUIET)
Expand All @@ -113,14 +113,14 @@ set(CMAKE_AUTOUIC ON)
find_package(Qt5 COMPONENTS OpenGL Concurrent Test QUIET)
find_package(TIFF QUIET)" OPENCV_MODULES "${OPENCV_MODULES}")

file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" "${OPENCV_MODULES}")

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
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)
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")

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
101 changes: 101 additions & 0 deletions ports/opencv2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"name": "opencv2",
"version": "2.4.13.7",
"port-version": 6,
"description": "computer vision library",
"homepage": "https://github.com/opencv/opencv",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
],
"default-features": [
"eigen",
"jpeg",
"png",
"tiff"
],
"features": {
"cuda": {
"description": "CUDA support for opencv",
"dependencies": [
"cuda"
]
},
"eigen": {
"description": "Eigen support for opencv",
"dependencies": [
"eigen3"
]
},
"ffmpeg": {
"description": "ffmpeg support for opencv",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avformat",
"swresample",
"swscale"
]
}
]
},
"jasper": {
"description": "JPEG 2000 support for opencv",
"dependencies": [
"jasper"
]
},
"jpeg": {
"description": "JPEG support for opencv",
"dependencies": [
"libjpeg-turbo"
]
},
"openexr": {
"description": "OpenEXR support for opencv",
"dependencies": [
"openexr"
]
},
"opengl": {
"description": "opengl support for opencv",
"dependencies": [
"opengl"
]
},
"png": {
"description": "PNG support for opencv",
"dependencies": [
"libpng"
]
},
"qt": {
"description": "Qt GUI support for opencv",
"dependencies": [
{
"name": "qt5-base",
"default-features": false
}
]
},
"tiff": {
"description": "TIFF support for opencv",
"dependencies": [
"tiff"
]
},
"world": {
"description": "Compile to a single package support for opencv"
}
}
}
15 changes: 15 additions & 0 deletions ports/opencv3/0010-fix-uwp-tiff-imgcodecs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt
index 24f89e6..435deb6 100644
--- a/modules/imgcodecs/CMakeLists.txt
+++ b/modules/imgcodecs/CMakeLists.txt
@@ -9,6 +9,10 @@ ocv_add_module(imgcodecs opencv_imgproc WRAP java objc python)

ocv_clear_vars(GRFMT_LIBS)

+if(MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996")
+endif()
+
if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif()
30 changes: 15 additions & 15 deletions ports/opencv3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ vcpkg_from_github(
0005-fix-vtk9.patch
0006-fix-uwp.patch
0008-devendor-quirc.patch
0010-fix-uwp-tiff-imgcodecs.patch
)

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
Expand Down Expand Up @@ -252,9 +253,8 @@ if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(BUILD_opencv_bgsegm OFF)
endif()

vcpkg_configure_cmake(
PREFER_NINJA
SOURCE_PATH ${SOURCE_PATH}
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
###### opencv cpu recognition is broken, always using host and not target: here we bypass that
-DOPENCV_SKIP_SYSTEM_PROCESSOR_DETECTION=TRUE
Expand Down Expand Up @@ -344,12 +344,12 @@ vcpkg_configure_cmake(
${ADDITIONAL_BUILD_FLAGS}
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/opencv" TARGET_PATH "share/opencv")
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME opencv CONFIG_PATH "share/opencv")
vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES)
file(READ "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" OPENCV_MODULES)
set(DEPS_STRING "include(CMakeFindDependencyMacro)
find_dependency(protobuf CONFIG)
if(protobuf_FOUND)
Expand Down Expand Up @@ -437,20 +437,20 @@ find_dependency(Qt5 COMPONENTS OpenGL Concurrent Test)")
"OgreGLSupport" OPENCV_MODULES "${OPENCV_MODULES}")
endif()

file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" "${OPENCV_MODULES}")


file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
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)
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")

if(VCPKG_TARGET_IS_ANDROID)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/README.android)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/README.android)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/README.android")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/README.android")
endif()

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
21 changes: 19 additions & 2 deletions ports/opencv3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"name": "opencv3",
"version": "3.4.14",
"port-version": 1,
"port-version": 2,
"description": "computer vision library",
"homepage": "https://github.com/opencv/opencv",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
],
"default-features": [
Expand Down Expand Up @@ -68,7 +76,16 @@
"ffmpeg": {
"description": "ffmpeg support for opencv",
"dependencies": [
"ffmpeg"
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avformat",
"swresample",
"swscale"
]
}
]
},
"flann": {
Expand Down
15 changes: 15 additions & 0 deletions ports/opencv4/0010-fix-uwp-tiff-imgcodecs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt
index 24f89e6..435deb6 100644
--- a/modules/imgcodecs/CMakeLists.txt
+++ b/modules/imgcodecs/CMakeLists.txt
@@ -9,6 +9,10 @@ ocv_add_module(imgcodecs opencv_imgproc WRAP java objc python)

ocv_clear_vars(GRFMT_LIBS)

+if(MSVC)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996")
+endif()
+
if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif()
Loading

0 comments on commit eb9cb29

Please sign in to comment.