blob: fb5e182b936774dc8e62345b4b1208b1639e0a22 [file] [log] [blame]
DRC84697032010-10-15 03:43:24 +00001#
2# Setup
3#
4
Alex Naidis6eb7d372016-10-16 23:10:08 +02005cmake_minimum_required(VERSION 2.8.11)
DRC9fe22da2014-04-16 23:30:38 +00006# Use LINK_INTERFACE_LIBRARIES instead of INTERFACE_LINK_LIBRARIES
7if(POLICY CMP0022)
8 cmake_policy(SET CMP0022 OLD)
9endif()
DRC84697032010-10-15 03:43:24 +000010
DRC5d6f8582011-02-18 23:08:58 +000011project(libjpeg-turbo C)
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -050012set(VERSION 1.5.3)
Alex Naidis6eb7d372016-10-16 23:10:08 +020013string(REPLACE "." ";" VERSION_TRIPLET ${VERSION})
14list(GET VERSION_TRIPLET 0 VERSION_MAJOR)
15list(GET VERSION_TRIPLET 1 VERSION_MINOR)
16list(GET VERSION_TRIPLET 2 VERSION_REVISION)
17function(pad_number NUMBER OUTPUT_LEN)
18 string(LENGTH "${${NUMBER}}" INPUT_LEN)
19 if(INPUT_LEN LESS OUTPUT_LEN)
20 math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1")
21 set(NUM ${${NUMBER}})
22 foreach(C RANGE ${ZEROES})
23 set(NUM "0${NUM}")
24 endforeach()
25 set(${NUMBER} ${NUM} PARENT_SCOPE)
DRC5e3bb3e2012-10-12 10:19:09 +000026 endif()
Alex Naidis6eb7d372016-10-16 23:10:08 +020027endfunction()
28pad_number(VERSION_MINOR 3)
29pad_number(VERSION_REVISION 3)
30set(LIBJPEG_TURBO_VERSION_NUMBER ${VERSION_MAJOR}${VERSION_MINOR}${VERSION_REVISION})
31
32if(NOT WIN32)
DRC378da4d2010-10-15 19:11:11 +000033 message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
DRC84697032010-10-15 03:43:24 +000034endif()
35
Alex Naidis6eb7d372016-10-16 23:10:08 +020036string(TIMESTAMP BUILD "%Y%m%d")
37
DRC2ffcb8e2011-04-04 04:56:24 +000038# This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning
39# in Visual Studio, and it always defaults to Debug when using NMake.
DRC84697032010-10-15 03:43:24 +000040if(NOT CMAKE_BUILD_TYPE)
41 set(CMAKE_BUILD_TYPE Release)
42endif()
43
44message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
45
46# This only works if building from the command line. There is currently no way
DRC2ffcb8e2011-04-04 04:56:24 +000047# to set a variable's value based on the build type when using Visual Studio.
DRC84697032010-10-15 03:43:24 +000048if(CMAKE_BUILD_TYPE STREQUAL "Debug")
49 set(BUILD "${BUILD}d")
50endif()
51
DRCeb2b9d62010-10-15 04:55:13 +000052message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
53
DRCddcd5a12011-04-15 00:24:02 +000054option(WITH_SIMD "Include SIMD extensions" TRUE)
Alex Naidis6eb7d372016-10-16 23:10:08 +020055option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
56option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE)
DRCddcd5a12011-04-15 00:24:02 +000057option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
58option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
DRCab706232013-01-18 23:42:31 +000059option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE)
DRCaee4f722014-08-09 23:06:07 +000060option(WITH_TURBOJPEG "Include the TurboJPEG wrapper library and associated test programs" TRUE)
DRC5039d732013-01-21 23:42:12 +000061option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE)
DRCaee4f722014-08-09 23:06:07 +000062option(WITH_12BIT "Encode/decode JPEG images with 12-bit samples (implies WITH_SIMD=0 WITH_TURBOJPEG=0 WITH_ARITH_ENC=0 WITH_ARITH_DEC=0)" FALSE)
DRC665c96e2015-05-15 22:08:21 +000063option(ENABLE_STATIC "Build static libraries" TRUE)
64option(ENABLE_SHARED "Build shared libraries" TRUE)
DRCaee4f722014-08-09 23:06:07 +000065
66if(WITH_12BIT)
67 set(WITH_SIMD FALSE)
68 set(WITH_TURBOJPEG FALSE)
DRCecc58362015-06-27 07:56:29 +000069 set(WITH_JAVA FALSE)
DRCaee4f722014-08-09 23:06:07 +000070 set(WITH_ARITH_ENC FALSE)
71 set(WITH_ARITH_DEC FALSE)
72 set(BITS_IN_JSAMPLE 12)
73 message(STATUS "12-bit JPEG support enabled")
74else()
75 set(BITS_IN_JSAMPLE 8)
76endif()
DRC245cfdf2010-11-23 17:11:06 +000077
Alex Naidis6eb7d372016-10-16 23:10:08 +020078if(WITH_JPEG8 OR WITH_JPEG7)
79 set(WITH_ARITH_ENC 1)
80 set(WITH_ARITH_DEC 1)
81endif()
82if(WITH_JPEG8)
83 set(WITH_MEM_SRCDST 1)
84endif()
85
DRC245cfdf2010-11-23 17:11:06 +000086if(WITH_ARITH_ENC)
87 set(C_ARITH_CODING_SUPPORTED 1)
DRC990e28d2011-01-04 21:40:11 +000088 message(STATUS "Arithmetic encoding support enabled")
DRC245cfdf2010-11-23 17:11:06 +000089else()
DRC990e28d2011-01-04 21:40:11 +000090 message(STATUS "Arithmetic encoding support disabled")
DRC245cfdf2010-11-23 17:11:06 +000091endif()
92
93if(WITH_ARITH_DEC)
94 set(D_ARITH_CODING_SUPPORTED 1)
DRC990e28d2011-01-04 21:40:11 +000095 message(STATUS "Arithmetic decoding support enabled")
DRC245cfdf2010-11-23 17:11:06 +000096else()
DRC990e28d2011-01-04 21:40:11 +000097 message(STATUS "Arithmetic decoding support disabled")
DRC245cfdf2010-11-23 17:11:06 +000098endif()
99
DRCaee4f722014-08-09 23:06:07 +0000100if(WITH_TURBOJPEG)
101 message(STATUS "TurboJPEG C wrapper enabled")
102else()
103 message(STATUS "TurboJPEG C wrapper disabled")
104endif()
105
DRC957d6232011-04-01 11:13:11 +0000106if(WITH_JAVA)
DRC5039d732013-01-21 23:42:12 +0000107 message(STATUS "TurboJPEG Java wrapper enabled")
DRC218c0c12011-02-05 06:01:18 +0000108else()
DRC5039d732013-01-21 23:42:12 +0000109 message(STATUS "TurboJPEG Java wrapper disabled")
DRC218c0c12011-02-05 06:01:18 +0000110endif()
111
DRCab706232013-01-18 23:42:31 +0000112set(SO_AGE 0)
113if(WITH_MEM_SRCDST)
114 set(SO_AGE 1)
115endif()
116
DRC84697032010-10-15 03:43:24 +0000117set(JPEG_LIB_VERSION 62)
118set(DLL_VERSION ${JPEG_LIB_VERSION})
DRCab706232013-01-18 23:42:31 +0000119set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0)
DRC84697032010-10-15 03:43:24 +0000120if(WITH_JPEG8)
121 set(JPEG_LIB_VERSION 80)
122 set(DLL_VERSION 8)
DRCa9d5b252010-10-15 06:42:45 +0000123 set(FULLVERSION ${DLL_VERSION}.0.2)
DRCf38eee02011-02-18 07:00:38 +0000124 message(STATUS "Emulating libjpeg v8 API/ABI")
DRC84697032010-10-15 03:43:24 +0000125elseif(WITH_JPEG7)
126 set(JPEG_LIB_VERSION 70)
127 set(DLL_VERSION 7)
DRCab706232013-01-18 23:42:31 +0000128 set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0)
DRC84697032010-10-15 03:43:24 +0000129 message(STATUS "Emulating libjpeg v7 API/ABI")
130endif(WITH_JPEG8)
131
DRCab706232013-01-18 23:42:31 +0000132if(WITH_MEM_SRCDST)
133 set(MEM_SRCDST_SUPPORTED 1)
134 message(STATUS "In-memory source/destination managers enabled")
135else()
136 message(STATUS "In-memory source/destination managers disabled")
137endif()
138
DRC84697032010-10-15 03:43:24 +0000139if(MSVC)
DRC89a3f972015-03-19 19:27:40 +0000140 option(WITH_CRT_DLL
141 "Link all libjpeg-turbo libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it."
142 FALSE)
143 if(NOT WITH_CRT_DLL)
144 # Use the static C library for all build types
145 foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
146 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
147 if(${var} MATCHES "/MD")
148 string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
149 endif()
150 endforeach()
151 endif()
DRC84697032010-10-15 03:43:24 +0000152 add_definitions(-W3 -wd4996)
153endif()
154
155# Detect whether compiler is 64-bit
156if(MSVC AND CMAKE_CL_64)
157 set(SIMD_X86_64 1)
158 set(64BIT 1)
159elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
160 set(SIMD_X86_64 1)
161 set(64BIT 1)
162endif()
163
164if(64BIT)
165 message(STATUS "64-bit build")
166else()
167 message(STATUS "32-bit build")
168endif()
169
DRC7175e512013-04-23 22:29:00 +0000170if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
171 if(MSVC)
172 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME})
173 else()
174 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}-gcc)
175 endif()
176 if(64BIT)
177 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64)
178 endif()
179 set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH
180 "Directory into which to install libjpeg-turbo (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})"
181 FORCE)
182endif()
183
184message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}")
185
DRC84697032010-10-15 03:43:24 +0000186configure_file(win/jconfig.h.in jconfig.h)
DRCff6961f2014-04-20 09:17:11 +0000187configure_file(win/jconfigint.h.in jconfigint.h)
DRC84697032010-10-15 03:43:24 +0000188
189include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
190
Alex Naidis6eb7d372016-10-16 23:10:08 +0200191string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
192
193set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
194message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}")
195
196set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
197message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}")
198
DRC957d6232011-04-01 11:13:11 +0000199if(WITH_JAVA)
200 find_package(Java)
201 find_package(JNI)
DRCdb425062011-04-03 06:10:18 +0000202 if(DEFINED JAVACFLAGS)
203 message(STATUS "Java compiler flags = ${JAVACFLAGS}")
204 endif()
DRC218c0c12011-02-05 06:01:18 +0000205endif()
206
DRC84697032010-10-15 03:43:24 +0000207
208#
209# Targets
210#
211
DRC245cfdf2010-11-23 17:11:06 +0000212set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
213 jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
214 jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
215 jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c
216 jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
217 jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
218 jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
219
220if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
221 set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
222endif()
223
224if(WITH_ARITH_ENC)
225 set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c)
226endif()
227
228if(WITH_ARITH_DEC)
229 set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c)
230endif()
DRC84697032010-10-15 03:43:24 +0000231
232if(WITH_SIMD)
233 add_definitions(-DWITH_SIMD)
234 add_subdirectory(simd)
235 if(SIMD_X86_64)
236 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c)
237 else()
238 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c)
239 endif()
240 # This tells CMake that the "source" files haven't been generated yet
241 set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
242else()
243 set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c)
DRC6f4ba612010-10-16 21:27:38 +0000244 message(STATUS "Not using SIMD acceleration")
DRC84697032010-10-15 03:43:24 +0000245endif()
246
DRC957d6232011-04-01 11:13:11 +0000247if(WITH_JAVA)
248 add_subdirectory(java)
DRC665c96e2015-05-15 22:08:21 +0000249 set(ENABLE_SHARED TRUE)
DRC957d6232011-04-01 11:13:11 +0000250endif()
251
DRC665c96e2015-05-15 22:08:21 +0000252if(ENABLE_SHARED)
253 add_subdirectory(sharedlib)
DRC84697032010-10-15 03:43:24 +0000254endif()
DRC665c96e2015-05-15 22:08:21 +0000255
256if(ENABLE_STATIC OR WITH_TURBOJPEG)
257 add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
258 if(NOT MSVC)
259 set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
260 endif()
261 if(WITH_SIMD)
262 add_dependencies(jpeg-static simd)
263 endif()
DRC84697032010-10-15 03:43:24 +0000264endif()
265
DRCaee4f722014-08-09 23:06:07 +0000266if(WITH_TURBOJPEG)
267 set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
268 if(WITH_JAVA)
269 set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
270 include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
271 endif()
272
DRC665c96e2015-05-15 22:08:21 +0000273 if(ENABLE_SHARED)
274 add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
275 set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
276 if(MINGW)
277 set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at)
278 endif()
279 target_link_libraries(turbojpeg jpeg-static)
280 set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "")
DRCaee4f722014-08-09 23:06:07 +0000281
DRC665c96e2015-05-15 22:08:21 +0000282 add_executable(tjunittest tjunittest.c tjutil.c)
283 target_link_libraries(tjunittest turbojpeg)
284
285 add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
286 wrppm.c)
287 target_link_libraries(tjbench turbojpeg jpeg-static)
288 set_property(TARGET tjbench PROPERTY COMPILE_FLAGS
289 "-DBMP_SUPPORTED -DPPM_SUPPORTED")
DRCaee4f722014-08-09 23:06:07 +0000290 endif()
291
DRC665c96e2015-05-15 22:08:21 +0000292 if(ENABLE_STATIC)
293 add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}
294 turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
295 if(NOT MSVC)
296 set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
297 endif()
298 if(WITH_SIMD)
299 add_dependencies(turbojpeg-static simd)
300 endif()
DRCaee4f722014-08-09 23:06:07 +0000301
DRC665c96e2015-05-15 22:08:21 +0000302 add_executable(tjunittest-static tjunittest.c tjutil.c)
303 target_link_libraries(tjunittest-static turbojpeg-static)
DRCaee4f722014-08-09 23:06:07 +0000304
DRC665c96e2015-05-15 22:08:21 +0000305 add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c
306 wrbmp.c wrppm.c)
307 target_link_libraries(tjbench-static turbojpeg-static jpeg-static)
308 set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS
309 "-DBMP_SUPPORTED -DPPM_SUPPORTED")
310 endif()
DRC218c0c12011-02-05 06:01:18 +0000311endif()
312
DRCaee4f722014-08-09 23:06:07 +0000313if(WITH_12BIT)
314 set(COMPILE_FLAGS "-DGIF_SUPPORTED -DPPM_SUPPORTED -DUSE_SETMODE")
315else()
316 set(COMPILE_FLAGS "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
DRCecc58362015-06-27 07:56:29 +0000317 set(CJPEG_BMP_SOURCES rdbmp.c rdtarga.c)
318 set(DJPEG_BMP_SOURCES wrbmp.c wrtarga.c)
DRC84697032010-10-15 03:43:24 +0000319endif()
320
DRC665c96e2015-05-15 22:08:21 +0000321if(ENABLE_STATIC)
322 add_executable(cjpeg-static cjpeg.c cdjpeg.c rdgif.c rdppm.c rdswitch.c
323 ${CJPEG_BMP_SOURCES})
324 set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS})
325 target_link_libraries(cjpeg-static jpeg-static)
DRC84697032010-10-15 03:43:24 +0000326
DRC665c96e2015-05-15 22:08:21 +0000327 add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrgif.c
328 wrppm.c ${DJPEG_BMP_SOURCES})
329 set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS ${COMPILE_FLAGS})
330 target_link_libraries(djpeg-static jpeg-static)
DRC84697032010-10-15 03:43:24 +0000331
DRC665c96e2015-05-15 22:08:21 +0000332 add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
333 target_link_libraries(jpegtran-static jpeg-static)
334 set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE")
335endif()
DRC84697032010-10-15 03:43:24 +0000336
337add_executable(rdjpgcom rdjpgcom.c)
338
DRCa81f5422014-06-22 20:50:14 +0000339add_executable(wrjpgcom wrjpgcom.c)
DRC84697032010-10-15 03:43:24 +0000340
341
342#
343# Tests
344#
345
Alex Naidis6eb7d372016-10-16 23:10:08 +0200346add_subdirectory(md5)
347
DRC957d6232011-04-01 11:13:11 +0000348if(MSVC_IDE)
349 set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/")
350else()
351 set(OBJDIR "")
352endif()
353
DRC84697032010-10-15 03:43:24 +0000354enable_testing()
DRC211d1e72013-01-13 11:25:20 +0000355
DRCaee4f722014-08-09 23:06:07 +0000356if(WITH_12BIT)
357 set(TESTORIG testorig12.jpg)
358 set(MD5_JPEG_RGB_ISLOW 9620f424569594bb9242b48498ad801f)
359 set(MD5_PPM_RGB_ISLOW f3301d2219783b8b3d942b7239fa50c0)
360 set(MD5_JPEG_422_IFAST_OPT 7322e3bd2f127f7de4b40d4480ce60e4)
361 set(MD5_PPM_422_IFAST 79807fa552899e66a04708f533e16950)
362 set(MD5_PPM_422M_IFAST 07737bfe8a7c1c87aaa393a0098d16b0)
363 set(MD5_JPEG_420_IFAST_Q100_PROG a1da220b5604081863a504297ed59e55)
364 set(MD5_PPM_420_Q100_IFAST 1b3730122709f53d007255e8dfd3305e)
365 set(MD5_PPM_420M_Q100_IFAST 980a1a3c5bf9510022869d30b7d26566)
366 set(MD5_JPEG_GRAY_ISLOW 235c90707b16e2e069f37c888b2636d9)
367 set(MD5_PPM_GRAY_ISLOW 7213c10af507ad467da5578ca5ee1fca)
368 set(MD5_PPM_GRAY_ISLOW_RGB e96ee81c30a6ed422d466338bd3de65d)
369 set(MD5_JPEG_420S_IFAST_OPT 7af8e60be4d9c227ec63ac9b6630855e)
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -0500370 if(64BIT)
371 # Windows/x64 uses SSE for floating point
372 set(MD5_JPEG_3x2_FLOAT_PROG a8c17daf77b457725ec929e215b603f8)
373 set(MD5_PPM_3x2_FLOAT 42876ab9e5c2f76a87d08db5fbd57956)
374 else()
375 # Windows/x86 uses the 387 FPU for floating point
376 if(MSVC)
377 set(MD5_JPEG_3x2_FLOAT_PROG e27840755870fa849872e58aa0cd1400)
378 set(MD5_PPM_3x2_FLOAT 6c2880b83bb1aa41dfe330e7a9768690)
379 else()
380 set(MD5_JPEG_3x2_FLOAT_PROG bc6dbbefac2872f6b9d6c4a0ae60c3c0)
381 set(MD5_PPM_3x2_FLOAT f58119ee294198ac9b4a9f5645a34266)
382 endif()
383 endif()
DRCaee4f722014-08-09 23:06:07 +0000384 set(MD5_PPM_420M_ISLOW_2_1 4ca6be2a6f326ff9eaab63e70a8259c0)
385 set(MD5_PPM_420M_ISLOW_15_8 12aa9f9534c1b3d7ba047322226365eb)
386 set(MD5_PPM_420M_ISLOW_13_8 f7e22817c7b25e1393e4ec101e9d4e96)
387 set(MD5_PPM_420M_ISLOW_11_8 800a16f9f4dc9b293197bfe11be10a82)
388 set(MD5_PPM_420M_ISLOW_9_8 06b7a92a9bc69f4dc36ec40f1937d55c)
389 set(MD5_PPM_420M_ISLOW_7_8 3ec444a14a4ab4eab88ffc49c48eca43)
390 set(MD5_PPM_420M_ISLOW_3_4 3e726b7ea872445b19437d1c1d4f0d93)
391 set(MD5_PPM_420M_ISLOW_5_8 a8a771abdc94301d20ffac119b2caccd)
392 set(MD5_PPM_420M_ISLOW_1_2 b419124dd5568b085787234866102866)
393 set(MD5_PPM_420M_ISLOW_3_8 343d19015531b7bbe746124127244fa8)
394 set(MD5_PPM_420M_ISLOW_1_4 35fd59d866e44659edfa3c18db2a3edb)
395 set(MD5_PPM_420M_ISLOW_1_8 ccaed48ac0aedefda5d4abe4013f4ad7)
DRCe67a7e32015-06-27 08:10:31 +0000396 set(MD5_PPM_420_ISLOW_SKIP15_31 86664cd9dc956536409e44e244d20a97)
DRC0ef076f2016-02-19 18:32:10 -0600397 set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 452a21656115a163029cfba5c04fa76a)
DRCe67a7e32015-06-27 08:10:31 +0000398 set(MD5_PPM_444_ISLOW_SKIP1_6 ef63901f71ef7a75cd78253fc0914f84)
DRC0ef076f2016-02-19 18:32:10 -0600399 set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 15b173fb5872d9575572fbcc1b05956f)
DRCaee4f722014-08-09 23:06:07 +0000400 set(MD5_JPEG_CROP cdb35ff4b4519392690ea040c56ea99c)
DRC35db75e2014-05-06 22:44:46 +0000401else()
DRCaee4f722014-08-09 23:06:07 +0000402 set(TESTORIG testorig.jpg)
403 set(MD5_JPEG_RGB_ISLOW 768e970dd57b340ff1b83c9d3d47c77b)
404 set(MD5_PPM_RGB_ISLOW 00a257f5393fef8821f2b88ac7421291)
405 set(MD5_BMP_RGB_ISLOW_565 f07d2e75073e4bb10f6c6f4d36e2e3be)
406 set(MD5_BMP_RGB_ISLOW_565D 4cfa0928ef3e6bb626d7728c924cfda4)
407 set(MD5_JPEG_422_IFAST_OPT 2540287b79d913f91665e660303ab2c8)
408 set(MD5_PPM_422_IFAST 35bd6b3f833bad23de82acea847129fa)
409 set(MD5_PPM_422M_IFAST 8dbc65323d62cca7c91ba02dd1cfa81d)
410 set(MD5_BMP_422M_IFAST_565 3294bd4d9a1f2b3d08ea6020d0db7065)
411 set(MD5_BMP_422M_IFAST_565D da98c9c7b6039511be4a79a878a9abc1)
412 set(MD5_JPEG_420_IFAST_Q100_PROG 990cbe0329c882420a2094da7e5adade)
413 set(MD5_PPM_420_Q100_IFAST 5a732542015c278ff43635e473a8a294)
414 set(MD5_PPM_420M_Q100_IFAST ff692ee9323a3b424894862557c092f1)
415 set(MD5_JPEG_GRAY_ISLOW 72b51f894b8f4a10b3ee3066770aa38d)
416 set(MD5_PPM_GRAY_ISLOW 8d3596c56eace32f205deccc229aa5ed)
417 set(MD5_PPM_GRAY_ISLOW_RGB 116424ac07b79e5e801f00508eab48ec)
418 set(MD5_BMP_GRAY_ISLOW_565 12f78118e56a2f48b966f792fedf23cc)
419 set(MD5_BMP_GRAY_ISLOW_565D bdbbd616441a24354c98553df5dc82db)
420 set(MD5_JPEG_420S_IFAST_OPT 388708217ac46273ca33086b22827ed8)
421 if(WITH_SIMD)
422 set(MD5_JPEG_3x2_FLOAT_PROG 343e3f8caf8af5986ebaf0bdc13b5c71)
423 set(MD5_PPM_3x2_FLOAT 1a75f36e5904d6fc3a85a43da9ad89bb)
424 else()
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -0500425 if(64BIT)
426 set(MD5_JPEG_3x2_FLOAT_PROG 9bca803d2042bd1eb03819e2bf92b3e5)
427 set(MD5_PPM_3x2_FLOAT f6bfab038438ed8f5522fbd33595dcdc)
428 else()
429 if(MSVC)
430 set(MD5_JPEG_3x2_FLOAT_PROG 7999ce9cd0ee9b6c7043b7351ab7639d)
431 set(MD5_PPM_3x2_FLOAT 28cdc448a6b75e97892f0e0f8d4b21f3)
432 else()
433 set(MD5_JPEG_3x2_FLOAT_PROG 1657664a410e0822c924b54f6f65e6e9)
434 set(MD5_PPM_3x2_FLOAT cb0a1f027f3d2917c902b5640214e025)
435 endif()
436 endif()
DRCaee4f722014-08-09 23:06:07 +0000437 endif()
438 set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1)
439 set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617)
440 set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437)
441 set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f)
442 set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9)
443 set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7)
444 set(MD5_PPM_420M_ISLOW_13_8 bc3452573c8152f6ae552939ee19f82f)
445 set(MD5_PPM_420M_ISLOW_11_8 d8cc73c0aaacd4556569b59437ba00a5)
446 set(MD5_PPM_420M_ISLOW_9_8 d25e61bc7eac0002f5b393aa223747b6)
447 set(MD5_PPM_420M_ISLOW_7_8 ddb564b7c74a09494016d6cd7502a946)
448 set(MD5_PPM_420M_ISLOW_3_4 8ed8e68808c3fbc4ea764fc9d2968646)
449 set(MD5_PPM_420M_ISLOW_5_8 a3363274999da2366a024efae6d16c9b)
450 set(MD5_PPM_420M_ISLOW_1_2 e692a315cea26b988c8e8b29a5dbcd81)
451 set(MD5_PPM_420M_ISLOW_3_8 79eca9175652ced755155c90e785a996)
452 set(MD5_PPM_420M_ISLOW_1_4 79cd778f8bf1a117690052cacdd54eca)
453 set(MD5_PPM_420M_ISLOW_1_8 391b3d4aca640c8567d6f8745eb2142f)
454 set(MD5_BMP_420_ISLOW_256 4980185e3776e89bd931736e1cddeee6)
455 set(MD5_BMP_420_ISLOW_565 bf9d13e16c4923b92e1faa604d7922cb)
456 set(MD5_BMP_420_ISLOW_565D 6bde71526acc44bcff76f696df8638d2)
457 set(MD5_BMP_420M_ISLOW_565 8dc0185245353cfa32ad97027342216f)
458 set(MD5_BMP_420M_ISLOW_565D d1be3a3339166255e76fa50a0d70d73e)
DRCe67a7e32015-06-27 08:10:31 +0000459 set(MD5_PPM_420_ISLOW_SKIP15_31 c4c65c1e43d7275cd50328a61e6534f0)
460 set(MD5_PPM_420_ISLOW_ARI_SKIP16_139 087c6b123db16ac00cb88c5b590bb74a)
DRC0ef076f2016-02-19 18:32:10 -0600461 set(MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71 26eb36ccc7d1f0cb80cdabb0ac8b5d99)
462 set(MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4 886c6775af22370257122f8b16207e6d)
DRCe67a7e32015-06-27 08:10:31 +0000463 set(MD5_PPM_444_ISLOW_SKIP1_6 5606f86874cf26b8fcee1117a0a436a6)
DRC0ef076f2016-02-19 18:32:10 -0600464 set(MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13 db87dc7ce26bcdc7a6b56239ce2b9d6c)
465 set(MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0 cb57b32bd6d03e35432362f7bf184b6d)
DRCaee4f722014-08-09 23:06:07 +0000466 set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d)
DRC35db75e2014-05-06 22:44:46 +0000467endif()
DRC211d1e72013-01-13 11:25:20 +0000468
DRC957d6232011-04-01 11:13:11 +0000469if(WITH_JAVA)
DRC35db75e2014-05-06 22:44:46 +0000470 add_test(TJUnitTest
471 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
472 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
473 TJUnitTest)
474 add_test(TJUnitTest-yuv
475 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
476 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
477 TJUnitTest -yuv)
478 add_test(TJUnitTest-yuv-nopad
479 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
480 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
481 TJUnitTest -yuv -noyuvpad)
482 add_test(TJUnitTest-bi
483 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
484 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
485 TJUnitTest -bi)
486 add_test(TJUnitTest-bi-yuv
487 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
488 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
489 TJUnitTest -bi -yuv)
490 add_test(TJUnitTest-bi-yuv-nopad
491 ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar
492 -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
493 TJUnitTest -bi -yuv -noyuvpad)
DRC957d6232011-04-01 11:13:11 +0000494endif()
DRC84697032010-10-15 03:43:24 +0000495
DRC665c96e2015-05-15 22:08:21 +0000496set(TEST_LIBTYPES "")
497if(ENABLE_SHARED)
498 set(TEST_LIBTYPES ${TEST_LIBTYPES} shared)
499endif()
500if(ENABLE_STATIC)
501 set(TEST_LIBTYPES ${TEST_LIBTYPES} static)
502endif()
503
Alex Naidis6eb7d372016-10-16 23:10:08 +0200504set(TESTIMAGES ${CMAKE_SOURCE_DIR}/testimages)
505set(MD5CMP ${CMAKE_CURRENT_BINARY_DIR}/md5/md5cmp)
506if(CMAKE_CROSSCOMPILING)
507 file(RELATIVE_PATH TESTIMAGES ${CMAKE_CURRENT_BINARY_DIR} ${TESTIMAGES})
508 file(RELATIVE_PATH MD5CMP ${CMAKE_CURRENT_BINARY_DIR} ${MD5CMP})
509endif()
510
DRC665c96e2015-05-15 22:08:21 +0000511foreach(libtype ${TEST_LIBTYPES})
DRC35db75e2014-05-06 22:44:46 +0000512 if(libtype STREQUAL "shared")
513 set(dir sharedlib/)
514 else()
515 set(dir "")
516 set(suffix -static)
517 endif()
DRCaee4f722014-08-09 23:06:07 +0000518 if(WITH_TURBOJPEG)
519 add_test(tjunittest${suffix} tjunittest${suffix})
520 add_test(tjunittest${suffix}-alloc tjunittest${suffix} -alloc)
521 add_test(tjunittest${suffix}-yuv tjunittest${suffix} -yuv)
522 add_test(tjunittest${suffix}-yuv-alloc tjunittest${suffix} -yuv -alloc)
523 add_test(tjunittest${suffix}-yuv-nopad tjunittest${suffix} -yuv -noyuvpad)
524 endif()
DRC35db75e2014-05-06 22:44:46 +0000525
526 # These tests are carefully chosen to provide full coverage of as many of the
527 # underlying algorithms as possible (including all of the SIMD-accelerated
528 # ones.)
529
530 # CC: null SAMP: fullsize FDCT: islow ENT: huff
531 add_test(cjpeg${suffix}-rgb-islow
Alex Naidis6eb7d372016-10-16 23:10:08 +0200532 ${dir}cjpeg${suffix} -rgb -dct int
533 -outfile testout_rgb_islow.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000534 add_test(cjpeg${suffix}-rgb-islow-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200535 ${MD5CMP} ${MD5_JPEG_RGB_ISLOW} testout_rgb_islow.jpg)
536
DRC35db75e2014-05-06 22:44:46 +0000537 # CC: null SAMP: fullsize IDCT: islow ENT: huff
538 add_test(djpeg${suffix}-rgb-islow
Alex Naidis6eb7d372016-10-16 23:10:08 +0200539 ${dir}djpeg${suffix} -dct int -ppm
540 -outfile testout_rgb_islow.ppm testout_rgb_islow.jpg)
DRC35db75e2014-05-06 22:44:46 +0000541 add_test(djpeg${suffix}-rgb-islow-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200542 ${MD5CMP} ${MD5_PPM_RGB_ISLOW} testout_rgb_islow.ppm)
543
DRCaee4f722014-08-09 23:06:07 +0000544 if(NOT WITH_12BIT)
545 # CC: RGB->RGB565 SAMP: fullsize IDCT: islow ENT: huff
546 add_test(djpeg${suffix}-rgb-islow-565
547 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
548 -outfile testout_rgb_islow_565.bmp testout_rgb_islow.jpg)
549 add_test(djpeg${suffix}-rgb-islow-565-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200550 ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565} testout_rgb_islow_565.bmp)
551
DRCaee4f722014-08-09 23:06:07 +0000552 # CC: RGB->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
553 add_test(djpeg${suffix}-rgb-islow-565D
554 ${dir}djpeg${suffix} -dct int -rgb565 -bmp
555 -outfile testout_rgb_islow_565D.bmp testout_rgb_islow.jpg)
556 add_test(djpeg${suffix}-rgb-islow-565D-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200557 ${MD5CMP} ${MD5_BMP_RGB_ISLOW_565D} testout_rgb_islow_565D.bmp)
DRCaee4f722014-08-09 23:06:07 +0000558 endif()
DRC35db75e2014-05-06 22:44:46 +0000559
560 # CC: RGB->YCC SAMP: fullsize/h2v1 FDCT: ifast ENT: 2-pass huff
561 add_test(cjpeg${suffix}-422-ifast-opt
562 ${dir}cjpeg${suffix} -sample 2x1 -dct fast -opt
Alex Naidis6eb7d372016-10-16 23:10:08 +0200563 -outfile testout_422_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000564 add_test(cjpeg${suffix}-422-ifast-opt-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200565 ${MD5CMP} ${MD5_JPEG_422_IFAST_OPT} testout_422_ifast_opt.jpg)
566
DRC35db75e2014-05-06 22:44:46 +0000567 # CC: YCC->RGB SAMP: fullsize/h2v1 fancy IDCT: ifast ENT: huff
568 add_test(djpeg${suffix}-422-ifast
Alex Naidis6eb7d372016-10-16 23:10:08 +0200569 ${dir}djpeg${suffix} -dct fast
570 -outfile testout_422_ifast.ppm testout_422_ifast_opt.jpg)
DRC35db75e2014-05-06 22:44:46 +0000571 add_test(djpeg${suffix}-422-ifast-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200572 ${MD5CMP} ${MD5_PPM_422_IFAST} testout_422_ifast.ppm)
573
DRC35db75e2014-05-06 22:44:46 +0000574 # CC: YCC->RGB SAMP: h2v1 merged IDCT: ifast ENT: huff
575 add_test(djpeg${suffix}-422m-ifast
Alex Naidis6eb7d372016-10-16 23:10:08 +0200576 ${dir}djpeg${suffix} -dct fast -nosmooth
577 -outfile testout_422m_ifast.ppm testout_422_ifast_opt.jpg)
DRC35db75e2014-05-06 22:44:46 +0000578 add_test(djpeg${suffix}-422m-ifast-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200579 ${MD5CMP} ${MD5_PPM_422M_IFAST} testout_422m_ifast.ppm)
580
DRCaee4f722014-08-09 23:06:07 +0000581 if(NOT WITH_12BIT)
582 # CC: YCC->RGB565 SAMP: h2v1 merged IDCT: ifast ENT: huff
583 add_test(djpeg${suffix}-422m-ifast-565
584 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp
585 -outfile testout_422m_ifast_565.bmp testout_422_ifast_opt.jpg)
586 add_test(djpeg${suffix}-422m-ifast-565-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200587 ${MD5CMP} ${MD5_BMP_422M_IFAST_565} testout_422m_ifast_565.bmp)
588
DRCaee4f722014-08-09 23:06:07 +0000589 # CC: YCC->RGB565 (dithered) SAMP: h2v1 merged IDCT: ifast ENT: huff
590 add_test(djpeg${suffix}-422m-ifast-565D
591 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp
592 -outfile testout_422m_ifast_565D.bmp testout_422_ifast_opt.jpg)
593 add_test(djpeg${suffix}-422m-ifast-565D-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200594 ${MD5CMP} ${MD5_BMP_422M_IFAST_565D} testout_422m_ifast_565D.bmp)
DRCaee4f722014-08-09 23:06:07 +0000595 endif()
DRC35db75e2014-05-06 22:44:46 +0000596
597 # CC: RGB->YCC SAMP: fullsize/h2v2 FDCT: ifast ENT: prog huff
598 add_test(cjpeg${suffix}-420-q100-ifast-prog
DRC78df2e62014-05-12 09:23:57 +0000599 ${dir}cjpeg${suffix} -sample 2x2 -quality 100 -dct fast -prog
Alex Naidis6eb7d372016-10-16 23:10:08 +0200600 -outfile testout_420_q100_ifast_prog.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000601 add_test(cjpeg${suffix}-420-q100-ifast-prog-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200602 ${MD5CMP} ${MD5_JPEG_420_IFAST_Q100_PROG} testout_420_q100_ifast_prog.jpg)
603
DRC35db75e2014-05-06 22:44:46 +0000604 # CC: YCC->RGB SAMP: fullsize/h2v2 fancy IDCT: ifast ENT: prog huff
605 add_test(djpeg${suffix}-420-q100-ifast-prog
Alex Naidis6eb7d372016-10-16 23:10:08 +0200606 ${dir}djpeg${suffix} -dct fast
607 -outfile testout_420_q100_ifast.ppm testout_420_q100_ifast_prog.jpg)
DRC35db75e2014-05-06 22:44:46 +0000608 add_test(djpeg${suffix}-420-q100-ifast-prog-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200609 ${MD5CMP} ${MD5_PPM_420_Q100_IFAST} testout_420_q100_ifast.ppm)
610
DRC35db75e2014-05-06 22:44:46 +0000611 # CC: YCC->RGB SAMP: h2v2 merged IDCT: ifast ENT: prog huff
612 add_test(djpeg${suffix}-420m-q100-ifast-prog
DRC78df2e62014-05-12 09:23:57 +0000613 ${dir}djpeg${suffix} -dct fast -nosmooth
DRC35db75e2014-05-06 22:44:46 +0000614 -outfile testout_420m_q100_ifast.ppm testout_420_q100_ifast_prog.jpg)
615 add_test(djpeg${suffix}-420m-q100-ifast-prog-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200616 ${MD5CMP} ${MD5_PPM_420M_Q100_IFAST} testout_420m_q100_ifast.ppm)
DRC35db75e2014-05-06 22:44:46 +0000617
618 # CC: RGB->Gray SAMP: fullsize FDCT: islow ENT: huff
619 add_test(cjpeg${suffix}-gray-islow
Alex Naidis6eb7d372016-10-16 23:10:08 +0200620 ${dir}cjpeg${suffix} -gray -dct int
621 -outfile testout_gray_islow.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000622 add_test(cjpeg${suffix}-gray-islow-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200623 ${MD5CMP} ${MD5_JPEG_GRAY_ISLOW} testout_gray_islow.jpg)
624
DRC78df2e62014-05-12 09:23:57 +0000625 # CC: Gray->Gray SAMP: fullsize IDCT: islow ENT: huff
DRC35db75e2014-05-06 22:44:46 +0000626 add_test(djpeg${suffix}-gray-islow
Alex Naidis6eb7d372016-10-16 23:10:08 +0200627 ${dir}djpeg${suffix} -dct int
628 -outfile testout_gray_islow.ppm testout_gray_islow.jpg)
DRC35db75e2014-05-06 22:44:46 +0000629 add_test(djpeg${suffix}-gray-islow-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200630 ${MD5CMP} ${MD5_PPM_GRAY_ISLOW} testout_gray_islow.ppm)
631
DRC78df2e62014-05-12 09:23:57 +0000632 # CC: Gray->RGB SAMP: fullsize IDCT: islow ENT: huff
633 add_test(djpeg${suffix}-gray-islow-rgb
Alex Naidis6eb7d372016-10-16 23:10:08 +0200634 ${dir}djpeg${suffix} -dct int -rgb
635 -outfile testout_gray_islow_rgb.ppm testout_gray_islow.jpg)
DRC4c773cf2014-12-08 23:23:41 +0000636 add_test(djpeg${suffix}-gray-islow-rgb-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200637 ${MD5CMP} ${MD5_PPM_GRAY_ISLOW_RGB} testout_gray_islow_rgb.ppm)
638
DRCaee4f722014-08-09 23:06:07 +0000639 if(NOT WITH_12BIT)
640 # CC: Gray->RGB565 SAMP: fullsize IDCT: islow ENT: huff
641 add_test(djpeg${suffix}-gray-islow-565
642 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
643 -outfile testout_gray_islow_565.bmp testout_gray_islow.jpg)
644 add_test(djpeg${suffix}-gray-islow-565-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200645 ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565} testout_gray_islow_565.bmp)
646
DRCaee4f722014-08-09 23:06:07 +0000647 # CC: Gray->RGB565 (dithered) SAMP: fullsize IDCT: islow ENT: huff
648 add_test(djpeg${suffix}-gray-islow-565D
649 ${dir}djpeg${suffix} -dct int -rgb565 -bmp
650 -outfile testout_gray_islow_565D.bmp testout_gray_islow.jpg)
651 add_test(djpeg${suffix}-gray-islow-565D-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200652 ${MD5CMP} ${MD5_BMP_GRAY_ISLOW_565D} testout_gray_islow_565D.bmp)
DRCaee4f722014-08-09 23:06:07 +0000653 endif()
DRC35db75e2014-05-06 22:44:46 +0000654
655 # CC: RGB->YCC SAMP: fullsize smooth/h2v2 smooth FDCT: islow
656 # ENT: 2-pass huff
657 add_test(cjpeg${suffix}-420s-ifast-opt
Alex Naidis6eb7d372016-10-16 23:10:08 +0200658 ${dir}cjpeg${suffix} -sample 2x2 -smooth 1 -dct int -opt
659 -outfile testout_420s_ifast_opt.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000660 add_test(cjpeg${suffix}-420s-ifast-opt-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200661 ${MD5CMP} ${MD5_JPEG_420S_IFAST_OPT} testout_420s_ifast_opt.jpg)
DRC35db75e2014-05-06 22:44:46 +0000662
663 # CC: RGB->YCC SAMP: fullsize/int FDCT: float ENT: prog huff
664 add_test(cjpeg${suffix}-3x2-float-prog
665 ${dir}cjpeg${suffix} -sample 3x2 -dct float -prog
Alex Naidis6eb7d372016-10-16 23:10:08 +0200666 -outfile testout_3x2_float_prog.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000667 add_test(cjpeg${suffix}-3x2-float-prog-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200668 ${MD5CMP} ${MD5_JPEG_3x2_FLOAT_PROG} testout_3x2_float_prog.jpg)
669
DRC35db75e2014-05-06 22:44:46 +0000670 # CC: YCC->RGB SAMP: fullsize/int IDCT: float ENT: prog huff
671 add_test(djpeg${suffix}-3x2-float-prog
Alex Naidis6eb7d372016-10-16 23:10:08 +0200672 ${dir}djpeg${suffix} -dct float
673 -outfile testout_3x2_float.ppm testout_3x2_float_prog.jpg)
DRC35db75e2014-05-06 22:44:46 +0000674 add_test(djpeg${suffix}-3x2-float-prog-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200675 ${MD5CMP} ${MD5_PPM_3x2_FLOAT} testout_3x2_float.ppm)
DRC35db75e2014-05-06 22:44:46 +0000676
677 if(WITH_ARITH_ENC)
678 # CC: YCC->RGB SAMP: fullsize/h2v2 FDCT: islow ENT: arith
679 add_test(cjpeg${suffix}-420-islow-ari
680 ${dir}cjpeg${suffix} -dct int -arithmetic
Alex Naidis6eb7d372016-10-16 23:10:08 +0200681 -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000682 add_test(cjpeg${suffix}-420-islow-ari-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200683 ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg)
684
DRC35db75e2014-05-06 22:44:46 +0000685 add_test(jpegtran${suffix}-420-islow-ari
686 ${dir}jpegtran${suffix} -arithmetic
Alex Naidis6eb7d372016-10-16 23:10:08 +0200687 -outfile testout_420_islow_ari.jpg ${TESTIMAGES}/testimgint.jpg)
DRC35db75e2014-05-06 22:44:46 +0000688 add_test(jpegtran${suffix}-420-islow-ari-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200689 ${MD5CMP} ${MD5_JPEG_420_ISLOW_ARI} testout_420_islow_ari.jpg)
690
DRC35db75e2014-05-06 22:44:46 +0000691 # CC: YCC->RGB SAMP: fullsize FDCT: islow ENT: prog arith
692 add_test(cjpeg${suffix}-444-islow-progari
DRCe67a7e32015-06-27 08:10:31 +0000693 ${dir}cjpeg${suffix} -sample 1x1 -dct int -prog -arithmetic
Alex Naidis6eb7d372016-10-16 23:10:08 +0200694 -outfile testout_444_islow_progari.jpg ${TESTIMAGES}/testorig.ppm)
DRC35db75e2014-05-06 22:44:46 +0000695 add_test(cjpeg${suffix}-444-islow-progari-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200696 ${MD5CMP} ${MD5_JPEG_444_ISLOW_PROGARI} testout_444_islow_progari.jpg)
DRC35db75e2014-05-06 22:44:46 +0000697 endif()
Alex Naidis6eb7d372016-10-16 23:10:08 +0200698
DRC35db75e2014-05-06 22:44:46 +0000699 if(WITH_ARITH_DEC)
700 # CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
DRC4c773cf2014-12-08 23:23:41 +0000701 add_test(djpeg${suffix}-420m-ifast-ari
Alex Naidis6eb7d372016-10-16 23:10:08 +0200702 ${dir}djpeg${suffix} -fast -ppm
703 -outfile testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg)
DRC4c773cf2014-12-08 23:23:41 +0000704 add_test(djpeg${suffix}-420m-ifast-ari-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200705 ${MD5CMP} ${MD5_PPM_420M_IFAST_ARI} testout_420m_ifast_ari.ppm)
706
DRC35db75e2014-05-06 22:44:46 +0000707 add_test(jpegtran${suffix}-420-islow
Alex Naidis6eb7d372016-10-16 23:10:08 +0200708 ${dir}jpegtran${suffix}
709 -outfile testout_420_islow.jpg ${TESTIMAGES}/testimgari.jpg)
DRC35db75e2014-05-06 22:44:46 +0000710 add_test(jpegtran${suffix}-420-islow-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200711 ${MD5CMP} ${MD5_JPEG_420_ISLOW} testout_420_islow.jpg)
DRC35db75e2014-05-06 22:44:46 +0000712 endif()
713
714 # 2/1-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 16x16 islow ENT: huff
715 # 15/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 15x15 islow ENT: huff
716 # 13/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 13x13 islow ENT: huff
717 # 11/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 11x11 islow ENT: huff
718 # 9/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 9x9 islow ENT: huff
719 # 7/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 7x7 islow/14x14 islow
720 # ENT: huff
721 # 3/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 6x6 islow/12x12 islow
722 # ENT: huff
723 # 5/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 5x5 islow/10x10 islow
724 # ENT: huff
725 # 1/2-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 4x4 islow/8x8 islow
726 # ENT: huff
727 # 3/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 3x3 islow/6x6 islow
728 # ENT: huff
729 # 1/4-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 2x2 islow/4x4 islow
730 # ENT: huff
731 # 1/8-- CC: YCC->RGB SAMP: h2v2 merged IDCT: 1x1 islow/2x2 islow
732 # ENT: huff
733 foreach(scale 2_1 15_8 13_8 11_8 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8)
734 string(REGEX REPLACE "_" "/" scalearg ${scale})
735 add_test(djpeg${suffix}-420m-islow-${scale}
DRC78df2e62014-05-12 09:23:57 +0000736 ${dir}djpeg${suffix} -dct int -scale ${scalearg} -nosmooth -ppm
Alex Naidis6eb7d372016-10-16 23:10:08 +0200737 -outfile testout_420m_islow_${scale}.ppm ${TESTIMAGES}/${TESTORIG})
DRC35db75e2014-05-06 22:44:46 +0000738 add_test(djpeg${suffix}-420m-islow-${scale}-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200739 ${MD5CMP} ${MD5_PPM_420M_ISLOW_${scale}} testout_420m_islow_${scale}.ppm)
DRC35db75e2014-05-06 22:44:46 +0000740 endforeach()
741
DRCaee4f722014-08-09 23:06:07 +0000742 if(NOT WITH_12BIT)
743 # CC: YCC->RGB (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
744 add_test(djpeg${suffix}-420-islow-256
745 ${dir}djpeg${suffix} -dct int -colors 256 -bmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200746 -outfile testout_420_islow_256.bmp ${TESTIMAGES}/${TESTORIG})
DRCaee4f722014-08-09 23:06:07 +0000747 add_test(djpeg${suffix}-420-islow-256-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200748 ${MD5CMP} ${MD5_BMP_420_ISLOW_256} testout_420_islow_256.bmp)
749
DRCaee4f722014-08-09 23:06:07 +0000750 # CC: YCC->RGB565 SAMP: h2v2 fancy IDCT: islow ENT: huff
751 add_test(djpeg${suffix}-420-islow-565
752 ${dir}djpeg${suffix} -dct int -rgb565 -dither none -bmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200753 -outfile testout_420_islow_565.bmp ${TESTIMAGES}/${TESTORIG})
DRCaee4f722014-08-09 23:06:07 +0000754 add_test(djpeg${suffix}-420-islow-565-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200755 ${MD5CMP} ${MD5_BMP_420_ISLOW_565} testout_420_islow_565.bmp)
756
DRCaee4f722014-08-09 23:06:07 +0000757 # CC: YCC->RGB565 (dithered) SAMP: h2v2 fancy IDCT: islow ENT: huff
758 add_test(djpeg${suffix}-420-islow-565D
759 ${dir}djpeg${suffix} -dct int -rgb565 -bmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200760 -outfile testout_420_islow_565D.bmp ${TESTIMAGES}/${TESTORIG})
DRCaee4f722014-08-09 23:06:07 +0000761 add_test(djpeg${suffix}-420-islow-565D-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200762 ${MD5CMP} ${MD5_BMP_420_ISLOW_565D} testout_420_islow_565D.bmp)
763
DRCaee4f722014-08-09 23:06:07 +0000764 # CC: YCC->RGB565 SAMP: h2v2 merged IDCT: islow ENT: huff
765 add_test(djpeg${suffix}-420m-islow-565
766 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -dither none -bmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200767 -outfile testout_420m_islow_565.bmp ${TESTIMAGES}/${TESTORIG})
DRCaee4f722014-08-09 23:06:07 +0000768 add_test(djpeg${suffix}-420m-islow-565-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200769 ${MD5CMP} ${MD5_BMP_420M_ISLOW_565} testout_420m_islow_565.bmp)
770
DRCaee4f722014-08-09 23:06:07 +0000771 # CC: YCC->RGB565 (dithered) SAMP: h2v2 merged IDCT: islow ENT: huff
772 add_test(djpeg${suffix}-420m-islow-565D
773 ${dir}djpeg${suffix} -dct int -nosmooth -rgb565 -bmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200774 -outfile testout_420m_islow_565D.bmp ${TESTIMAGES}/${TESTORIG})
DRCaee4f722014-08-09 23:06:07 +0000775 add_test(djpeg${suffix}-420m-islow-565D-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200776 ${MD5CMP} ${MD5_BMP_420M_ISLOW_565D} testout_420m_islow_565D.bmp)
DRCaee4f722014-08-09 23:06:07 +0000777 endif()
DRCe67a7e32015-06-27 08:10:31 +0000778
779 # Partial decode tests. These tests are designed to cover all of the
780 # possible code paths in jpeg_skip_scanlines().
781
782 # Context rows: Yes Intra-iMCU row: Yes iMCU row prefetch: No ENT: huff
783 add_test(djpeg${suffix}-420-islow-skip15_31
784 ${dir}djpeg${suffix} -dct int -skip 15,31 -ppm
Alex Naidis6eb7d372016-10-16 23:10:08 +0200785 -outfile testout_420_islow_skip15,31.ppm ${TESTIMAGES}/${TESTORIG})
DRCe67a7e32015-06-27 08:10:31 +0000786 add_test(djpeg${suffix}-420-islow-skip15_31-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200787 ${MD5CMP} ${MD5_PPM_420_ISLOW_SKIP15_31} testout_420_islow_skip15,31.ppm)
788
DRCe67a7e32015-06-27 08:10:31 +0000789 # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: Yes ENT: arith
790 if(WITH_ARITH_DEC)
791 add_test(djpeg${suffix}-420-islow-ari-skip16_139
792 ${dir}djpeg${suffix} -dct int -skip 16,139 -ppm
793 -outfile testout_420_islow_ari_skip16,139.ppm
Alex Naidis6eb7d372016-10-16 23:10:08 +0200794 ${TESTIMAGES}/testimgari.jpg)
DRCe67a7e32015-06-27 08:10:31 +0000795 add_test(djpeg${suffix}-420-islow-ari_skip16_139-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200796 ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_SKIP16_139}
797 testout_420_islow_ari_skip16,139.ppm)
DRCe67a7e32015-06-27 08:10:31 +0000798 endif()
Alex Naidis6eb7d372016-10-16 23:10:08 +0200799
DRCe67a7e32015-06-27 08:10:31 +0000800 # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: prog huff
801 add_test(cjpeg${suffix}-420-islow-prog
DRC0ef076f2016-02-19 18:32:10 -0600802 ${dir}cjpeg${suffix} -dct int -prog
803 -outfile testout_420_islow_prog.jpg ${TESTIMAGES}/testorig.ppm)
804 add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71
805 ${dir}djpeg${suffix} -dct int -crop 62x62+71+71 -ppm
806 -outfile testout_420_islow_prog_crop62x62,71,71.ppm
807 testout_420_islow_prog.jpg)
808 add_test(djpeg${suffix}-420-islow-prog-crop62x62_71_71-cmp
809 ${MD5CMP} ${MD5_PPM_420_ISLOW_PROG_CROP62x62_71_71}
810 testout_420_islow_prog_crop62x62,71,71.ppm)
811
DRCe67a7e32015-06-27 08:10:31 +0000812 # Context rows: Yes Intra-iMCU row: No iMCU row prefetch: No ENT: arith
813 if(WITH_ARITH_DEC)
DRC0ef076f2016-02-19 18:32:10 -0600814 add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4
815 ${dir}djpeg${suffix} -dct int -crop 53x53+4+4 -ppm
816 -outfile testout_420_islow_ari_crop53x53,4,4.ppm
817 ${TESTIMAGES}/testimgari.jpg)
818 add_test(djpeg${suffix}-420-islow-ari-crop53x53_4_4-cmp
819 ${MD5CMP} ${MD5_PPM_420_ISLOW_ARI_CROP53x53_4_4}
820 testout_420_islow_ari_crop53x53,4,4.ppm)
DRCe67a7e32015-06-27 08:10:31 +0000821 endif()
Alex Naidis6eb7d372016-10-16 23:10:08 +0200822
DRCe67a7e32015-06-27 08:10:31 +0000823 # Context rows: No Intra-iMCU row: Yes ENT: huff
824 add_test(cjpeg${suffix}-444-islow
Alex Naidis6eb7d372016-10-16 23:10:08 +0200825 ${dir}cjpeg${suffix} -dct int -sample 1x1
826 -outfile testout_444_islow.jpg ${TESTIMAGES}/testorig.ppm)
DRCe67a7e32015-06-27 08:10:31 +0000827 add_test(djpeg${suffix}-444-islow-skip1_6
828 ${dir}djpeg${suffix} -dct int -skip 1,6 -ppm
829 -outfile testout_444_islow_skip1,6.ppm testout_444_islow.jpg)
830 add_test(djpeg${suffix}-444-islow-skip1_6-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200831 ${MD5CMP} ${MD5_PPM_444_ISLOW_SKIP1_6} testout_444_islow_skip1,6.ppm)
832
DRCe67a7e32015-06-27 08:10:31 +0000833 # Context rows: No Intra-iMCU row: No ENT: prog huff
834 add_test(cjpeg${suffix}-444-islow-prog
835 ${dir}cjpeg${suffix} -dct int -prog -sample 1x1
DRC0ef076f2016-02-19 18:32:10 -0600836 -outfile testout_444_islow_prog.jpg ${TESTIMAGES}/testorig.ppm)
837 add_test(djpeg${suffix}-444-islow-prog-crop98x98_13_13
838 ${dir}djpeg${suffix} -dct int -crop 98x98+13+13 -ppm
839 -outfile testout_444_islow_prog_crop98x98,13,13.ppm
840 testout_444_islow_prog.jpg)
841 add_test(djpeg${suffix}-444-islow-prog_crop98x98_13_13-cmp
842 ${MD5CMP} ${MD5_PPM_444_ISLOW_PROG_CROP98x98_13_13}
843 testout_444_islow_prog_crop98x98,13,13.ppm)
844
DRCe67a7e32015-06-27 08:10:31 +0000845 # Context rows: No Intra-iMCU row: No ENT: arith
846 if(WITH_ARITH_ENC)
847 add_test(cjpeg${suffix}-444-islow-ari
848 ${dir}cjpeg${suffix} -dct int -arithmetic -sample 1x1
Alex Naidis6eb7d372016-10-16 23:10:08 +0200849 -outfile testout_444_islow_ari.jpg ${TESTIMAGES}/testorig.ppm)
DRCe67a7e32015-06-27 08:10:31 +0000850 if(WITH_ARITH_DEC)
DRC0ef076f2016-02-19 18:32:10 -0600851 add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0
852 ${dir}djpeg${suffix} -dct int -crop 37x37+0+0 -ppm
853 -outfile testout_444_islow_ari_crop37x37,0,0.ppm
DRCe67a7e32015-06-27 08:10:31 +0000854 testout_444_islow_ari.jpg)
DRC0ef076f2016-02-19 18:32:10 -0600855 add_test(djpeg${suffix}-444-islow-ari-crop37x37_0_0-cmp
856 ${MD5CMP} ${MD5_PPM_444_ISLOW_ARI_CROP37x37_0_0}
857 testout_444_islow_ari_crop37x37,0,0.ppm)
DRCe67a7e32015-06-27 08:10:31 +0000858 endif()
859 endif()
860
DRC35db75e2014-05-06 22:44:46 +0000861 add_test(jpegtran${suffix}-crop
862 ${dir}jpegtran${suffix} -crop 120x90+20+50 -transpose -perfect
Alex Naidis6eb7d372016-10-16 23:10:08 +0200863 -outfile testout_crop.jpg ${TESTIMAGES}/${TESTORIG})
DRC35db75e2014-05-06 22:44:46 +0000864 add_test(jpegtran${suffix}-crop-cmp
Alex Naidis6eb7d372016-10-16 23:10:08 +0200865 ${MD5CMP} ${MD5_JPEG_CROP} testout_crop.jpg)
DRC35db75e2014-05-06 22:44:46 +0000866
DRC0af8d672012-01-31 11:09:11 +0000867endforeach()
DRC2c0a4e12010-10-16 08:51:43 +0000868
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -0500869add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P
DRCa0f878a2011-04-02 04:43:14 +0000870 ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake)
871
DRC2c0a4e12010-10-16 08:51:43 +0000872
873#
874# Installer
875#
876
DRC2c0a4e12010-10-16 08:51:43 +0000877if(MSVC)
878 set(INST_PLATFORM "Visual C++")
DRCb94f2de2011-03-22 09:31:25 +0000879 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
DRC7175e512013-04-23 22:29:00 +0000880 set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
DRC2c0a4e12010-10-16 08:51:43 +0000881elseif(MINGW)
882 set(INST_PLATFORM GCC)
DRCb94f2de2011-03-22 09:31:25 +0000883 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
DRC7175e512013-04-23 22:29:00 +0000884 set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
DRC2c0a4e12010-10-16 08:51:43 +0000885 set(INST_DEFS -DGCC)
886endif()
887
888if(64BIT)
889 set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
890 set(INST_NAME ${INST_NAME}64)
DRC7175e512013-04-23 22:29:00 +0000891 set(INST_REG_NAME ${INST_DIR}64)
DRC2c0a4e12010-10-16 08:51:43 +0000892 set(INST_DEFS ${INST_DEFS} -DWIN64)
893endif()
894
DRC957d6232011-04-01 11:13:11 +0000895if(WITH_JAVA)
896 set(INST_DEFS ${INST_DEFS} -DJAVA)
897endif()
898
DRC2c0a4e12010-10-16 08:51:43 +0000899if(MSVC_IDE)
DRC926e01f2011-04-06 06:35:38 +0000900 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
DRC2c0a4e12010-10-16 08:51:43 +0000901else()
902 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
903endif()
904
DRC9fe22da2014-04-16 23:30:38 +0000905STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
DRC7175e512013-04-23 22:29:00 +0000906
DRC2c0a4e12010-10-16 08:51:43 +0000907configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
908
DRC7175e512013-04-23 22:29:00 +0000909if(WITH_JAVA)
910 set(JAVA_DEPEND java)
911endif()
DRC2c0a4e12010-10-16 08:51:43 +0000912add_custom_target(installer
913 makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
DRCb94f2de2011-03-22 09:31:25 +0000914 DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
DRC7175e512013-04-23 22:29:00 +0000915 cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
DRC2c0a4e12010-10-16 08:51:43 +0000916 SOURCES libjpeg-turbo.nsi)
DRC7284c9a2010-10-16 21:55:14 +0000917
DRCaee4f722014-08-09 23:06:07 +0000918if(WITH_TURBOJPEG)
DRC665c96e2015-05-15 22:08:21 +0000919 if(ENABLE_SHARED)
920 install(TARGETS turbojpeg tjbench
921 ARCHIVE DESTINATION lib
922 LIBRARY DESTINATION lib
923 RUNTIME DESTINATION bin)
924 endif()
925 if(ENABLE_STATIC)
926 install(TARGETS turbojpeg-static ARCHIVE DESTINATION lib)
927 if(NOT ENABLE_SHARED)
928 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static.exe
929 DESTINATION bin RENAME tjbench.exe)
930 endif()
931 endif()
932 install(FILES ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include)
DRCaee4f722014-08-09 23:06:07 +0000933endif()
DRC665c96e2015-05-15 22:08:21 +0000934
935if(ENABLE_STATIC)
936 install(TARGETS jpeg-static ARCHIVE DESTINATION lib)
937 if(NOT ENABLE_SHARED)
938 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static.exe
939 DESTINATION bin RENAME cjpeg.exe)
940 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static.exe
941 DESTINATION bin RENAME djpeg.exe)
942 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static.exe
943 DESTINATION bin RENAME jpegtran.exe)
944 endif()
945endif()
946
947install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION bin)
DRC7284c9a2010-10-16 21:55:14 +0000948
Alex Naidis6eb7d372016-10-16 23:10:08 +0200949install(FILES ${CMAKE_SOURCE_DIR}/README.ijg ${CMAKE_SOURCE_DIR}/README.md
DRC9fe22da2014-04-16 23:30:38 +0000950 ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt
DRCa1647c82012-02-10 00:39:05 +0000951 ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt
952 ${CMAKE_SOURCE_DIR}/wizard.txt
DRC7284c9a2010-10-16 21:55:14 +0000953 DESTINATION doc)
DRCe2befde2010-10-17 07:28:08 +0000954
955install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h
956 ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h
DRC665c96e2015-05-15 22:08:21 +0000957 DESTINATION include)
Leon Scroggins IIIbd7903e2018-02-28 14:05:04 -0500958
959configure_file("${CMAKE_SOURCE_DIR}/cmakescripts/cmake_uninstall.cmake.in"
960 "cmake_uninstall.cmake" IMMEDIATE @ONLY)
961
962add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P cmake_uninstall.cmake)