blob: f88cf4fe66de875d643da8f20a639096f91e57d2 [file] [log] [blame]
DRC84697032010-10-15 03:43:24 +00001#
2# Setup
3#
4
DRCd45c5492014-03-11 06:21:46 +00005cmake_minimum_required(VERSION 2.8.8)
DRC84697032010-10-15 03:43:24 +00006
DRC5d6f8582011-02-18 23:08:58 +00007project(libjpeg-turbo C)
DRC17745dd2013-04-25 09:45:50 +00008set(VERSION 1.3.80)
DRC84697032010-10-15 03:43:24 +00009
DRC378da4d2010-10-15 19:11:11 +000010if(MINGW OR CYGWIN)
DRC84697032010-10-15 03:43:24 +000011 execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
12 string(REGEX REPLACE "\n" "" BUILD ${BUILD})
13elseif(WIN32)
DRC5e3bb3e2012-10-12 10:19:09 +000014 execute_process(COMMAND "wmic.exe" "os" "get" "LocalDateTime" OUTPUT_VARIABLE
15 BUILD)
16 string(REGEX REPLACE "[^0-9]" "" BUILD "${BUILD}")
17 if (BUILD STREQUAL "")
18 execute_process(COMMAND "cmd.exe" "/C" "DATE" "/T" OUTPUT_VARIABLE BUILD)
19 string(REGEX REPLACE ".*[ ]([0-9]*)[/.]([0-9]*)[/.]([0-9]*).*" "\\3\\2\\1" BUILD "${BUILD}")
20 else()
21 string(SUBSTRING "${BUILD}" 0 8 BUILD)
22 endif()
DRC84697032010-10-15 03:43:24 +000023else()
DRC378da4d2010-10-15 19:11:11 +000024 message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
DRC84697032010-10-15 03:43:24 +000025endif()
26
DRC2ffcb8e2011-04-04 04:56:24 +000027# This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning
28# in Visual Studio, and it always defaults to Debug when using NMake.
DRC84697032010-10-15 03:43:24 +000029if(NOT CMAKE_BUILD_TYPE)
30 set(CMAKE_BUILD_TYPE Release)
31endif()
32
33message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
34
35# This only works if building from the command line. There is currently no way
DRC2ffcb8e2011-04-04 04:56:24 +000036# to set a variable's value based on the build type when using Visual Studio.
DRC84697032010-10-15 03:43:24 +000037if(CMAKE_BUILD_TYPE STREQUAL "Debug")
38 set(BUILD "${BUILD}d")
39endif()
40
DRCeb2b9d62010-10-15 04:55:13 +000041message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
42
DRCddcd5a12011-04-15 00:24:02 +000043option(WITH_SIMD "Include SIMD extensions" TRUE)
44option(WITH_ARITH_ENC "Include arithmetic encoding support" TRUE)
45option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE)
46option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
47option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
DRCab706232013-01-18 23:42:31 +000048option(WITH_MEM_SRCDST "Include in-memory source/destination manager functions when emulating the libjpeg v6b or v7 API/ABI" TRUE)
DRC5039d732013-01-21 23:42:12 +000049option(WITH_JAVA "Build Java wrapper for the TurboJPEG library" FALSE)
DRC245cfdf2010-11-23 17:11:06 +000050
51if(WITH_ARITH_ENC)
52 set(C_ARITH_CODING_SUPPORTED 1)
DRC990e28d2011-01-04 21:40:11 +000053 message(STATUS "Arithmetic encoding support enabled")
DRC245cfdf2010-11-23 17:11:06 +000054else()
DRC990e28d2011-01-04 21:40:11 +000055 message(STATUS "Arithmetic encoding support disabled")
DRC245cfdf2010-11-23 17:11:06 +000056endif()
57
58if(WITH_ARITH_DEC)
59 set(D_ARITH_CODING_SUPPORTED 1)
DRC990e28d2011-01-04 21:40:11 +000060 message(STATUS "Arithmetic decoding support enabled")
DRC245cfdf2010-11-23 17:11:06 +000061else()
DRC990e28d2011-01-04 21:40:11 +000062 message(STATUS "Arithmetic decoding support disabled")
DRC245cfdf2010-11-23 17:11:06 +000063endif()
64
DRC957d6232011-04-01 11:13:11 +000065if(WITH_JAVA)
DRC5039d732013-01-21 23:42:12 +000066 message(STATUS "TurboJPEG Java wrapper enabled")
DRC218c0c12011-02-05 06:01:18 +000067else()
DRC5039d732013-01-21 23:42:12 +000068 message(STATUS "TurboJPEG Java wrapper disabled")
DRC218c0c12011-02-05 06:01:18 +000069endif()
70
DRCab706232013-01-18 23:42:31 +000071set(SO_AGE 0)
72if(WITH_MEM_SRCDST)
73 set(SO_AGE 1)
74endif()
75
DRC84697032010-10-15 03:43:24 +000076set(JPEG_LIB_VERSION 62)
77set(DLL_VERSION ${JPEG_LIB_VERSION})
DRCab706232013-01-18 23:42:31 +000078set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0)
DRC84697032010-10-15 03:43:24 +000079if(WITH_JPEG8)
80 set(JPEG_LIB_VERSION 80)
81 set(DLL_VERSION 8)
DRCa9d5b252010-10-15 06:42:45 +000082 set(FULLVERSION ${DLL_VERSION}.0.2)
DRCf38eee02011-02-18 07:00:38 +000083 message(STATUS "Emulating libjpeg v8 API/ABI")
DRC84697032010-10-15 03:43:24 +000084elseif(WITH_JPEG7)
85 set(JPEG_LIB_VERSION 70)
86 set(DLL_VERSION 7)
DRCab706232013-01-18 23:42:31 +000087 set(FULLVERSION ${DLL_VERSION}.${SO_AGE}.0)
DRC84697032010-10-15 03:43:24 +000088 message(STATUS "Emulating libjpeg v7 API/ABI")
89endif(WITH_JPEG8)
90
DRCab706232013-01-18 23:42:31 +000091if(WITH_MEM_SRCDST)
92 set(MEM_SRCDST_SUPPORTED 1)
93 message(STATUS "In-memory source/destination managers enabled")
94else()
95 message(STATUS "In-memory source/destination managers disabled")
96endif()
97
DRC84697032010-10-15 03:43:24 +000098if(MSVC)
99 # Use the static C library for all build types
100 foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
DRC2e4d0442011-02-08 01:18:37 +0000101 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
DRC84697032010-10-15 03:43:24 +0000102 if(${var} MATCHES "/MD")
103 string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
104 endif()
105 endforeach()
106
107 add_definitions(-W3 -wd4996)
108endif()
109
110# Detect whether compiler is 64-bit
111if(MSVC AND CMAKE_CL_64)
112 set(SIMD_X86_64 1)
113 set(64BIT 1)
114elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
115 set(SIMD_X86_64 1)
116 set(64BIT 1)
117endif()
118
119if(64BIT)
120 message(STATUS "64-bit build")
121else()
122 message(STATUS "32-bit build")
123endif()
124
DRC7175e512013-04-23 22:29:00 +0000125if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
126 if(MSVC)
127 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME})
128 else()
129 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_PROJECT_NAME}-gcc)
130 endif()
131 if(64BIT)
132 set(CMAKE_INSTALL_PREFIX_DEFAULT ${CMAKE_INSTALL_PREFIX_DEFAULT}64)
133 endif()
134 set(CMAKE_INSTALL_PREFIX "c:/${CMAKE_INSTALL_PREFIX_DEFAULT}" CACHE PATH
135 "Directory into which to install libjpeg-turbo (default: c:/${CMAKE_INSTALL_PREFIX_DEFAULT})"
136 FORCE)
137endif()
138
139message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}")
140
DRC84697032010-10-15 03:43:24 +0000141configure_file(win/jconfig.h.in jconfig.h)
142configure_file(win/config.h.in config.h)
143
144include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
145
DRC957d6232011-04-01 11:13:11 +0000146if(WITH_JAVA)
147 find_package(Java)
148 find_package(JNI)
DRCdb425062011-04-03 06:10:18 +0000149 if(DEFINED JAVACFLAGS)
150 message(STATUS "Java compiler flags = ${JAVACFLAGS}")
151 endif()
DRC218c0c12011-02-05 06:01:18 +0000152endif()
153
DRC84697032010-10-15 03:43:24 +0000154
155#
156# Targets
157#
158
DRC245cfdf2010-11-23 17:11:06 +0000159set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
160 jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
161 jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
162 jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c
163 jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
164 jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
165 jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
166
167if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
168 set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
169endif()
170
171if(WITH_ARITH_ENC)
172 set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c)
173endif()
174
175if(WITH_ARITH_DEC)
176 set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c)
177endif()
DRC84697032010-10-15 03:43:24 +0000178
179if(WITH_SIMD)
180 add_definitions(-DWITH_SIMD)
181 add_subdirectory(simd)
182 if(SIMD_X86_64)
183 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c)
184 else()
185 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c)
186 endif()
187 # This tells CMake that the "source" files haven't been generated yet
188 set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
189else()
190 set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c)
DRC6f4ba612010-10-16 21:27:38 +0000191 message(STATUS "Not using SIMD acceleration")
DRC84697032010-10-15 03:43:24 +0000192endif()
193
DRC957d6232011-04-01 11:13:11 +0000194if(WITH_JAVA)
195 add_subdirectory(java)
196endif()
197
DRC84697032010-10-15 03:43:24 +0000198add_subdirectory(sharedlib)
199
200add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
DRC84697032010-10-15 03:43:24 +0000201if(NOT MSVC)
202 set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
203endif()
204if(WITH_SIMD)
205 add_dependencies(jpeg-static simd)
206endif()
207
DRC418dbdf2011-05-26 10:45:06 +0000208set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
DRC957d6232011-04-01 11:13:11 +0000209if(WITH_JAVA)
DRC218c0c12011-02-05 06:01:18 +0000210 set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
DRC957d6232011-04-01 11:13:11 +0000211 include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
DRC218c0c12011-02-05 06:01:18 +0000212endif()
213
214add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES})
DRC84697032010-10-15 03:43:24 +0000215set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
DRC389c4722011-02-06 18:48:13 +0000216if(MINGW)
217 set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at)
218endif()
DRC84697032010-10-15 03:43:24 +0000219target_link_libraries(turbojpeg jpeg-static)
220set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "")
221
222add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}
DRC418dbdf2011-05-26 10:45:06 +0000223 turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
DRC84697032010-10-15 03:43:24 +0000224if(NOT MSVC)
225 set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
226endif()
227if(WITH_SIMD)
228 add_dependencies(turbojpeg-static simd)
229endif()
230
DRC3185cb92011-05-25 03:52:22 +0000231add_executable(tjunittest tjunittest.c tjutil.c)
232target_link_libraries(tjunittest turbojpeg)
DRC84697032010-10-15 03:43:24 +0000233
DRC3185cb92011-05-25 03:52:22 +0000234add_executable(tjunittest-static tjunittest.c tjutil.c)
235target_link_libraries(tjunittest-static turbojpeg-static)
DRC84697032010-10-15 03:43:24 +0000236
DRC3185cb92011-05-25 03:52:22 +0000237add_executable(tjbench tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
DRC43484642011-05-24 17:03:51 +0000238 wrppm.c)
DRC4ad60032011-09-20 05:41:54 +0000239target_link_libraries(tjbench turbojpeg jpeg-static)
DRC3185cb92011-05-25 03:52:22 +0000240set_property(TARGET tjbench PROPERTY COMPILE_FLAGS
DRC43484642011-05-24 17:03:51 +0000241 "-DBMP_SUPPORTED -DPPM_SUPPORTED")
DRC84697032010-10-15 03:43:24 +0000242
DRC3185cb92011-05-25 03:52:22 +0000243add_executable(tjbench-static tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c
DRC43484642011-05-24 17:03:51 +0000244 wrppm.c)
DRC3185cb92011-05-25 03:52:22 +0000245target_link_libraries(tjbench-static turbojpeg-static jpeg-static)
246set_property(TARGET tjbench-static PROPERTY COMPILE_FLAGS
DRC43484642011-05-24 17:03:51 +0000247 "-DBMP_SUPPORTED -DPPM_SUPPORTED")
DRC84697032010-10-15 03:43:24 +0000248
249add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
250 rdtarga.c)
251set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS
DRC5ee81f42011-05-02 00:35:50 +0000252 "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
DRC84697032010-10-15 03:43:24 +0000253target_link_libraries(cjpeg-static jpeg-static)
254
255add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c
256 wrppm.c wrtarga.c)
257set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS
DRC5ee81f42011-05-02 00:35:50 +0000258 "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED -DUSE_SETMODE")
DRC84697032010-10-15 03:43:24 +0000259target_link_libraries(djpeg-static jpeg-static)
260
261add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
262target_link_libraries(jpegtran-static jpeg-static)
DRC7e3fd2f2011-05-25 06:04:43 +0000263set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "-DUSE_SETMODE")
DRC84697032010-10-15 03:43:24 +0000264
265add_executable(rdjpgcom rdjpgcom.c)
266
267add_executable(wrjpgcom rdjpgcom.c)
268
269
270#
271# Tests
272#
273
DRC957d6232011-04-01 11:13:11 +0000274if(MSVC_IDE)
275 set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/")
276else()
277 set(OBJDIR "")
278endif()
279
DRC84697032010-10-15 03:43:24 +0000280enable_testing()
DRC211d1e72013-01-13 11:25:20 +0000281
282set(MD5_JPEG_INT 9a68f56bc76e466aa7e52f415d0f4a5f)
283set(MD5_JPEG_FAST 0e1502e7fa421835e376a314fac2a39f)
284set(MD5_JPEG_FAST_100 7bf72a8e741d64eecb960c97323af77c)
285set(MD5_JPEG_FLOAT d1623885ffafcd40c684af09e3d65cd5)
286set(MD5_JPEG_FLOAT_NOSIMD fb4884c35f8273f498cb32879de5c455)
287set(MD5_JPEG_INT_GRAY 72b51f894b8f4a10b3ee3066770aa38d)
288set(MD5_PPM_INT d1ed0d11f076b842525271647716aeb8)
289set(MD5_PPM_FAST 048298a2d2410261c0533cb97bcfef23)
290set(MD5_PPM_FLOAT 7f5b446ee36b2630e06785b8d42af15f)
291set(MD5_PPM_FLOAT_NOSIMD 64072f1dbdc5b3a187777788604971a5)
292set(MD5_PPM_INT_2_1 9f9de8c0612f8d06869b960b05abf9c9)
293set(MD5_PPM_INT_15_8 b6875bc070720b899566cc06459b63b7)
294set(MD5_PPM_INT_7_4 06a177eae05f164fac57f7a2c346ee87)
295set(MD5_PPM_INT_13_8 bc3452573c8152f6ae552939ee19f82f)
296set(MD5_PPM_INT_3_2 f5a8b88a8a7f96016f04d259cf82ed67)
297set(MD5_PPM_INT_11_8 d8cc73c0aaacd4556569b59437ba00a5)
298set(MD5_PPM_INT_5_4 32775dd9ad2ab90f4c5b219b53e0c86c)
299set(MD5_PPM_INT_9_8 d25e61bc7eac0002f5b393aa223747b6)
300set(MD5_PPM_INT_7_8 ddb564b7c74a09494016d6cd7502a946)
301set(MD5_PPM_INT_3_4 8ed8e68808c3fbc4ea764fc9d2968646)
302set(MD5_PPM_INT_5_8 a3363274999da2366a024efae6d16c9b)
303set(MD5_PPM_INT_1_2 e692a315cea26b988c8e8b29a5dbcd81)
304set(MD5_PPM_INT_3_8 79eca9175652ced755155c90e785a996)
305set(MD5_PPM_INT_1_4 79cd778f8bf1a117690052cacdd54eca)
306set(MD5_PPM_INT_1_8 391b3d4aca640c8567d6f8745eb2142f)
307set(MD5_PPM_FAST_1_2 f30bcf6d32ccd44cbdd9aeaacbd9454f)
308set(MD5_BMP_256 4980185e3776e89bd931736e1cddeee6)
309set(MD5_JPEG_ARI e986fb0a637a8d833d96e8a6d6d84ea1)
310set(MD5_PPM_ARI 72b59a99bcf1de24c5b27d151bde2437)
311set(MD5_JPEG_PROG 1c4afddc05c0a43489ee54438a482d92)
DRC4b509282013-11-06 06:55:28 +0000312set(MD5_JPEG_PROG_ARI 0a8f1c8f66e113c3cf635df0a475a617)
DRC211d1e72013-01-13 11:25:20 +0000313set(MD5_JPEG_CROP b4197f377e621c4e9b1d20471432610d)
314
DRC957d6232011-04-01 11:13:11 +0000315if(WITH_JAVA)
316add_test(TJUnitTest ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest)
317add_test(TJUnitTest-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv)
DRCfef98522013-04-28 01:32:52 +0000318add_test(TJUnitTest-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv -noyuvpad)
DRC957d6232011-04-01 11:13:11 +0000319add_test(TJUnitTest-bi ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi)
320add_test(TJUnitTest-bi-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv)
DRCfef98522013-04-28 01:32:52 +0000321add_test(TJUnitTest-bi-yuv-nopad ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv -noyuvpad)
DRC957d6232011-04-01 11:13:11 +0000322endif()
DRC3185cb92011-05-25 03:52:22 +0000323add_test(tjunittest tjunittest)
324add_test(tjunittest-alloc tjunittest -alloc)
325add_test(tjunittest-yuv tjunittest -yuv)
DRCfaa868b2013-10-31 05:02:20 +0000326add_test(tjunittest-yuv-alloc tjunittest -yuv -alloc)
DRCf610d612013-04-26 10:33:29 +0000327add_test(tjunittest-yuv-nopad tjunittest -yuv -noyuvpad)
DRC7ab03642012-01-31 05:47:07 +0000328add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000329add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutint.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000330add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000331add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST} -DFILE=testoutfst.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000332add_test(cjpeg-fast-100 sharedlib/cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000333add_test(cjpeg-fast-100-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST_100} -DFILE=testoutfst100.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000334add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC84697032010-10-15 03:43:24 +0000335if(WITH_SIMD)
DRC211d1e72013-01-13 11:25:20 +0000336add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000337else()
DRC211d1e72013-01-13 11:25:20 +0000338add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT_NOSIMD} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000339endif()
DRC7ab03642012-01-31 05:47:07 +0000340add_test(cjpeg-int-gray sharedlib/cjpeg -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000341add_test(cjpeg-int-gray-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT_GRAY} -DFILE=testoutgray.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000342add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000343add_test(djpeg-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT} -DFILE=testoutint.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000344add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000345add_test(djpeg-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST} -DFILE=testoutfst.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000346add_test(djpeg-float sharedlib/djpeg -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC84697032010-10-15 03:43:24 +0000347if(WITH_SIMD)
DRC211d1e72013-01-13 11:25:20 +0000348add_test(djpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000349else()
DRC211d1e72013-01-13 11:25:20 +0000350add_test(djpeg-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT_NOSIMD} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000351endif()
DRC0af8d672012-01-31 11:09:11 +0000352foreach(scale 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8)
353string(REGEX REPLACE "_" "/" scalearg ${scale})
DRCcf775bf2012-02-01 02:49:10 +0000354add_test(djpeg-int-${scale} sharedlib/djpeg -dct int -nosmooth -scale ${scalearg} -ppm -outfile testoutint${scale}.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000355add_test(djpeg-int-${scale}-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT_${scale}} -DFILE=testoutint${scale}.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC0af8d672012-01-31 11:09:11 +0000356endforeach()
DRC7ab03642012-01-31 05:47:07 +0000357add_test(djpeg-fast-1_2 sharedlib/djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000358add_test(djpeg-fast-1_2-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST_1_2} -DFILE=testoutfst1_2.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000359add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000360add_test(djpeg-256-cmp ${CMAKE_COMMAND} -DMD5=${MD5_BMP_256} -DFILE=testout.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000361add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000362add_test(cjpeg-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG} -DFILE=testoutp.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000363add_test(jpegtran-prog sharedlib/jpegtran -outfile testoutt.jpg testoutp.jpg)
DRC211d1e72013-01-13 11:25:20 +0000364add_test(jpegtran-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC245cfdf2010-11-23 17:11:06 +0000365if(WITH_ARITH_ENC)
DRC7ab03642012-01-31 05:47:07 +0000366add_test(cjpeg-ari sharedlib/cjpeg -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000367add_test(cjpeg-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testoutari.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake )
DRC7ab03642012-01-31 05:47:07 +0000368add_test(jpegtran-toari sharedlib/jpegtran -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg)
DRC211d1e72013-01-13 11:25:20 +0000369add_test(jpegtran-toari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC4b509282013-11-06 06:55:28 +0000370add_test(cjpeg-prog-ari sharedlib/cjpeg -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
371add_test(cjpeg-prog-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG_ARI} -DFILE=testoutpa.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake )
DRC245cfdf2010-11-23 17:11:06 +0000372endif()
373if(WITH_ARITH_DEC)
DRC7ab03642012-01-31 05:47:07 +0000374add_test(djpeg-ari sharedlib/djpeg -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
DRC211d1e72013-01-13 11:25:20 +0000375add_test(djpeg-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_ARI} -DFILE=testoutari.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000376add_test(jpegtran-fromari sharedlib/jpegtran -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
DRC211d1e72013-01-13 11:25:20 +0000377add_test(jpegtran-fromari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC245cfdf2010-11-23 17:11:06 +0000378endif()
DRC7ab03642012-01-31 05:47:07 +0000379add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000380add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testoutcrop.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000381
DRC3185cb92011-05-25 03:52:22 +0000382add_test(tjunittest-static tjunittest-static)
383add_test(tjunittest-static-alloc tjunittest-static -alloc)
384add_test(tjunittest-static-yuv tjunittest-static -yuv)
DRCfaa868b2013-10-31 05:02:20 +0000385add_test(tjunittest-static-yuv-alloc tjunittest-static -yuv -alloc)
DRCf610d612013-04-26 10:33:29 +0000386add_test(tjunittest-static-yuv-nopad tjunittest-static -yuv -noyuvpad)
DRC7ab03642012-01-31 05:47:07 +0000387add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000388add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutint.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000389add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000390add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST} -DFILE=testoutfst.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000391add_test(cjpeg-static-fast-100 cjpeg-static -dct fast -quality 100 -opt -outfile testoutfst100.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000392add_test(cjpeg-static-fast-100-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FAST_100} -DFILE=testoutfst100.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000393add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC84697032010-10-15 03:43:24 +0000394if(WITH_SIMD)
DRC211d1e72013-01-13 11:25:20 +0000395add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000396else()
DRC211d1e72013-01-13 11:25:20 +0000397add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_FLOAT_NOSIMD} -DFILE=testoutflt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000398endif()
DRC7ab03642012-01-31 05:47:07 +0000399add_test(cjpeg-static-int-gray cjpeg-static -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000400add_test(cjpeg-static-int-gray-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT_GRAY} -DFILE=testoutgray.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000401add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000402add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT} -DFILE=testoutint.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000403add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000404add_test(djpeg-static-fast-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST} -DFILE=testoutfst.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000405add_test(djpeg-static-float djpeg-static -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC84697032010-10-15 03:43:24 +0000406if(WITH_SIMD)
DRC211d1e72013-01-13 11:25:20 +0000407add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000408else()
DRC211d1e72013-01-13 11:25:20 +0000409add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FLOAT_NOSIMD} -DFILE=testoutflt.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000410endif()
DRC0af8d672012-01-31 11:09:11 +0000411foreach(scale 2_1 15_8 7_4 13_8 3_2 11_8 5_4 9_8 7_8 3_4 5_8 1_2 3_8 1_4 1_8)
412string(REGEX REPLACE "_" "/" scalearg ${scale})
DRCcf775bf2012-02-01 02:49:10 +0000413add_test(djpeg-static-int-${scale} djpeg-static -dct int -nosmooth -scale ${scalearg} -ppm -outfile testoutint${scale}.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000414add_test(djpeg-static-int-${scale}-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_INT_${scale}} -DFILE=testoutint${scale}.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC0af8d672012-01-31 11:09:11 +0000415endforeach()
DRC7ab03642012-01-31 05:47:07 +0000416add_test(djpeg-static-fast-1_2 djpeg-static -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000417add_test(djpeg-static-fast-1_2-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_FAST_1_2} -DFILE=testoutfst1_2.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000418add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000419add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -DMD5=${MD5_BMP_256} -DFILE=testout.bmp -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000420add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000421add_test(cjpeg-static-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG} -DFILE=testoutp.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC84697032010-10-15 03:43:24 +0000422add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg)
DRC211d1e72013-01-13 11:25:20 +0000423add_test(jpegtran-static-prog-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testoutt.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC245cfdf2010-11-23 17:11:06 +0000424if(WITH_ARITH_ENC)
DRC7ab03642012-01-31 05:47:07 +0000425add_test(cjpeg-static-ari cjpeg-static -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
DRC211d1e72013-01-13 11:25:20 +0000426add_test(cjpeg-static-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testoutari.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake )
DRC7ab03642012-01-31 05:47:07 +0000427add_test(jpegtran-static-toari jpegtran-static -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgint.jpg)
DRC211d1e72013-01-13 11:25:20 +0000428add_test(jpegtran-static-toari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_ARI} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC4b509282013-11-06 06:55:28 +0000429add_test(cjpeg-static-prog-ari cjpeg-static -dct int -progressive -arithmetic -sample 1x1 -outfile testoutpa.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.ppm)
430add_test(cjpeg-static-prog-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_PROG_ARI} -DFILE=testoutpa.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake )
DRC245cfdf2010-11-23 17:11:06 +0000431endif()
432if(WITH_ARITH_DEC)
DRC7ab03642012-01-31 05:47:07 +0000433add_test(djpeg-static-ari djpeg-static -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
DRC211d1e72013-01-13 11:25:20 +0000434add_test(djpeg-static-ari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_PPM_ARI} -DFILE=testoutari.ppm -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC7ab03642012-01-31 05:47:07 +0000435add_test(jpegtran-static-fromari jpegtran-static -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimages/testimgari.jpg)
DRC211d1e72013-01-13 11:25:20 +0000436add_test(jpegtran-static-fromari-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_INT} -DFILE=testouta.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC245cfdf2010-11-23 17:11:06 +0000437endif()
DRC7ab03642012-01-31 05:47:07 +0000438add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testimages/testorig.jpg)
DRC211d1e72013-01-13 11:25:20 +0000439add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -DMD5=${MD5_JPEG_CROP} -DFILE=testoutcrop.jpg -P ${CMAKE_SOURCE_DIR}/cmakescripts/md5cmp.cmake)
DRC2c0a4e12010-10-16 08:51:43 +0000440
DRCa0f878a2011-04-02 04:43:14 +0000441add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P
442 ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake)
443
DRC2c0a4e12010-10-16 08:51:43 +0000444
445#
446# Installer
447#
448
DRC2c0a4e12010-10-16 08:51:43 +0000449if(MSVC)
450 set(INST_PLATFORM "Visual C++")
DRCb94f2de2011-03-22 09:31:25 +0000451 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-vc)
DRC7175e512013-04-23 22:29:00 +0000452 set(INST_REG_NAME ${CMAKE_PROJECT_NAME})
DRC2c0a4e12010-10-16 08:51:43 +0000453elseif(MINGW)
454 set(INST_PLATFORM GCC)
DRCb94f2de2011-03-22 09:31:25 +0000455 set(INST_NAME ${CMAKE_PROJECT_NAME}-${VERSION}-gcc)
DRC7175e512013-04-23 22:29:00 +0000456 set(INST_REG_NAME ${CMAKE_PROJECT_NAME}-gcc)
DRC2c0a4e12010-10-16 08:51:43 +0000457 set(INST_DEFS -DGCC)
458endif()
459
460if(64BIT)
461 set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
462 set(INST_NAME ${INST_NAME}64)
DRC7175e512013-04-23 22:29:00 +0000463 set(INST_REG_NAME ${INST_DIR}64)
DRC2c0a4e12010-10-16 08:51:43 +0000464 set(INST_DEFS ${INST_DEFS} -DWIN64)
465endif()
466
DRC957d6232011-04-01 11:13:11 +0000467if(WITH_JAVA)
468 set(INST_DEFS ${INST_DEFS} -DJAVA)
469endif()
470
DRC2c0a4e12010-10-16 08:51:43 +0000471if(MSVC_IDE)
DRC926e01f2011-04-06 06:35:38 +0000472 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
DRC2c0a4e12010-10-16 08:51:43 +0000473else()
474 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
475endif()
476
DRC7175e512013-04-23 22:29:00 +0000477STRING(REGEX REPLACE "/" "\\\\" INST_DIR ${CMAKE_INSTALL_PREFIX})
478
DRC2c0a4e12010-10-16 08:51:43 +0000479configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
480
DRC7175e512013-04-23 22:29:00 +0000481if(WITH_JAVA)
482 set(JAVA_DEPEND java)
483endif()
DRC2c0a4e12010-10-16 08:51:43 +0000484add_custom_target(installer
485 makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
DRCb94f2de2011-03-22 09:31:25 +0000486 DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
DRC7175e512013-04-23 22:29:00 +0000487 cjpeg djpeg jpegtran tjbench ${JAVA_DEPEND}
DRC2c0a4e12010-10-16 08:51:43 +0000488 SOURCES libjpeg-turbo.nsi)
DRC7284c9a2010-10-16 21:55:14 +0000489
DRC3185cb92011-05-25 03:52:22 +0000490install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench
DRC7284c9a2010-10-16 21:55:14 +0000491 ARCHIVE DESTINATION lib
492 LIBRARY DESTINATION lib
493 RUNTIME DESTINATION bin
494)
495
DRCa1647c82012-02-10 00:39:05 +0000496install(FILES ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt
497 ${CMAKE_SOURCE_DIR}/example.c ${CMAKE_SOURCE_DIR}/libjpeg.txt
498 ${CMAKE_SOURCE_DIR}/structure.txt ${CMAKE_SOURCE_DIR}/usage.txt
499 ${CMAKE_SOURCE_DIR}/wizard.txt
DRC7284c9a2010-10-16 21:55:14 +0000500 DESTINATION doc)
DRCe2befde2010-10-17 07:28:08 +0000501
502install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h
503 ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h
504 ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include)