diff -Nur jpeg-7.orig/CMakeLists.txt jpeg-7/CMakeLists.txt --- jpeg-7.orig/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ jpeg-7/CMakeLists.txt 2009-08-21 00:54:37.000000000 -0400 @@ -0,0 +1,91 @@ +project(JPEG C) + +include(CheckIncludeFile) +CHECK_INCLUDE_FILE(stddef.h HAVE_STDDEF_H) +CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H) +if(WIN32) + # This is for jpeg binaries and is #defined in jconfig.h + set(TWO_FILE_COMMANDLINE true) +endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jconfig.h.in + ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +if(MSVC) + set(CMAKE_DEBUG_POSTFIX "D") + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + +set(JPEG_PUBLIC_HDRS + jerror.h + jmorecfg.h + jpeglib.h + ${CMAKE_CURRENT_BINARY_DIR}/jconfig.h +) +set(JPEG_PRIVATE_HDRS + cderror.h + cdjpeg.h + jdct.h + jinclude.h + jmemsys.h + jpegint.h + jversion.h + transupp.h +) + +# memmgr back ends: compile only one of these into a working library +# (For now, let's use the mode that requires the image fit into memory. +# This is the recommended mode for Win32 anyway.) +SET(JPEG_systemdependent_SRCS jmemnobs.c) + +set(JPEG_SRCS + jaricom.c jcapimin.c jcapistd.c jcarith.c jccoefct.c jccolor.c + jcdctmgr.c jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c + jcomapi.c jcparam.c jcprepct.c jcsample.c jctrans.c jdapimin.c + jdapistd.c jdarith.c jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c + jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdmaster.c + jdmerge.c jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c + jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c + jquant2.c jutils.c jmemmgr.c) + +add_library(jpeg ${JPEG_systemdependent_SRCS} ${JPEG_SRCS} ${JPEG_PUBLIC_HDRS} ${JPEG_PRIVATE_HDRS}) +set_target_properties(jpeg PROPERTIES VERSION 7.0.0) +set_target_properties(jpeg PROPERTIES SOVERSION 7) +if(WIN32 AND BUILD_SHARED_LIBS) + # We add JPEG_DLL only to building of this target because bad things + # happen if it's enabled on all binary targets owing to the macros + # defined in jmorecfg.h + set_target_properties(jpeg PROPERTIES COMPILE_FLAGS -DJPEG_DLL) +endif() + + +set(JPEG_MANPAGES cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1) + +add_executable(cjpeg cjpeg.c rdppm.c rdgif.c rdtarga.c rdrle.c rdbmp.c rdswitch.c cdjpeg.c) +target_link_libraries(cjpeg jpeg) + +add_executable(djpeg djpeg.c wrppm.c wrgif.c wrtarga.c wrrle.c wrbmp.c rdcolmap.c cdjpeg.c) +target_link_libraries(djpeg jpeg) + +add_executable(jpegtran jpegtran.c rdswitch.c cdjpeg.c transupp.c) +target_link_libraries(jpegtran jpeg) + +add_executable(rdjpgcom rdjpgcom.c) +add_executable(wrjpgcom wrjpgcom.c) + +if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) + install(TARGETS jpeg + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib ) +endif() +if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) + install(FILES ${JPEG_PUBLIC_HDRS} DESTINATION include) +endif() +if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) + install(FILES ${JPEG_MANPAGES} DESTINATION share/man/man1) +endif() +if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL) + install(TARGETS cjpeg djpeg jpegtran rdjpgcom wrjpgcom DESTINATION bin) +endif() diff -Nur jpeg-7.orig/jconfig.h.in jpeg-7/jconfig.h.in --- jpeg-7.orig/jconfig.h.in 1969-12-31 19:00:00.000000000 -0500 +++ jpeg-7/jconfig.h.in 2009-08-21 00:54:00.000000000 -0400 @@ -0,0 +1,168 @@ +// +// Based on jconfig.doc, here we substitute in a couple of symbols +// detected with CMake. We can do more but it's probably overkill +// as most compilers support these options today. +// + +/* + * jconfig.doc + * + * Copyright (C) 1991-1994, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file documents the configuration options that are required to + * customize the JPEG software for a particular system. + * + * The actual configuration options for a particular installation are stored + * in jconfig.h. On many machines, jconfig.h can be generated automatically + * or copied from one of the "canned" jconfig files that we supply. But if + * you need to generate a jconfig.h file by hand, this file tells you how. + */ + + +/* + * These symbols indicate the properties of your machine or compiler. + * #define the symbol if yes, #undef it if no. + */ + +/* Does your compiler support function prototypes? + * (If not, you also need to use ansi2knr, see install.doc) + */ +#define HAVE_PROTOTYPES + +/* Does your compiler support the declaration "unsigned char" ? + * How about "unsigned short" ? + */ +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT + +/* Define "void" as "char" if your compiler doesn't know about type void. + * NOTE: be sure to define void such that "void *" represents the most general + * pointer type, e.g., that returned by malloc(). + */ +/* #define void char */ + +/* Define "const" as empty if your compiler doesn't know the "const" keyword. + */ +/* #define const */ + +/* Define this if an ordinary "char" type is unsigned. + * If you're not sure, leaving it undefined will work at some cost in speed. + * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal. + */ +#undef CHAR_IS_UNSIGNED + +/* Define this if your system has an ANSI-conforming file. + */ +#cmakedefine HAVE_STDDEF_H + +/* Define this if your system has an ANSI-conforming file. + */ +#cmakedefine HAVE_STDLIB_H + +/* Define this if your system does not have an ANSI/SysV , + * but does have a BSD-style . + */ +#undef NEED_BSD_STRINGS + +/* Define this if your system does not provide typedef size_t in any of the + * ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in + * instead. + */ +#undef NEED_SYS_TYPES_H + +/* For 80x86 machines, you need to define NEED_FAR_POINTERS, + * unless you are using a large-data memory model or 80386 flat-memory mode. + * On less brain-damaged CPUs this symbol must not be defined. + * (Defining this symbol causes large data structures to be referenced through + * "far" pointers and to be allocated with a special version of malloc.) + */ +#undef NEED_FAR_POINTERS + +/* Define this if your linker needs global names to be unique in less + * than the first 15 characters. + */ +#undef NEED_SHORT_EXTERNAL_NAMES + +/* Although a real ANSI C compiler can deal perfectly well with pointers to + * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI + * and pseudo-ANSI compilers get confused. To keep one of these bozos happy, + * define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you + * actually get "missing structure definition" warnings or errors while + * compiling the JPEG code. + */ +#undef INCOMPLETE_TYPES_BROKEN + +// Here we use some code grabbed from jconfig.vc for MSVC compilers +// In windows BOOLEAN is a uint8 so "boolean" is typedef to a uint8 +// here before jmorecfg.h can typedef it as an int. +#ifdef _MSC_VER + /* Define "boolean" as unsigned char, not int, per Windows custom */ + #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ + typedef unsigned char boolean; + #endif + #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ +#endif + +/* + * The following options affect code selection within the JPEG library, + * but they don't need to be visible to applications using the library. + * To minimize application namespace pollution, the symbols won't be + * defined unless JPEG_INTERNALS has been defined. + */ + +#ifdef JPEG_INTERNALS + +/* Define this if your compiler implements ">>" on signed values as a logical + * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift, + * which is the normal and rational definition. + */ +#undef RIGHT_SHIFT_IS_UNSIGNED + + +#endif /* JPEG_INTERNALS */ + + +/* + * The remaining options do not affect the JPEG library proper, + * but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c). + * Other applications can ignore these. + */ + +#ifdef JPEG_CJPEG_DJPEG + +/* These defines indicate which image (non-JPEG) file formats are allowed. */ + +#define BMP_SUPPORTED /* BMP image file format */ +#define GIF_SUPPORTED /* GIF image file format */ +#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +#undef RLE_SUPPORTED /* Utah RLE image file format */ +#define TARGA_SUPPORTED /* Targa image file format */ + +/* Define this if you want to name both input and output files on the command + * line, rather than using stdout and optionally stdin. You MUST do this if + * your system can't cope with binary I/O to stdin/stdout. See comments at + * head of cjpeg.c or djpeg.c. + */ +#cmakedefine TWO_FILE_COMMANDLINE + +/* Define this if your system needs explicit cleanup of temporary files. + * This is crucial under MS-DOS, where the temporary "files" may be areas + * of extended memory; on most other systems it's not as important. + */ +#undef NEED_SIGNAL_CATCHER + +/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb"). + * This is necessary on systems that distinguish text files from binary files, + * and is harmless on most systems that don't. If you have one of the rare + * systems that complains about the "b" spec, define this symbol. + */ +#undef DONT_USE_B_MODE + +/* Define this if you want percent-done progress reports from cjpeg/djpeg. + */ +#undef PROGRESS_REPORT + + +#endif /* JPEG_CJPEG_DJPEG */