mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 12:40:05 +08:00
Download cache
This commit is contained in:
parent
d0c64fca2b
commit
e72d353b45
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
*.user
|
||||
*~
|
||||
.*.swp
|
||||
.cache
|
||||
.DS_Store
|
||||
.sw[a-z]
|
||||
Thumbs.db
|
||||
|
54
3rdparty/ffmpeg/ffmpeg.cmake
vendored
54
3rdparty/ffmpeg/ffmpeg.cmake
vendored
@ -1,25 +1,37 @@
|
||||
# Binary branch name: ffmpeg/master_20161202
|
||||
# Binaries were created for OpenCV: 594c136d1fcbb5816c57516e50f9cbeffbd90835
|
||||
set(FFMPEG_BINARIES_COMMIT "2a19d0006415955c79431116e4634f04d5eb5a74")
|
||||
set(FFMPEG_FILE_HASH_BIN32 "f081abd9d6ca7e425d340ce586f9c090")
|
||||
set(FFMPEG_FILE_HASH_BIN64 "a423363a6eb76d362ca6c406c96c8db6")
|
||||
set(FFMPEG_FILE_HASH_CMAKE "5346ae1854fc7aa569a722e85af480ec")
|
||||
function(download_win_ffmpeg script_var)
|
||||
set(${script_var} "" PARENT_SCOPE)
|
||||
|
||||
set(FFMPEG_DOWNLOAD_URL ${OPENCV_FFMPEG_URL};$ENV{OPENCV_FFMPEG_URL};https://raw.githubusercontent.com/opencv/opencv_3rdparty/${FFMPEG_BINARIES_COMMIT}/ffmpeg/)
|
||||
set(ids BIN32 BIN64 CMAKE)
|
||||
set(name_BIN32 "opencv_ffmpeg.dll")
|
||||
set(name_BIN64 "opencv_ffmpeg_64.dll")
|
||||
set(name_CMAKE "ffmpeg_version.cmake")
|
||||
|
||||
ocv_download(PACKAGE opencv_ffmpeg.dll
|
||||
HASH ${FFMPEG_FILE_HASH_BIN32}
|
||||
URL ${FFMPEG_DOWNLOAD_URL}
|
||||
DESTINATION_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
# Binary branch name: ffmpeg/master_20161202
|
||||
# Binaries were created for OpenCV: 594c136d1fcbb5816c57516e50f9cbeffbd90835
|
||||
set(FFMPEG_BINARIES_COMMIT "2a19d0006415955c79431116e4634f04d5eb5a74")
|
||||
set(FFMPEG_FILE_HASH_BIN32 "f081abd9d6ca7e425d340ce586f9c090")
|
||||
set(FFMPEG_FILE_HASH_BIN64 "a423363a6eb76d362ca6c406c96c8db6")
|
||||
set(FFMPEG_FILE_HASH_CMAKE "5346ae1854fc7aa569a722e85af480ec")
|
||||
|
||||
ocv_download(PACKAGE opencv_ffmpeg_64.dll
|
||||
HASH ${FFMPEG_FILE_HASH_BIN64}
|
||||
URL ${FFMPEG_DOWNLOAD_URL}
|
||||
DESTINATION_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(FFMPEG_BINARIES_COMMIT "2a19d0006415955c79431116e4634f04d5eb5a74")
|
||||
set(FFMPEG_DOWNLOAD_DIR "${OpenCV_BINARY_DIR}/3rdparty/ffmpeg")
|
||||
|
||||
ocv_download(PACKAGE ffmpeg_version.cmake
|
||||
HASH ${FFMPEG_FILE_HASH_CMAKE}
|
||||
URL ${FFMPEG_DOWNLOAD_URL}
|
||||
DESTINATION_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ffmpeg_version.cmake)
|
||||
set(status TRUE)
|
||||
foreach(id ${ids})
|
||||
ocv_download(FILENAME ${name_${id}}
|
||||
HASH ${FFMPEG_FILE_HASH_${id}}
|
||||
URL
|
||||
"$ENV{OPENCV_FFMPEG_URL}"
|
||||
"${OPENCV_FFMPEG_URL}"
|
||||
"https://raw.githubusercontent.com/opencv/opencv_3rdparty/${FFMPEG_BINARIES_COMMIT}/ffmpeg/"
|
||||
DESTINATION_DIR ${FFMPEG_DOWNLOAD_DIR}
|
||||
RELATIVE_URL
|
||||
STATUS res)
|
||||
if(NOT res)
|
||||
set(status FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
if(status)
|
||||
set(${script_var} "${FFMPEG_DOWNLOAD_DIR}/ffmpeg_version.cmake" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
2
3rdparty/ippicv/.gitignore
vendored
2
3rdparty/ippicv/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
downloads/
|
||||
unpack/
|
110
3rdparty/ippicv/downloader.cmake
vendored
110
3rdparty/ippicv/downloader.cmake
vendored
@ -1,110 +0,0 @@
|
||||
#
|
||||
# The script downloads ICV package
|
||||
#
|
||||
# On return this will define:
|
||||
# OPENCV_ICV_PATH - path to unpacked downloaded package
|
||||
#
|
||||
|
||||
function(_icv_downloader)
|
||||
# Commit SHA in the opencv_3rdparty repo
|
||||
set(IPPICV_BINARIES_COMMIT "81a676001ca8075ada498583e4166079e5744668")
|
||||
# Define actual ICV versions
|
||||
if(APPLE)
|
||||
set(OPENCV_ICV_PACKAGE_NAME "ippicv_macosx_20151201.tgz")
|
||||
set(OPENCV_ICV_PACKAGE_HASH "4ff1fde9a7cfdfe7250bfcd8334e0f2f")
|
||||
set(OPENCV_ICV_PLATFORM "macosx")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_osx")
|
||||
elseif(UNIX)
|
||||
if(ANDROID AND NOT (ANDROID_ABI STREQUAL x86 OR ANDROID_ABI STREQUAL x86_64))
|
||||
return()
|
||||
endif()
|
||||
set(OPENCV_ICV_PACKAGE_NAME "ippicv_linux_20151201.tgz")
|
||||
set(OPENCV_ICV_PACKAGE_HASH "808b791a6eac9ed78d32a7666804320e")
|
||||
set(OPENCV_ICV_PLATFORM "linux")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_lnx")
|
||||
elseif(WIN32 AND NOT ARM)
|
||||
set(OPENCV_ICV_PACKAGE_NAME "ippicv_windows_20151201.zip")
|
||||
set(OPENCV_ICV_PACKAGE_HASH "04e81ce5d0e329c3fbc606ae32cad44d")
|
||||
set(OPENCV_ICV_PLATFORM "windows")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_win")
|
||||
else()
|
||||
return() # Not supported
|
||||
endif()
|
||||
|
||||
set(OPENCV_ICV_UNPACK_PATH "${CMAKE_BINARY_DIR}/3rdparty/ippicv")
|
||||
set(OPENCV_ICV_PATH "${OPENCV_ICV_UNPACK_PATH}${OPENCV_ICV_PACKAGE_SUBDIR}")
|
||||
|
||||
if(DEFINED OPENCV_ICV_PACKAGE_DOWNLOADED
|
||||
AND OPENCV_ICV_PACKAGE_DOWNLOADED STREQUAL OPENCV_ICV_PACKAGE_HASH
|
||||
AND EXISTS ${OPENCV_ICV_PATH})
|
||||
# Package has been downloaded and checked by the previous build
|
||||
set(OPENCV_ICV_PATH "${OPENCV_ICV_PATH}" PARENT_SCOPE)
|
||||
return()
|
||||
else()
|
||||
if(EXISTS ${OPENCV_ICV_UNPACK_PATH})
|
||||
message(STATUS "ICV: Removing previous unpacked package: ${OPENCV_ICV_UNPACK_PATH}")
|
||||
file(REMOVE_RECURSE ${OPENCV_ICV_UNPACK_PATH})
|
||||
endif()
|
||||
endif()
|
||||
unset(OPENCV_ICV_PACKAGE_DOWNLOADED CACHE)
|
||||
|
||||
set(OPENCV_ICV_PACKAGE_ARCHIVE "${CMAKE_CURRENT_LIST_DIR}/downloads/${OPENCV_ICV_PLATFORM}-${OPENCV_ICV_PACKAGE_HASH}/${OPENCV_ICV_PACKAGE_NAME}")
|
||||
get_filename_component(OPENCV_ICV_PACKAGE_ARCHIVE_DIR "${OPENCV_ICV_PACKAGE_ARCHIVE}" PATH)
|
||||
if(EXISTS "${OPENCV_ICV_PACKAGE_ARCHIVE}")
|
||||
file(MD5 "${OPENCV_ICV_PACKAGE_ARCHIVE}" archive_md5)
|
||||
if(NOT archive_md5 STREQUAL OPENCV_ICV_PACKAGE_HASH)
|
||||
message(WARNING "ICV: Local copy of ICV package has invalid MD5 hash: ${archive_md5} (expected: ${OPENCV_ICV_PACKAGE_HASH})")
|
||||
file(REMOVE "${OPENCV_ICV_PACKAGE_ARCHIVE}")
|
||||
file(REMOVE_RECURSE "${OPENCV_ICV_PACKAGE_ARCHIVE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${OPENCV_ICV_PACKAGE_ARCHIVE}")
|
||||
if(NOT DEFINED OPENCV_ICV_URL)
|
||||
if(DEFINED ENV{OPENCV_ICV_URL})
|
||||
set(OPENCV_ICV_URL $ENV{OPENCV_ICV_URL})
|
||||
else()
|
||||
set(OPENCV_ICV_URL "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_BINARIES_COMMIT}/ippicv")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY ${OPENCV_ICV_PACKAGE_ARCHIVE_DIR})
|
||||
message(STATUS "ICV: Downloading ${OPENCV_ICV_PACKAGE_NAME}...")
|
||||
file(DOWNLOAD "${OPENCV_ICV_URL}/${OPENCV_ICV_PACKAGE_NAME}" "${OPENCV_ICV_PACKAGE_ARCHIVE}"
|
||||
TIMEOUT 600 STATUS __status
|
||||
EXPECTED_MD5 ${OPENCV_ICV_PACKAGE_HASH})
|
||||
if(NOT __status EQUAL 0)
|
||||
message(FATAL_ERROR "ICV: Failed to download ICV package: ${OPENCV_ICV_PACKAGE_NAME}. Status=${__status}")
|
||||
else()
|
||||
# Don't remove this code, because EXPECTED_MD5 parameter doesn't fail "file(DOWNLOAD)" step
|
||||
# on wrong hash
|
||||
file(MD5 "${OPENCV_ICV_PACKAGE_ARCHIVE}" archive_md5)
|
||||
if(NOT archive_md5 STREQUAL OPENCV_ICV_PACKAGE_HASH)
|
||||
message(FATAL_ERROR "ICV: Downloaded copy of ICV package has invalid MD5 hash: ${archive_md5} (expected: ${OPENCV_ICV_PACKAGE_HASH})")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ocv_assert(EXISTS "${OPENCV_ICV_PACKAGE_ARCHIVE}")
|
||||
ocv_assert(NOT EXISTS "${OPENCV_ICV_UNPACK_PATH}")
|
||||
file(MAKE_DIRECTORY ${OPENCV_ICV_UNPACK_PATH})
|
||||
ocv_assert(EXISTS "${OPENCV_ICV_UNPACK_PATH}")
|
||||
|
||||
message(STATUS "ICV: Unpacking ${OPENCV_ICV_PACKAGE_NAME} to ${OPENCV_ICV_UNPACK_PATH}...")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xz "${OPENCV_ICV_PACKAGE_ARCHIVE}"
|
||||
WORKING_DIRECTORY "${OPENCV_ICV_UNPACK_PATH}"
|
||||
RESULT_VARIABLE __result)
|
||||
|
||||
if(NOT __result EQUAL 0)
|
||||
message(FATAL_ERROR "ICV: Failed to unpack ICV package from ${OPENCV_ICV_PACKAGE_ARCHIVE} to ${OPENCV_ICV_UNPACK_PATH} with error ${__result}")
|
||||
endif()
|
||||
|
||||
ocv_assert(EXISTS "${OPENCV_ICV_PATH}")
|
||||
|
||||
set(OPENCV_ICV_PACKAGE_DOWNLOADED "${OPENCV_ICV_PACKAGE_HASH}" CACHE INTERNAL "ICV package hash")
|
||||
|
||||
message(STATUS "ICV: Package successfully downloaded")
|
||||
set(OPENCV_ICV_PATH "${OPENCV_ICV_PATH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
_icv_downloader()
|
40
3rdparty/ippicv/ippicv.cmake
vendored
Normal file
40
3rdparty/ippicv/ippicv.cmake
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
function(download_ippicv root_var)
|
||||
set(${root_var} "" PARENT_SCOPE)
|
||||
|
||||
# Commit SHA in the opencv_3rdparty repo
|
||||
set(IPPICV_COMMIT "81a676001ca8075ada498583e4166079e5744668")
|
||||
# Define actual ICV versions
|
||||
if(APPLE)
|
||||
set(OPENCV_ICV_NAME "ippicv_macosx_20151201.tgz")
|
||||
set(OPENCV_ICV_HASH "4ff1fde9a7cfdfe7250bfcd8334e0f2f")
|
||||
set(OPENCV_ICV_PLATFORM "macosx")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_osx")
|
||||
elseif((UNIX AND NOT ANDROID) OR (UNIX AND ANDROID_ABI MATCHES "x86"))
|
||||
set(OPENCV_ICV_NAME "ippicv_linux_20151201.tgz")
|
||||
set(OPENCV_ICV_HASH "808b791a6eac9ed78d32a7666804320e")
|
||||
set(OPENCV_ICV_PLATFORM "linux")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_lnx")
|
||||
elseif(WIN32 AND NOT ARM)
|
||||
set(OPENCV_ICV_NAME "ippicv_windows_20151201.zip")
|
||||
set(OPENCV_ICV_HASH "04e81ce5d0e329c3fbc606ae32cad44d")
|
||||
set(OPENCV_ICV_PLATFORM "windows")
|
||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_win")
|
||||
else()
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/ippicv")
|
||||
ocv_download(FILENAME ${OPENCV_ICV_NAME}
|
||||
HASH ${OPENCV_ICV_HASH}
|
||||
URL
|
||||
"${OPENCV_IPPICV_URL}"
|
||||
"$ENV{OPENCV_IPPICV_URL}"
|
||||
"https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"
|
||||
DESTINATION_DIR "${THE_ROOT}"
|
||||
STATUS res
|
||||
UNPACK RELATIVE_URL)
|
||||
|
||||
if(res)
|
||||
set(${root_var} "${THE_ROOT}/${OPENCV_ICV_PACKAGE_SUBDIR}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
117
3rdparty/tbb/CMakeLists.txt
vendored
117
3rdparty/tbb/CMakeLists.txt
vendored
@ -6,112 +6,27 @@ if (WIN32 AND NOT ARM)
|
||||
endif()
|
||||
|
||||
set(tbb_ver "tbb44_20160128oss")
|
||||
set(tbb_url "http://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160128oss_src_0.tgz")
|
||||
set(tbb_md5 "9d8a4cdf43496f1b3f7c473a5248e5cc")
|
||||
set(tbb_filename "4.4.3.tar.gz")
|
||||
set(tbb_subdir "tbb-4.4.3")
|
||||
set(tbb_md5 "8e7200af3ac16e91a0d1535c606a485c")
|
||||
set(tbb_version_file "version_string.ver")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4702)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow)
|
||||
|
||||
# 4.1 update 4 - The first release that supports Windows RT. Hangs on some Android devices
|
||||
#set(tbb_ver "tbb41_20130613oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130613oss_src.tgz")
|
||||
#set(tbb_md5 "108c8c1e481b0aaea61878289eb28b6a")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
#ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4702)
|
||||
|
||||
# 4.1 update 2 - works fine
|
||||
#set(tbb_ver "tbb41_20130116oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130116oss_src.tgz")
|
||||
#set(tbb_md5 "3809790e1001a1b32d59c9fee590ee85")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
#ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow)
|
||||
|
||||
# 4.1 update 3 dev - Hangs on some Android devices
|
||||
#set(tbb_ver "tbb41_20130401oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130401oss_src.tgz")
|
||||
#set(tbb_md5 "f2f591a0d2ca8f801e221ce7d9ea84bb")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
#ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow)
|
||||
|
||||
# 4.1 update 2 - works fine
|
||||
#set(tbb_ver "tbb41_20130116oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130116oss_src.tgz")
|
||||
#set(tbb_md5 "3809790e1001a1b32d59c9fee590ee85")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
#ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow)
|
||||
|
||||
# 4.1 update 1 - works fine
|
||||
#set(tbb_ver "tbb41_20121003oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20121003oss_src.tgz")
|
||||
#set(tbb_md5 "2a684fefb855d2d0318d1ef09afa75ff")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.1 - works fine
|
||||
#set(tbb_ver "tbb41_20120718oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20120718oss_src.tgz")
|
||||
#set(tbb_md5 "31b9ec300f3d09da2504d5d882788dd4")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.0 update 5 - works fine
|
||||
#set(tbb_ver "tbb40_20120613oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20120613oss_src.tgz")
|
||||
#set(tbb_md5 "da01ed74944ec5950cfae3476901a172")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.0 update 4 - works fine
|
||||
#set(tbb_ver "tbb40_20120408oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20120408oss_src.tgz")
|
||||
#set(tbb_md5 "734b356da7fe0ed308741f3e6018251e")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.0 update 3 - build broken
|
||||
#set(tbb_ver "tbb40_20120201oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20120201oss_src.tgz")
|
||||
#set(tbb_md5 "4669e7d4adee018de7a7b8b972987218")
|
||||
#set(tbb_version_file "version_string.tmp")
|
||||
|
||||
set(tbb_tarball "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_ver}_src.tgz")
|
||||
set(tbb_src_dir "${CMAKE_CURRENT_BINARY_DIR}/${tbb_ver}")
|
||||
|
||||
if(EXISTS "${tbb_tarball}")
|
||||
file(MD5 "${tbb_tarball}" tbb_local_md5)
|
||||
if(NOT tbb_local_md5 STREQUAL tbb_md5)
|
||||
message(WARNING "Local copy of TBB source tarball has invalid MD5 hash: ${tbb_local_md5} (expected: ${tbb_md5})")
|
||||
file(REMOVE "${tbb_tarball}")
|
||||
if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${tbb_ver}")
|
||||
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/${tbb_ver}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${tbb_tarball}")
|
||||
message(STATUS "Downloading ${tbb_ver}_src.tgz")
|
||||
file(DOWNLOAD "${tbb_url}" "${tbb_tarball}" TIMEOUT 600 STATUS __statvar)
|
||||
if(NOT __statvar EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to download TBB sources (${__statvar}): ${tbb_url}")
|
||||
endif()
|
||||
file(MD5 "${tbb_tarball}" tbb_local_md5)
|
||||
if(NOT tbb_local_md5 STREQUAL tbb_md5)
|
||||
file(REMOVE "${tbb_tarball}")
|
||||
message(FATAL_ERROR "Downloaded TBB source tarball has invalid MD5 hash: ${tbb_local_md5} (expected: ${tbb_md5})")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${tbb_src_dir}")
|
||||
file(REMOVE_RECURSE "${tbb_src_dir}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# untar TBB sources
|
||||
if(NOT EXISTS "${tbb_src_dir}")
|
||||
message(STATUS "Unpacking ${tbb_ver}_src.tgz to ${tbb_src_dir}")
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xz "${tbb_tarball}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
RESULT_VARIABLE tbb_untar_RESULT)
|
||||
|
||||
if(NOT tbb_untar_RESULT EQUAL 0 OR NOT EXISTS "${tbb_src_dir}")
|
||||
message(FATAL_ERROR "Failed to unpack TBB sources from ${tbb_tarball} to ${tbb_src_dir} with error ${tbb_untar_RESULT}")
|
||||
endif()
|
||||
set(tbb_src_dir "${OpenCV_BINARY_DIR}/3rdparty/tbb")
|
||||
ocv_download(FILENAME ${tbb_filename}
|
||||
HASH ${tbb_md5}
|
||||
URL
|
||||
"${OPENCV_TBB_URL}"
|
||||
"$ENV{OPENCV_TBB_URL}"
|
||||
"https://github.com/01org/tbb/archive/"
|
||||
DESTINATION_DIR ${tbb_src_dir}
|
||||
STATUS res
|
||||
UNPACK RELATIVE_URL)
|
||||
if(NOT res)
|
||||
return()
|
||||
endif()
|
||||
set(tbb_src_dir "${tbb_src_dir}/${tbb_subdir}")
|
||||
|
||||
ocv_include_directories("${tbb_src_dir}/include"
|
||||
"${tbb_src_dir}/src/"
|
||||
|
@ -119,6 +119,8 @@ ocv_cmake_eval(DEBUG_PRE ONCE)
|
||||
|
||||
ocv_clear_vars(OpenCVModules_TARGETS)
|
||||
|
||||
include(cmake/OpenCVDownload.cmake)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Break in case of popular CMake configuration mistakes
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -301,8 +303,6 @@ OCV_OPTION(CV_ENABLE_INTRINSICS "Use intrinsic-based optimized code" ON )
|
||||
OCV_OPTION(CV_DISABLE_OPTIMIZATION "Disable explicit optimized code (dispatched code/intrinsics/loop unrolling/etc)" OFF )
|
||||
|
||||
|
||||
OCV_OPTION(DOWNLOAD_EXTERNAL_TEST_DATA "Download external test data (Python executable and OPENCV_TEST_DATA_PATH environment variable may be required)" OFF )
|
||||
|
||||
|
||||
if(ENABLE_IMPL_COLLECTION)
|
||||
add_definitions(-DCV_COLLECT_IMPL_DATA)
|
||||
@ -1108,7 +1108,7 @@ endif(DEFINED WITH_1394)
|
||||
|
||||
if(DEFINED WITH_FFMPEG OR HAVE_FFMPEG)
|
||||
if(WIN32)
|
||||
status(" FFMPEG:" WITH_FFMPEG THEN "YES (prebuilt binaries)" ELSE NO)
|
||||
status(" FFMPEG:" HAVE_FFMPEG THEN "YES (prebuilt binaries)" ELSE NO)
|
||||
else()
|
||||
status(" FFMPEG:" HAVE_FFMPEG THEN YES ELSE NO)
|
||||
endif()
|
||||
|
@ -68,7 +68,9 @@ endfunction()
|
||||
|
||||
if(BUILD_TBB)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
||||
message(STATUS "Found TBB: build")
|
||||
if(NOT TARGET tbb)
|
||||
return()
|
||||
endif()
|
||||
set(HAVE_TBB TRUE)
|
||||
endif()
|
||||
|
||||
|
133
cmake/OpenCVDownload.cmake
Normal file
133
cmake/OpenCVDownload.cmake
Normal file
@ -0,0 +1,133 @@
|
||||
#
|
||||
# Download and optionally unpack a file
|
||||
#
|
||||
# ocv_download(FILENAME p HASH h URL u1 [u2 ...] DESTINATION_DIR d [STATUS s] [UNPACK] [RELATIVE])
|
||||
# FILENAME - filename
|
||||
# HASH - MD5 hash
|
||||
# URL - full download url (first nonempty value will be chosen)
|
||||
# DESTINATION_DIR - file will be copied to this directory
|
||||
# STATUS - passed variable will be updated in parent scope,
|
||||
# function will not fail the build in case of download problem if this option is provided,
|
||||
# but will fail in case when other operations (copy, remove, etc.) failed
|
||||
# UNPACK - downloaded file will be unpacked to DESTINATION_DIR
|
||||
# RELATIVE_URL - if set, then URL is treated as a base, and FILENAME will be appended to it
|
||||
# Note: uses OPENCV_DOWNLOAD_PATH folder as cache, default is <opencv>/.cache
|
||||
|
||||
set(OPENCV_DOWNLOAD_PATH "${OpenCV_SOURCE_DIR}/.cache" CACHE PATH "Cache directory for downloaded files")
|
||||
set(OPENCV_DOWNLOAD_LOG "${OpenCV_BINARY_DIR}/CMakeDownloadLog.txt")
|
||||
|
||||
# Init download cache directory and log file
|
||||
if(NOT EXISTS "${OPENCV_DOWNLOAD_PATH}")
|
||||
file(MAKE_DIRECTORY ${OPENCV_DOWNLOAD_PATH})
|
||||
endif()
|
||||
file(WRITE "${OPENCV_DOWNLOAD_LOG}" "use_cache \"${OPENCV_DOWNLOAD_PATH}\"\n")
|
||||
|
||||
|
||||
function(ocv_download)
|
||||
cmake_parse_arguments(DL "UNPACK;RELATIVE_URL" "FILENAME;HASH;DESTINATION_DIR;STATUS" "URL" ${ARGN})
|
||||
|
||||
ocv_assert(DEFINED DL_FILENAME)
|
||||
ocv_assert(DEFINED DL_HASH)
|
||||
ocv_assert(DEFINED DL_URL)
|
||||
ocv_assert(DEFINED DL_DESTINATION_DIR)
|
||||
|
||||
if(DEFINED DL_STATUS)
|
||||
set(${DL_STATUS} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# Select first non-empty url
|
||||
foreach(url ${DL_URL})
|
||||
if(url)
|
||||
set(DL_URL "${url}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Append filename to url if needed
|
||||
if(DL_RELATIVE_URL)
|
||||
set(DL_URL "${DL_URL}${DL_FILENAME}")
|
||||
endif()
|
||||
|
||||
set(mode "copy")
|
||||
if(DL_UNPACK)
|
||||
set(mode "unpack")
|
||||
endif()
|
||||
|
||||
# Log all calls to file
|
||||
file(APPEND "${OPENCV_DOWNLOAD_LOG}" "do_${mode} \"${DL_FILENAME}\" \"${DL_HASH}\" \"${DL_URL}\" \"${DL_DESTINATION_DIR}\"\n")
|
||||
# ... and to console
|
||||
message(STATUS "Download: ${DL_FILENAME}")
|
||||
|
||||
# Copy mode: check if copy destination exists and is correct
|
||||
if(NOT DL_UNPACK)
|
||||
set(COPY_DESTINATION "${DL_DESTINATION_DIR}/${DL_FILENAME}")
|
||||
if(EXISTS "${COPY_DESTINATION}")
|
||||
file(MD5 "${COPY_DESTINATION}" target_md5)
|
||||
if(target_md5 STREQUAL DL_HASH)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check cache first
|
||||
set(CACHE_CANDIDATE "${OPENCV_DOWNLOAD_PATH}/${DL_HASH}-${DL_FILENAME}")
|
||||
if(EXISTS "${CACHE_CANDIDATE}")
|
||||
file(MD5 "${CACHE_CANDIDATE}" target_md5)
|
||||
if(NOT target_md5 STREQUAL DL_HASH)
|
||||
file(REMOVE ${CACHE_CANDIDATE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Download
|
||||
if(NOT EXISTS "${CACHE_CANDIDATE}")
|
||||
file(DOWNLOAD "${DL_URL}" "${CACHE_CANDIDATE}"
|
||||
INACTIVITY_TIMEOUT 60
|
||||
TIMEOUT 600
|
||||
STATUS status
|
||||
LOG log)
|
||||
string(REPLACE "\n" "\n# " log "# ${log}")
|
||||
file(APPEND "${OPENCV_DOWNLOAD_LOG}" "${log}\n\n")
|
||||
if(NOT status EQUAL 0)
|
||||
set(msg_level FATAL_ERROR)
|
||||
if(DEFINED DL_STATUS)
|
||||
set(${DL_STATUS} FALSE PARENT_SCOPE)
|
||||
set(msg_level WARNING)
|
||||
endif()
|
||||
message(${msg_level} "Download failed: ${status}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Don't remove this code, because EXPECTED_MD5 parameter doesn't fail "file(DOWNLOAD)" step on wrong hash
|
||||
file(MD5 "${CACHE_CANDIDATE}" target_md5)
|
||||
if(NOT target_md5 STREQUAL DL_HASH)
|
||||
set(msg_level FATAL_ERROR)
|
||||
if(DEFINED DL_STATUS)
|
||||
set(${DL_STATUS} FALSE PARENT_SCOPE)
|
||||
set(msg_level WARNING)
|
||||
endif()
|
||||
message(${msg_level} "Hash mismatch: ${target_md5}")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Unpack or copy
|
||||
if(DL_UNPACK)
|
||||
if(EXISTS "${DL_DESTINATION_DIR}")
|
||||
file(REMOVE_RECURSE "${DL_DESTINATION_DIR}")
|
||||
endif()
|
||||
file(MAKE_DIRECTORY "${DL_DESTINATION_DIR}")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E tar xz "${CACHE_CANDIDATE}"
|
||||
WORKING_DIRECTORY "${DL_DESTINATION_DIR}"
|
||||
RESULT_VARIABLE res)
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "Unpack failed: ${res}")
|
||||
endif()
|
||||
else()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CACHE_CANDIDATE}" "${COPY_DESTINATION}"
|
||||
RESULT_VARIABLE res)
|
||||
if(NOT res EQUAL 0)
|
||||
message(FATAL_ERROR "Copy failed: ${res}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
@ -233,6 +233,7 @@ endmacro()
|
||||
if(DEFINED ENV{OPENCV_IPP_PATH} AND NOT DEFINED IPPROOT)
|
||||
set(IPPROOT "$ENV{OPENCV_IPP_PATH}")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED IPPROOT)
|
||||
if(IOS AND NOT x86_64)
|
||||
# 2016/10: There is an issue with MacOS binary .a file.
|
||||
@ -240,10 +241,9 @@ if(NOT DEFINED IPPROOT)
|
||||
# So try to ignore i386 version
|
||||
return()
|
||||
endif()
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ippicv/downloader.cmake")
|
||||
if(DEFINED OPENCV_ICV_PATH)
|
||||
set(IPPROOT "${OPENCV_ICV_PATH}")
|
||||
else()
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ippicv/ippicv.cmake")
|
||||
download_ippicv(IPPROOT)
|
||||
if(NOT IPPROOT)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -217,7 +217,11 @@ ocv_clear_vars(HAVE_FFMPEG)
|
||||
if(WITH_FFMPEG)
|
||||
if(WIN32 AND NOT ARM)
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg.cmake")
|
||||
set(HAVE_FFMPEG TRUE)
|
||||
download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT)
|
||||
if(FFMPEG_CMAKE_SCRIPT)
|
||||
set(HAVE_FFMPEG TRUE)
|
||||
include("${FFMPEG_CMAKE_SCRIPT}")
|
||||
endif()
|
||||
elseif(PKG_CONFIG_FOUND)
|
||||
ocv_check_modules(FFMPEG libavcodec libavformat libavutil libswscale)
|
||||
ocv_check_modules(FFMPEG_libavresample libavresample)
|
||||
|
@ -1063,78 +1063,6 @@ macro(ocv_get_all_libs _modules _extra _3rdparty)
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
function(ocv_download)
|
||||
cmake_parse_arguments(DL "" "PACKAGE;HASH;URL;DESTINATION_DIR;DOWNLOAD_DIR" "" ${ARGN})
|
||||
if(NOT DL_DOWNLOAD_DIR)
|
||||
set(DL_DOWNLOAD_DIR "${DL_DESTINATION_DIR}/downloads")
|
||||
endif()
|
||||
if(DEFINED DL_DESTINATION_DIR)
|
||||
set(DESTINATION_TARGET "${DL_DESTINATION_DIR}/${DL_PACKAGE}")
|
||||
if(EXISTS "${DESTINATION_TARGET}")
|
||||
file(MD5 "${DESTINATION_TARGET}" target_md5)
|
||||
if(NOT target_md5 STREQUAL DL_HASH)
|
||||
file(REMOVE "${DESTINATION_TARGET}")
|
||||
else()
|
||||
set(DOWNLOAD_PACKAGE_LOCATION "" PARENT_SCOPE)
|
||||
unset(DOWNLOAD_PACKAGE_LOCATION)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(DOWNLOAD_TARGET "${DL_DOWNLOAD_DIR}/${DL_HASH}/${DL_PACKAGE}")
|
||||
get_filename_component(DOWNLOAD_TARGET_DIR "${DOWNLOAD_TARGET}" PATH)
|
||||
if(EXISTS "${DOWNLOAD_TARGET}")
|
||||
file(MD5 "${DOWNLOAD_TARGET}" target_md5)
|
||||
if(NOT target_md5 STREQUAL DL_HASH)
|
||||
message(WARNING "Download: Local copy of ${DL_PACKAGE} has invalid MD5 hash: ${target_md5} (expected: ${DL_HASH})")
|
||||
file(REMOVE "${DOWNLOAD_TARGET}")
|
||||
file(REMOVE_RECURSE "${DOWNLOAD_TARGET_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${DOWNLOAD_TARGET}")
|
||||
set(__url "")
|
||||
foreach(__url_i ${DL_URL})
|
||||
if(NOT ("${__url_i}" STREQUAL ""))
|
||||
set(__url "${__url_i}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if("${__url}" STREQUAL "")
|
||||
message(FATAL_ERROR "Download URL is not specified for package ${DL_PACKAGE}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${DOWNLOAD_TARGET_DIR}")
|
||||
file(MAKE_DIRECTORY ${DOWNLOAD_TARGET_DIR})
|
||||
endif()
|
||||
message(STATUS "Downloading ${DL_PACKAGE}...")
|
||||
#message(STATUS " ${__url}${DL_PACKAGE}")
|
||||
file(DOWNLOAD "${__url}${DL_PACKAGE}" "${DOWNLOAD_TARGET}"
|
||||
TIMEOUT 600 STATUS __status
|
||||
EXPECTED_MD5 ${DL_HASH})
|
||||
if(NOT __status EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to download ${DL_PACKAGE}. Status=${__status}")
|
||||
else()
|
||||
# Don't remove this code, because EXPECTED_MD5 parameter doesn't fail "file(DOWNLOAD)" step on wrong hash
|
||||
file(MD5 "${DOWNLOAD_TARGET}" target_md5)
|
||||
if(NOT target_md5 STREQUAL DL_HASH)
|
||||
message(FATAL_ERROR "Downloaded copy of ${DL_PACKAGE} has invalid MD5 hash: ${target_md5} (expected: ${DL_HASH})")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "Downloading ${DL_PACKAGE}... Done")
|
||||
endif()
|
||||
|
||||
if(DEFINED DL_DESTINATION_DIR)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${DOWNLOAD_TARGET}" "${DL_DESTINATION_DIR}/"
|
||||
RESULT_VARIABLE __result)
|
||||
|
||||
if(NOT __result EQUAL 0)
|
||||
message(FATAL_ERROR "Downloader: Failed to copy package from ${DOWNLOAD_TARGET} to ${DL_DESTINATION_DIR} with error ${__result}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(DOWNLOAD_PACKAGE_LOCATION ${DOWNLOAD_TARGET} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(ocv_add_test_from_target test_name test_kind the_target)
|
||||
if(CMAKE_VERSION VERSION_GREATER "2.8" AND NOT CMAKE_CROSSCOMPILING)
|
||||
|
@ -255,15 +255,16 @@ endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
|
||||
|
||||
if(WIN32 AND WITH_FFMPEG)
|
||||
if(WIN32 AND HAVE_FFMPEG)
|
||||
#copy ffmpeg dll to the output folder
|
||||
if(MSVC64 OR MINGW64)
|
||||
set(FFMPEG_SUFFIX _64)
|
||||
endif()
|
||||
|
||||
set(ffmpeg_dir "${OpenCV_BINARY_DIR}/3rdparty/ffmpeg")
|
||||
set(ffmpeg_bare_name "opencv_ffmpeg${FFMPEG_SUFFIX}.dll")
|
||||
set(ffmpeg_bare_name_ver "opencv_ffmpeg${OPENCV_DLLVERSION}${FFMPEG_SUFFIX}.dll")
|
||||
set(ffmpeg_path "${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/${ffmpeg_bare_name}")
|
||||
set(ffmpeg_path "${ffmpeg_dir}/${ffmpeg_bare_name}")
|
||||
|
||||
if(MSVC_IDE)
|
||||
add_custom_command(TARGET ${the_module} POST_BUILD
|
||||
@ -283,8 +284,8 @@ if(WIN32 AND WITH_FFMPEG)
|
||||
install(FILES "${ffmpeg_path}" DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs RENAME "${ffmpeg_bare_name_ver}")
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/opencv_ffmpeg.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}.dll")
|
||||
install(FILES "${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/opencv_ffmpeg_64.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}_64.dll")
|
||||
install(FILES "${ffmpeg_dir}/opencv_ffmpeg.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}.dll")
|
||||
install(FILES "${ffmpeg_dir}/opencv_ffmpeg_64.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}_64.dll")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
Loading…
Reference in New Issue
Block a user