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