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