DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.12) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 2 | |
DRC | 0fa7850 | 2018-07-20 11:30:04 -0500 | [diff] [blame] | 3 | if(CMAKE_EXECUTABLE_SUFFIX) |
| 4 | set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX}) |
| 5 | endif() |
| 6 | |
DRC | 5d6f858 | 2011-02-18 23:08:58 +0000 | [diff] [blame] | 7 | project(libjpeg-turbo C) |
DRC | 58a3975 | 2019-04-10 14:35:45 -0500 | [diff] [blame] | 8 | set(VERSION 2.0.3) |
DRC | f06cc12 | 2016-05-10 19:36:34 -0500 | [diff] [blame] | 9 | string(REPLACE "." ";" VERSION_TRIPLET ${VERSION}) |
| 10 | list(GET VERSION_TRIPLET 0 VERSION_MAJOR) |
| 11 | list(GET VERSION_TRIPLET 1 VERSION_MINOR) |
| 12 | list(GET VERSION_TRIPLET 2 VERSION_REVISION) |
| 13 | function(pad_number NUMBER OUTPUT_LEN) |
| 14 | string(LENGTH "${${NUMBER}}" INPUT_LEN) |
| 15 | if(INPUT_LEN LESS OUTPUT_LEN) |
| 16 | math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1") |
| 17 | set(NUM ${${NUMBER}}) |
| 18 | foreach(C RANGE ${ZEROES}) |
| 19 | set(NUM "0${NUM}") |
| 20 | endforeach() |
| 21 | set(${NUMBER} ${NUM} PARENT_SCOPE) |
| 22 | endif() |
| 23 | endfunction() |
| 24 | pad_number(VERSION_MINOR 3) |
| 25 | pad_number(VERSION_REVISION 3) |
| 26 | set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION}) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 27 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 28 | string(TIMESTAMP DEFAULT_BUILD "%Y%m%d") |
| 29 | set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 30 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 31 | # NOTE: On Windows, this does nothing except when using MinGW or Cygwin. |
| 32 | # CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to |
| 33 | # Debug when using NMake. |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 34 | if(NOT CMAKE_BUILD_TYPE) |
| 35 | set(CMAKE_BUILD_TYPE Release) |
| 36 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 37 | message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") |
| 38 | |
DRC | eb2b9d6 | 2010-10-15 04:55:13 +0000 | [diff] [blame] | 39 | message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") |
| 40 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 41 | # Detect CPU type and whether we're building 64-bit or 32-bit code |
| 42 | math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8") |
| 43 | string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC) |
| 44 | if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR |
| 45 | CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR |
| 46 | CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR |
| 47 | CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR |
| 48 | CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32") |
| 49 | if(BITS EQUAL 64) |
| 50 | set(CPU_TYPE x86_64) |
| 51 | else() |
| 52 | set(CPU_TYPE i386) |
| 53 | endif() |
| 54 | if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE}) |
| 55 | set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE}) |
| 56 | endif() |
| 57 | elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR |
| 58 | CMAKE_SYSTEM_PROCESSOR_LC MATCHES "arm*64*") |
| 59 | set(CPU_TYPE arm64) |
| 60 | elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "arm*") |
| 61 | set(CPU_TYPE arm) |
| 62 | elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ppc*" OR |
| 63 | CMAKE_SYSTEM_PROCESSOR_LC MATCHES "powerpc*") |
| 64 | set(CPU_TYPE powerpc) |
| 65 | else() |
| 66 | set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC}) |
| 67 | endif() |
| 68 | message(STATUS "${BITS}-bit build (${CPU_TYPE})") |
| 69 | |
| 70 | |
| 71 | ############################################################################### |
| 72 | # INSTALL DIRECTORIES |
| 73 | ############################################################################### |
| 74 | |
| 75 | if(WIN32) |
| 76 | if(MSVC) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 77 | set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 78 | else() |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 79 | set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}-gcc") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 80 | endif() |
| 81 | if(BITS EQUAL 64) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 82 | set(CMAKE_INSTALL_DEFAULT_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}64") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 83 | endif() |
| 84 | else() |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 85 | set(CMAKE_INSTALL_DEFAULT_PREFIX /opt/${CMAKE_PROJECT_NAME}) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 86 | endif() |
| 87 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 88 | set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}" CACHE PATH |
| 89 | "Directory into which to install ${CMAKE_PROJECT_NAME} (default: ${CMAKE_INSTALL_DEFAULT_PREFIX})" |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 90 | FORCE) |
| 91 | endif() |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 92 | message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 93 | |
| 94 | # When the prefix is /opt/${CMAKE_PROJECT_NAME}, we assume that an "official" |
| 95 | # build is being created, and thus we install things into specific locations. |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 96 | |
DRC | c8358fc | 2016-12-08 14:43:59 -0600 | [diff] [blame] | 97 | if(CMAKE_INSTALL_PREFIX STREQUAL "${CMAKE_INSTALL_DEFAULT_PREFIX}") |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 98 | set(CMAKE_INSTALL_DEFAULT_DATAROOTDIR "") |
DRC | c8358fc | 2016-12-08 14:43:59 -0600 | [diff] [blame] | 99 | set(CMAKE_INSTALL_DEFAULT_DOCDIR "<CMAKE_INSTALL_DATAROOTDIR>/doc") |
| 100 | set(CMAKE_INSTALL_DEFAULT_JAVADIR "<CMAKE_INSTALL_DATAROOTDIR>/classes") |
| 101 | if(UNIX AND NOT APPLE) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 102 | if(BITS EQUAL 64) |
| 103 | set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64") |
| 104 | else() |
| 105 | set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib32") |
| 106 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 107 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 108 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 109 | |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 110 | include(cmakescripts/GNUInstallDirs.cmake) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 111 | |
DRC | 6530203 | 2016-12-09 10:21:29 -0600 | [diff] [blame] | 112 | macro(report_directory var) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 113 | if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var}) |
| 114 | message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}") |
| 115 | else() |
| 116 | message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})") |
| 117 | endif() |
| 118 | mark_as_advanced(CLEAR CMAKE_INSTALL_${var}) |
DRC | 6530203 | 2016-12-09 10:21:29 -0600 | [diff] [blame] | 119 | endmacro() |
| 120 | |
| 121 | set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR") |
| 122 | if(UNIX) |
| 123 | list(APPEND DIRLIST "MANDIR") |
| 124 | endif() |
| 125 | foreach(dir ${DIRLIST}) |
| 126 | report_directory(${dir}) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 127 | endforeach() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 128 | |
| 129 | |
| 130 | ############################################################################### |
| 131 | # CONFIGURATION OPTIONS |
| 132 | ############################################################################### |
| 133 | |
| 134 | macro(boolean_number var) |
| 135 | if(${var}) |
| 136 | set(${var} 1) |
| 137 | else() |
| 138 | set(${var} 0) |
| 139 | endif() |
| 140 | endmacro() |
| 141 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 142 | option(ENABLE_SHARED "Build shared libraries" TRUE) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 143 | boolean_number(ENABLE_SHARED) |
| 144 | option(ENABLE_STATIC "Build static libraries" TRUE) |
| 145 | boolean_number(ENABLE_STATIC) |
| 146 | option(REQUIRE_SIMD "Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)" FALSE) |
| 147 | boolean_number(REQUIRE_SIMD) |
| 148 | option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_ARITH_DEC=0 WITH_ARITH_ENC=0 WITH_JAVA=0 WITH_SIMD=0 WITH_TURBOJPEG=0 )" FALSE) |
| 149 | boolean_number(WITH_12BIT) |
| 150 | option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE) |
| 151 | boolean_number(WITH_ARITH_DEC) |
| 152 | option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE) |
| 153 | boolean_number(WITH_ARITH_ENC) |
| 154 | option(WITH_JAVA "Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)" FALSE) |
| 155 | boolean_number(WITH_JAVA) |
| 156 | option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) |
| 157 | boolean_number(WITH_JPEG7) |
| 158 | option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)" FALSE) |
| 159 | boolean_number(WITH_JPEG8) |
| 160 | option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) |
| 161 | boolean_number(WITH_MEM_SRCDST) |
| 162 | option(WITH_SIMD "Include SIMD extensions, if available for this platform" TRUE) |
| 163 | boolean_number(WITH_SIMD) |
| 164 | option(WITH_TURBOJPEG "Include the TurboJPEG API library and associated test programs" TRUE) |
| 165 | boolean_number(WITH_TURBOJPEG) |
| 166 | |
| 167 | macro(report_option var desc) |
| 168 | if(${var}) |
| 169 | message(STATUS "${desc} enabled (${var} = ${${var}})") |
| 170 | else() |
| 171 | message(STATUS "${desc} disabled (${var} = ${${var}})") |
| 172 | endif() |
| 173 | endmacro() |
| 174 | |
| 175 | if(WITH_JAVA) |
| 176 | set(ENABLE_SHARED 1) |
| 177 | endif() |
| 178 | |
| 179 | # Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all |
| 180 | # targets, which will cause the shared library builds to fail. Thus, if shared |
| 181 | # libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set |
| 182 | # to FALSE, we need to unset it, thus restoring the default behavior |
| 183 | # (automatically using PIC for shared library targets.) |
| 184 | if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND |
| 185 | NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED) |
| 186 | unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE) |
| 187 | endif() |
| 188 | |
| 189 | report_option(ENABLE_SHARED "Shared libraries") |
| 190 | report_option(ENABLE_STATIC "Static libraries") |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 191 | |
DRC | c868e41 | 2019-01-01 14:26:48 -0600 | [diff] [blame] | 192 | if(ENABLE_SHARED) |
| 193 | set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}) |
| 194 | endif() |
| 195 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 196 | if(WITH_12BIT) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 197 | set(WITH_ARITH_DEC 0) |
| 198 | set(WITH_ARITH_ENC 0) |
| 199 | set(WITH_JAVA 0) |
| 200 | set(WITH_SIMD 0) |
| 201 | set(WITH_TURBOJPEG 0) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 202 | set(BITS_IN_JSAMPLE 12) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 203 | else() |
| 204 | set(BITS_IN_JSAMPLE 8) |
| 205 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 206 | report_option(WITH_12BIT "12-bit JPEG support") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 207 | |
DRC | 5c064de | 2016-05-09 20:00:46 -0500 | [diff] [blame] | 208 | if(WITH_JPEG8 OR WITH_JPEG7) |
| 209 | set(WITH_ARITH_ENC 1) |
| 210 | set(WITH_ARITH_DEC 1) |
| 211 | endif() |
| 212 | if(WITH_JPEG8) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 213 | set(WITH_MEM_SRCDST 0) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 214 | endif() |
| 215 | |
| 216 | if(WITH_ARITH_DEC) |
| 217 | set(D_ARITH_CODING_SUPPORTED 1) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 218 | endif() |
| 219 | if(NOT WITH_12BIT) |
| 220 | report_option(WITH_ARITH_DEC "Arithmetic decoding support") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 221 | endif() |
| 222 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 223 | if(WITH_ARITH_ENC) |
| 224 | set(C_ARITH_CODING_SUPPORTED 1) |
| 225 | endif() |
| 226 | if(NOT WITH_12BIT) |
| 227 | report_option(WITH_ARITH_ENC "Arithmetic encoding support") |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 228 | endif() |
| 229 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 230 | if(NOT WITH_12BIT) |
| 231 | report_option(WITH_TURBOJPEG "TurboJPEG API library") |
| 232 | report_option(WITH_JAVA "TurboJPEG Java wrapper") |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 233 | endif() |
| 234 | |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 235 | if(WITH_MEM_SRCDST) |
| 236 | set(MEM_SRCDST_SUPPORTED 1) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 237 | set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;") |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 238 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 239 | if(NOT WITH_JPEG8) |
| 240 | report_option(WITH_MEM_SRCDST "In-memory source/destination managers") |
| 241 | endif() |
| 242 | |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 243 | set(SO_AGE 2) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 244 | if(WITH_MEM_SRCDST) |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 245 | set(SO_AGE 3) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 246 | endif() |
| 247 | |
| 248 | if(WITH_JPEG8) |
| 249 | set(JPEG_LIB_VERSION 80) |
| 250 | elseif(WITH_JPEG7) |
| 251 | set(JPEG_LIB_VERSION 70) |
| 252 | else() |
| 253 | set(JPEG_LIB_VERSION 62) |
| 254 | endif() |
| 255 | |
| 256 | math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10") |
| 257 | math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10") |
| 258 | if(JPEG_LIB_VERSION STREQUAL "62") |
| 259 | set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION}) |
| 260 | else() |
| 261 | set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10}) |
| 262 | endif() |
| 263 | if(JPEG_LIB_VERSION STREQUAL "80") |
| 264 | set(DEFAULT_SO_MINOR_VERSION 2) |
| 265 | else() |
| 266 | set(DEFAULT_SO_MINOR_VERSION 0) |
| 267 | endif() |
| 268 | |
| 269 | # This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if |
| 270 | # WITH_JPEG7 or WITH_JPEG8 has changed. |
| 271 | if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR |
| 272 | (DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT)) |
| 273 | set(FORCE_SO_VERSION "FORCE") |
| 274 | endif() |
| 275 | set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "") |
| 276 | set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "") |
| 277 | |
| 278 | set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING |
| 279 | "Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})" |
| 280 | ${FORCE_SO_VERSION}) |
| 281 | set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING |
| 282 | "Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})" |
| 283 | ${FORCE_SO_VERSION}) |
| 284 | |
| 285 | set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}") |
| 286 | message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})") |
| 287 | message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}") |
| 288 | |
| 289 | # Because the TurboJPEG API library uses versioned symbols and changes the |
| 290 | # names of functions whenever they are modified in a backward-incompatible |
| 291 | # manner, it is always backward-ABI-compatible with itself, so the major and |
| 292 | # minor SO versions don't change. However, we increase the middle number (the |
| 293 | # SO "age") whenever functions are added to the API. |
| 294 | set(TURBOJPEG_SO_MAJOR_VERSION 0) |
DRC | b9ab64d | 2017-05-11 21:02:29 -0500 | [diff] [blame] | 295 | set(TURBOJPEG_SO_VERSION 0.2.0) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 296 | |
| 297 | |
| 298 | ############################################################################### |
| 299 | # COMPILER SETTINGS |
| 300 | ############################################################################### |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 301 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 302 | if(MSVC) |
DRC | 89a3f97 | 2015-03-19 19:27:40 +0000 | [diff] [blame] | 303 | option(WITH_CRT_DLL |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 304 | "Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it." |
DRC | 89a3f97 | 2015-03-19 19:27:40 +0000 | [diff] [blame] | 305 | FALSE) |
| 306 | if(NOT WITH_CRT_DLL) |
| 307 | # Use the static C library for all build types |
| 308 | foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
| 309 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) |
| 310 | if(${var} MATCHES "/MD") |
| 311 | string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") |
| 312 | endif() |
| 313 | endforeach() |
| 314 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 315 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /wd4996") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 316 | endif() |
| 317 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 318 | if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") |
| 319 | # Use the maximum optimization level for release builds |
| 320 | foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) |
| 321 | if(${var} MATCHES "-O2") |
| 322 | string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}") |
| 323 | endif() |
| 324 | endforeach() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 325 | endif() |
| 326 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 327 | if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") |
| 328 | if(CMAKE_C_COMPILER_ID MATCHES "SunPro") |
| 329 | # Use the maximum optimization level for release builds |
| 330 | foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO) |
| 331 | if(${var} MATCHES "-xO3") |
| 332 | string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}") |
| 333 | endif() |
| 334 | if(${var} MATCHES "-xO2") |
| 335 | string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}") |
| 336 | endif() |
| 337 | endforeach() |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 338 | endif() |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 339 | endif() |
| 340 | |
DRC | 03841e6 | 2016-02-09 18:27:27 -0600 | [diff] [blame] | 341 | string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC) |
| 342 | |
| 343 | set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") |
| 344 | message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}") |
| 345 | |
| 346 | set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}") |
| 347 | message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}") |
| 348 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 349 | include(CheckCSourceCompiles) |
mayeut | 16bd984 | 2018-03-02 22:33:19 +0100 | [diff] [blame] | 350 | include(CheckIncludeFiles) |
| 351 | include(CheckTypeSize) |
| 352 | |
| 353 | check_type_size("size_t" SIZE_T) |
| 354 | check_type_size("unsigned long" UNSIGNED_LONG) |
| 355 | |
| 356 | if(SIZE_T EQUAL UNSIGNED_LONG) |
| 357 | check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }" |
| 358 | HAVE_BUILTIN_CTZL) |
| 359 | endif() |
DRC | a74655a | 2018-03-31 15:34:23 -0500 | [diff] [blame] | 360 | if(MSVC) |
| 361 | check_include_files("intrin.h" HAVE_INTRIN_H) |
| 362 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 363 | |
| 364 | if(UNIX) |
| 365 | # Check for headers |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 366 | check_include_files(locale.h HAVE_LOCALE_H) |
| 367 | check_include_files(stddef.h HAVE_STDDEF_H) |
| 368 | check_include_files(stdlib.h HAVE_STDLIB_H) |
| 369 | check_include_files(sys/types.h NEED_SYS_TYPES_H) |
| 370 | |
| 371 | # Check for functions |
DRC | 13e4803 | 2018-03-31 16:19:01 -0500 | [diff] [blame] | 372 | include(CheckSymbolExists) |
| 373 | check_symbol_exists(memset string.h HAVE_MEMSET) |
| 374 | check_symbol_exists(memcpy string.h HAVE_MEMCPY) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 375 | if(NOT HAVE_MEMSET AND NOT HAVE_MEMCPY) |
| 376 | set(NEED_BSD_STRINGS 1) |
| 377 | endif() |
| 378 | |
| 379 | # Check for types |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 380 | check_type_size("unsigned char" UNSIGNED_CHAR) |
| 381 | check_type_size("unsigned short" UNSIGNED_SHORT) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 382 | |
| 383 | # Check for compiler features |
DRC | 13e4803 | 2018-03-31 16:19:01 -0500 | [diff] [blame] | 384 | check_c_source_compiles("int main(void) { typedef struct undefined_structure *undef_struct_ptr; undef_struct_ptr ptr = 0; return ptr != 0; }" |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 385 | INCOMPLETE_TYPES) |
| 386 | if(INCOMPLETE_TYPES) |
| 387 | message(STATUS "Compiler supports pointers to undefined structures.") |
| 388 | else() |
| 389 | set(INCOMPLETE_TYPES_BROKEN 1) |
| 390 | message(STATUS "Compiler does not support pointers to undefined structures.") |
| 391 | endif() |
| 392 | |
| 393 | if(CMAKE_CROSSCOMPILING) |
| 394 | set(RIGHT_SHIFT_IS_UNSIGNED 0) |
| 395 | else() |
| 396 | include(CheckCSourceRuns) |
| 397 | check_c_source_runs(" |
| 398 | #include <stdio.h> |
| 399 | #include <stdlib.h> |
| 400 | int is_shifting_signed (long arg) { |
| 401 | long res = arg >> 4; |
| 402 | if (res == -0x7F7E80CL) |
| 403 | return 1; /* right shift is signed */ |
| 404 | /* see if unsigned-shift hack will fix it. */ |
| 405 | /* we can't just test exact value since it depends on width of long... */ |
| 406 | res |= (~0L) << (32-4); |
| 407 | if (res == -0x7F7E80CL) |
| 408 | return 0; /* right shift is unsigned */ |
| 409 | printf(\"Right shift isn't acting as I expect it to.\\\\n\"); |
| 410 | printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\"); |
| 411 | return 0; /* try it with unsigned anyway */ |
| 412 | } |
| 413 | int main (void) { |
| 414 | exit(is_shifting_signed(-0x7F7E80B1L)); |
| 415 | }" RIGHT_SHIFT_IS_UNSIGNED) |
| 416 | endif() |
| 417 | |
| 418 | if(CMAKE_CROSSCOMPILING) |
| 419 | set(__CHAR_UNSIGNED__ 0) |
| 420 | else() |
| 421 | check_c_source_runs("int main(void) { return ((char) -1 < 0); }" |
| 422 | __CHAR_UNSIGNED__) |
DRC | db42506 | 2011-04-03 06:10:18 +0000 | [diff] [blame] | 423 | endif() |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 424 | endif() |
| 425 | |
DRC | 2af2fe4 | 2016-12-05 16:52:54 -0600 | [diff] [blame] | 426 | if(MSVC) |
| 427 | set(INLINE_OPTIONS "__inline;inline") |
| 428 | else() |
| 429 | set(INLINE_OPTIONS "__inline__;inline") |
| 430 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 431 | option(FORCE_INLINE "Force function inlining" TRUE) |
| 432 | boolean_number(FORCE_INLINE) |
| 433 | if(FORCE_INLINE) |
| 434 | if(MSVC) |
DRC | 2af2fe4 | 2016-12-05 16:52:54 -0600 | [diff] [blame] | 435 | list(INSERT INLINE_OPTIONS 0 "__forceinline") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 436 | else() |
DRC | 2af2fe4 | 2016-12-05 16:52:54 -0600 | [diff] [blame] | 437 | list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))") |
| 438 | list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 439 | endif() |
| 440 | endif() |
DRC | 2af2fe4 | 2016-12-05 16:52:54 -0600 | [diff] [blame] | 441 | foreach(inline ${INLINE_OPTIONS}) |
DRC | 13e4803 | 2018-03-31 16:19:01 -0500 | [diff] [blame] | 442 | check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }" |
DRC | 2af2fe4 | 2016-12-05 16:52:54 -0600 | [diff] [blame] | 443 | INLINE_WORKS) |
| 444 | if(INLINE_WORKS) |
| 445 | set(INLINE ${inline}) |
| 446 | break() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 447 | endif() |
DRC | 2af2fe4 | 2016-12-05 16:52:54 -0600 | [diff] [blame] | 448 | endforeach() |
| 449 | if(NOT INLINE_WORKS) |
| 450 | message(FATAL_ERROR "Could not determine how to inline functions.") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 451 | endif() |
| 452 | message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 453 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 454 | if(UNIX AND NOT APPLE) |
| 455 | file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };") |
| 456 | set(CMAKE_REQUIRED_FLAGS |
| 457 | "-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map") |
| 458 | check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT) |
| 459 | set(CMAKE_REQUIRED_FLAGS) |
| 460 | file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) |
| 461 | if(HAVE_VERSION_SCRIPT) |
| 462 | message(STATUS "Linker supports GNU-style version scripts") |
| 463 | set(MAPFLAG "-Wl,--version-script,") |
| 464 | set(TJMAPFLAG "-Wl,--version-script,") |
| 465 | else() |
| 466 | message(STATUS "Linker does not support GNU-style version scripts") |
| 467 | if(CMAKE_SYSTEM_NAME STREQUAL "SunOS") |
| 468 | # The Solaris linker doesn't like our version script for the libjpeg API |
| 469 | # library, but the version script for the TurboJPEG API library should |
| 470 | # still work. |
| 471 | file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map |
| 472 | "VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;") |
DRC | 43ce78e | 2018-11-15 11:54:20 -0600 | [diff] [blame] | 473 | set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared") |
| 474 | check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }" |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 475 | HAVE_MAPFILE) |
| 476 | set(CMAKE_REQUIRED_FLAGS) |
| 477 | file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map) |
| 478 | if(HAVE_MAPFILE) |
| 479 | message(STATUS "Linker supports mapfiles") |
| 480 | set(TJMAPFLAG "-Wl,-M,") |
| 481 | else() |
| 482 | message(STATUS "Linker does not support mapfiles") |
| 483 | endif() |
| 484 | endif() |
| 485 | endif() |
| 486 | endif() |
| 487 | |
| 488 | # Generate files |
| 489 | if(WIN32) |
| 490 | configure_file(win/jconfig.h.in jconfig.h) |
| 491 | else() |
| 492 | configure_file(jconfig.h.in jconfig.h) |
| 493 | endif() |
| 494 | configure_file(jconfigint.h.in jconfigint.h) |
| 495 | if(UNIX) |
| 496 | configure_file(libjpeg.map.in libjpeg.map) |
| 497 | endif() |
| 498 | |
| 499 | # Include directories and compiler definitions |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 500 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 501 | |
| 502 | |
| 503 | ############################################################################### |
| 504 | # TARGETS |
| 505 | ############################################################################### |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 506 | |
DRC | 0fa7850 | 2018-07-20 11:30:04 -0500 | [diff] [blame] | 507 | if(CMAKE_EXECUTABLE_SUFFIX_TMP) |
| 508 | set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP}) |
| 509 | endif() |
| 510 | message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}") |
| 511 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 512 | set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 513 | jcicc.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c |
| 514 | jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c |
| 515 | jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c |
| 516 | jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c |
| 517 | jdtrans.c jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c |
| 518 | jidctint.c jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 519 | |
| 520 | if(WITH_ARITH_ENC OR WITH_ARITH_DEC) |
| 521 | set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) |
| 522 | endif() |
| 523 | |
| 524 | if(WITH_ARITH_ENC) |
| 525 | set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) |
| 526 | endif() |
| 527 | |
| 528 | if(WITH_ARITH_DEC) |
| 529 | set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) |
| 530 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 531 | |
| 532 | if(WITH_SIMD) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 533 | add_subdirectory(simd) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 534 | elseif(NOT WITH_12BIT) |
| 535 | message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})") |
| 536 | endif() |
| 537 | if(WITH_SIMD) |
| 538 | message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})") |
DRC | f37b7c1 | 2019-07-02 11:28:26 -0500 | [diff] [blame] | 539 | if(MSVC_IDE OR XCODE) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 540 | set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 541 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 542 | else() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 543 | add_library(simd OBJECT jsimd_none.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 544 | endif() |
| 545 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 546 | if(WITH_JAVA) |
| 547 | add_subdirectory(java) |
| 548 | endif() |
| 549 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 550 | if(ENABLE_SHARED) |
| 551 | add_subdirectory(sharedlib) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 552 | endif() |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 553 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 554 | if(ENABLE_STATIC) |
| 555 | add_library(jpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd> |
| 556 | ${SIMD_OBJS}) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 557 | if(NOT MSVC) |
| 558 | set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) |
| 559 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 560 | endif() |
| 561 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 562 | if(WITH_TURBOJPEG) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 563 | if(ENABLE_SHARED) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 564 | set(TURBOJPEG_SOURCES ${JPEG_SOURCES} $<TARGET_OBJECTS:simd> ${SIMD_OBJS} |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 565 | turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c rdppm.c |
| 566 | wrbmp.c wrppm.c) |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 567 | set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 568 | if(WITH_JAVA) |
| 569 | set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) |
| 570 | include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 571 | set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 572 | endif() |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 573 | add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 574 | set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS |
| 575 | "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 576 | if(WIN32) |
| 577 | set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) |
| 578 | endif() |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 579 | if(MINGW) |
| 580 | set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) |
| 581 | endif() |
DRC | 8d95be3 | 2018-07-24 21:16:00 -0500 | [diff] [blame] | 582 | if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR |
| 583 | CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4)) |
DRC | c80ddef | 2018-03-23 23:17:08 -0500 | [diff] [blame] | 584 | if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG) |
| 585 | set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") |
| 586 | endif() |
DRC | 27d4c5e | 2016-11-23 17:12:57 -0600 | [diff] [blame] | 587 | set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1) |
| 588 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 589 | set_target_properties(turbojpeg PROPERTIES |
| 590 | SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION}) |
| 591 | if(TJMAPFLAG) |
| 592 | set_target_properties(turbojpeg PROPERTIES |
| 593 | LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}") |
| 594 | endif() |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 595 | |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 596 | add_executable(tjunittest tjunittest.c tjutil.c md5/md5.c md5/md5hl.c) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 597 | target_link_libraries(tjunittest turbojpeg) |
| 598 | |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 599 | add_executable(tjbench tjbench.c tjutil.c) |
| 600 | target_link_libraries(tjbench turbojpeg) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 601 | if(UNIX) |
| 602 | target_link_libraries(tjbench m) |
| 603 | endif() |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 604 | |
| 605 | add_executable(tjexample tjexample.c) |
| 606 | target_link_libraries(tjexample turbojpeg) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 607 | endif() |
| 608 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 609 | if(ENABLE_STATIC) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 610 | add_library(turbojpeg-static STATIC ${JPEG_SOURCES} $<TARGET_OBJECTS:simd> |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 611 | ${SIMD_OBJS} turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c rdbmp.c |
| 612 | rdppm.c wrbmp.c wrppm.c) |
| 613 | set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS |
| 614 | "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 615 | if(NOT MSVC) |
| 616 | set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) |
| 617 | endif() |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 618 | |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 619 | add_executable(tjunittest-static tjunittest.c tjutil.c md5/md5.c |
| 620 | md5/md5hl.c) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 621 | target_link_libraries(tjunittest-static turbojpeg-static) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 622 | |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 623 | add_executable(tjbench-static tjbench.c tjutil.c) |
| 624 | target_link_libraries(tjbench-static turbojpeg-static) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 625 | if(UNIX) |
| 626 | target_link_libraries(tjbench-static m) |
| 627 | endif() |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 628 | endif() |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 629 | endif() |
| 630 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 631 | if(WIN32) |
| 632 | set(USE_SETMODE "-DUSE_SETMODE") |
| 633 | endif() |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 634 | if(WITH_12BIT) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 635 | set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED ${USE_SETMODE}") |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 636 | else() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 637 | set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}") |
DRC | ecc5836 | 2015-06-27 07:56:29 +0000 | [diff] [blame] | 638 | set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c) |
| 639 | set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 640 | endif() |
| 641 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 642 | if(ENABLE_STATIC) |
| 643 | add_executable(cjpeg-static cjpeg.c cdjpeg.c rdgif.c rdppm.c rdswitch.c |
| 644 | ${CJPEG_BMP_SOURCES}) |
| 645 | set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) |
| 646 | target_link_libraries(cjpeg-static jpeg-static) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 647 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 648 | add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrgif.c |
| 649 | wrppm.c ${DJPEG_BMP_SOURCES}) |
| 650 | set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS}) |
| 651 | target_link_libraries(djpeg-static jpeg-static) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 652 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 653 | add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) |
| 654 | target_link_libraries(jpegtran-static jpeg-static) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 655 | set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "${USE_SETMODE}") |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 656 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 657 | |
| 658 | add_executable(rdjpgcom rdjpgcom.c) |
| 659 | |
DRC | a81f542 | 2014-06-22 20:50:14 +0000 | [diff] [blame] | 660 | add_executable(wrjpgcom wrjpgcom.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 661 | |
| 662 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 663 | ############################################################################### |
| 664 | # TESTS |
| 665 | ############################################################################### |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 666 | |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 667 | add_subdirectory(md5) |
| 668 | |
DRC | f37b7c1 | 2019-07-02 11:28:26 -0500 | [diff] [blame] | 669 | if(MSVC_IDE OR XCODE) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 670 | set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") |
| 671 | else() |
| 672 | set(OBJDIR "") |
| 673 | endif() |
| 674 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 675 | enable_testing() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 676 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 677 | if(WITH_12BIT) |
| 678 | set(TESTORIG testorig12.jpg) |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 679 | set(MD5_JPEG_RGB_ISLOW 9d7369207c520d37f2c1cbfcb82b2964) |
| 680 | set(MD5_JPEG_RGB_ISLOW2 a00bd20d8ae49684640ef7177d2e0b64) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 681 | set(MD5_PPM_RGB_ISLOW f3301d2219783b8b3d942b7239fa50c0) |
| 682 | set(MD5_JPEG_422_IFAST_OPT 7322e3bd2f127f7de4b40d4480ce60e4) |
| 683 | set(MD5_PPM_422_IFAST 79807fa552899e66a04708f533e16950) |
| 684 | set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0) |
DRC | a81a8c1 | 2019-08-14 13:17:11 -0500 | [diff] [blame] | 685 | set(MD5_JPEG_420_IFAST_Q100_PROG 008ab68d6ddbba04a8f01deee4e0f9f8) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 686 | set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e) |
| 687 | set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566) |
| 688 | set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9) |
| 689 | set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca) |
| 690 | set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d) |
| 691 | set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 692 | |
| 693 | set(MD5_JPEG_3x2_FLOAT_PROG_SSE a8c17daf77b457725ec929e215b603f8) |
| 694 | set(MD5_PPM_3x2_FLOAT_SSE 42876ab9e5c2f76a87d08db5fbd57956) |
| 695 | set(MD5_JPEG_3x2_FLOAT_PROG_32BIT a8c17daf77b457725ec929e215b603f8) |
| 696 | set(MD5_PPM_3x2_FLOAT_32BIT ${MD5_PPM_3x2_FLOAT_SSE}) |
| 697 | set(MD5_JPEG_3x2_FLOAT_PROG_64BIT ${MD5_JPEG_3x2_FLOAT_PROG_32BIT}) |
| 698 | set(MD5_PPM_3x2_FLOAT_64BIT ${MD5_PPM_3x2_FLOAT_SSE}) |
| 699 | set(MD5_JPEG_3x2_FLOAT_PROG_387 bc6dbbefac2872f6b9d6c4a0ae60c3c0) |
| 700 | set(MD5_PPM_3x2_FLOAT_387 bcc5723c61560463ac60f772e742d092) |
| 701 | set(MD5_JPEG_3x2_FLOAT_PROG_MSVC e27840755870fa849872e58aa0cd1400) |
| 702 | set(MD5_PPM_3x2_FLOAT_MSVC 6c2880b83bb1aa41dfe330e7a9768690) |
| 703 | |
| 704 | set(MD5_JPEG_3x2_IFAST_PROG 1396cc2b7185cfe943d408c9d305339e) |
| 705 | set(MD5_PPM_3x2_IFAST 3975985ef6eeb0a2cdc58daa651ccc00) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 706 | set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0) |
| 707 | set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb) |
| 708 | set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96) |
| 709 | set(MD5_PPM_420M_ISLOW_11_8 800a16f9f4dc9b293197bfe11be10a82) |
| 710 | set(MD5_PPM_420M_ISLOW_9_8 06b7a92a9bc69f4dc36ec40f1937d55c) |
| 711 | set(MD5_PPM_420M_ISLOW_7_8 3ec444a14a4ab4eab88ffc49c48eca43) |
| 712 | set(MD5_PPM_420M_ISLOW_3_4 3e726b7ea872445b19437d1c1d4f0d93) |
| 713 | set(MD5_PPM_420M_ISLOW_5_8 a8a771abdc94301d20ffac119b2caccd) |
| 714 | set(MD5_PPM_420M_ISLOW_1_2 b419124dd5568b085787234866102866) |
| 715 | set(MD5_PPM_420M_ISLOW_3_8 343d19015531b7bbe746124127244fa8) |
| 716 | set(MD5_PPM_420M_ISLOW_1_4 35fd59d866e44659edfa3c18db2a3edb) |
| 717 | set(MD5_PPM_420M_ISLOW_1_8 ccaed48ac0aedefda5d4abe4013f4ad7) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 718 | set(MD5_PPM_420_ISLOW_SKIP15_31 86664cd9dc956536409e44e244d20a97) |
DRC | 3ab68cf | 2016-02-19 18:32:10 -0600 | [diff] [blame] | 719 | set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 452a21656115a163029cfba5c04fa76a) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 720 | set(MD5_PPM_444_ISLOW_SKIP1_6 ef63901f71ef7a75cd78253fc0914f84) |
DRC | 3ab68cf | 2016-02-19 18:32:10 -0600 | [diff] [blame] | 721 | set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 15b173fb5872d9575572fbcc1b05956f) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 722 | set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 723 | else() |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 724 | set(TESTORIG testorig.jpg) |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 725 | set(MD5_JPEG_RGB_ISLOW 1d44a406f61da743b5fd31c0a9abdca3) |
| 726 | set(MD5_JPEG_RGB_ISLOW2 31d121e57b6c2934c890a7fc7763bcd4) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 727 | set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) |
| 728 | set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be) |
| 729 | set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4) |
| 730 | set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) |
| 731 | set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) |
| 732 | set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) |
| 733 | set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065) |
| 734 | set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1) |
DRC | a81a8c1 | 2019-08-14 13:17:11 -0500 | [diff] [blame] | 735 | set(MD5_JPEG_420_IFAST_Q100_PROG e59bb462016a8d9a748c330a3474bb55) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 736 | set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) |
| 737 | set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) |
| 738 | set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) |
| 739 | set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) |
| 740 | set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec) |
| 741 | set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc) |
| 742 | set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db) |
| 743 | set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 744 | |
| 745 | set(MD5_JPEG_3x2_FLOAT_PROG_SSE 343e3f8caf8af5986ebaf0bdc13b5c71) |
| 746 | set(MD5_PPM_3x2_FLOAT_SSE 1a75f36e5904d6fc3a85a43da9ad89bb) |
| 747 | set(MD5_JPEG_3x2_FLOAT_PROG_32BIT 9bca803d2042bd1eb03819e2bf92b3e5) |
| 748 | set(MD5_PPM_3x2_FLOAT_32BIT f6bfab038438ed8f5522fbd33595dcdc) |
| 749 | set(MD5_JPEG_3x2_FLOAT_PROG_64BIT ${MD5_JPEG_3x2_FLOAT_PROG_32BIT}) |
| 750 | set(MD5_PPM_3x2_FLOAT_64BIT 0e917a34193ef976b679a6b069b1be26) |
| 751 | set(MD5_JPEG_3x2_FLOAT_PROG_387 1657664a410e0822c924b54f6f65e6e9) |
| 752 | set(MD5_PPM_3x2_FLOAT_387 cb0a1f027f3d2917c902b5640214e025) |
| 753 | set(MD5_JPEG_3x2_FLOAT_PROG_MSVC 7999ce9cd0ee9b6c7043b7351ab7639d) |
| 754 | set(MD5_PPM_3x2_FLOAT_MSVC 28cdc448a6b75e97892f0e0f8d4b21f3) |
| 755 | |
| 756 | set(MD5_JPEG_3x2_IFAST_PROG 1ee5d2c1a77f2da495f993c8c7cceca5) |
| 757 | set(MD5_PPM_3x2_IFAST fd283664b3b49127984af0a7f118fccd) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 758 | set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) |
| 759 | set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) |
| 760 | set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) |
| 761 | set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) |
| 762 | set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) |
| 763 | set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) |
| 764 | set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) |
| 765 | set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) |
| 766 | set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) |
| 767 | set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) |
| 768 | set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) |
| 769 | set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) |
| 770 | set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) |
| 771 | set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) |
| 772 | set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) |
| 773 | set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) |
| 774 | set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) |
| 775 | set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb) |
| 776 | set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2) |
| 777 | set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f) |
DRC | d485955 | 2018-02-13 16:14:03 -0600 | [diff] [blame] | 778 | set(MD5_BMP_420M_ISLOW_565D ce034037d212bc403330df6f915c161b) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 779 | set(MD5_PPM_420_ISLOW_SKIP15_31 c4c65c1e43d7275cd50328a61e6534f0) |
| 780 | set(MD5_PPM_420_ISLOW_ARI_SKIP16_139 087c6b123db16ac00cb88c5b590bb74a) |
DRC | 3ab68cf | 2016-02-19 18:32:10 -0600 | [diff] [blame] | 781 | set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 26eb36ccc7d1f0cb80cdabb0ac8b5d99) |
| 782 | set(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 886c6775af22370257122f8b16207e6d) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 783 | set(MD5_PPM_444_ISLOW_SKIP1_6 5606f86874cf26b8fcee1117a0a436a6) |
DRC | 3ab68cf | 2016-02-19 18:32:10 -0600 | [diff] [blame] | 784 | set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 db87dc7ce26bcdc7a6b56239ce2b9d6c) |
| 785 | set(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 cb57b32bd6d03e35432362f7bf184b6d) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 786 | set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 787 | endif() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 788 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 789 | if(WITH_JAVA) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 790 | add_test(TJUnitTest |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 791 | ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 792 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 793 | TJUnitTest) |
| 794 | add_test(TJUnitTest-yuv |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 795 | ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 796 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 797 | TJUnitTest -yuv) |
| 798 | add_test(TJUnitTest-yuv-nopad |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 799 | ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 800 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 801 | TJUnitTest -yuv -noyuvpad) |
| 802 | add_test(TJUnitTest-bi |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 803 | ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 804 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 805 | TJUnitTest -bi) |
| 806 | add_test(TJUnitTest-bi-yuv |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 807 | ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 808 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 809 | TJUnitTest -bi -yuv) |
| 810 | add_test(TJUnitTest-bi-yuv-nopad |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 811 | ${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 812 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 813 | TJUnitTest -bi -yuv -noyuvpad) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 814 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 815 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 816 | set(TEST_LIBTYPES "") |
| 817 | if(ENABLE_SHARED) |
| 818 | set(TEST_LIBTYPES ${TEST_LIBTYPES} shared) |
| 819 | endif() |
| 820 | if(ENABLE_STATIC) |
| 821 | set(TEST_LIBTYPES ${TEST_LIBTYPES} static) |
| 822 | endif() |
| 823 | |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 824 | set(TESTIMAGES ${CMAKE_CURRENT_SOURCE_DIR}/testimages) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 825 | set(MD5CMP ${CMAKE_CURRENT_BINARY_DIR}/md5/md5cmp) |
| 826 | if(CMAKE_CROSSCOMPILING) |
| 827 | file(RELATIVE_PATH TESTIMAGES ${CMAKE_CURRENT_BINARY_DIR} ${TESTIMAGES}) |
| 828 | file(RELATIVE_PATH MD5CMP ${CMAKE_CURRENT_BINARY_DIR} ${MD5CMP}) |
| 829 | endif() |
| 830 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 831 | # The output of the floating point DCT/IDCT algorithms differs depending on the |
| 832 | # type of floating point math used, so the FLOATTEST CMake variable must be |
| 833 | # set in order to tell the testing system which floating point results it |
| 834 | # should expect: |
| 835 | # |
| 836 | # sse = validate against the expected results from the libjpeg-turbo SSE SIMD |
| 837 | # extensions |
| 838 | # 32bit = validate against the expected results from the C code when running on |
| 839 | # a 32-bit FPU (or when SSE is being used for floating point math, |
| 840 | # which is generally the default with x86-64 compilers) |
| 841 | # 64bit = validate against the expected results from the C code when running |
| 842 | # on a 64-bit FPU |
| 843 | # 387 = validate against the expected results from the C code when the 387 FPU |
| 844 | # is being used for floating point math (which is generally the default |
| 845 | # with x86 compilers) |
| 846 | # msvc = validate against the expected results from the C code when compiled |
| 847 | # with a 32-bit version of Visual C++ |
| 848 | |
| 849 | if(CPU_TYPE STREQUAL "x86_64" OR CPU_TYPE STREQUAL "i386") |
| 850 | if(WITH_SIMD) |
| 851 | set(DEFAULT_FLOATTEST sse) |
| 852 | elseif(CPU_TYPE STREQUAL "x86_64") |
| 853 | set(DEFAULT_FLOATTEST 32bit) |
| 854 | elseif(CPU_TYPE STREQUAL "i386" AND MSVC) |
| 855 | set(DEFAULT_FLOATTEST msvc) |
| 856 | endif() |
| 857 | else() |
| 858 | if(BITS EQUAL 64) |
| 859 | set(DEFAULT_FLOATTEST 64bit) |
| 860 | elseif(BITS EQUAL 32) |
| 861 | set(DEFAULT_FLOATTEST 32bit) |
| 862 | endif() |
| 863 | endif() |
| 864 | |
| 865 | # This causes FLOATTEST to reset to the default value if WITH_SIMD has |
| 866 | # changed. |
| 867 | if(DEFINED WITH_SIMD_INT AND NOT WITH_SIMD EQUAL WITH_SIMD_INT) |
| 868 | set(FORCE_FLOATTEST "FORCE") |
| 869 | endif() |
| 870 | set(WITH_SIMD_INT ${WITH_SIMD} CACHE INTERNAL "") |
| 871 | set(FLOATTEST ${DEFAULT_FLOATTEST} CACHE STRING |
| 872 | "The type of floating point math used by the floating point DCT/IDCT algorithms. This tells the testing system which numerical results it should expect from those tests. [sse = libjpeg-turbo x86/x86-64 SIMD extensions, 32bit = generic 32-bit FPU or SSE, 64bit = generic 64-bit FPU, 387 = 387 FPU, msvc = 32-bit Visual Studio] (default = ${DEFAULT_FLOATTEST})" |
| 873 | ${FORCE_FLOATTEST}) |
| 874 | message(STATUS "FLOATTEST = ${FLOATTEST}") |
| 875 | |
| 876 | if(FLOATTEST) |
| 877 | string(TOUPPER ${FLOATTEST} FLOATTEST_UC) |
| 878 | string(TOLOWER ${FLOATTEST} FLOATTEST) |
| 879 | if(NOT FLOATTEST STREQUAL "sse" AND NOT FLOATTEST STREQUAL "32bit" AND |
| 880 | NOT FLOATTEST STREQUAL "64bit" AND NOT FLOATTEST STREQUAL "387" AND |
| 881 | NOT FLOATTEST STREQUAL "msvc") |
| 882 | message(FATAL_ERROR "\"${FLOATTEST}\" is not a valid value for FLOATTEST.") |
| 883 | endif() |
| 884 | endif() |
| 885 | |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 886 | foreach(libtype ${TEST_LIBTYPES}) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 887 | if(libtype STREQUAL "static") |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 888 | set(suffix -static) |
| 889 | endif() |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 890 | if(WITH_TURBOJPEG) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 891 | add_test(tjunittest-${libtype} tjunittest${suffix}) |
| 892 | add_test(tjunittest-${libtype}-alloc tjunittest${suffix} -alloc) |
| 893 | add_test(tjunittest-${libtype}-yuv tjunittest${suffix} -yuv) |
| 894 | add_test(tjunittest-${libtype}-yuv-alloc tjunittest${suffix} -yuv -alloc) |
| 895 | add_test(tjunittest-${libtype}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) |
DRC | aa74590 | 2017-11-16 18:09:07 -0600 | [diff] [blame] | 896 | add_test(tjunittest-${libtype}-bmp tjunittest${suffix} -bmp) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 897 | |
| 898 | set(MD5_PPM_GRAY_TILE 89d3ca21213d9d864b50b4e4e7de4ca6) |
| 899 | set(MD5_PPM_420_8x8_TILE 847fceab15c5b7b911cb986cf0f71de3) |
| 900 | set(MD5_PPM_420_16x16_TILE ca45552a93687e078f7137cc4126a7b0) |
| 901 | set(MD5_PPM_420_32x32_TILE d8676f1d6b68df358353bba9844f4a00) |
| 902 | set(MD5_PPM_420_64x64_TILE 4e4c1a3d7ea4bace4f868bcbe83b7050) |
| 903 | set(MD5_PPM_420_128x128_TILE f24c3429c52265832beab9df72a0ceae) |
| 904 | set(MD5_PPM_420M_8x8_TILE bc25320e1f4c31ce2e610e43e9fd173c) |
| 905 | set(MD5_PPM_420M_TILE 75ffdf14602258c5c189522af57fa605) |
| 906 | set(MD5_PPM_422_8x8_TILE d83dacd9fc73b0a6f10c09acad64eb1e) |
| 907 | set(MD5_PPM_422_16x16_TILE 35077fb610d72dd743b1eb0cbcfe10fb) |
| 908 | set(MD5_PPM_422_32x32_TILE e6902ed8a449ecc0f0d6f2bf945f65f7) |
| 909 | set(MD5_PPM_422_64x64_TILE 2b4502a8f316cedbde1da7bce3d2231e) |
| 910 | set(MD5_PPM_422_128x128_TILE f0b5617d578f5e13c8eee215d64d4877) |
| 911 | set(MD5_PPM_422M_8x8_TILE 828941d7f41cd6283abd6beffb7fd51d) |
| 912 | set(MD5_PPM_422M_TILE e877ae1324c4a280b95376f7f018172f) |
| 913 | set(MD5_PPM_444_TILE 7964e41e67cfb8d0a587c0aa4798f9c3) |
| 914 | |
| 915 | # Test compressing from/decompressing to an arbitrary subregion of a larger |
| 916 | # image buffer |
| 917 | add_test(tjbench-${libtype}-tile-cp |
| 918 | ${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES}/testorig.ppm |
| 919 | testout_tile.ppm) |
| 920 | add_test(tjbench-${libtype}-tile |
DRC | dedce66 | 2017-06-28 15:30:41 -0500 | [diff] [blame] | 921 | tjbench${suffix} testout_tile.ppm 95 -rgb -quiet -tile -benchtime 0.01 |
| 922 | -warmup 0) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 923 | set_tests_properties(tjbench-${libtype}-tile |
| 924 | PROPERTIES DEPENDS tjbench-${libtype}-tile-cp) |
| 925 | |
| 926 | foreach(tile 8 16 32 64 128) |
| 927 | add_test(tjbench-${libtype}-tile-gray-${tile}x${tile}-cmp |
| 928 | ${MD5CMP} ${MD5_PPM_GRAY_TILE} |
| 929 | testout_tile_GRAY_Q95_${tile}x${tile}.ppm) |
| 930 | foreach(subsamp 420 422) |
| 931 | add_test(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp |
| 932 | ${MD5CMP} ${MD5_PPM_${subsamp}_${tile}x${tile}_TILE} |
| 933 | testout_tile_${subsamp}_Q95_${tile}x${tile}.ppm) |
| 934 | endforeach() |
| 935 | add_test(tjbench-${libtype}-tile-444-${tile}x${tile}-cmp |
| 936 | ${MD5CMP} ${MD5_PPM_444_TILE} |
| 937 | testout_tile_444_Q95_${tile}x${tile}.ppm) |
| 938 | foreach(subsamp gray 420 422 444) |
| 939 | set_tests_properties(tjbench-${libtype}-tile-${subsamp}-${tile}x${tile}-cmp |
| 940 | PROPERTIES DEPENDS tjbench-${libtype}-tile) |
| 941 | endforeach() |
| 942 | endforeach() |
| 943 | |
| 944 | add_test(tjbench-${libtype}-tilem-cp |
| 945 | ${CMAKE_COMMAND} -E copy_if_different ${TESTIMAGES}/testorig.ppm |
| 946 | testout_tilem.ppm) |
| 947 | add_test(tjbench-${libtype}-tilem |
| 948 | tjbench${suffix} testout_tilem.ppm 95 -rgb -fastupsample -quiet -tile |
DRC | dedce66 | 2017-06-28 15:30:41 -0500 | [diff] [blame] | 949 | -benchtime 0.01 -warmup 0) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 950 | set_tests_properties(tjbench-${libtype}-tilem |
| 951 | PROPERTIES DEPENDS tjbench-${libtype}-tilem-cp) |
| 952 | |
| 953 | add_test(tjbench-${libtype}-tile-420m-8x8-cmp |
| 954 | ${MD5CMP} ${MD5_PPM_420M_8x8_TILE} testout_tilem_420_Q95_8x8.ppm) |
| 955 | add_test(tjbench-${libtype}-tile-422m-8x8-cmp |
| 956 | ${MD5CMP} ${MD5_PPM_422M_8x8_TILE} testout_tilem_422_Q95_8x8.ppm) |
| 957 | foreach(tile 16 32 64 128) |
| 958 | foreach(subsamp 420 422) |
| 959 | add_test(tjbench-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp |
| 960 | ${MD5CMP} ${MD5_PPM_${subsamp}M_TILE} |
| 961 | testout_tilem_${subsamp}_Q95_${tile}x${tile}.ppm) |
| 962 | endforeach() |
| 963 | endforeach() |
| 964 | foreach(tile 8 16 32 64 128) |
| 965 | foreach(subsamp 420 422) |
| 966 | set_tests_properties(tjbench-${libtype}-tile-${subsamp}m-${tile}x${tile}-cmp |
| 967 | PROPERTIES DEPENDS tjbench-${libtype}-tilem) |
| 968 | endforeach() |
| 969 | endforeach() |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 970 | endif() |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 971 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 972 | # These tests are carefully crafted to provide full coverage of as many of |
| 973 | # the underlying algorithms as possible (including all of the |
| 974 | # SIMD-accelerated ones.) |
| 975 | |
| 976 | macro(add_bittest PROG NAME ARGS OUTFILE INFILE MD5SUM) |
| 977 | add_test(${PROG}-${libtype}-${NAME} |
| 978 | ${PROG}${suffix} ${ARGS} -outfile ${OUTFILE} ${INFILE}) |
| 979 | add_test(${PROG}-${libtype}-${NAME}-cmp |
| 980 | ${MD5CMP} ${MD5SUM} ${OUTFILE}) |
| 981 | set_tests_properties(${PROG}-${libtype}-${NAME}-cmp PROPERTIES |
| 982 | DEPENDS ${PROG}-${libtype}-${NAME}) |
| 983 | if(${ARGC} GREATER 6) |
| 984 | set(DEPENDS ${ARGN}) |
| 985 | set_tests_properties(${PROG}-${libtype}-${NAME} PROPERTIES |
| 986 | DEPENDS ${DEPENDS}) |
| 987 | endif() |
| 988 | endmacro() |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 989 | |
| 990 | # CC: null SAMP: fullsize FDCT: islow ENT: huff |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 991 | add_bittest(cjpeg rgb-islow "-rgb;-dct;int;-icc;${TESTIMAGES}/test1.icc" |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 992 | testout_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm |
| 993 | ${MD5_JPEG_RGB_ISLOW}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 994 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 995 | # CC: null SAMP: fullsize IDCT: islow ENT: huff |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 996 | add_bittest(djpeg rgb-islow "-dct;int;-ppm;-icc;testout_rgb_islow.icc" |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 997 | testout_rgb_islow.ppm testout_rgb_islow.jpg |
| 998 | ${MD5_PPM_RGB_ISLOW} cjpeg-${libtype}-rgb-islow) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 999 | |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 1000 | add_test(djpeg-${libtype}-rgb-islow-icc-cmp |
| 1001 | ${MD5CMP} b06a39d730129122e85c1363ed1bbc9e testout_rgb_islow.icc) |
Orivej Desh | ce90ab5 | 2019-01-21 22:56:56 +0000 | [diff] [blame] | 1002 | set_tests_properties(djpeg-${libtype}-rgb-islow-icc-cmp PROPERTIES |
| 1003 | DEPENDS djpeg-${libtype}-rgb-islow) |
DRC | 44b2399 | 2017-01-19 15:18:57 -0600 | [diff] [blame] | 1004 | |
| 1005 | add_bittest(jpegtran icc "-copy;all;-icc;${TESTIMAGES}/test2.icc" |
| 1006 | testout_rgb_islow2.jpg testout_rgb_islow.jpg ${MD5_JPEG_RGB_ISLOW2}) |
| 1007 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1008 | if(NOT WITH_12BIT) |
| 1009 | # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1010 | add_bittest(djpeg rgb-islow-565 "-dct;int;-rgb565;-dither;none;-bmp" |
| 1011 | testout_rgb_islow_565.bmp testout_rgb_islow.jpg |
| 1012 | ${MD5_BMP_RGB_ISLOW_565} cjpeg-${libtype}-rgb-islow) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1013 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1014 | # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1015 | add_bittest(djpeg rgb-islow-565D "-dct;int;-rgb565;-bmp" |
| 1016 | testout_rgb_islow_565D.bmp testout_rgb_islow.jpg |
| 1017 | ${MD5_BMP_RGB_ISLOW_565D} cjpeg-${libtype}-rgb-islow) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1018 | endif() |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1019 | |
| 1020 | # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1021 | add_bittest(cjpeg 422-ifast-opt "-sample;2x1;-dct;fast;-opt" |
| 1022 | testout_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm |
| 1023 | ${MD5_JPEG_422_IFAST_OPT}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1024 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1025 | # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1026 | add_bittest(djpeg 422-ifast "-dct;fast" |
| 1027 | testout_422_ifast.ppm testout_422_ifast_opt.jpg |
| 1028 | ${MD5_PPM_422_IFAST} cjpeg-${libtype}-422-ifast-opt) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1029 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1030 | # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1031 | add_bittest(djpeg 422m-ifast "-dct;fast;-nosmooth" |
| 1032 | testout_422m_ifast.ppm testout_422_ifast_opt.jpg |
| 1033 | ${MD5_PPM_422M_IFAST} cjpeg-${libtype}-422-ifast-opt) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1034 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1035 | if(NOT WITH_12BIT) |
| 1036 | # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1037 | add_bittest(djpeg 422m-ifast-565 |
| 1038 | "-dct;int;-nosmooth;-rgb565;-dither;none;-bmp" |
| 1039 | testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg |
| 1040 | ${MD5_BMP_422M_IFAST_565} cjpeg-${libtype}-422-ifast-opt) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1041 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1042 | # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1043 | add_bittest(djpeg 422m-ifast-565D "-dct;int;-nosmooth;-rgb565;-bmp" |
| 1044 | testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg |
| 1045 | ${MD5_BMP_422M_IFAST_565D} cjpeg-${libtype}-422-ifast-opt) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1046 | endif() |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1047 | |
| 1048 | # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1049 | add_bittest(cjpeg 420-q100-ifast-prog |
DRC | a81a8c1 | 2019-08-14 13:17:11 -0500 | [diff] [blame] | 1050 | "-sample;2x2;-quality;100;-dct;fast;-scans;${TESTIMAGES}/test.scan" |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1051 | testout_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm |
| 1052 | ${MD5_JPEG_420_IFAST_Q100_PROG}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1053 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1054 | # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1055 | add_bittest(djpeg 420-q100-ifast-prog "-dct;fast" |
| 1056 | testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg |
| 1057 | ${MD5_PPM_420_Q100_IFAST} cjpeg-${libtype}-420-q100-ifast-prog) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1058 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1059 | # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1060 | add_bittest(djpeg 420m-q100-ifast-prog "-dct;fast;-nosmooth" |
| 1061 | testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg |
| 1062 | ${MD5_PPM_420M_Q100_IFAST} cjpeg-${libtype}-420-q100-ifast-prog) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1063 | |
| 1064 | # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1065 | add_bittest(cjpeg gray-islow "-gray;-dct;int" |
| 1066 | testout_gray_islow.jpg ${TESTIMAGES}/testorig.ppm |
| 1067 | ${MD5_JPEG_GRAY_ISLOW}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1068 | |
DRC | 78df2e6 | 2014-05-12 09:23:57 +0000 | [diff] [blame] | 1069 | # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1070 | add_bittest(djpeg gray-islow "-dct;int" |
| 1071 | testout_gray_islow.ppm testout_gray_islow.jpg |
| 1072 | ${MD5_PPM_GRAY_ISLOW} cjpeg-${libtype}-gray-islow) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1073 | |
DRC | 78df2e6 | 2014-05-12 09:23:57 +0000 | [diff] [blame] | 1074 | # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1075 | add_bittest(djpeg gray-islow-rgb "-dct;int;-rgb" |
| 1076 | testout_gray_islow_rgb.ppm testout_gray_islow.jpg |
| 1077 | ${MD5_PPM_GRAY_ISLOW_RGB} cjpeg-${libtype}-gray-islow) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1078 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1079 | if(NOT WITH_12BIT) |
| 1080 | # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1081 | add_bittest(djpeg gray-islow-565 "-dct;int;-rgb565;-dither;none;-bmp" |
| 1082 | testout_gray_islow_565.bmp testout_gray_islow.jpg |
| 1083 | ${MD5_BMP_GRAY_ISLOW_565} cjpeg-${libtype}-gray-islow) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1084 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1085 | # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1086 | add_bittest(djpeg gray-islow-565D "-dct;int;-rgb565;-bmp" |
| 1087 | testout_gray_islow_565D.bmp testout_gray_islow.jpg |
| 1088 | ${MD5_BMP_GRAY_ISLOW_565D} cjpeg-${libtype}-gray-islow) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1089 | endif() |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1090 | |
| 1091 | # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow |
| 1092 | # ENT: 2-pass huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1093 | add_bittest(cjpeg 420s-ifast-opt "-sample;2x2;-smooth;1;-dct;int;-opt" |
| 1094 | testout_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm |
| 1095 | ${MD5_JPEG_420S_IFAST_OPT}) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1096 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1097 | if(FLOATTEST) |
| 1098 | # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff |
| 1099 | add_bittest(cjpeg 3x2-float-prog "-sample;3x2;-dct;float;-prog" |
| 1100 | testout_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm |
| 1101 | ${MD5_JPEG_3x2_FLOAT_PROG_${FLOATTEST_UC}}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1102 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1103 | # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff |
| 1104 | add_bittest(djpeg 3x2-float-prog "-dct;float" |
| 1105 | testout_3x2_float.ppm testout_3x2_float_prog.jpg |
| 1106 | ${MD5_PPM_3x2_FLOAT_${FLOATTEST_UC}} cjpeg-${libtype}-3x2-float-prog) |
| 1107 | endif() |
| 1108 | |
| 1109 | # CC: RGB->YCC SAMP: fullsize/int FDCT: ifast ENT: prog huff |
| 1110 | add_bittest(cjpeg 3x2-ifast-prog "-sample;3x2;-dct;fast;-prog" |
| 1111 | testout_3x2_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm |
| 1112 | ${MD5_JPEG_3x2_IFAST_PROG}) |
| 1113 | |
| 1114 | # CC: YCC->RGB SAMP: fullsize/int IDCT: ifast ENT: prog huff |
| 1115 | add_bittest(djpeg 3x2-ifast-prog "-dct;fast" |
| 1116 | testout_3x2_ifast.ppm testout_3x2_ifast_prog.jpg |
| 1117 | ${MD5_PPM_3x2_IFAST} cjpeg-${libtype}-3x2-ifast-prog) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1118 | |
| 1119 | if(WITH_ARITH_ENC) |
| 1120 | # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1121 | add_bittest(cjpeg 420-islow-ari "-dct;int;-arithmetic" |
| 1122 | testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm |
| 1123 | ${MD5_JPEG_420_ISLOW_ARI}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1124 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1125 | add_bittest(jpegtran 420-islow-ari "-arithmetic" |
| 1126 | testout_420_islow_ari2.jpg ${TESTIMAGES}/testimgint.jpg |
| 1127 | ${MD5_JPEG_420_ISLOW_ARI}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1128 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1129 | # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1130 | add_bittest(cjpeg 444-islow-progari |
| 1131 | "-sample;1x1;-dct;int;-prog;-arithmetic" |
| 1132 | testout_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm |
| 1133 | ${MD5_JPEG_444_ISLOW_PROGARI}) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1134 | endif() |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1135 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1136 | if(WITH_ARITH_DEC) |
| 1137 | # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1138 | add_bittest(djpeg 420m-ifast-ari "-fast;-ppm" |
| 1139 | testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg |
| 1140 | ${MD5_PPM_420M_IFAST_ARI}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1141 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1142 | add_bittest(jpegtran 420-islow "" |
| 1143 | testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg |
| 1144 | ${MD5_JPEG_420_ISLOW}) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1145 | endif() |
| 1146 | |
| 1147 | # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff |
| 1148 | # 15/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff |
| 1149 | # 13/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff |
| 1150 | # 11/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff |
| 1151 | # 9/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff |
| 1152 | # 7/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow |
| 1153 | # ENT: huff |
| 1154 | # 3/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow |
| 1155 | # ENT: huff |
| 1156 | # 5/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow |
| 1157 | # ENT: huff |
| 1158 | # 1/2-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow |
| 1159 | # ENT: huff |
| 1160 | # 3/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow |
| 1161 | # ENT: huff |
| 1162 | # 1/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow |
| 1163 | # ENT: huff |
| 1164 | # 1/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow |
| 1165 | # ENT: huff |
| 1166 | foreach(scale 2_1 15_8 13_8 11_8 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) |
| 1167 | string(REGEX REPLACE "_" "/" scalearg ${scale}) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1168 | add_bittest(djpeg 420m-islow-${scale} |
| 1169 | "-dct;int;-scale;${scalearg};-nosmooth;-ppm" |
| 1170 | testout_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG} |
| 1171 | ${MD5_PPM_420M_ISLOW_${scale}}) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1172 | endforeach() |
| 1173 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1174 | if(NOT WITH_12BIT) |
| 1175 | # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1176 | add_bittest(djpeg 420-islow-256 "-dct;int;-colors;256;-bmp" |
| 1177 | testout_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG} |
| 1178 | ${MD5_BMP_420_ISLOW_256}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1179 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1180 | # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1181 | add_bittest(djpeg 420-islow-565 "-dct;int;-rgb565;-dither;none;-bmp" |
| 1182 | testout_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG} |
| 1183 | ${MD5_BMP_420_ISLOW_565}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1184 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1185 | # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1186 | add_bittest(djpeg 420-islow-565D "-dct;int;-rgb565;-bmp" |
| 1187 | testout_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG} |
| 1188 | ${MD5_BMP_420_ISLOW_565D}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1189 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1190 | # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1191 | add_bittest(djpeg 420m-islow-565 |
| 1192 | "-dct;int;-nosmooth;-rgb565;-dither;none;-bmp" |
| 1193 | testout_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG} |
| 1194 | ${MD5_BMP_420M_ISLOW_565}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1195 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1196 | # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1197 | add_bittest(djpeg 420m-islow-565D "-dct;int;-nosmooth;-rgb565;-bmp" |
| 1198 | testout_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG} |
| 1199 | ${MD5_BMP_420M_ISLOW_565D}) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1200 | endif() |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1201 | |
| 1202 | # Partial decode tests. These tests are designed to cover all of the |
| 1203 | # possible code paths in jpeg_skip_scanlines(). |
| 1204 | |
| 1205 | # Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1206 | add_bittest(djpeg 420-islow-skip15_31 "-dct;int;-skip;15,31;-ppm" |
| 1207 | testout_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG} |
| 1208 | ${MD5_PPM_420_ISLOW_SKIP15_31}) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1209 | |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1210 | # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith |
| 1211 | if(WITH_ARITH_DEC) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1212 | add_bittest(djpeg 420-islow-ari-skip16_139 "-dct;int;-skip;16,139;-ppm" |
| 1213 | testout_420_islow_ari_skip16,139.ppm ${TESTIMAGES}/testimgari.jpg |
| 1214 | ${MD5_PPM_420_ISLOW_ARI_SKIP16_139}) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1215 | endif() |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1216 | |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1217 | # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1218 | add_test(cjpeg-${libtype}-420-islow-prog |
| 1219 | cjpeg${suffix} -dct int -prog |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1220 | -outfile testout_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1221 | add_bittest(djpeg 420-islow-prog-crop62x62_71_71 |
| 1222 | "-dct;int;-crop;62x62+71+71;-ppm" |
| 1223 | testout_420_islow_prog_crop62x62,71,71.ppm testout_420_islow_prog.jpg |
| 1224 | ${MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71} cjpeg-${libtype}-420-islow-prog) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1225 | |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1226 | # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith |
| 1227 | if(WITH_ARITH_DEC) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1228 | add_bittest(djpeg 420-islow-ari-crop53x53_4_4 |
| 1229 | "-dct;int;-crop;53x53+4+4;-ppm" |
| 1230 | testout_420_islow_ari_crop53x53,4,4.ppm ${TESTIMAGES}/testimgari.jpg |
| 1231 | ${MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4}) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1232 | endif() |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1233 | |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1234 | # Context rows: No Intra-iMCU row: Yes ENT: huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1235 | add_test(cjpeg-${libtype}-444-islow |
| 1236 | cjpeg${suffix} -dct int -sample 1x1 |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1237 | -outfile testout_444_islow.jpg ${TESTIMAGES}/testorig.ppm) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1238 | add_bittest(djpeg 444-islow-skip1_6 "-dct;int;-skip;1,6;-ppm" |
| 1239 | testout_444_islow_skip1,6.ppm testout_444_islow.jpg |
| 1240 | ${MD5_PPM_444_ISLOW_SKIP1_6} cjpeg-${libtype}-444-islow) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1241 | |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1242 | # Context rows: No Intra-iMCU row: No ENT: prog huff |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1243 | add_test(cjpeg-${libtype}-444-islow-prog |
| 1244 | cjpeg${suffix} -dct int -prog -sample 1x1 |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1245 | -outfile testout_444_islow_prog.jpg ${TESTIMAGES}/testorig.ppm) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1246 | add_bittest(djpeg 444-islow-prog-crop98x98_13_13 |
| 1247 | "-dct;int;-crop;98x98+13+13;-ppm" |
| 1248 | testout_444_islow_prog_crop98x98,13,13.ppm testout_444_islow_prog.jpg |
| 1249 | ${MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13} cjpeg-${libtype}-444-islow-prog) |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1250 | |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1251 | # Context rows: No Intra-iMCU row: No ENT: arith |
| 1252 | if(WITH_ARITH_ENC) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1253 | add_test(cjpeg-${libtype}-444-islow-ari |
| 1254 | cjpeg${suffix} -dct int -arithmetic -sample 1x1 |
DRC | f913438 | 2016-02-06 14:09:20 -0600 | [diff] [blame] | 1255 | -outfile testout_444_islow_ari.jpg ${TESTIMAGES}/testorig.ppm) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1256 | if(WITH_ARITH_DEC) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1257 | add_bittest(djpeg 444-islow-ari-crop37x37_0_0 |
| 1258 | "-dct;int;-crop;37x37+0+0;-ppm" |
| 1259 | testout_444_islow_ari_crop37x37,0,0.ppm testout_444_islow_ari.jpg |
| 1260 | ${MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0} cjpeg-${libtype}-444-islow-ari) |
DRC | 7a7da94 | 2015-06-27 08:10:31 +0000 | [diff] [blame] | 1261 | endif() |
| 1262 | endif() |
| 1263 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1264 | add_bittest(jpegtran crop "-crop;120x90+20+50;-transpose;-perfect" |
| 1265 | testout_crop.jpg ${TESTIMAGES}/${TESTORIG} |
| 1266 | ${MD5_JPEG_CROP}) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 1267 | |
DRC | 0af8d67 | 2012-01-31 11:09:11 +0000 | [diff] [blame] | 1268 | endforeach() |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 1269 | |
DRC | 6aae007 | 2016-11-15 08:37:04 -0600 | [diff] [blame] | 1270 | add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1271 | ${CMAKE_CURRENT_SOURCE_DIR}/cmakescripts/testclean.cmake) |
DRC | a0f878a | 2011-04-02 04:43:14 +0000 | [diff] [blame] | 1272 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1273 | if(WITH_TURBOJPEG) |
| 1274 | configure_file(tjbenchtest.in tjbenchtest @ONLY) |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 1275 | configure_file(tjexampletest.in tjexampletest @ONLY) |
DRC | cd8a125 | 2017-11-15 09:19:27 -0600 | [diff] [blame] | 1276 | if(WIN32) |
| 1277 | set(BASH bash) |
| 1278 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1279 | if(WITH_JAVA) |
| 1280 | configure_file(tjbenchtest.java.in tjbenchtest.java @ONLY) |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 1281 | configure_file(tjexampletest.java.in tjexampletest.java @ONLY) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1282 | add_custom_target(tjtest |
DRC | cd8a125 | 2017-11-15 09:19:27 -0600 | [diff] [blame] | 1283 | COMMAND echo tjbenchtest |
| 1284 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest |
| 1285 | COMMAND echo tjbenchtest -alloc |
| 1286 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -alloc |
| 1287 | COMMAND echo tjbenchtest -yuv |
| 1288 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -yuv |
| 1289 | COMMAND echo tjbenchtest -yuv -alloc |
| 1290 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -yuv -alloc |
DRC | 087ec12 | 2017-11-15 20:50:53 -0600 | [diff] [blame] | 1291 | COMMAND echo tjbenchtest -progressive |
| 1292 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive |
DRC | ded5a50 | 2019-08-15 13:24:25 -0500 | [diff] [blame] | 1293 | COMMAND echo tjbenchtest -progressive -yuv |
| 1294 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive -yuv |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 1295 | COMMAND echo tjexampletest |
| 1296 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest |
DRC | cd8a125 | 2017-11-15 09:19:27 -0600 | [diff] [blame] | 1297 | COMMAND echo tjbenchtest.java |
| 1298 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java |
| 1299 | COMMAND echo tjbenchtest.java -yuv |
| 1300 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java -yuv |
DRC | 087ec12 | 2017-11-15 20:50:53 -0600 | [diff] [blame] | 1301 | COMMAND echo tjbenchtest.java -progressive |
| 1302 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java -progressive |
DRC | ded5a50 | 2019-08-15 13:24:25 -0500 | [diff] [blame] | 1303 | COMMAND echo tjexampletest.java -progressive -yuv |
| 1304 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java |
| 1305 | -progressive -yuv |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 1306 | COMMAND echo tjexampletest.java |
| 1307 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest.java |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1308 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest |
| 1309 | ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest.java |
| 1310 | ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1311 | else() |
| 1312 | add_custom_target(tjtest |
DRC | cd8a125 | 2017-11-15 09:19:27 -0600 | [diff] [blame] | 1313 | COMMAND echo tjbenchtest |
| 1314 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest |
| 1315 | COMMAND echo tjbenchtest -alloc |
| 1316 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -alloc |
| 1317 | COMMAND echo tjbenchtest -yuv |
| 1318 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -yuv |
| 1319 | COMMAND echo tjbenchtest -yuv -alloc |
| 1320 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -yuv -alloc |
DRC | ded5a50 | 2019-08-15 13:24:25 -0500 | [diff] [blame] | 1321 | COMMAND echo tjbenchtest -progressive |
| 1322 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive |
| 1323 | COMMAND echo tjbenchtest -progressive -yuv |
| 1324 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest -progressive -yuv |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 1325 | COMMAND echo tjexampletest |
| 1326 | COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/tjexampletest |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1327 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tjbenchtest) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1328 | endif() |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 1329 | endif() |
| 1330 | |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1331 | |
| 1332 | ############################################################################### |
| 1333 | # INSTALLATION |
| 1334 | ############################################################################### |
| 1335 | |
DRC | 0c8eb5b | 2018-07-19 17:01:42 -0500 | [diff] [blame] | 1336 | set(EXE ${CMAKE_EXECUTABLE_SUFFIX}) |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 1337 | |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1338 | if(WITH_TURBOJPEG) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 1339 | if(ENABLE_SHARED) |
| 1340 | install(TARGETS turbojpeg tjbench |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1341 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 1342 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 1343 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
DRC | 75be88c | 2019-02-11 13:10:09 -0600 | [diff] [blame] | 1344 | if(NOT CMAKE_VERSION VERSION_LESS "3.1" AND MSVC AND |
| 1345 | CMAKE_C_LINKER_SUPPORTS_PDB) |
| 1346 | install(FILES "$<TARGET_PDB_FILE:turbojpeg>" |
| 1347 | DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) |
| 1348 | endif() |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 1349 | endif() |
| 1350 | if(ENABLE_STATIC) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1351 | install(TARGETS turbojpeg-static ARCHIVE |
| 1352 | DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 1353 | if(NOT ENABLE_SHARED) |
DRC | f37b7c1 | 2019-07-02 11:28:26 -0500 | [diff] [blame] | 1354 | if(MSVC_IDE OR XCODE) |
DRC | 2d0b675 | 2019-01-25 16:46:02 -0600 | [diff] [blame] | 1355 | set(DIR "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}") |
| 1356 | else() |
| 1357 | set(DIR ${CMAKE_CURRENT_BINARY_DIR}) |
| 1358 | endif() |
| 1359 | install(PROGRAMS ${DIR}/tjbench-static${EXE} |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1360 | DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME tjbench${EXE}) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 1361 | endif() |
| 1362 | endif() |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1363 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg.h |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1364 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
DRC | aee4f72 | 2014-08-09 23:06:07 +0000 | [diff] [blame] | 1365 | endif() |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 1366 | |
| 1367 | if(ENABLE_STATIC) |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1368 | install(TARGETS jpeg-static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 1369 | if(NOT ENABLE_SHARED) |
DRC | f37b7c1 | 2019-07-02 11:28:26 -0500 | [diff] [blame] | 1370 | if(MSVC_IDE OR XCODE) |
DRC | 2d0b675 | 2019-01-25 16:46:02 -0600 | [diff] [blame] | 1371 | set(DIR "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}") |
| 1372 | else() |
| 1373 | set(DIR ${CMAKE_CURRENT_BINARY_DIR}) |
| 1374 | endif() |
| 1375 | install(PROGRAMS ${DIR}/cjpeg-static${EXE} |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1376 | DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME cjpeg${EXE}) |
DRC | 2d0b675 | 2019-01-25 16:46:02 -0600 | [diff] [blame] | 1377 | install(PROGRAMS ${DIR}/djpeg-static${EXE} |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1378 | DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME djpeg${EXE}) |
DRC | 2d0b675 | 2019-01-25 16:46:02 -0600 | [diff] [blame] | 1379 | install(PROGRAMS ${DIR}/jpegtran-static${EXE} |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1380 | DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME jpegtran${EXE}) |
DRC | 665c96e | 2015-05-15 22:08:21 +0000 | [diff] [blame] | 1381 | endif() |
| 1382 | endif() |
| 1383 | |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1384 | install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 1385 | |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1386 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.ijg |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 1387 | ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/example.txt |
| 1388 | ${CMAKE_CURRENT_SOURCE_DIR}/tjexample.c |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1389 | ${CMAKE_CURRENT_SOURCE_DIR}/libjpeg.txt |
| 1390 | ${CMAKE_CURRENT_SOURCE_DIR}/structure.txt |
| 1391 | ${CMAKE_CURRENT_SOURCE_DIR}/usage.txt ${CMAKE_CURRENT_SOURCE_DIR}/wizard.txt |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1392 | ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) |
DRC | 8c40ac8 | 2017-11-16 18:46:01 -0600 | [diff] [blame] | 1393 | if(WITH_JAVA) |
| 1394 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/java/TJExample.java |
| 1395 | DESTINATION ${CMAKE_INSTALL_DOCDIR}) |
| 1396 | endif() |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1397 | |
DRC | e15a6b4 | 2018-03-23 11:14:50 -0500 | [diff] [blame] | 1398 | if(UNIX OR MINGW) |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1399 | install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cjpeg.1 |
| 1400 | ${CMAKE_CURRENT_SOURCE_DIR}/djpeg.1 ${CMAKE_CURRENT_SOURCE_DIR}/jpegtran.1 |
| 1401 | ${CMAKE_CURRENT_SOURCE_DIR}/rdjpgcom.1 |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1402 | ${CMAKE_CURRENT_SOURCE_DIR}/wrjpgcom.1 |
| 1403 | DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1404 | endif() |
DRC | 504a295 | 2018-10-11 15:13:34 -0500 | [diff] [blame] | 1405 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libjpeg.pc |
| 1406 | ${CMAKE_CURRENT_BINARY_DIR}/pkgscripts/libturbojpeg.pc |
| 1407 | DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) |
DRC | e2befde | 2010-10-17 07:28:08 +0000 | [diff] [blame] | 1408 | |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1409 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h |
| 1410 | ${CMAKE_CURRENT_SOURCE_DIR}/jerror.h ${CMAKE_CURRENT_SOURCE_DIR}/jmorecfg.h |
DRC | d681fa7 | 2016-12-07 10:54:54 -0600 | [diff] [blame] | 1411 | ${CMAKE_CURRENT_SOURCE_DIR}/jpeglib.h |
| 1412 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
DRC | 6abd391 | 2016-11-15 08:47:43 -0600 | [diff] [blame] | 1413 | |
| 1414 | include(cmakescripts/BuildPackages.cmake) |
DRC | 3da94de | 2016-11-20 19:10:54 -0600 | [diff] [blame] | 1415 | |
DRC | 952191d | 2016-12-03 14:21:11 -0600 | [diff] [blame] | 1416 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmakescripts/cmake_uninstall.cmake.in" |
DRC | 3da94de | 2016-11-20 19:10:54 -0600 | [diff] [blame] | 1417 | "cmake_uninstall.cmake" IMMEDIATE @ONLY) |
| 1418 | |
| 1419 | add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P cmake_uninstall.cmake) |