blob: cf86b5790d4e21c8eb370b15fdf71030728d4f35 [file] [log] [blame]
DRC84697032010-10-15 03:43:24 +00001#
2# Setup
3#
4
5cmake_minimum_required(VERSION 2.6)
6
7project(libjpeg-turbo)
DRC3a606242010-10-18 08:27:04 +00008set(VERSION 1.0.90)
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)
14 execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmakescripts/getdate.bat"
15 OUTPUT_VARIABLE BUILD)
16 string(REGEX REPLACE "\n" "" BUILD ${BUILD})
17else()
DRC378da4d2010-10-15 19:11:11 +000018 message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
DRC84697032010-10-15 03:43:24 +000019endif()
20
21if(NOT CMAKE_BUILD_TYPE)
22 set(CMAKE_BUILD_TYPE Release)
23endif()
24
25message(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.
29if(CMAKE_BUILD_TYPE STREQUAL "Debug")
30 set(BUILD "${BUILD}d")
31endif()
32
DRCeb2b9d62010-10-15 04:55:13 +000033message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
34
DRC84697032010-10-15 03:43:24 +000035if(NOT DEFINED WITH_SIMD)
36 set(WITH_SIMD 1)
37endif()
38
DRC245cfdf2010-11-23 17:11:06 +000039if(NOT DEFINED WITH_ARITH_ENC)
40 set(WITH_ARITH_ENC 1)
41endif()
42
43if(NOT DEFINED WITH_ARITH_DEC)
44 set(WITH_ARITH_DEC 1)
45endif()
46
47if(WITH_ARITH_ENC)
48 set(C_ARITH_CODING_SUPPORTED 1)
49 message(STATUS "Arithmetic encoding enabled")
50else()
51 message(STATUS "Arithmetic encoding disabled")
52endif()
53
54if(WITH_ARITH_DEC)
55 set(D_ARITH_CODING_SUPPORTED 1)
56 message(STATUS "Arithmetic decoding enabled")
57else()
58 message(STATUS "Arithmetic decoding disabled")
59endif()
60
DRC84697032010-10-15 03:43:24 +000061set(JPEG_LIB_VERSION 62)
62set(DLL_VERSION ${JPEG_LIB_VERSION})
DRCa9d5b252010-10-15 06:42:45 +000063set(FULLVERSION ${DLL_VERSION}.0.0)
DRC84697032010-10-15 03:43:24 +000064if(WITH_JPEG8)
65 set(JPEG_LIB_VERSION 80)
66 set(DLL_VERSION 8)
DRCa9d5b252010-10-15 06:42:45 +000067 set(FULLVERSION ${DLL_VERSION}.0.2)
DRC84697032010-10-15 03:43:24 +000068 message(STATUS "Emulating libjpeg v8b API/ABI")
69elseif(WITH_JPEG7)
70 set(JPEG_LIB_VERSION 70)
71 set(DLL_VERSION 7)
DRCa9d5b252010-10-15 06:42:45 +000072 set(FULLVERSION ${DLL_VERSION}.0.0)
DRC84697032010-10-15 03:43:24 +000073 message(STATUS "Emulating libjpeg v7 API/ABI")
74endif(WITH_JPEG8)
75
76if(MSVC)
77 # Use the static C library for all build types
78 foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
79 CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
80 CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
81 CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
82 if(${var} MATCHES "/MD")
83 string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
84 endif()
85 endforeach()
86
87 add_definitions(-W3 -wd4996)
88endif()
89
90# Detect whether compiler is 64-bit
91if(MSVC AND CMAKE_CL_64)
92 set(SIMD_X86_64 1)
93 set(64BIT 1)
94elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
95 set(SIMD_X86_64 1)
96 set(64BIT 1)
97endif()
98
99if(64BIT)
100 message(STATUS "64-bit build")
101else()
102 message(STATUS "32-bit build")
103endif()
104
105configure_file(win/jconfig.h.in jconfig.h)
106configure_file(win/config.h.in config.h)
107
108include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
109
110
111#
112# Targets
113#
114
DRC245cfdf2010-11-23 17:11:06 +0000115set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
116 jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
117 jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
118 jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c
119 jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
120 jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
121 jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
122
123if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
124 set(JPEG_SOURCES ${JPEG_SOURCES} jaricom.c)
125endif()
126
127if(WITH_ARITH_ENC)
128 set(JPEG_SOURCES ${JPEG_SOURCES} jcarith.c)
129endif()
130
131if(WITH_ARITH_DEC)
132 set(JPEG_SOURCES ${JPEG_SOURCES} jdarith.c)
133endif()
DRC84697032010-10-15 03:43:24 +0000134
135if(WITH_SIMD)
136 add_definitions(-DWITH_SIMD)
137 add_subdirectory(simd)
138 if(SIMD_X86_64)
139 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c)
140 else()
141 set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c)
142 endif()
143 # This tells CMake that the "source" files haven't been generated yet
144 set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
145else()
146 set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c)
DRC6f4ba612010-10-16 21:27:38 +0000147 message(STATUS "Not using SIMD acceleration")
DRC84697032010-10-15 03:43:24 +0000148endif()
149
150add_subdirectory(sharedlib)
151
152add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
DRC84697032010-10-15 03:43:24 +0000153if(NOT MSVC)
154 set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
155endif()
156if(WITH_SIMD)
157 add_dependencies(jpeg-static simd)
158endif()
159
160add_library(turbojpeg SHARED turbojpegl.c)
161set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
162target_link_libraries(turbojpeg jpeg-static)
163set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "")
164
165add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}
166 turbojpegl.c)
DRC84697032010-10-15 03:43:24 +0000167if(NOT MSVC)
168 set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
169endif()
170if(WITH_SIMD)
171 add_dependencies(turbojpeg-static simd)
172endif()
173
174add_executable(jpegut jpegut.c)
175target_link_libraries(jpegut turbojpeg)
176
177add_executable(jpegut-static jpegut.c)
178target_link_libraries(jpegut-static turbojpeg-static)
179
180add_executable(jpgtest jpgtest.cxx bmp.c)
181target_link_libraries(jpgtest turbojpeg)
182
183add_executable(jpgtest-static jpgtest.cxx bmp.c)
184target_link_libraries(jpgtest-static turbojpeg-static)
185
186add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
187 rdtarga.c)
188set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS
189 "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
190target_link_libraries(cjpeg-static jpeg-static)
191
192add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c
193 wrppm.c wrtarga.c)
194set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS
195 "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED")
196target_link_libraries(djpeg-static jpeg-static)
197
198add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c)
199target_link_libraries(jpegtran-static jpeg-static)
200
201add_executable(rdjpgcom rdjpgcom.c)
202
203add_executable(wrjpgcom rdjpgcom.c)
204
205
206#
207# Tests
208#
209
210enable_testing()
211add_test(jpegut jpegut)
212add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
DRCb42a48c2010-10-18 01:06:36 +0000213add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
DRC84697032010-10-15 03:43:24 +0000214add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
DRCb42a48c2010-10-18 01:06:36 +0000215add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
DRC84697032010-10-15 03:43:24 +0000216add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
217if(WITH_SIMD)
DRCb42a48c2010-10-18 01:06:36 +0000218add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
DRC84697032010-10-15 03:43:24 +0000219else()
DRCb42a48c2010-10-18 01:06:36 +0000220add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg)
DRC84697032010-10-15 03:43:24 +0000221endif()
222add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000223add_test(djpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm)
DRC84697032010-10-15 03:43:24 +0000224add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000225add_test(djpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.ppm testoutfst.ppm)
DRC84697032010-10-15 03:43:24 +0000226add_test(djpeg-float sharedlib/djpeg -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
227if(WITH_SIMD)
DRCb42a48c2010-10-18 01:06:36 +0000228add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.ppm testoutflt.ppm)
DRC84697032010-10-15 03:43:24 +0000229else()
DRCb42a48c2010-10-18 01:06:36 +0000230add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm)
DRC84697032010-10-15 03:43:24 +0000231endif()
232add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000233add_test(djpeg-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp)
DRC84697032010-10-15 03:43:24 +0000234add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
DRCb42a48c2010-10-18 01:06:36 +0000235add_test(cjpeg-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgp.jpg testoutp.jpg)
DRC84697032010-10-15 03:43:24 +0000236add_test(jpegtran-prog sharedlib/jpegtran -outfile testoutt.jpg testoutp.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000237add_test(jpegtran-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg)
DRC245cfdf2010-11-23 17:11:06 +0000238if(WITH_ARITH_ENC)
DRC66f97e62010-11-23 05:49:54 +0000239add_test(cjpeg-ari sharedlib/cjpeg -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
240add_test(cjpeg-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testoutari.jpg)
DRC245cfdf2010-11-23 17:11:06 +0000241add_test(jpegtran-toari sharedlib/jpegtran -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgint.jpg)
242add_test(jpegtran-toari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testouta.jpg)
243endif()
244if(WITH_ARITH_DEC)
DRC66f97e62010-11-23 05:49:54 +0000245add_test(djpeg-ari sharedlib/djpeg -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimgari.jpg)
246add_test(djpeg-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.ppm testoutari.ppm)
DRC245cfdf2010-11-23 17:11:06 +0000247add_test(jpegtran-fromari sharedlib/jpegtran -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgari.jpg)
DRC66f97e62010-11-23 05:49:54 +0000248add_test(jpegtran-fromari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testouta.jpg)
DRC245cfdf2010-11-23 17:11:06 +0000249endif()
DRC84697032010-10-15 03:43:24 +0000250add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000251add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg)
DRC84697032010-10-15 03:43:24 +0000252
253add_test(jpegut-static jpegut-static)
254add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
DRCb42a48c2010-10-18 01:06:36 +0000255add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
DRC84697032010-10-15 03:43:24 +0000256add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
DRCb42a48c2010-10-18 01:06:36 +0000257add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg)
DRC84697032010-10-15 03:43:24 +0000258add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
259if(WITH_SIMD)
DRCb42a48c2010-10-18 01:06:36 +0000260add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg)
DRC84697032010-10-15 03:43:24 +0000261else()
DRCb42a48c2010-10-18 01:06:36 +0000262add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg)
DRC84697032010-10-15 03:43:24 +0000263endif()
264add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000265add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm)
DRC84697032010-10-15 03:43:24 +0000266add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000267add_test(djpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.ppm testoutfst.ppm)
DRC84697032010-10-15 03:43:24 +0000268add_test(djpeg-static-float djpeg-static -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
269if(WITH_SIMD)
DRCb42a48c2010-10-18 01:06:36 +0000270add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.ppm testoutflt.ppm)
DRC84697032010-10-15 03:43:24 +0000271else()
DRCb42a48c2010-10-18 01:06:36 +0000272add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm)
DRC84697032010-10-15 03:43:24 +0000273endif()
274add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000275add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp)
DRC84697032010-10-15 03:43:24 +0000276add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
DRCb42a48c2010-10-18 01:06:36 +0000277add_test(cjpeg-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgp.jpg testoutp.jpg)
DRC84697032010-10-15 03:43:24 +0000278add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000279add_test(jpegtran-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg)
DRC245cfdf2010-11-23 17:11:06 +0000280if(WITH_ARITH_ENC)
DRC66f97e62010-11-23 05:49:54 +0000281add_test(cjpeg-static-ari cjpeg-static -dct int -arithmetic -outfile testoutari.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
282add_test(cjpeg-static-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testoutari.jpg)
DRC245cfdf2010-11-23 17:11:06 +0000283add_test(jpegtran-static-toari jpegtran-static -arithmetic -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgint.jpg)
284add_test(jpegtran-static-toari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.jpg testouta.jpg)
285endif()
286if(WITH_ARITH_DEC)
DRC66f97e62010-11-23 05:49:54 +0000287add_test(djpeg-static-ari djpeg-static -dct int -fast -ppm -outfile testoutari.ppm ${CMAKE_SOURCE_DIR}/testimgari.jpg)
288add_test(djpeg-static-ari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgari.ppm testoutari.ppm)
DRC245cfdf2010-11-23 17:11:06 +0000289add_test(jpegtran-static-fromari jpegtran-static -outfile testouta.jpg ${CMAKE_SOURCE_DIR}/testimgari.jpg)
DRC66f97e62010-11-23 05:49:54 +0000290add_test(jpegtran-static-fromari-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testouta.jpg)
DRC245cfdf2010-11-23 17:11:06 +0000291endif()
DRC84697032010-10-15 03:43:24 +0000292add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg)
DRCb42a48c2010-10-18 01:06:36 +0000293add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg)
DRC2c0a4e12010-10-16 08:51:43 +0000294
295
296#
297# Installer
298#
299
300set(INST_NAME ${CMAKE_PROJECT_NAME})
301
302if(MSVC)
303 set(INST_PLATFORM "Visual C++")
304elseif(MINGW)
305 set(INST_PLATFORM GCC)
306 set(INST_NAME ${INST_NAME}-gcc)
307 set(INST_DEFS -DGCC)
308endif()
309
310if(64BIT)
311 set(INST_PLATFORM "${INST_PLATFORM} 64-bit")
312 set(INST_NAME ${INST_NAME}64)
313 set(INST_DEFS ${INST_DEFS} -DWIN64)
314endif()
315
316if(MSVC_IDE)
317 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=$(OutDir)\\")
318else()
319 set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=")
320endif()
321
322configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY)
323
324add_custom_target(installer
325 makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
326 DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static
327 SOURCES libjpeg-turbo.nsi)
DRC7284c9a2010-10-16 21:55:14 +0000328
329install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
330 ARCHIVE DESTINATION lib
331 LIBRARY DESTINATION lib
332 RUNTIME DESTINATION bin
333)
334
335install(FILES ${CMAKE_SOURCE_DIR}/LGPL.txt ${CMAKE_SOURCE_DIR}/LICENSE.txt
336 ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt
337 ${CMAKE_SOURCE_DIR}/libjpeg.txt ${CMAKE_SOURCE_DIR}/usage.txt
338 DESTINATION doc)
DRCe2befde2010-10-17 07:28:08 +0000339
340install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h
341 ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h
342 ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include)