if(NOT BUILD_SHARED_LIBS)
install(TARGETS tbb ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()
+
+# get TBB version
+ocv_parse_header("${tbb_src_dir}/include/tbb/tbb_stddef.h" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION CACHE)
+
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${ZLIB_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()
+
+ocv_parse_header2(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/zlib.h" ZLIB_VERSION PARENT_SCOPE)
+
status("")
status(" Platform:")
status(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
-status(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
+if(CMAKE_CROSSCOMPILING)
+ status(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
+endif()
status(" CMake:" ${CMAKE_VERSION})
status(" CMake generator:" ${CMAKE_GENERATOR})
status(" CMake build tool:" ${CMAKE_BUILD_TOOL})
# media
status("")
status(" Media I/O: ")
-status(" ZLib:" ZLIB_FOUND THEN "${ZLIB_LIBRARY}" ELSE build)
+status(" ZLib:" BUILD_ZLIB THEN "build (ver ${ZLIB_VERSION_STRING})" ELSE "${ZLIB_LIBRARY} (ver ${ZLIB_VERSION_STRING})")
if(WITH_JPEG)
- status(" JPEG:" JPEG_FOUND THEN "${JPEG_LIBRARY}" ELSE build)
+ status(" JPEG:" JPEG_FOUND THEN "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})" ELSE "build (ver ${JPEG_LIB_VERSION})")
else()
status(" JPEG:" "NO")
endif()
if(WITH_PNG)
- status(" PNG:" PNG_FOUND THEN "${PNG_LIBRARY}" ELSE build)
+ status(" PNG:" PNG_FOUND THEN "${PNG_LIBRARY} (ver ${PNG_VERSION})" ELSE "build (ver ${PNG_VERSION})")
else()
status(" PNG:" "NO")
endif()
if(WITH_TIFF)
- status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY}" ELSE build)
+ status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION})" ELSE "build (ver ${TIFF_VERSION})")
else()
status(" TIFF:" "NO")
endif()
if(WITH_JASPER)
- status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY}" ELSE build)
+ status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build (ver ${JASPER_VERSION_STRING})")
else()
status(" JPEG 2000:" "NO")
endif()
find_file(TBB_STDDEF_PATH tbb/tbb_stddef.h "${TBB_INCLUDE_DIRS}")
endif()
if(HAVE_TBB AND TBB_STDDEF_PATH)
- file(STRINGS "${TBB_STDDEF_PATH}" TBB_VERSION_LINES REGEX "#define (TBB_VERSION_MAJOR|TBB_VERSION_MINOR|TBB_INTERFACE_VERSION)[ ]+[0-9]+" )
- string(REGEX REPLACE ".+TBB_VERSION_MAJOR[ ]+([0-9]+).*" "\\1" TBB_VERSION_MAJOR "${TBB_VERSION_LINES}")
- string(REGEX REPLACE ".+TBB_VERSION_MINOR[ ]+([0-9]+).*" "\\1" TBB_VERSION_MINOR "${TBB_VERSION_LINES}")
- string(REGEX REPLACE ".+TBB_INTERFACE_VERSION[ ]+([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${TBB_VERSION_LINES}")
+ ocv_parse_header("${TBB_STDDEF_PATH}" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION)
else()
unset(TBB_VERSION_MAJOR)
unset(TBB_VERSION_MINOR)
set(ZLIB_LIBRARY z)
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
set(ZLIB_INCLUDE_DIR "")
+ ocv_parse_header2(ZLIB "${ANDROID_SYSROOT}/usr/include/zlib.h" ZLIB_VERSION "")
else()
include(FindZLIB)
endif()
unset_all(TIFF_FOUND)
else()
include(FindTIFF)
+ if(TIFF_FOUND)
+ ocv_parse_header("${TIFF_INCLUDE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
+ endif()
endif()
endif()
set(TIFF_LIBRARIES ${TIFF_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libtiff")
set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}" "${${TIFF_LIBRARY}_BINARY_DIR}")
+ ocv_parse_header("${${TIFF_LIBRARY}_SOURCE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
+endif()
+
+if(TIFF_VERSION_CLASSIC AND NOT TIFF_VERSION)
+ set(TIFF_VERSION ${TIFF_VERSION_CLASSIC})
+endif()
+
+if(TIFF_BIGTIFF_VERSION AND NOT TIFF_VERSION_BIG)
+ set(TIFF_VERSION_BIG ${TIFF_BIGTIFF_VERSION})
endif()
################### libjpeg - optional
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
endif()
+ocv_parse_header("${JPEG_INCLUDE_DIR}/jpeglib.h" JPEG_VERSION_LINES JPEG_LIB_VERSION)
+
+
################### libjasper - optional (should be searched after libjpeg)
if(WITH_JASPER)
if(BUILD_JASPER)
set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}")
endif()
+ocv_parse_header2(JASPER "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" JAS_VERSION "")
+
################### libpng - optional (should be searched after zlib)
if(WITH_PNG)
if(BUILD_PNG)
else()
include(FindPNG)
if(PNG_FOUND)
- check_include_file(${PNG_PNG_INCLUDE_DIR}/png.h HAVE_PNG_H)
- check_include_file(${PNG_PNG_INCLUDE_DIR}/libpng/png.h HAVE_LIBPNG_PNG_H)
+ check_include_file("${PNG_PNG_INCLUDE_DIR}/png.h" HAVE_PNG_H)
+ check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
+ if(HAVE_PNG_H)
+ ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
+ elseif(HAVE_LIBPNG_PNG_H)
+ ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
+ endif()
endif()
endif()
endif()
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libpng")
set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}")
set(PNG_DEFINITIONS "")
+ ocv_parse_header("${PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
endif()
+set(PNG_VERSION "${PNG_LIBPNG_VER_MAJOR}.${PNG_LIBPNG_VER_MINOR}.${PNG_LIBPNG_VER_RELEASE}")
+
################### OpenEXR - optional
if(WITH_OPENEXR)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
unset(__tmp)
endif()
endmacro()
+
+
+# read set of defines from the header file
+macro(ocv_parse_header FILENAME FILE_VAR)
+ set(vars_regex "")
+ set(__parnet_scope OFF)
+ set(__add_cache OFF)
+ foreach(name ${ARGN})
+ if("${name}" STREQUAL "PARENT_SCOPE")
+ set(__parnet_scope ON)
+ elseif("${name}" STREQUAL "CACHE")
+ set(__add_cache ON)
+ elseif(vars_regex)
+ set(vars_regex "${vars_regex}|${name}")
+ else()
+ set(vars_regex "${name}")
+ endif()
+ endforeach()
+ if(EXISTS "${FILENAME}")
+ file(STRINGS "${FILENAME}" ${FILE_VAR} REGEX "#define[ \t]+(${vars_regex})[ \t]+[0-9]+" )
+ else()
+ unset(${FILE_VAR})
+ endif()
+ foreach(name ${ARGN})
+ if(NOT "${name}" STREQUAL "PARENT_SCOPE" AND NOT "${name}" STREQUAL "CACHE")
+ if(${FILE_VAR})
+ if(${FILE_VAR} MATCHES ".+[ \t]${name}[ \t]+([0-9]+).*")
+ string(REGEX REPLACE ".+[ \t]${name}[ \t]+([0-9]+).*" "\\1" ${name} "${${FILE_VAR}}")
+ else()
+ set(${name} "")
+ endif()
+ if(__add_cache)
+ set(${name} ${${name}} CACHE INTERNAL "${name} parsed from ${FILENAME}" FORCE)
+ elseif(__parnet_scope)
+ set(${name} "${${name}}" PARENT_SCOPE)
+ endif()
+ else()
+ unset(${name} CACHE)
+ endif()
+ endif()
+ endforeach()
+endmacro()
+
+macro(ocv_parse_header2 LIBNAME HDR_PATH VARNAME SCOPE)
+ set(${LIBNAME}_H "")
+ if(EXISTS "${HDR_PATH}")
+ file(STRINGS "${HDR_PATH}" ${LIBNAME}_H REGEX "^#define[ \t]+${VARNAME}[ \t]+\"[^\"]*\".*$" LIMIT_COUNT 1)
+ endif()
+ if(${LIBNAME}_H)
+ string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MAJOR "${${LIBNAME}_H}")
+ string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MINOR "${${LIBNAME}_H}")
+ string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_PATCH "${${LIBNAME}_H}")
+ set(${LIBNAME}_VERSION_MAJOR ${${LIBNAME}_VERSION_MAJOR} ${SCOPE})
+ set(${LIBNAME}_VERSION_MINOR ${${LIBNAME}_VERSION_MINOR} ${SCOPE})
+ set(${LIBNAME}_VERSION_PATCH ${${LIBNAME}_VERSION_PATCH} ${SCOPE})
+ set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_MAJOR}.${${LIBNAME}_VERSION_MINOR}.${${LIBNAME}_VERSION_PATCH}" ${SCOPE})
+
+ # append a TWEAK version if it exists:
+ set(${LIBNAME}_VERSION_TWEAK "")
+ if("${${LIBNAME}_H}" MATCHES "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
+ set(${LIBNAME}_VERSION_TWEAK "${CMAKE_MATCH_1}" ${SCOPE})
+ set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_STRING}.${${LIBNAME}_VERSION_TWEAK}" ${SCOPE})
+ endif()
+ else()
+ unset(${LIBNAME}_VERSION_MAJOR CACHE)
+ unset(${LIBNAME}_VERSION_MINOR CACHE)
+ unset(${LIBNAME}_VERSION_PATCH CACHE)
+ unset(${LIBNAME}_VERSION_TWEAK CACHE)
+ unset(${LIBNAME}_VERSION_STRING CACHE)
+ endif()
+endmacro()