DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 1 | # |
| 2 | # Setup |
| 3 | # |
| 4 | |
| 5 | cmake_minimum_required(VERSION 2.6) |
| 6 | |
DRC | 5d6f858 | 2011-02-18 23:08:58 +0000 | [diff] [blame] | 7 | project(libjpeg-turbo C) |
DRC | cf137ac | 2011-05-31 20:23:07 +0000 | [diff] [blame] | 8 | set(VERSION 1.1.2) |
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) |
| 14 | execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmakescripts/getdate.bat" |
| 15 | OUTPUT_VARIABLE BUILD) |
| 16 | string(REGEX REPLACE "\n" "" BUILD ${BUILD}) |
| 17 | else() |
DRC | 378da4d | 2010-10-15 19:11:11 +0000 | [diff] [blame] | 18 | message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 19 | endif() |
| 20 | |
DRC | 760ea8d | 2012-02-07 23:25:19 +0000 | [diff] [blame^] | 21 | # This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning |
| 22 | # in Visual Studio, and it always defaults to Debug when using NMake. |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 23 | if(NOT CMAKE_BUILD_TYPE) |
| 24 | set(CMAKE_BUILD_TYPE Release) |
| 25 | endif() |
| 26 | |
| 27 | message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") |
| 28 | |
| 29 | # This only works if building from the command line. There is currently no way |
DRC | 760ea8d | 2012-02-07 23:25:19 +0000 | [diff] [blame^] | 30 | # 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] | 31 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 32 | set(BUILD "${BUILD}d") |
| 33 | endif() |
| 34 | |
DRC | eb2b9d6 | 2010-10-15 04:55:13 +0000 | [diff] [blame] | 35 | message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") |
| 36 | |
DRC | 98b8529 | 2011-04-15 00:20:15 +0000 | [diff] [blame] | 37 | option(WITH_SIMD "Include SIMD extensions" TRUE) |
| 38 | option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE) |
| 39 | option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE) |
| 40 | option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) |
| 41 | option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 42 | |
| 43 | if(WITH_ARITH_ENC) |
| 44 | set(C_ARITH_CODING_SUPPORTED 1) |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 45 | message(STATUS "Arithmetic encoding support enabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 46 | else() |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 47 | message(STATUS "Arithmetic encoding support disabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 48 | endif() |
| 49 | |
| 50 | if(WITH_ARITH_DEC) |
| 51 | set(D_ARITH_CODING_SUPPORTED 1) |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 52 | message(STATUS "Arithmetic decoding support enabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 53 | else() |
DRC | 990e28d | 2011-01-04 21:40:11 +0000 | [diff] [blame] | 54 | message(STATUS "Arithmetic decoding support disabled") |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 55 | endif() |
| 56 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 57 | set(JPEG_LIB_VERSION 62) |
| 58 | set(DLL_VERSION ${JPEG_LIB_VERSION}) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 59 | set(FULLVERSION ${DLL_VERSION}.0.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 60 | if(WITH_JPEG8) |
| 61 | set(JPEG_LIB_VERSION 80) |
| 62 | set(DLL_VERSION 8) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 63 | set(FULLVERSION ${DLL_VERSION}.0.2) |
DRC | f38eee0 | 2011-02-18 07:00:38 +0000 | [diff] [blame] | 64 | message(STATUS "Emulating libjpeg v8 API/ABI") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 65 | elseif(WITH_JPEG7) |
| 66 | set(JPEG_LIB_VERSION 70) |
| 67 | set(DLL_VERSION 7) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 68 | set(FULLVERSION ${DLL_VERSION}.0.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 69 | message(STATUS "Emulating libjpeg v7 API/ABI") |
| 70 | endif(WITH_JPEG8) |
| 71 | |
| 72 | if(MSVC) |
| 73 | # Use the static C library for all build types |
| 74 | foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 75 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 76 | if(${var} MATCHES "/MD") |
| 77 | string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") |
| 78 | endif() |
| 79 | endforeach() |
| 80 | |
| 81 | add_definitions(-W3 -wd4996) |
| 82 | endif() |
| 83 | |
| 84 | # Detect whether compiler is 64-bit |
| 85 | if(MSVC AND CMAKE_CL_64) |
| 86 | set(SIMD_X86_64 1) |
| 87 | set(64BIT 1) |
| 88 | elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) |
| 89 | set(SIMD_X86_64 1) |
| 90 | set(64BIT 1) |
| 91 | endif() |
| 92 | |
| 93 | if(64BIT) |
| 94 | message(STATUS "64-bit build") |
| 95 | else() |
| 96 | message(STATUS "32-bit build") |
| 97 | endif() |
| 98 | |
| 99 | configure_file(win/jconfig.h.in jconfig.h) |
| 100 | configure_file(win/config.h.in config.h) |
| 101 | |
| 102 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) |
| 103 | |
| 104 | |
| 105 | # |
| 106 | # Targets |
| 107 | # |
| 108 | |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 109 | set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c |
| 110 | jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c |
| 111 | jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c |
| 112 | jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c |
| 113 | jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c |
| 114 | jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c |
| 115 | jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) |
| 116 | |
| 117 | if(WITH_ARITH_ENC OR WITH_ARITH_DEC) |
| 118 | set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c) |
| 119 | endif() |
| 120 | |
| 121 | if(WITH_ARITH_ENC) |
| 122 | set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c) |
| 123 | endif() |
| 124 | |
| 125 | if(WITH_ARITH_DEC) |
| 126 | set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c) |
| 127 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 128 | |
| 129 | if(WITH_SIMD) |
| 130 | add_definitions(-DWITH_SIMD) |
| 131 | add_subdirectory(simd) |
| 132 | if(SIMD_X86_64) |
| 133 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c) |
| 134 | else() |
| 135 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c) |
| 136 | endif() |
| 137 | # This tells CMake that the "source" files haven't been generated yet |
| 138 | set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) |
| 139 | else() |
| 140 | set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c) |
DRC | 6f4ba61 | 2010-10-16 21:27:38 +0000 | [diff] [blame] | 141 | message(STATUS "Not using SIMD acceleration") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 142 | endif() |
| 143 | |
| 144 | add_subdirectory(sharedlib) |
| 145 | |
| 146 | add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 147 | if(NOT MSVC) |
| 148 | set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) |
| 149 | endif() |
| 150 | if(WITH_SIMD) |
| 151 | add_dependencies(jpeg-static simd) |
| 152 | endif() |
| 153 | |
| 154 | add_library(turbojpeg SHARED turbojpegl.c) |
| 155 | set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) |
| 156 | target_link_libraries(turbojpeg jpeg-static) |
| 157 | set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "") |
| 158 | |
| 159 | add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS} |
| 160 | turbojpegl.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 161 | if(NOT MSVC) |
| 162 | set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) |
| 163 | endif() |
| 164 | if(WITH_SIMD) |
| 165 | add_dependencies(turbojpeg-static simd) |
| 166 | endif() |
| 167 | |
| 168 | add_executable(jpegut jpegut.c) |
| 169 | target_link_libraries(jpegut turbojpeg) |
| 170 | |
| 171 | add_executable(jpegut-static jpegut.c) |
| 172 | target_link_libraries(jpegut-static turbojpeg-static) |
| 173 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 174 | add_executable(jpgtest jpgtest.c bmp.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 175 | target_link_libraries(jpgtest turbojpeg) |
| 176 | |
DRC | 2e4d044 | 2011-02-08 01:18:37 +0000 | [diff] [blame] | 177 | add_executable(jpgtest-static jpgtest.c bmp.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 178 | target_link_libraries(jpgtest-static turbojpeg-static) |
| 179 | |
| 180 | add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c |
| 181 | rdtarga.c) |
| 182 | set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS |
DRC | 5ee81f4 | 2011-05-02 00:35:50 +0000 | [diff] [blame] | 183 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 184 | target_link_libraries(cjpeg-static jpeg-static) |
| 185 | |
| 186 | add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c |
| 187 | wrppm.c wrtarga.c) |
| 188 | set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS |
DRC | 5ee81f4 | 2011-05-02 00:35:50 +0000 | [diff] [blame] | 189 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 190 | target_link_libraries(djpeg-static jpeg-static) |
| 191 | |
| 192 | add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) |
| 193 | target_link_libraries(jpegtran-static jpeg-static) |
DRC | 7e3fd2f | 2011-05-25 06:04:43 +0000 | [diff] [blame] | 194 | set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 195 | |
| 196 | add_executable(rdjpgcom rdjpgcom.c) |
| 197 | |
| 198 | add_executable(wrjpgcom rdjpgcom.c) |
| 199 | |
| 200 | |
| 201 | # |
| 202 | # Tests |
| 203 | # |
| 204 | |
| 205 | enable_testing() |
| 206 | add_test(jpegut jpegut) |
DRC | fbb6747 | 2010-11-24 04:02:37 +0000 | [diff] [blame] | 207 | add_test(jpegut-yuv jpegut -yuv) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 208 | add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 209 | add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 210 | add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 211 | add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg) |
DRC | c4ef01f | 2011-02-18 05:06:58 +0000 | [diff] [blame] | 212 | add_test(cjpeg-fast-100 sharedlib/cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 213 | add_test(cjpeg-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst100.jpg testoutfst100.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 214 | add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 215 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 216 | add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 217 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 218 | add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 219 | endif() |
| 220 | add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 221 | add_test(djpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 222 | add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 223 | add_test(djpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.ppm testoutfst.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 224 | add_test(djpeg-float sharedlib/djpeg -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
| 225 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 226 | add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 227 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 228 | add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 229 | endif() |
| 230 | add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 231 | add_test(djpeg-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 232 | add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 233 | add_test(cjpeg-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgp.jpg testoutp.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 234 | add_test(jpegtran-prog sharedlib/jpegtran -outfile testoutt.jpg testoutp.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 235 | add_test(jpegtran-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 236 | if(WITH_ARITH_ENC) |
DRC | 66f97e6 | 2010-11-23 05:49:54 +0000 | [diff] [blame] | 237 | add_test(cjpeg-ari sharedlib/cjpeg -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 238 | add_test(cjpeg-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testoutari.jpg) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 239 | add_test(jpegtran-toari sharedlib/jpegtran -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgint.jpg) |
| 240 | add_test(jpegtran-toari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testouta.jpg) |
| 241 | endif() |
| 242 | if(WITH_ARITH_DEC) |
DRC | 66f97e6 | 2010-11-23 05:49:54 +0000 | [diff] [blame] | 243 | add_test(djpeg-ari sharedlib/djpeg -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimgari.jpg) |
| 244 | add_test(djpeg-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.ppm testoutari.ppm) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 245 | add_test(jpegtran-fromari sharedlib/jpegtran -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgari.jpg) |
DRC | 66f97e6 | 2010-11-23 05:49:54 +0000 | [diff] [blame] | 246 | add_test(jpegtran-fromari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testouta.jpg) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 247 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 248 | add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 249 | add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 250 | |
| 251 | add_test(jpegut-static jpegut-static) |
DRC | fbb6747 | 2010-11-24 04:02:37 +0000 | [diff] [blame] | 252 | add_test(jpegut-static-yuv jpegut-static -yuv) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 253 | add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 254 | add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 255 | add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 256 | add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg) |
DRC | c4ef01f | 2011-02-18 05:06:58 +0000 | [diff] [blame] | 257 | add_test(cjpeg-static-fast-100 cjpeg-static -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 258 | add_test(cjpeg-static-fast-100-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst100.jpg testoutfst100.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 259 | add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 260 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 261 | add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 262 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 263 | add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 264 | endif() |
| 265 | add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 266 | add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 267 | add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 268 | add_test(djpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.ppm testoutfst.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 269 | add_test(djpeg-static-float djpeg-static -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
| 270 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 271 | add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 272 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 273 | add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 274 | endif() |
| 275 | add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 276 | add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 277 | add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 278 | add_test(cjpeg-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgp.jpg testoutp.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 279 | add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 280 | add_test(jpegtran-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 281 | if(WITH_ARITH_ENC) |
DRC | 66f97e6 | 2010-11-23 05:49:54 +0000 | [diff] [blame] | 282 | add_test(cjpeg-static-ari cjpeg-static -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 283 | add_test(cjpeg-static-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testoutari.jpg) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 284 | add_test(jpegtran-static-toari jpegtran-static -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgint.jpg) |
| 285 | add_test(jpegtran-static-toari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testouta.jpg) |
| 286 | endif() |
| 287 | if(WITH_ARITH_DEC) |
DRC | 66f97e6 | 2010-11-23 05:49:54 +0000 | [diff] [blame] | 288 | add_test(djpeg-static-ari djpeg-static -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimgari.jpg) |
| 289 | add_test(djpeg-static-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.ppm testoutari.ppm) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 290 | add_test(jpegtran-static-fromari jpegtran-static -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgari.jpg) |
DRC | 66f97e6 | 2010-11-23 05:49:54 +0000 | [diff] [blame] | 291 | add_test(jpegtran-static-fromari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testouta.jpg) |
DRC | 245cfdf | 2010-11-23 17:11:06 +0000 | [diff] [blame] | 292 | endif() |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 293 | add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 294 | add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 295 | |
| 296 | |
| 297 | # |
| 298 | # Installer |
| 299 | # |
| 300 | |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 301 | if(MSVC) |
| 302 | set(INST_PLATFORM "Visual C++") |
DRC | 1c87e45 | 2011-03-22 06:49:31 +0000 | [diff] [blame] | 303 | set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc) |
| 304 | set(INST_DIR ${CMAKE_PROJECT_NAME}) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 305 | elseif(MINGW) |
| 306 | set(INST_PLATFORM GCC) |
DRC | 1c87e45 | 2011-03-22 06:49:31 +0000 | [diff] [blame] | 307 | set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc) |
| 308 | set(INST_DIR ${CMAKE_PROJECT_NAME}-gcc) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 309 | set(INST_DEFS -DGCC) |
| 310 | endif() |
| 311 | |
| 312 | if(64BIT) |
| 313 | set(INST_PLATFORM "${INST_PLATFORM} 64-bit") |
| 314 | set(INST_NAME ${INST_NAME}64) |
DRC | 1c87e45 | 2011-03-22 06:49:31 +0000 | [diff] [blame] | 315 | set(INST_DIR ${INST_DIR}64) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 316 | set(INST_DEFS ${INST_DEFS} -DWIN64) |
| 317 | endif() |
| 318 | |
| 319 | if(MSVC_IDE) |
DRC | 926e01f | 2011-04-06 06:35:38 +0000 | [diff] [blame] | 320 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\") |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 321 | else() |
| 322 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=") |
| 323 | endif() |
| 324 | |
| 325 | configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY) |
| 326 | |
| 327 | add_custom_target(installer |
| 328 | makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi |
DRC | 95db4f4 | 2011-03-22 00:20:43 +0000 | [diff] [blame] | 329 | DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom |
| 330 | cjpeg djpeg jpegtran jpgtest |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 331 | SOURCES libjpeg-turbo.nsi) |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 332 | |
DRC | 8569c2f | 2011-02-18 23:49:42 +0000 | [diff] [blame] | 333 | install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom jpgtest |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 334 | ARCHIVE DESTINATION lib |
| 335 | LIBRARY DESTINATION lib |
| 336 | RUNTIME DESTINATION bin |
| 337 | ) |
| 338 | |
| 339 | install(FILES ${CMAKE_SOURCE_DIR}/LGPL.txt ${CMAKE_SOURCE_DIR}/LICENSE.txt |
| 340 | ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt |
| 341 | ${CMAKE_SOURCE_DIR}/libjpeg.txt ${CMAKE_SOURCE_DIR}/usage.txt |
| 342 | DESTINATION doc) |
DRC | e2befde | 2010-10-17 07:28:08 +0000 | [diff] [blame] | 343 | |
| 344 | install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h |
| 345 | ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h |
| 346 | ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include) |