提交 f8252702 编写于 作者: A Alexander Alekhin

3rdparty: integrate libjpeg-turbo build scripts into OpenCV

上级 77795392
......@@ -48,4 +48,6 @@ typedef signed int INT32;
#undef RIGHT_SHIFT_IS_UNSIGNED
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
#endif /* JPEG_INTERNALS */
......@@ -294,6 +294,9 @@ set(PIXARLOG_SUPPORT FALSE)
set(JPEG_SUPPORT FALSE)
if(HAVE_JPEG)
set(JPEG_SUPPORT TRUE)
if(TARGET ${JPEG_LIBRARY} AND DEFINED ${JPEG_LIBRARY}_BINARY_DIR)
include_directories("${${JPEG_LIBRARY}_BINARY_DIR}")
endif()
include_directories(${JPEG_INCLUDE_DIR})
endif()
......
......@@ -6,12 +6,20 @@ In order to use these versions of libraries instead of system ones on UNIX syste
should use BUILD_<library_name> CMake flags (for example, BUILD_PNG for the libpng library).
------------------------------------------------------------------------------------
libjpeg The Independent JPEG Group's JPEG software.
libjpeg (deprecated) The Independent JPEG Group's JPEG software.
Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
See IGJ home page http://www.ijg.org
for details and links to the source code
WITH_JPEG CMake option must be ON to add libjpeg support to imgcodecs.
libjpeg-turbo libjpeg-turbo is covered by three compatible BSD-style open source licenses.
Refer to [LICENSE.md](libjpeg-turbo/LICENSE.md) for a roll-up of license terms.
Site: https://github.com/libjpeg-turbo/libjpeg-turbo
API is compatible with original libjpeg.
WITH_JPEG CMake option must be ON to add libjpeg or libjpeg-turbo support to imgcodecs.
BUILD_JPEG=ON selects libjpeg-turbo by default (since OpenCV 3.4.2).
Enable BUILD_JPEG_TURBO_DISABLE=ON to force using of libjpeg (this option is removed in OpenCV 4.0).
------------------------------------------------------------------------------------
libpng Portable Network Graphics library.
The license and copyright notes can be found in libpng/LICENSE.
......
......@@ -1165,7 +1165,13 @@ status(" Media I/O: ")
status(" ZLib:" ZLIB_FOUND THEN "${ZLIB_LIBRARIES} (ver ${ZLIB_VERSION_STRING})" ELSE "build (ver ${ZLIB_VERSION_STRING})")
if(WITH_JPEG OR HAVE_JPEG)
status(" JPEG:" JPEG_FOUND THEN "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})" ELSE "build (ver ${JPEG_LIB_VERSION})")
if(NOT HAVE_JPEG)
status(" JPEG:" NO)
elseif(BUILD_JPEG)
status(" JPEG:" "build-${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
else()
status(" JPEG:" "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
endif()
endif()
if(WITH_WEBP OR HAVE_WEBP)
......
......@@ -36,13 +36,36 @@ if(WITH_JPEG)
if(NOT JPEG_FOUND)
ocv_clear_vars(JPEG_LIBRARY JPEG_LIBRARIES JPEG_INCLUDE_DIR)
set(JPEG_LIBRARY libjpeg)
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
if(NOT BUILD_JPEG_TURBO_DISABLE)
set(JPEG_LIBRARY libjpeg-turbo)
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg-turbo")
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}/src")
else()
set(JPEG_LIBRARY libjpeg)
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
endif()
endif()
ocv_parse_header("${JPEG_INCLUDE_DIR}/jpeglib.h" JPEG_VERSION_LINES JPEG_LIB_VERSION)
macro(ocv_detect_jpeg_version header_file)
if(NOT DEFINED JPEG_LIB_VERSION AND EXISTS "${header_file}")
ocv_parse_header("${header_file}" JPEG_VERSION_LINES JPEG_LIB_VERSION)
endif()
endmacro()
ocv_detect_jpeg_version("${JPEG_INCLUDE_DIR}/jpeglib.h")
if(DEFINED CMAKE_CXX_LIBRARY_ARCHITECTURE)
ocv_detect_jpeg_version("${JPEG_INCLUDE_DIR}/${CMAKE_CXX_LIBRARY_ARCHITECTURE}/jconfig.h")
endif()
# no needed for strict platform check here, both files 64/32 should contain the same version
ocv_detect_jpeg_version("${JPEG_INCLUDE_DIR}/jconfig-64.h")
ocv_detect_jpeg_version("${JPEG_INCLUDE_DIR}/jconfig-32.h")
ocv_detect_jpeg_version("${JPEG_INCLUDE_DIR}/jconfig.h")
ocv_detect_jpeg_version("${${JPEG_LIBRARY}_BINARY_DIR}/jconfig.h")
if(NOT DEFINED JPEG_LIB_VERSION)
set(JPEG_LIB_VERSION "unknown")
endif()
set(HAVE_JPEG YES)
endif()
......
......@@ -19,7 +19,7 @@ if(HAVE_PNG OR HAVE_TIFF OR HAVE_OPENEXR)
endif()
if(HAVE_JPEG)
ocv_include_directories(${JPEG_INCLUDE_DIR})
ocv_include_directories(${JPEG_INCLUDE_DIR} ${${JPEG_LIBRARY}_BINARY_DIR})
list(APPEND GRFMT_LIBS ${JPEG_LIBRARIES})
endif()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册