DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 1 | # |
| 2 | # Setup |
| 3 | # |
| 4 | |
| 5 | cmake_minimum_required(VERSION 2.6) |
| 6 | |
| 7 | project(libjpeg-turbo) |
| 8 | set(VERSION 1.0.80) |
| 9 | |
DRC | 378da4d | 2010-10-15 19:11:11 +0000 | [diff] [blame] | 10 | if(MINGW OR CYGWIN) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 11 | execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) |
| 12 | string(REGEX REPLACE "\n" "" BUILD ${BUILD}) |
| 13 | elseif(WIN32) |
| 14 | execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmakescripts/getdate.bat" |
| 15 | OUTPUT_VARIABLE BUILD) |
| 16 | string(REGEX REPLACE "\n" "" BUILD ${BUILD}) |
| 17 | else() |
DRC | 378da4d | 2010-10-15 19:11:11 +0000 | [diff] [blame] | 18 | message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 19 | endif() |
| 20 | |
| 21 | if(NOT CMAKE_BUILD_TYPE) |
| 22 | set(CMAKE_BUILD_TYPE Release) |
| 23 | endif() |
| 24 | |
| 25 | message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") |
| 26 | |
| 27 | # This only works if building from the command line. There is currently no way |
| 28 | # to set a variable's value based on the build type when using the MSVC IDE. |
| 29 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 30 | set(BUILD "${BUILD}d") |
| 31 | endif() |
| 32 | |
DRC | eb2b9d6 | 2010-10-15 04:55:13 +0000 | [diff] [blame] | 33 | message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") |
| 34 | |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 35 | if(NOT DEFINED WITH_SIMD) |
| 36 | set(WITH_SIMD 1) |
| 37 | endif() |
| 38 | |
| 39 | set(JPEG_LIB_VERSION 62) |
| 40 | set(DLL_VERSION ${JPEG_LIB_VERSION}) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 41 | set(FULLVERSION ${DLL_VERSION}.0.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 42 | if(WITH_JPEG8) |
| 43 | set(JPEG_LIB_VERSION 80) |
| 44 | set(DLL_VERSION 8) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 45 | set(FULLVERSION ${DLL_VERSION}.0.2) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 46 | message(STATUS "Emulating libjpeg v8b API/ABI") |
| 47 | elseif(WITH_JPEG7) |
| 48 | set(JPEG_LIB_VERSION 70) |
| 49 | set(DLL_VERSION 7) |
DRC | a9d5b25 | 2010-10-15 06:42:45 +0000 | [diff] [blame] | 50 | set(FULLVERSION ${DLL_VERSION}.0.0) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 51 | message(STATUS "Emulating libjpeg v7 API/ABI") |
| 52 | endif(WITH_JPEG8) |
| 53 | |
| 54 | if(MSVC) |
| 55 | # Use the static C library for all build types |
| 56 | foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
| 57 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO |
| 58 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE |
| 59 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
| 60 | if(${var} MATCHES "/MD") |
| 61 | string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") |
| 62 | endif() |
| 63 | endforeach() |
| 64 | |
| 65 | add_definitions(-W3 -wd4996) |
| 66 | endif() |
| 67 | |
| 68 | # Detect whether compiler is 64-bit |
| 69 | if(MSVC AND CMAKE_CL_64) |
| 70 | set(SIMD_X86_64 1) |
| 71 | set(64BIT 1) |
| 72 | elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) |
| 73 | set(SIMD_X86_64 1) |
| 74 | set(64BIT 1) |
| 75 | endif() |
| 76 | |
| 77 | if(64BIT) |
| 78 | message(STATUS "64-bit build") |
| 79 | else() |
| 80 | message(STATUS "32-bit build") |
| 81 | endif() |
| 82 | |
| 83 | configure_file(win/jconfig.h.in jconfig.h) |
| 84 | configure_file(win/config.h.in config.h) |
| 85 | |
| 86 | include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) |
| 87 | |
| 88 | |
| 89 | # |
| 90 | # Targets |
| 91 | # |
| 92 | |
| 93 | set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c |
| 94 | jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c |
| 95 | jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c |
| 96 | jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c |
| 97 | jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c |
| 98 | jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c |
| 99 | jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) |
| 100 | |
| 101 | if(WITH_SIMD) |
| 102 | add_definitions(-DWITH_SIMD) |
| 103 | add_subdirectory(simd) |
| 104 | if(SIMD_X86_64) |
| 105 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_x86_64.c) |
| 106 | else() |
| 107 | set(JPEG_SOURCES ${JPEG_SOURCES} simd/jsimd_i386.c) |
| 108 | endif() |
| 109 | # This tells CMake that the "source" files haven't been generated yet |
| 110 | set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1) |
| 111 | else() |
| 112 | set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c) |
DRC | 6f4ba61 | 2010-10-16 21:27:38 +0000 | [diff] [blame] | 113 | message(STATUS "Not using SIMD acceleration") |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 114 | endif() |
| 115 | |
| 116 | add_subdirectory(sharedlib) |
| 117 | |
| 118 | add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 119 | if(NOT MSVC) |
| 120 | set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg) |
| 121 | endif() |
| 122 | if(WITH_SIMD) |
| 123 | add_dependencies(jpeg-static simd) |
| 124 | endif() |
| 125 | |
| 126 | add_library(turbojpeg SHARED turbojpegl.c) |
| 127 | set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE) |
| 128 | target_link_libraries(turbojpeg jpeg-static) |
| 129 | set_target_properties(turbojpeg PROPERTIES LINK_INTERFACE_LIBRARIES "") |
| 130 | |
| 131 | add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS} |
| 132 | turbojpegl.c) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 133 | if(NOT MSVC) |
| 134 | set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg) |
| 135 | endif() |
| 136 | if(WITH_SIMD) |
| 137 | add_dependencies(turbojpeg-static simd) |
| 138 | endif() |
| 139 | |
| 140 | add_executable(jpegut jpegut.c) |
| 141 | target_link_libraries(jpegut turbojpeg) |
| 142 | |
| 143 | add_executable(jpegut-static jpegut.c) |
| 144 | target_link_libraries(jpegut-static turbojpeg-static) |
| 145 | |
| 146 | add_executable(jpgtest jpgtest.cxx bmp.c) |
| 147 | target_link_libraries(jpgtest turbojpeg) |
| 148 | |
| 149 | add_executable(jpgtest-static jpgtest.cxx bmp.c) |
| 150 | target_link_libraries(jpgtest-static turbojpeg-static) |
| 151 | |
| 152 | add_executable(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c |
| 153 | rdtarga.c) |
| 154 | set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS |
| 155 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED") |
| 156 | target_link_libraries(cjpeg-static jpeg-static) |
| 157 | |
| 158 | add_executable(djpeg-static djpeg.c cdjpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c |
| 159 | wrppm.c wrtarga.c) |
| 160 | set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS |
| 161 | "-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED") |
| 162 | target_link_libraries(djpeg-static jpeg-static) |
| 163 | |
| 164 | add_executable(jpegtran-static jpegtran.c cdjpeg.c rdswitch.c transupp.c) |
| 165 | target_link_libraries(jpegtran-static jpeg-static) |
| 166 | |
| 167 | add_executable(rdjpgcom rdjpgcom.c) |
| 168 | |
| 169 | add_executable(wrjpgcom rdjpgcom.c) |
| 170 | |
| 171 | |
| 172 | # |
| 173 | # Tests |
| 174 | # |
| 175 | |
| 176 | enable_testing() |
| 177 | add_test(jpegut jpegut) |
| 178 | add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 179 | add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 180 | add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 181 | add_test(cjpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 182 | add_test(cjpeg-float sharedlib/cjpeg -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 183 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 184 | add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 185 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 186 | add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 187 | endif() |
| 188 | add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 189 | add_test(djpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 190 | add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 191 | add_test(djpeg-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.ppm testoutfst.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 192 | add_test(djpeg-float sharedlib/djpeg -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
| 193 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 194 | add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 195 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 196 | add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 197 | endif() |
| 198 | add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 199 | add_test(djpeg-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 200 | add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 201 | add_test(cjpeg-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgp.jpg testoutp.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 202 | add_test(jpegtran-prog sharedlib/jpegtran -outfile testoutt.jpg testoutp.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 203 | add_test(jpegtran-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 204 | add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 205 | add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 206 | |
| 207 | add_test(jpegut-static jpegut-static) |
| 208 | add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 209 | add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 210 | add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 211 | add_test(cjpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.jpg testoutfst.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 212 | add_test(cjpeg-static-float cjpeg-static -dct float -outfile testoutflt.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
| 213 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 214 | add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 215 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 216 | add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 217 | endif() |
| 218 | add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 219 | add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 220 | add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 221 | add_test(djpeg-static-fast-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst.ppm testoutfst.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 222 | add_test(djpeg-static-float djpeg-static -dct float -ppm -outfile testoutflt.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg) |
| 223 | if(WITH_SIMD) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 224 | add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 225 | else() |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 226 | add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 227 | endif() |
| 228 | add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 229 | add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 230 | add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 231 | add_test(cjpeg-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgp.jpg testoutp.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 232 | add_test(jpegtran-static-prog jpegtran-static -outfile testoutt.jpg testoutp.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 233 | add_test(jpegtran-static-prog-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutt.jpg) |
DRC | 8469703 | 2010-10-15 03:43:24 +0000 | [diff] [blame] | 234 | add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg) |
DRC | b42a48c | 2010-10-18 01:06:36 +0000 | [diff] [blame] | 235 | add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg) |
DRC | 2c0a4e1 | 2010-10-16 08:51:43 +0000 | [diff] [blame] | 236 | |
| 237 | |
| 238 | # |
| 239 | # Installer |
| 240 | # |
| 241 | |
| 242 | set(INST_NAME ${CMAKE_PROJECT_NAME}) |
| 243 | |
| 244 | if(MSVC) |
| 245 | set(INST_PLATFORM "Visual C++") |
| 246 | elseif(MINGW) |
| 247 | set(INST_PLATFORM GCC) |
| 248 | set(INST_NAME ${INST_NAME}-gcc) |
| 249 | set(INST_DEFS -DGCC) |
| 250 | endif() |
| 251 | |
| 252 | if(64BIT) |
| 253 | set(INST_PLATFORM "${INST_PLATFORM} 64-bit") |
| 254 | set(INST_NAME ${INST_NAME}64) |
| 255 | set(INST_DEFS ${INST_DEFS} -DWIN64) |
| 256 | endif() |
| 257 | |
| 258 | if(MSVC_IDE) |
| 259 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=$(OutDir)\\") |
| 260 | else() |
| 261 | set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=") |
| 262 | endif() |
| 263 | |
| 264 | configure_file(release/libjpeg-turbo.nsi.in libjpeg-turbo.nsi @ONLY) |
| 265 | |
| 266 | add_custom_target(installer |
| 267 | makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi |
| 268 | DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static |
| 269 | SOURCES libjpeg-turbo.nsi) |
DRC | 7284c9a | 2010-10-16 21:55:14 +0000 | [diff] [blame] | 270 | |
| 271 | install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom |
| 272 | ARCHIVE DESTINATION lib |
| 273 | LIBRARY DESTINATION lib |
| 274 | RUNTIME DESTINATION bin |
| 275 | ) |
| 276 | |
| 277 | install(FILES ${CMAKE_SOURCE_DIR}/LGPL.txt ${CMAKE_SOURCE_DIR}/LICENSE.txt |
| 278 | ${CMAKE_SOURCE_DIR}/README ${CMAKE_SOURCE_DIR}/README-turbo.txt |
| 279 | ${CMAKE_SOURCE_DIR}/libjpeg.txt ${CMAKE_SOURCE_DIR}/usage.txt |
| 280 | DESTINATION doc) |
DRC | e2befde | 2010-10-17 07:28:08 +0000 | [diff] [blame] | 281 | |
| 282 | install(FILES ${CMAKE_BINARY_DIR}/jconfig.h ${CMAKE_SOURCE_DIR}/jerror.h |
| 283 | ${CMAKE_SOURCE_DIR}/jmorecfg.h ${CMAKE_SOURCE_DIR}/jpeglib.h |
| 284 | ${CMAKE_SOURCE_DIR}/turbojpeg.h DESTINATION include) |