2018-05-10 22:02:24 +08:00
|
|
|
project(${JPEG_LIBRARY} C)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-64-to-32 -Wimplicit-fallthrough)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2019-02-24 00:30:49 +08:00
|
|
|
set(VERSION_MAJOR 2)
|
|
|
|
set(VERSION_MINOR 0)
|
|
|
|
set(VERSION_REVISION 2)
|
2018-05-10 22:02:24 +08:00
|
|
|
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
|
2019-02-24 00:30:49 +08:00
|
|
|
set(LIBJPEG_TURBO_VERSION_NUMBER 2000002)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo")
|
2018-05-10 20:50:35 +08:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
2018-05-10 22:02:24 +08:00
|
|
|
set(BUILD "${BUILD}-debug")
|
2018-05-10 20:50:35 +08:00
|
|
|
endif()
|
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
message(STATUS "libjpeg-turbo: VERSION = ${VERSION}, BUILD = ${BUILD}")
|
2018-05-10 20:50:35 +08:00
|
|
|
|
|
|
|
option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
|
|
|
|
option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE)
|
|
|
|
|
2019-02-25 23:50:15 +08:00
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckTypeSize)
|
|
|
|
|
|
|
|
check_type_size("size_t" SIZEOF_SIZE_T)
|
|
|
|
check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
|
|
|
|
|
|
|
|
if(SIZEOF_SIZE_T EQUAL SIZEOF_UNSIGNED_LONG)
|
|
|
|
check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }"
|
|
|
|
HAVE_BUILTIN_CTZL)
|
|
|
|
endif()
|
|
|
|
if(MSVC)
|
|
|
|
check_include_files("intrin.h" HAVE_INTRIN_H)
|
2018-05-10 20:50:35 +08:00
|
|
|
endif()
|
|
|
|
|
2019-02-25 23:50:15 +08:00
|
|
|
if(UNIX)
|
|
|
|
# Check for headers
|
|
|
|
check_include_files(locale.h HAVE_LOCALE_H)
|
|
|
|
check_include_files(stddef.h HAVE_STDDEF_H)
|
|
|
|
check_include_files(stdlib.h HAVE_STDLIB_H)
|
|
|
|
check_include_files(sys/types.h NEED_SYS_TYPES_H)
|
|
|
|
|
|
|
|
# Other predefines
|
|
|
|
# undef NEED_BSD_STRINGS
|
|
|
|
ocv_update(HAVE_UNSIGNED_CHAR 1)
|
|
|
|
ocv_update(HAVE_UNSIGNED_SHORT 1)
|
|
|
|
# undef INCOMPLETE_TYPES_BROKEN
|
|
|
|
ocv_update(RIGHT_SHIFT_IS_UNSIGNED 0)
|
|
|
|
ocv_update(__CHAR_UNSIGNED__ 0)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
set(BITS_IN_JSAMPLE 8)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
|
|
|
if(WITH_ARITH_ENC)
|
|
|
|
set(C_ARITH_CODING_SUPPORTED 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_ARITH_DEC)
|
|
|
|
set(D_ARITH_CODING_SUPPORTED 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(JPEG_LIB_VERSION 62)
|
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
# OpenCV
|
|
|
|
set(JPEG_LIB_VERSION "${VERSION}-${JPEG_LIB_VERSION}" PARENT_SCOPE)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
|
|
|
if(MSVC)
|
2018-05-10 22:02:24 +08:00
|
|
|
add_definitions(-W3 -wd4996 -wd4018)
|
2018-05-10 20:50:35 +08:00
|
|
|
endif()
|
|
|
|
|
2019-02-25 23:50:15 +08:00
|
|
|
if(WIN32)
|
|
|
|
configure_file(jconfig.h.win.in jconfig.h)
|
|
|
|
else()
|
|
|
|
configure_file(jconfig.h.in jconfig.h)
|
|
|
|
endif()
|
2018-05-10 22:02:24 +08:00
|
|
|
configure_file(jconfigint.h.in jconfigint.h)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2019-06-03 20:32:28 +08:00
|
|
|
set(JPEG_SOURCES
|
|
|
|
jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c jcicc.c
|
2018-05-10 20:50:35 +08:00
|
|
|
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
|
|
|
|
jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
|
2019-06-03 20:32:28 +08:00
|
|
|
jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c jdmainct.c jdmarker.c
|
2018-05-10 20:50:35 +08:00
|
|
|
jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
|
|
|
|
jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
|
|
|
|
jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
|
|
|
|
|
|
|
|
if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
|
|
|
|
set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_ARITH_ENC)
|
|
|
|
set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_ARITH_DEC)
|
|
|
|
set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c)
|
|
|
|
endif()
|
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
# No SIMD
|
|
|
|
set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
ocv_list_add_prefix(JPEG_SOURCES src/)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
add_library(${JPEG_LIBRARY} STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
set_target_properties(${JPEG_LIBRARY}
|
|
|
|
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
|
|
|
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
|
|
|
COMPILE_PDB_NAME ${JPEG_LIBRARY}
|
|
|
|
COMPILE_PDB_NAME_DEBUG "${JPEG_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
|
|
|
|
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
|
|
|
)
|
2018-05-10 20:50:35 +08:00
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
if(ENABLE_SOLUTION_FOLDERS)
|
|
|
|
set_target_properties(${JPEG_LIBRARY} PROPERTIES FOLDER "3rdparty")
|
2018-05-10 20:50:35 +08:00
|
|
|
endif()
|
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
if(NOT BUILD_SHARED_LIBS)
|
|
|
|
ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
2018-05-10 20:50:35 +08:00
|
|
|
endif()
|
|
|
|
|
2018-05-10 22:02:24 +08:00
|
|
|
ocv_install_3rdparty_licenses(libjpeg-turbo README.md LICENSE.md README.ijg)
|