Skip to content

Commit

Permalink
3rdparty: update libjpeg-turbo/CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Feb 26, 2019
1 parent 30cf5e0 commit d5a3ad5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
44 changes: 35 additions & 9 deletions 3rdparty/libjpeg-turbo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
12 changes: 10 additions & 2 deletions 3rdparty/libjpeg-turbo/jconfigint.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@"
Expand All @@ -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
Expand Down

0 comments on commit d5a3ad5

Please sign in to comment.