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 | 5eb1efa | 2014-03-11 06:30:21 +0000 | [diff] [blame] | 6 | cmake_policy(SET CMP0022 OLD) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 7 | |
DRC | 5d6f858 | 2011-02-18 23:08:58 +0000 | [diff] [blame] | 8 | project(libjpeg-turbo C) |
DRC | 17745dd | 2013-04-25 09:45:50 +0000 | [diff] [blame] | 9 | set(VERSION 1.3.80) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 10 | |
DRC | 378da4d | 2010-10-15 19:11:11 +0000 | [diff] [blame] | 11 | if(MINGW OR CYGWIN) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 12 | execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) |
| 13 | string(REGEX REPLACE "\n" "" BUILD ${BUILD}) |
| 14 | elseif(WIN32) |
DRC | 5e3bb3e | 2012-10-12 10:19:09 +0000 | [diff] [blame] | 15 | execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE |
| 16 | BUILD) |
| 17 | string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}") |
| 18 | if (BUILD STREQUAL "") |
| 19 | execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD) |
| 20 | string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" BUILD "${BUILD}") |
| 21 | else() |
| 22 | string(SUBSTRING "${BUILD}" 0 8 BUILD) |
| 23 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 24 | else() |
DRC | 378da4d | 2010-10-15 19:11:11 +0000 | [diff] [blame] | 25 | message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 26 | endif() |
| 27 | |
DRC | 2ffcb8e | 2011-04-04 04:56:24 +0000 | [diff] [blame] | 28 | # This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning |
| 29 | # in Visual Studio, and it always defaults to Debug when using NMake. |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 30 | if(NOT CMAKE_BUILD_TYPE) |
| 31 | set(CMAKE_BUILD_TYPE Release) |
| 32 | endif() |
| 33 | |
| 34 | message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") |
| 35 | |
| 36 | # 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] | 37 | # 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] | 38 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 39 | set(BUILD "${BUILD}d") |
| 40 | endif() |
| 41 | |
DRC | eb2b9d6 | 2010-10-15 04:55:13 +0000 | [diff] [blame] | 42 | message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") |
| 43 | |
DRC | ddcd5a1 | 2011-04-15 00:24:02 +0000 | [diff] [blame] | 44 | option(WITH_SIMD "Include SIMD extensions" TRUE) |
| 45 | option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE) |
| 46 | option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE) |
| 47 | option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) |
| 48 | 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] | 49 | 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] | 50 | option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 51 | |
| 52 | if(WITH_ARITH_ENC) |
| 53 | set(C_ARITH_CODING_SUPPORTED 1) |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 54 | message(STATUS "Arithmetic encoding support enabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 55 | else() |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 56 | message(STATUS "Arithmetic encoding support disabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 57 | endif() |
| 58 | |
| 59 | if(WITH_ARITH_DEC) |
| 60 | set(D_ARITH_CODING_SUPPORTED 1) |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 61 | message(STATUS "Arithmetic decoding support enabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 62 | else() |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 63 | message(STATUS "Arithmetic decoding support disabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 64 | endif() |
| 65 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 66 | if(WITH_JAVA) |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 67 | message(STATUS "TurboJPEG Java wrapper enabled") |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 68 | else() |
DRC | 5039d73 | 2013-01-21 23:42:12 +0000 | [diff] [blame] | 69 | message(STATUS "TurboJPEG Java wrapper disabled") |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 70 | endif() |
| 71 | |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 72 | set(SO_AGE 0) |
| 73 | if(WITH_MEM_SRCDST) |
| 74 | set(SO_AGE 1) |
| 75 | endif() |
| 76 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 77 | set(JPEG_LIB_VERSION 62) |
| 78 | set(DLL_VERSION ${JPEG_LIB_VERSION}) |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 79 | set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 80 | if(WITH_JPEG8) |
| 81 | set(JPEG_LIB_VERSION 80) |
| 82 | set(DLL_VERSION 8) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 83 | set(FULLVERSION ${DLL_VERSION}.0.2) |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 84 | message(STATUS "Emulating libjpeg v8 API/ABI") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 85 | elseif(WITH_JPEG7) |
| 86 | set(JPEG_LIB_VERSION 70) |
| 87 | set(DLL_VERSION 7) |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 88 | set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 89 | message(STATUS "Emulating libjpeg v7 API/ABI") |
| 90 | endif(WITH_JPEG8) |
| 91 | |
DRC | ab70623 | 2013-01-18 23:42:31 +0000 | [diff] [blame] | 92 | if(WITH_MEM_SRCDST) |
| 93 | set(MEM_SRCDST_SUPPORTED 1) |
| 94 | message(STATUS "In-memory source/destination managers enabled") |
| 95 | else() |
| 96 | message(STATUS "In-memory source/destination managers disabled") |
| 97 | endif() |
| 98 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 99 | if(MSVC) |
| 100 | # Use the static C library for all build types |
| 101 | foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 102 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 103 | if(${var} MATCHES "/MD") |
| 104 | string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") |
| 105 | endif() |
| 106 | endforeach() |
| 107 | |
| 108 | add_definitions(-W3 -wd4996) |
| 109 | endif() |
| 110 | |
| 111 | # Detect whether compiler is 64-bit |
| 112 | if(MSVC AND CMAKE_CL_64) |
| 113 | set(SIMD_X86_64 1) |
| 114 | set(64BIT 1) |
| 115 | elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) |
| 116 | set(SIMD_X86_64 1) |
| 117 | set(64BIT 1) |
| 118 | endif() |
| 119 | |
| 120 | if(64BIT) |
| 121 | message(STATUS "64-bit build") |
| 122 | else() |
| 123 | message(STATUS "32-bit build") |
| 124 | endif() |
| 125 | |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 126 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 127 | if(MSVC) |
| 128 | set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}) |
| 129 | else() |
| 130 | set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}-gcc) |
| 131 | endif() |
| 132 | if(64BIT) |
| 133 | set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64) |
| 134 | endif() |
| 135 | set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH |
| 136 | "Directory into which to install libjpeg-turbo (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})" |
| 137 | FORCE) |
| 138 | endif() |
| 139 | |
| 140 | message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}") |
| 141 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 142 | configure_file(win/jconfig.h.in jconfig.h) |
| 143 | configure_file(win/config.h.in config.h) |
| 144 | |
| 145 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) |
| 146 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 147 | if(WITH_JAVA) |
| 148 | find_package(Java) |
| 149 | find_package(JNI) |
DRC | db42506 | 2011-04-03 06:10:18 +0000 | [diff] [blame] | 150 | if(DEFINED JAVACFLAGS) |
| 151 | message(STATUS "Java compiler flags = ${JAVACFLAGS}") |
| 152 | endif() |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 153 | endif() |
| 154 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 155 | |
| 156 | # |
| 157 | # Targets |
| 158 | # |
| 159 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 160 | set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c |
| 161 | jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c |
| 162 | jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c |
| 163 | jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c |
| 164 | jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c |
| 165 | jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c |
| 166 | jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) |
| 167 | |
| 168 | if(WITH_ARITH_ENC OR WITH_ARITH_DEC) |
| 169 | set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) |
| 170 | endif() |
| 171 | |
| 172 | if(WITH_ARITH_ENC) |
| 173 | set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) |
| 174 | endif() |
| 175 | |
| 176 | if(WITH_ARITH_DEC) |
| 177 | set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) |
| 178 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 179 | |
| 180 | if(WITH_SIMD) |
| 181 | add_definitions(-DWITH_SIMD) |
| 182 | add_subdirectory(simd) |
| 183 | if(SIMD_X86_64) |
| 184 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c) |
| 185 | else() |
| 186 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c) |
| 187 | endif() |
| 188 | # This tells CMake that the "source" files haven't been generated yet |
| 189 | set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) |
| 190 | else() |
| 191 | set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c) |
DRC | 6f4ba61 | 2010-10-16 21:27:38 +0000 | [diff] [blame] | 192 | message(STATUS "Not using SIMD acceleration") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 193 | endif() |
| 194 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 195 | if(WITH_JAVA) |
| 196 | add_subdirectory(java) |
| 197 | endif() |
| 198 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 199 | add_subdirectory(sharedlib) |
| 200 | |
| 201 | add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 202 | if(NOT MSVC) |
| 203 | set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) |
| 204 | endif() |
| 205 | if(WITH_SIMD) |
| 206 | add_dependencies(jpeg-static simd) |
| 207 | endif() |
| 208 | |
DRC | 418dbdf | 2011-05-26 10:45:06 +0000 | [diff] [blame] | 209 | set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 210 | if(WITH_JAVA) |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 211 | set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 212 | include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) |
DRC | 218c0c1 | 2011-02-05 06:01:18 +0000 | [diff] [blame] | 213 | endif() |
| 214 | |
| 215 | add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 216 | set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) |
DRC | 389c472 | 2011-02-06 18:48:13 +0000 | [diff] [blame] | 217 | if(MINGW) |
| 218 | set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at) |
| 219 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 220 | target_link_libraries(turbojpeg jpeg-static) |
| 221 | set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "") |
| 222 | |
| 223 | add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS} |
DRC | 418dbdf | 2011-05-26 10:45:06 +0000 | [diff] [blame] | 224 | turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 225 | if(NOT MSVC) |
| 226 | set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) |
| 227 | endif() |
| 228 | if(WITH_SIMD) |
| 229 | add_dependencies(turbojpeg-static simd) |
| 230 | endif() |
| 231 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 232 | add_executable(tjunittest tjunittest.c tjutil.c) |
| 233 | target_link_libraries(tjunittest turbojpeg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 234 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 235 | add_executable(tjunittest-static tjunittest.c tjutil.c) |
| 236 | target_link_libraries(tjunittest-static turbojpeg-static) |
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(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c |
DRC | 4348464 | 2011-05-24 17:03:51 +0000 | [diff] [blame] | 239 | wrppm.c) |
DRC | 4ad6003 | 2011-09-20 05:41:54 +0000 | [diff] [blame] | 240 | target_link_libraries(tjbench turbojpeg jpeg-static) |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 241 | set_property(TARGET tjbench PROPERTY COMPILE_FLAGS |
DRC | 4348464 | 2011-05-24 17:03:51 +0000 | [diff] [blame] | 242 | "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 243 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 244 | 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] | 245 | wrppm.c) |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 246 | target_link_libraries(tjbench-static turbojpeg-static jpeg-static) |
| 247 | set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS |
DRC | 4348464 | 2011-05-24 17:03:51 +0000 | [diff] [blame] | 248 | "-DBMP_SUPPORTED -DPPM_SUPPORTED") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 249 | |
| 250 | add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c |
| 251 | rdtarga.c) |
| 252 | set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS |
DRC | 5ee81f4 | 2011-05-02 00:35:50 +0000 | [diff] [blame] | 253 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 254 | target_link_libraries(cjpeg-static jpeg-static) |
| 255 | |
| 256 | add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c |
| 257 | wrppm.c wrtarga.c) |
| 258 | set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS |
DRC | 5ee81f4 | 2011-05-02 00:35:50 +0000 | [diff] [blame] | 259 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 260 | target_link_libraries(djpeg-static jpeg-static) |
| 261 | |
| 262 | add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) |
| 263 | target_link_libraries(jpegtran-static jpeg-static) |
DRC | 7e3fd2f | 2011-05-25 06:04:43 +0000 | [diff] [blame] | 264 | set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 265 | |
| 266 | add_executable(rdjpgcom rdjpgcom.c) |
| 267 | |
| 268 | add_executable(wrjpgcom rdjpgcom.c) |
| 269 | |
| 270 | |
| 271 | # |
| 272 | # Tests |
| 273 | # |
| 274 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 275 | if(MSVC_IDE) |
| 276 | set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/") |
| 277 | else() |
| 278 | set(OBJDIR "") |
| 279 | endif() |
| 280 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 281 | enable_testing() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 282 | |
| 283 | set(MD5_JPEG_INT 9a68f56bc76e466aa7e52f415d0f4a5f) |
| 284 | set(MD5_JPEG_FAST 0e1502e7fa421835e376a314fac2a39f) |
| 285 | set(MD5_JPEG_FAST_100 7bf72a8e741d64eecb960c97323af77c) |
| 286 | set(MD5_JPEG_FLOAT d1623885ffafcd40c684af09e3d65cd5) |
| 287 | set(MD5_JPEG_FLOAT_NOSIMD fb4884c35f8273f498cb32879de5c455) |
| 288 | set(MD5_JPEG_INT_GRAY 72b51f894b8f4a10b3ee3066770aa38d) |
| 289 | set(MD5_PPM_INT d1ed0d11f076b842525271647716aeb8) |
| 290 | set(MD5_PPM_FAST 048298a2d2410261c0533cb97bcfef23) |
| 291 | set(MD5_PPM_FLOAT 7f5b446ee36b2630e06785b8d42af15f) |
| 292 | set(MD5_PPM_FLOAT_NOSIMD 64072f1dbdc5b3a187777788604971a5) |
| 293 | set(MD5_PPM_INT_2_1 9f9de8c0612f8d06869b960b05abf9c9) |
| 294 | set(MD5_PPM_INT_15_8 b6875bc070720b899566cc06459b63b7) |
| 295 | set(MD5_PPM_INT_7_4 06a177eae05f164fac57f7a2c346ee87) |
| 296 | set(MD5_PPM_INT_13_8 bc3452573c8152f6ae552939ee19f82f) |
| 297 | set(MD5_PPM_INT_3_2 f5a8b88a8a7f96016f04d259cf82ed67) |
| 298 | set(MD5_PPM_INT_11_8 d8cc73c0aaacd4556569b59437ba00a5) |
| 299 | set(MD5_PPM_INT_5_4 32775dd9ad2ab90f4c5b219b53e0c86c) |
| 300 | set(MD5_PPM_INT_9_8 d25e61bc7eac0002f5b393aa223747b6) |
| 301 | set(MD5_PPM_INT_7_8 ddb564b7c74a09494016d6cd7502a946) |
| 302 | set(MD5_PPM_INT_3_4 8ed8e68808c3fbc4ea764fc9d2968646) |
| 303 | set(MD5_PPM_INT_5_8 a3363274999da2366a024efae6d16c9b) |
| 304 | set(MD5_PPM_INT_1_2 e692a315cea26b988c8e8b29a5dbcd81) |
| 305 | set(MD5_PPM_INT_3_8 79eca9175652ced755155c90e785a996) |
| 306 | set(MD5_PPM_INT_1_4 79cd778f8bf1a117690052cacdd54eca) |
| 307 | set(MD5_PPM_INT_1_8 391b3d4aca640c8567d6f8745eb2142f) |
| 308 | set(MD5_PPM_FAST_1_2 f30bcf6d32ccd44cbdd9aeaacbd9454f) |
| 309 | set(MD5_BMP_256 4980185e3776e89bd931736e1cddeee6) |
| 310 | set(MD5_JPEG_ARI e986fb0a637a8d833d96e8a6d6d84ea1) |
| 311 | set(MD5_PPM_ARI 72b59a99bcf1de24c5b27d151bde2437) |
| 312 | set(MD5_JPEG_PROG 1c4afddc05c0a43489ee54438a482d92) |
DRC | 4b50928 | 2013-11-06 06:55:28 +0000 | [diff] [blame] | 313 | set(MD5_JPEG_PROG_ARI 0a8f1c8f66e113c3cf635df0a475a617) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 314 | set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d) |
| 315 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 316 | if(WITH_JAVA) |
| 317 | add_test(TJUnitTest ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest) |
| 318 | add_test(TJUnitTest-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv) |
DRC | fef9852 | 2013-04-28 01:32:52 +0000 | [diff] [blame] | 319 | add_test(TJUnitTest-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv -noyuvpad) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 320 | add_test(TJUnitTest-bi ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi) |
| 321 | add_test(TJUnitTest-bi-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv) |
DRC | fef9852 | 2013-04-28 01:32:52 +0000 | [diff] [blame] | 322 | add_test(TJUnitTest-bi-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv -noyuvpad) |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 323 | endif() |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 324 | add_test(tjunittest tjunittest) |
| 325 | add_test(tjunittest-alloc tjunittest -alloc) |
| 326 | add_test(tjunittest-yuv tjunittest -yuv) |
DRC | faa868b | 2013-10-31 05:02:20 +0000 | [diff] [blame] | 327 | add_test(tjunittest-yuv-alloc tjunittest -yuv -alloc) |
DRC | f610d61 | 2013-04-26 10:33:29 +0000 | [diff] [blame] | 328 | add_test(tjunittest-yuv-nopad tjunittest -yuv -noyuvpad) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 329 | add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 330 | add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutint.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 331 | add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 332 | add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST} -DFILE=testoutfst.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 333 | add_test(cjpeg-fast-100 sharedlib/cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 334 | add_test(cjpeg-fast-100-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST_100} -DFILE=testoutfst100.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 335 | add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 336 | if(WITH_SIMD) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 337 | add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 338 | else() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 339 | add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT_NOSIMD} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 340 | endif() |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 341 | add_test(cjpeg-int-gray sharedlib/cjpeg -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 342 | add_test(cjpeg-int-gray-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT_GRAY} -DFILE=testoutgray.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 343 | add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 344 | add_test(djpeg-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT} -DFILE=testoutint.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 345 | add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 346 | add_test(djpeg-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST} -DFILE=testoutfst.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 347 | add_test(djpeg-float sharedlib/djpeg -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 348 | if(WITH_SIMD) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 349 | add_test(djpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 350 | else() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 351 | add_test(djpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT_NOSIMD} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 352 | endif() |
DRC | 0af8d67 | 2012-01-31 11:09:11 +0000 | [diff] [blame] | 353 | foreach(scale 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) |
| 354 | string(REGEX REPLACE "_" "/" scalearg ${scale}) |
DRC | cf775bf | 2012-02-01 02:49:10 +0000 | [diff] [blame] | 355 | add_test(djpeg-int-${scale} sharedlib/djpeg -dct int -nosmooth -scale ${scalearg} -ppm -outfile testoutint${scale}.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 356 | add_test(djpeg-int-${scale}-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT_${scale}} -DFILE=testoutint${scale}.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 0af8d67 | 2012-01-31 11:09:11 +0000 | [diff] [blame] | 357 | endforeach() |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 358 | add_test(djpeg-fast-1_2 sharedlib/djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 359 | add_test(djpeg-fast-1_2-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST_1_2} -DFILE=testoutfst1_2.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 360 | add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 361 | add_test(djpeg-256-cmp ${CMAKE_COMMAND} -DMD5=${MD5_BMP_256} -DFILE=testout.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 362 | add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 363 | add_test(cjpeg-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG} -DFILE=testoutp.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 364 | add_test(jpegtran-prog sharedlib/jpegtran -outfile testoutt.jpg testoutp.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 365 | add_test(jpegtran-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 366 | if(WITH_ARITH_ENC) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 367 | add_test(cjpeg-ari sharedlib/cjpeg -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 368 | add_test(cjpeg-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testoutari.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 369 | add_test(jpegtran-toari sharedlib/jpegtran -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 370 | add_test(jpegtran-toari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 4b50928 | 2013-11-06 06:55:28 +0000 | [diff] [blame] | 371 | add_test(cjpeg-prog-ari sharedlib/cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 372 | add_test(cjpeg-prog-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG_ARI} -DFILE=testoutpa.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 373 | endif() |
| 374 | if(WITH_ARITH_DEC) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 375 | add_test(djpeg-ari sharedlib/djpeg -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 376 | add_test(djpeg-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_ARI} -DFILE=testoutari.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 377 | add_test(jpegtran-fromari sharedlib/jpegtran -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 378 | add_test(jpegtran-fromari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 379 | endif() |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 380 | add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 381 | add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testoutcrop.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 382 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 383 | add_test(tjunittest-static tjunittest-static) |
| 384 | add_test(tjunittest-static-alloc tjunittest-static -alloc) |
| 385 | add_test(tjunittest-static-yuv tjunittest-static -yuv) |
DRC | faa868b | 2013-10-31 05:02:20 +0000 | [diff] [blame] | 386 | add_test(tjunittest-static-yuv-alloc tjunittest-static -yuv -alloc) |
DRC | f610d61 | 2013-04-26 10:33:29 +0000 | [diff] [blame] | 387 | add_test(tjunittest-static-yuv-nopad tjunittest-static -yuv -noyuvpad) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 388 | add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 389 | add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutint.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 390 | add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 391 | add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST} -DFILE=testoutfst.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 392 | add_test(cjpeg-static-fast-100 cjpeg-static -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 393 | add_test(cjpeg-static-fast-100-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST_100} -DFILE=testoutfst100.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 394 | add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 395 | if(WITH_SIMD) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 396 | add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 397 | else() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 398 | add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT_NOSIMD} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 399 | endif() |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 400 | add_test(cjpeg-static-int-gray cjpeg-static -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 401 | add_test(cjpeg-static-int-gray-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT_GRAY} -DFILE=testoutgray.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 402 | add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 403 | add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT} -DFILE=testoutint.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 404 | add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 405 | add_test(djpeg-static-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST} -DFILE=testoutfst.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 406 | add_test(djpeg-static-float djpeg-static -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 407 | if(WITH_SIMD) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 408 | add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 409 | else() |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 410 | add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT_NOSIMD} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 411 | endif() |
DRC | 0af8d67 | 2012-01-31 11:09:11 +0000 | [diff] [blame] | 412 | foreach(scale 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8) |
| 413 | string(REGEX REPLACE "_" "/" scalearg ${scale}) |
DRC | cf775bf | 2012-02-01 02:49:10 +0000 | [diff] [blame] | 414 | add_test(djpeg-static-int-${scale} djpeg-static -dct int -nosmooth -scale ${scalearg} -ppm -outfile testoutint${scale}.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 415 | add_test(djpeg-static-int-${scale}-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT_${scale}} -DFILE=testoutint${scale}.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 0af8d67 | 2012-01-31 11:09:11 +0000 | [diff] [blame] | 416 | endforeach() |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 417 | add_test(djpeg-static-fast-1_2 djpeg-static -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 418 | add_test(djpeg-static-fast-1_2-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST_1_2} -DFILE=testoutfst1_2.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 419 | add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 420 | add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -DMD5=${MD5_BMP_256} -DFILE=testout.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 421 | add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 422 | add_test(cjpeg-static-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG} -DFILE=testoutp.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 423 | add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 424 | add_test(jpegtran-static-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 425 | if(WITH_ARITH_ENC) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 426 | add_test(cjpeg-static-ari cjpeg-static -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 427 | add_test(cjpeg-static-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testoutari.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 428 | add_test(jpegtran-static-toari jpegtran-static -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 429 | add_test(jpegtran-static-toari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 4b50928 | 2013-11-06 06:55:28 +0000 | [diff] [blame] | 430 | add_test(cjpeg-static-prog-ari cjpeg-static -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm) |
| 431 | add_test(cjpeg-static-prog-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG_ARI} -DFILE=testoutpa.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake ) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 432 | endif() |
| 433 | if(WITH_ARITH_DEC) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 434 | add_test(djpeg-static-ari djpeg-static -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 435 | add_test(djpeg-static-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_ARI} -DFILE=testoutari.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 436 | add_test(jpegtran-static-fromari jpegtran-static -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 437 | add_test(jpegtran-static-fromari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 438 | endif() |
DRC | 7ab0364 | 2012-01-31 05:47:07 +0000 | [diff] [blame] | 439 | add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg) |
DRC | 211d1e7 | 2013-01-13 11:25:20 +0000 | [diff] [blame] | 440 | add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testoutcrop.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 441 | |
DRC | a0f878a | 2011-04-02 04:43:14 +0000 | [diff] [blame] | 442 | add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P |
| 443 | ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake) |
| 444 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 445 | |
| 446 | # |
| 447 | # Installer |
| 448 | # |
| 449 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 450 | if(MSVC) |
| 451 | set(INST_PLATFORM "Visual C++") |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 452 | set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc) |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 453 | set(INST_REG_NAME ${CMAKE_PROJECT_NAME}) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 454 | elseif(MINGW) |
| 455 | set(INST_PLATFORM GCC) |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 456 | set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc) |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 457 | set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 458 | set(INST_DEFS -DGCC) |
| 459 | endif() |
| 460 | |
| 461 | if(64BIT) |
| 462 | set(INST_PLATFORM "${INST_PLATFORM} 64-bit") |
| 463 | set(INST_NAME ${INST_NAME}64) |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 464 | set(INST_REG_NAME ${INST_DIR}64) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 465 | set(INST_DEFS ${INST_DEFS} -DWIN64) |
| 466 | endif() |
| 467 | |
DRC | 957d623 | 2011-04-01 11:13:11 +0000 | [diff] [blame] | 468 | if(WITH_JAVA) |
| 469 | set(INST_DEFS ${INST_DEFS} -DJAVA) |
| 470 | endif() |
| 471 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 472 | if(MSVC_IDE) |
DRC | 926e01f | 2011-04-06 06:35:38 +0000 | [diff] [blame] | 473 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\") |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 474 | else() |
| 475 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=") |
| 476 | endif() |
| 477 | |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 478 | STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX}) |
| 479 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 480 | configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY) |
| 481 | |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 482 | if(WITH_JAVA) |
| 483 | set(JAVA_DEPEND java) |
| 484 | endif() |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 485 | add_custom_target(installer |
| 486 | makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi |
DRC | b94f2de | 2011-03-22 09:31:25 +0000 | [diff] [blame] | 487 | DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom |
DRC | 7175e51 | 2013-04-23 22:29:00 +0000 | [diff] [blame] | 488 | cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND} |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 489 | SOURCES libjpeg-turbo.nsi) |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 490 | |
DRC | 3185cb9 | 2011-05-25 03:52:22 +0000 | [diff] [blame] | 491 | install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 492 | ARCHIVE DESTINATION lib |
| 493 | LIBRARY DESTINATION lib |
| 494 | RUNTIME DESTINATION bin |
| 495 | ) |
| 496 | |
DRC | a1647c8 | 2012-02-10 00:39:05 +0000 | [diff] [blame] | 497 | install(FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt |
| 498 | ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt |
| 499 | ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt |
| 500 | ${CMAKE_SOURCE_DIR}/wizard.txt |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 501 | DESTINATION doc) |
DRC | e2befde | 2010-10-17 07:28:08 +0000 | [diff] [blame] | 502 | |
| 503 | install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h |
| 504 | ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h |
| 505 | ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include) |