DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 1 | # |
| 2 | # Setup |
| 3 | # |
| 4 | |
DRC | d45c549 | 2014-03-11 06:21:46 +0000 | [diff] [blame] | 5 | cmake_minimum_required(VERSION 2.8.8) |
DRC | 9fe22da | 2014-04-16 23:30:38 +0000 | [diff] [blame] | 6 | # Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES |
| 7 | if(POLICY CMP0022) |
| 8 | cmake_policy(SET CMP0022 OLD) |
| 9 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 10 | |
DRC | 5d6f858 | 2011-02-18 23:08:58 +0000 | [diff] [blame] | 11 | project(libjpeg-turbo C) |
DRC | 17745dd | 2013-04-25 09:45:50 +0000 | [diff] [blame] | 12 | set(VERSION 1.3.80) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 13 | |
DRC | 9fe22da | 2014-04-16 23:30:38 +0000 | [diff] [blame] | 14 | if(CYGWIN OR NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 15 | execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) |
| 16 | string(REGEX REPLACE "\n" "" BUILD ${BUILD}) |
| 17 | elseif(WIN32) |
DRC | 5e3bb3e | 2012-10-12 10:19:09 +0000 | [diff] [blame] | 18 | execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE |
| 19 | BUILD) |
| 20 | string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}") |
| 21 | if (BUILD STREQUAL "") |
| 22 | execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD) |
| 23 | string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" BUILD "${BUILD}") |
| 24 | else() |
| 25 | string(SUBSTRING "${BUILD}" 0 8 BUILD) |
| 26 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 27 | else() |
DRC | 378da4d | 2010-10-15 19:11:11 +0000 | [diff] [blame] | 28 | message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 29 | endif() |
| 30 | |
DRC | 2ffcb8e | 2011-04-04 04:56:24 +0000 | [diff] [blame] | 31 | # This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning |
| 32 | # in Visual Studio, and it always defaults to Debug when using NMake. |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 33 | if(NOT CMAKE_BUILD_TYPE) |
| 34 | set(CMAKE_BUILD_TYPE Release) |
| 35 | endif() |
| 36 | |
| 37 | message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") |
| 38 | |
| 39 | # This only works if building from the command line. There is currently no way |
DRC | 2ffcb8e | 2011-04-04 04:56:24 +0000 | [diff] [blame] | 40 | # to set a variable's value based on the build type when using Visual Studio. |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 41 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 42 | set(BUILD "${BUILD}d") |
| 43 | endif() |
| 44 | |
DRC | eb2b9d6 | 2010-10-15 04:55:13 +0000 | [diff] [blame] | 45 | message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") |
| 46 | |
DRC | ddcd5a1 | 2011-04-15 00:24:02 +0000 | [diff] [blame] | 47 | option(WITH_SIMD "Include SIMD extensions" TRUE) |
| 48 | option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE) |
| 49 | option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE) |
| 50 | option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) |
| 51 | option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 52 | option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 53 | option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 54 | |
| 55 | if(WITH_ARITH_ENC) |
| 56 | set(C_ARITH_CODING_SUPPORTED 1) |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 57 | message(STATUS "Arithmetic encoding support enabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 58 | else() |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 59 | message(STATUS "Arithmetic encoding support disabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 60 | endif() |
| 61 | |
| 62 | if(WITH_ARITH_DEC) |
| 63 | set(D_ARITH_CODING_SUPPORTED 1) |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 64 | message(STATUS "Arithmetic decoding support enabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 65 | else() |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 66 | message(STATUS "Arithmetic decoding support disabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 67 | endif() |
| 68 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 69 | if(WITH_JAVA) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 70 | message(STATUS "TurboJPEG Java wrapper enabled") |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 71 | else() |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 72 | message(STATUS "TurboJPEG Java wrapper disabled") |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 73 | endif() |
| 74 | |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 75 | set(SO_AGE 0) |
| 76 | if(WITH_MEM_SRCDST) |
| 77 | set(SO_AGE 1) |
| 78 | endif() |
| 79 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 80 | set(JPEG_LIB_VERSION 62) |
| 81 | set(DLL_VERSION ${JPEG_LIB_VERSION}) |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 82 | set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 83 | if(WITH_JPEG8) |
| 84 | set(JPEG_LIB_VERSION 80) |
| 85 | set(DLL_VERSION 8) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 86 | set(FULLVERSION ${DLL_VERSION}.0.2) |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 87 | message(STATUS "Emulating libjpeg v8 API/ABI") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 88 | elseif(WITH_JPEG7) |
| 89 | set(JPEG_LIB_VERSION 70) |
| 90 | set(DLL_VERSION 7) |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 91 | set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 92 | message(STATUS "Emulating libjpeg v7 API/ABI") |
| 93 | endif(WITH_JPEG8) |
| 94 | |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 95 | if(WITH_MEM_SRCDST) |
| 96 | set(MEM_SRCDST_SUPPORTED 1) |
| 97 | message(STATUS "In-memory source/destination managers enabled") |
| 98 | else() |
| 99 | message(STATUS "In-memory source/destination managers disabled") |
| 100 | endif() |
| 101 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 102 | if(MSVC) |
| 103 | # Use the static C library for all build types |
| 104 | foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 105 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 106 | if(${var} MATCHES "/MD") |
| 107 | string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") |
| 108 | endif() |
| 109 | endforeach() |
| 110 | |
| 111 | add_definitions(-W3 -wd4996) |
| 112 | endif() |
| 113 | |
| 114 | # Detect whether compiler is 64-bit |
| 115 | if(MSVC AND CMAKE_CL_64) |
| 116 | set(SIMD_X86_64 1) |
| 117 | set(64BIT 1) |
| 118 | elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) |
| 119 | set(SIMD_X86_64 1) |
| 120 | set(64BIT 1) |
| 121 | endif() |
| 122 | |
| 123 | if(64BIT) |
| 124 | message(STATUS "64-bit build") |
| 125 | else() |
| 126 | message(STATUS "32-bit build") |
| 127 | endif() |
| 128 | |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 129 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 130 | if(MSVC) |
| 131 | set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}) |
| 132 | else() |
| 133 | set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}-gcc) |
| 134 | endif() |
| 135 | if(64BIT) |
| 136 | set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64) |
| 137 | endif() |
| 138 | set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH |
| 139 | "Directory into which to install libjpeg-turbo (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})" |
| 140 | FORCE) |
| 141 | endif() |
| 142 | |
| 143 | message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}") |
| 144 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 145 | configure_file(win/jconfig.h.in jconfig.h) |
DRC | ff6961f | 2014-04-20 09:17:11 +0000 | [diff] [blame] | 146 | configure_file(win/jconfigint.h.in jconfigint.h) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 147 | |
| 148 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) |
| 149 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 150 | if(WITH_JAVA) |
| 151 | find_package(Java) |
| 152 | find_package(JNI) |
DRC | db42506 | 2011-04-03 06:10:18 +0000 | [diff] [blame] | 153 | if(DEFINED JAVACFLAGS) |
| 154 | message(STATUS "Java compiler flags = ${JAVACFLAGS}") |
| 155 | endif() |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 156 | endif() |
| 157 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 158 | |
| 159 | # |
| 160 | # Targets |
| 161 | # |
| 162 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 163 | set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c |
| 164 | jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c |
| 165 | jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c |
| 166 | jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c |
| 167 | jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c |
| 168 | jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c |
| 169 | jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) |
| 170 | |
| 171 | if(WITH_ARITH_ENC OR WITH_ARITH_DEC) |
| 172 | set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) |
| 173 | endif() |
| 174 | |
| 175 | if(WITH_ARITH_ENC) |
| 176 | set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) |
| 177 | endif() |
| 178 | |
| 179 | if(WITH_ARITH_DEC) |
| 180 | set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) |
| 181 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 182 | |
| 183 | if(WITH_SIMD) |
| 184 | add_definitions(-DWITH_SIMD) |
| 185 | add_subdirectory(simd) |
| 186 | if(SIMD_X86_64) |
| 187 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c) |
| 188 | else() |
| 189 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c) |
| 190 | endif() |
| 191 | # This tells CMake that the "source" files haven't been generated yet |
| 192 | set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) |
| 193 | else() |
| 194 | set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c) |
DRC | 6f4ba61 | 2010-10-16 21:27:38 +0000 | [diff] [blame] | 195 | message(STATUS "Not using SIMD acceleration") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 196 | endif() |
| 197 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 198 | if(WITH_JAVA) |
| 199 | add_subdirectory(java) |
| 200 | endif() |
| 201 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 202 | add_subdirectory(sharedlib) |
| 203 | |
| 204 | add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 205 | if(NOT MSVC) |
| 206 | set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) |
| 207 | endif() |
| 208 | if(WITH_SIMD) |
| 209 | add_dependencies(jpeg-static simd) |
| 210 | endif() |
| 211 | |
DRC | 418dbdf | 2011-05-26 10:45:06 +0000 | [diff] [blame] | 212 | set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 213 | if(WITH_JAVA) |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 214 | set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 215 | include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 216 | endif() |
| 217 | |
| 218 | add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 219 | set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) |
DRC | 389c472 | 2011-02-06 18:48:13 +0000 | [diff] [blame] | 220 | if(MINGW) |
| 221 | set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) |
| 222 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 223 | target_link_libraries(turbojpeg jpeg-static) |
| 224 | set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "") |
| 225 | |
| 226 | add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS} |
DRC | 418dbdf | 2011-05-26 10:45:06 +0000 | [diff] [blame] | 227 | turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 228 | if(NOT MSVC) |
| 229 | set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) |
| 230 | endif() |
| 231 | if(WITH_SIMD) |
| 232 | add_dependencies(turbojpeg-static simd) |
| 233 | endif() |
| 234 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 235 | add_executable(tjunittest tjunittest.c tjutil.c) |
| 236 | target_link_libraries(tjunittest turbojpeg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 237 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 238 | add_executable(tjunittest-static tjunittest.c tjutil.c) |
| 239 | target_link_libraries(tjunittest-static turbojpeg-static) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 240 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 241 | add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c |
DRC | 4348464 | 2011-05-24 17:03:51 +0000 | [diff] [blame] | 242 | wrppm.c) |
DRC | 4ad6003 | 2011-09-20 05:41:54 +0000 | [diff] [blame] | 243 | target_link_libraries(tjbench turbojpeg jpeg-static) |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 244 | set_property(TARGET tjbench PROPERTY COMPILE_FLAGS |
DRC | 4348464 | 2011-05-24 17:03:51 +0000 | [diff] [blame] | 245 | "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 246 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 247 | add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c |
DRC | 4348464 | 2011-05-24 17:03:51 +0000 | [diff] [blame] | 248 | wrppm.c) |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 249 | target_link_libraries(tjbench-static turbojpeg-static jpeg-static) |
| 250 | set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS |
DRC | 4348464 | 2011-05-24 17:03:51 +0000 | [diff] [blame] | 251 | "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 252 | |
| 253 | add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c |
| 254 | rdtarga.c) |
| 255 | set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS |
DRC | 5ee81f4 | 2011-05-02 00:35:50 +0000 | [diff] [blame] | 256 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 257 | target_link_libraries(cjpeg-static jpeg-static) |
| 258 | |
| 259 | add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c |
| 260 | wrppm.c wrtarga.c) |
| 261 | set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS |
DRC | 5ee81f4 | 2011-05-02 00:35:50 +0000 | [diff] [blame] | 262 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 263 | target_link_libraries(djpeg-static jpeg-static) |
| 264 | |
| 265 | add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) |
| 266 | target_link_libraries(jpegtran-static jpeg-static) |
DRC | 7e3fd2f | 2011-05-25 06:04:43 +0000 | [diff] [blame] | 267 | set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 268 | |
| 269 | add_executable(rdjpgcom rdjpgcom.c) |
| 270 | |
| 271 | add_executable(wrjpgcom rdjpgcom.c) |
| 272 | |
| 273 | |
| 274 | # |
| 275 | # Tests |
| 276 | # |
| 277 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 278 | if(MSVC_IDE) |
| 279 | set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") |
| 280 | else() |
| 281 | set(OBJDIR "") |
| 282 | endif() |
| 283 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 284 | enable_testing() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 285 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 286 | set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b) |
| 287 | set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291) |
| 288 | set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8) |
| 289 | set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa) |
| 290 | set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d) |
| 291 | set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade) |
| 292 | set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294) |
| 293 | set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1) |
| 294 | set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d) |
| 295 | set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed) |
| 296 | set(MD5_PPM_GRAY_RGB_ISLOW 116424ac07b79e5e801f00508eab48ec) |
| 297 | set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8) |
| 298 | if(WITH_SIMD) |
| 299 | set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71) |
| 300 | set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb) |
| 301 | else() |
| 302 | set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5) |
DRC | 715bb41 | 2014-05-11 10:09:07 +0000 | [diff] [blame^] | 303 | set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 304 | endif() |
| 305 | set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1) |
| 306 | set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617) |
| 307 | set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437) |
| 308 | set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f) |
| 309 | set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9) |
| 310 | set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7) |
| 311 | set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f) |
| 312 | set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5) |
| 313 | set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6) |
| 314 | set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946) |
| 315 | set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646) |
| 316 | set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b) |
| 317 | set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81) |
| 318 | set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996) |
| 319 | set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca) |
| 320 | set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f) |
| 321 | set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 322 | set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) |
| 323 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 324 | if(WITH_JAVA) |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 325 | add_test(TJUnitTest |
| 326 | ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 327 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 328 | TJUnitTest) |
| 329 | add_test(TJUnitTest-yuv |
| 330 | ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 331 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 332 | TJUnitTest -yuv) |
| 333 | add_test(TJUnitTest-yuv-nopad |
| 334 | ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 335 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 336 | TJUnitTest -yuv -noyuvpad) |
| 337 | add_test(TJUnitTest-bi |
| 338 | ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 339 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 340 | TJUnitTest -bi) |
| 341 | add_test(TJUnitTest-bi-yuv |
| 342 | ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 343 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 344 | TJUnitTest -bi -yuv) |
| 345 | add_test(TJUnitTest-bi-yuv-nopad |
| 346 | ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar |
| 347 | -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} |
| 348 | TJUnitTest -bi -yuv -noyuvpad) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 349 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 350 | |
DRC | 35db75e | 2014-05-06 22:44:46 +0000 | [diff] [blame] | 351 | foreach(libtype shared static) |
| 352 | if(libtype STREQUAL "shared") |
| 353 | set(dir sharedlib/) |
| 354 | else() |
| 355 | set(dir "") |
| 356 | set(suffix -static) |
| 357 | endif() |
| 358 | add_test(tjunittest${suffix} tjunittest${suffix}) |
| 359 | add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc) |
| 360 | add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv) |
| 361 | add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc) |
| 362 | add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad) |
| 363 | |
| 364 | # These tests are carefully chosen to provide full coverage of as many of the |
| 365 | # underlying algorithms as possible (including all of the SIMD-accelerated |
| 366 | # ones.) |
| 367 | |
| 368 | # CC: null SAMP: fullsize FDCT: islow ENT: huff |
| 369 | add_test(cjpeg${suffix}-rgb-islow |
| 370 | ${dir}cjpeg${suffix} -rgb -dct int -outfile testout_rgb_islow.jpg |
| 371 | ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 372 | add_test(cjpeg${suffix}-rgb-islow-cmp |
| 373 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_RGB_ISLOW} -DFILE=testout_rgb_islow.jpg |
| 374 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 375 | # CC: null SAMP: fullsize IDCT: islow ENT: huff |
| 376 | add_test(djpeg${suffix}-rgb-islow |
| 377 | ${dir}djpeg${suffix} -dct int -ppm -outfile testout_rgb_islow.ppm |
| 378 | testout_rgb_islow.jpg) |
| 379 | add_test(djpeg${suffix}-rgb-islow-cmp |
| 380 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_RGB_ISLOW} -DFILE=testout_rgb_islow.ppm |
| 381 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 382 | |
| 383 | # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff |
| 384 | add_test(cjpeg${suffix}-422-ifast-opt |
| 385 | ${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt |
| 386 | -outfile testout_422_ifast_opt.jpg |
| 387 | ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 388 | add_test(cjpeg${suffix}-422-ifast-opt-cmp |
| 389 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_422_IFAST_OPT} |
| 390 | -DFILE=testout_422_ifast_opt.jpg |
| 391 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 392 | # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff |
| 393 | add_test(djpeg${suffix}-422-ifast |
| 394 | ${dir}djpeg${suffix} -dct fast -outfile testout_422_ifast.ppm |
| 395 | testout_422_ifast_opt.jpg) |
| 396 | add_test(djpeg${suffix}-422-ifast-cmp |
| 397 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422_IFAST} -DFILE=testout_422_ifast.ppm |
| 398 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 399 | # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff |
| 400 | add_test(djpeg${suffix}-422m-ifast |
| 401 | ${dir}djpeg${suffix} -nosmooth -dct fast -outfile testout_422m_ifast.ppm |
| 402 | testout_422_ifast_opt.jpg) |
| 403 | add_test(djpeg${suffix}-422m-ifast-cmp |
| 404 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_422M_IFAST} -DFILE=testout_422m_ifast.ppm |
| 405 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 406 | |
| 407 | # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff |
| 408 | add_test(cjpeg${suffix}-420-q100-ifast-prog |
| 409 | ${dir}cjpeg${suffix} -sample 2x2 -dct fast -quality 100 -prog |
| 410 | -outfile testout_420_q100_ifast_prog.jpg |
| 411 | ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 412 | add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp |
| 413 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_IFAST_Q100_PROG} |
| 414 | -DFILE=testout_420_q100_ifast_prog.jpg |
| 415 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 416 | # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff |
| 417 | add_test(djpeg${suffix}-420-q100-ifast-prog |
| 418 | ${dir}djpeg${suffix} -dct fast -outfile testout_420_q100_ifast.ppm |
| 419 | testout_420_q100_ifast_prog.jpg) |
| 420 | add_test(djpeg${suffix}-420-q100-ifast-prog-cmp |
| 421 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420_Q100_IFAST} |
| 422 | -DFILE=testout_420_q100_ifast.ppm |
| 423 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 424 | # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff |
| 425 | add_test(djpeg${suffix}-420m-q100-ifast-prog |
| 426 | ${dir}djpeg${suffix} -nosmooth -dct fast |
| 427 | -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg) |
| 428 | add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp |
| 429 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_Q100_IFAST} |
| 430 | -DFILE=testout_420m_q100_ifast.ppm |
| 431 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 432 | |
| 433 | # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff |
| 434 | add_test(cjpeg${suffix}-gray-islow |
| 435 | ${dir}cjpeg${suffix} -gray -dct int -outfile testout_gray_islow.jpg |
| 436 | ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 437 | add_test(cjpeg${suffix}-gray-islow-cmp |
| 438 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_GRAY_ISLOW} |
| 439 | -DFILE=testout_gray_islow.jpg |
| 440 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 441 | # CC: Gray->Gray SAMP: fullsize FDCT: islow ENT: huff |
| 442 | add_test(djpeg${suffix}-gray-islow |
| 443 | ${dir}djpeg${suffix} -dct int -outfile testout_gray_islow.ppm |
| 444 | testout_gray_islow.jpg) |
| 445 | add_test(djpeg${suffix}-gray-islow-cmp |
| 446 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_ISLOW} |
| 447 | -DFILE=testout_gray_islow.ppm |
| 448 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 449 | # CC: Gray->RGB SAMP: fullsize FDCT: islow ENT: huff |
| 450 | add_test(djpeg${suffix}-gray-rgb-islow |
| 451 | ${dir}djpeg${suffix} -rgb -dct int -outfile testout_gray_rgb_islow.ppm |
| 452 | testout_gray_islow.jpg) |
| 453 | add_test(cjpeg${suffix}-gray-rgb-islow-cmp |
| 454 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_GRAY_RGB_ISLOW} |
| 455 | -DFILE=testout_gray_rgb_islow.ppm |
| 456 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 457 | |
| 458 | # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow |
| 459 | # ENT: 2-pass huff |
| 460 | add_test(cjpeg${suffix}-420s-ifast-opt |
| 461 | ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt -outfile |
| 462 | testout_420s_ifast_opt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 463 | add_test(cjpeg${suffix}-420s-ifast-opt-cmp |
| 464 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420S_IFAST_OPT} |
| 465 | -DFILE=testout_420s_ifast_opt.jpg |
| 466 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 467 | |
| 468 | # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff |
| 469 | add_test(cjpeg${suffix}-3x2-float-prog |
| 470 | ${dir}cjpeg${suffix} -sample 3x2 -dct float -prog |
| 471 | -outfile testout_3x2_float_prog.jpg |
| 472 | ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 473 | add_test(cjpeg${suffix}-3x2-float-prog-cmp |
| 474 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_3x2_FLOAT_PROG} |
| 475 | -DFILE=testout_3x2_float_prog.jpg |
| 476 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 477 | # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff |
| 478 | add_test(djpeg${suffix}-3x2-float-prog |
| 479 | ${dir}djpeg${suffix} -dct float -outfile testout_3x2_float.ppm |
| 480 | testout_3x2_float_prog.jpg) |
| 481 | add_test(djpeg${suffix}-3x2-float-prog-cmp |
| 482 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_3x2_FLOAT} -DFILE=testout_3x2_float.ppm |
| 483 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 484 | |
| 485 | if(WITH_ARITH_ENC) |
| 486 | # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith |
| 487 | add_test(cjpeg${suffix}-420-islow-ari |
| 488 | ${dir}cjpeg${suffix} -dct int -arithmetic |
| 489 | -outfile testout_420_islow_ari.jpg |
| 490 | ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 491 | add_test(cjpeg${suffix}-420-islow-ari-cmp |
| 492 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} |
| 493 | -DFILE=testout_420_islow_ari.jpg |
| 494 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 495 | add_test(jpegtran${suffix}-420-islow-ari |
| 496 | ${dir}jpegtran${suffix} -arithmetic |
| 497 | -outfile testout_420_islow_ari.jpg |
| 498 | ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) |
| 499 | add_test(jpegtran${suffix}-420-islow-ari-cmp |
| 500 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW_ARI} |
| 501 | -DFILE=testout_420_islow_ari.jpg |
| 502 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 503 | # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith |
| 504 | add_test(cjpeg${suffix}-444-islow-progari |
| 505 | ${dir}cjpeg${suffix} -dct int -progressive -arithmetic -sample 1x1 |
| 506 | -outfile testout_444_islow_progari.jpg |
| 507 | ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 508 | add_test(cjpeg${suffix}-444-islow-progari-cmp |
| 509 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_444_ISLOW_PROGARI} |
| 510 | -DFILE=testout_444_islow_progari.jpg |
| 511 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 512 | endif() |
| 513 | if(WITH_ARITH_DEC) |
| 514 | # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith |
| 515 | add_test(cjpeg${suffix}-420m-ifast-ari |
| 516 | ${dir}djpeg${suffix} -fast -ppm -outfile testout_420m_ifast_ari.ppm |
| 517 | ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) |
| 518 | add_test(cjpeg${suffix}-420m-ifast-ari-cmp |
| 519 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_IFAST_ARI} |
| 520 | -DFILE=testout_420m_ifast_ari.ppm |
| 521 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 522 | add_test(jpegtran${suffix}-420-islow |
| 523 | ${dir}jpegtran${suffix} -outfile testout_420_islow.jpg |
| 524 | ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) |
| 525 | add_test(jpegtran${suffix}-420-islow-cmp |
| 526 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_420_ISLOW} |
| 527 | -DFILE=testout_420_islow.jpg |
| 528 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 529 | endif() |
| 530 | |
| 531 | # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff |
| 532 | # 15/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff |
| 533 | # 13/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff |
| 534 | # 11/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff |
| 535 | # 9/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff |
| 536 | # 7/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow |
| 537 | # ENT: huff |
| 538 | # 3/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow |
| 539 | # ENT: huff |
| 540 | # 5/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow |
| 541 | # ENT: huff |
| 542 | # 1/2-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow |
| 543 | # ENT: huff |
| 544 | # 3/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow |
| 545 | # ENT: huff |
| 546 | # 1/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow |
| 547 | # ENT: huff |
| 548 | # 1/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow |
| 549 | # ENT: huff |
| 550 | 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) |
| 551 | string(REGEX REPLACE "_" "/" scalearg ${scale}) |
| 552 | add_test(djpeg${suffix}-420m-islow-${scale} |
| 553 | ${dir}djpeg${suffix} -dct int -nosmooth -scale ${scalearg} -ppm |
| 554 | -outfile testout_420m_islow_${scale}.ppm |
| 555 | ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
| 556 | add_test(djpeg${suffix}-420m-islow-${scale}-cmp |
| 557 | ${CMAKE_COMMAND} -DMD5=${MD5_PPM_420M_ISLOW_${scale}} |
| 558 | -DFILE=testout_420m_islow_${scale}.ppm |
| 559 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 560 | endforeach() |
| 561 | |
| 562 | # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff |
| 563 | add_test(djpeg${suffix}-420-islow-256 |
| 564 | ${dir}djpeg${suffix} -dct int -bmp -colors 256 |
| 565 | -outfile testout_420_islow_256.bmp |
| 566 | ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
| 567 | add_test(djpeg${suffix}-420-islow-256-cmp |
| 568 | ${CMAKE_COMMAND} -DMD5=${MD5_BMP_420_ISLOW_256} |
| 569 | -DFILE=testout_420_islow_256.bmp |
| 570 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 571 | |
| 572 | add_test(jpegtran${suffix}-crop |
| 573 | ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect |
| 574 | -outfile testout_crop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
| 575 | add_test(jpegtran${suffix}-crop-cmp |
| 576 | ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testout_crop.jpg |
| 577 | -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
| 578 | |
DRC | 0af8d67 | 2012-01-31 11:09:11 +0000 | [diff] [blame] | 579 | endforeach() |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 580 | |
DRC | a0f878a | 2011-04-02 04:43:14 +0000 | [diff] [blame] | 581 | add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P |
| 582 | ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake) |
| 583 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 584 | |
| 585 | # |
| 586 | # Installer |
| 587 | # |
| 588 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 589 | if(MSVC) |
| 590 | set(INST_PLATFORM "Visual C++") |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 591 | set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc) |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 592 | set(INST_REG_NAME ${CMAKE_PROJECT_NAME}) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 593 | elseif(MINGW) |
| 594 | set(INST_PLATFORM GCC) |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 595 | set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc) |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 596 | set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 597 | set(INST_DEFS -DGCC) |
| 598 | endif() |
| 599 | |
| 600 | if(64BIT) |
| 601 | set(INST_PLATFORM "${INST_PLATFORM} 64-bit") |
| 602 | set(INST_NAME ${INST_NAME}64) |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 603 | set(INST_REG_NAME ${INST_DIR}64) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 604 | set(INST_DEFS ${INST_DEFS} -DWIN64) |
| 605 | endif() |
| 606 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 607 | if(WITH_JAVA) |
| 608 | set(INST_DEFS ${INST_DEFS} -DJAVA) |
| 609 | endif() |
| 610 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 611 | if(MSVC_IDE) |
DRC | 926e01f | 2011-04-06 06:35:38 +0000 | [diff] [blame] | 612 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\") |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 613 | else() |
| 614 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=") |
| 615 | endif() |
| 616 | |
DRC | 9fe22da | 2014-04-16 23:30:38 +0000 | [diff] [blame] | 617 | STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX}) |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 618 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 619 | configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY) |
| 620 | |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 621 | if(WITH_JAVA) |
| 622 | set(JAVA_DEPEND java) |
| 623 | endif() |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 624 | add_custom_target(installer |
| 625 | makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 626 | DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 627 | cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND} |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 628 | SOURCES libjpeg-turbo.nsi) |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 629 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 630 | install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 631 | ARCHIVE DESTINATION lib |
| 632 | LIBRARY DESTINATION lib |
| 633 | RUNTIME DESTINATION bin |
| 634 | ) |
| 635 | |
DRC | a1647c8 | 2012-02-10 00:39:05 +0000 | [diff] [blame] | 636 | install(FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt |
DRC | 9fe22da | 2014-04-16 23:30:38 +0000 | [diff] [blame] | 637 | ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt |
DRC | a1647c8 | 2012-02-10 00:39:05 +0000 | [diff] [blame] | 638 | ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt |
| 639 | ${CMAKE_SOURCE_DIR}/wizard.txt |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 640 | DESTINATION doc) |
DRC | e2befde | 2010-10-17 07:28:08 +0000 | [diff] [blame] | 641 | |
| 642 | install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h |
| 643 | ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h |
| 644 | ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include) |