From d5a3ad5b64359b8f94992c2879dd890df125b9a8 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 25 Feb 2019 18:50:15 +0300 Subject: [PATCH] 3rdparty: update libjpeg-turbo/CMakeLists.txt --- 3rdparty/libjpeg-turbo/CMakeLists.txt | 44 ++++++++++++++++++++------ 3rdparty/libjpeg-turbo/jconfigint.h.in | 12 +++++-- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/3rdparty/libjpeg-turbo/CMakeLists.txt b/3rdparty/libjpeg-turbo/CMakeLists.txt index d97cfb8250..cf1f77aaa3 100644 --- a/3rdparty/libjpeg-turbo/CMakeLists.txt +++ b/3rdparty/libjpeg-turbo/CMakeLists.txt @@ -18,16 +18,38 @@ message(STATUS "libjpeg-turbo: VERSION = ${VERSION}, BUILD = ${BUILD}") 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) -if(NOT DEFINED SIZEOF_SIZE_T) - if(IOS) # Workaround iOS issues - set(SIZEOF_SIZE_T "${CMAKE_SIZEOF_VOID_P}") - message(STATUS "SIZEOF_SIZE_T = ${SIZEOF_SIZE_T}") - else() - include(CheckTypeSize) - CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T) - endif() +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) endif() +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() + + set(BITS_IN_JSAMPLE 8) if(WITH_ARITH_ENC) @@ -47,7 +69,11 @@ if(MSVC) add_definitions(-W3 -wd4996 -wd4018) endif() -configure_file(jconfig.h.in jconfig.h) +if(WIN32) + configure_file(jconfig.h.win.in jconfig.h) +else() + configure_file(jconfig.h.in jconfig.h) +endif() configure_file(jconfigint.h.in jconfigint.h) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src) diff --git a/3rdparty/libjpeg-turbo/jconfigint.h.in b/3rdparty/libjpeg-turbo/jconfigint.h.in index 55df053676..7f6a285523 100644 --- a/3rdparty/libjpeg-turbo/jconfigint.h.in +++ b/3rdparty/libjpeg-turbo/jconfigint.h.in @@ -5,7 +5,15 @@ #undef inline /* How to obtain function inlining. */ -#define INLINE @INLINE@ +#ifndef INLINE +#if defined(__GNUC__) +#define INLINE inline __attribute__((always_inline)) +#elif defined(_MSC_VER) +#define INLINE __forceinline +#else +#define INLINE +#endif +#endif /* Define to the full name of this package. */ #define PACKAGE_NAME "@CMAKE_PROJECT_NAME@" @@ -14,7 +22,7 @@ #define VERSION "@VERSION@" /* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T @SIZE_T@ +#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@ /* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */ #cmakedefine HAVE_BUILTIN_CTZL