Allow proper compiling of libjpeg for windows.

This expands on #777 to work with jconfig.h properly.

To facilitate these operations, a new macro was added for doing compile tests.

Note that this commit does NOT bring in the other files associated with this version of libjpeg.

At some point, it would be desirable to automatically get the files as part of the cmake configuration step, similar to ffmpeg.
This commit is contained in:
Jason Felds
2015-09-13 13:10:58 -04:00
parent 34ba6e37c4
commit 68b3620bac
12 changed files with 221 additions and 141 deletions
+1 -3
View File
@@ -4,6 +4,7 @@ include(CMakeProject-json.cmake)
if (APPLE OR MSVC)
include(CMakeProject-mad.cmake)
include(CMakeProject-zlib.cmake)
include(CMakeProject-jpeg.cmake)
endif()
if (NOT SYSTEM_PCRE_FOUND)
include(CMakeProject-pcre.cmake)
@@ -12,6 +13,3 @@ include(CMakeProject-tomcrypt.cmake)
include(CMakeProject-tommath.cmake)
include(CMakeProject-png.cmake)
if (APPLE)
include(CMakeProject-jpeg.cmake)
endif()
+78 -55
View File
@@ -1,61 +1,81 @@
set(JPEG_DIR "${SM_EXTERN_DIR}/libjpeg")
configure_file("${SM_EXTERN_DIR}/config.jpeg.in.h" "${JPEG_DIR}/jconfig.h")
if (NOT HAVE_PROTOTYPES)
list(APPEND JPEG_SRC "${JPEG_DIR}/ansi2knr.c")
endif()
list(APPEND JPEG_SRC
"libjpeg/ansi2knr.c"
"libjpeg/cdjpeg.c"
"libjpeg/cjpeg.c"
"libjpeg/ckconfig.c"
"libjpeg/djpeg.c"
"libjpeg/jaricom.c"
"libjpeg/jcapimin.c"
"libjpeg/jcapistd.c"
"libjpeg/jcarith.c"
"libjpeg/jccoefct.c"
"libjpeg/jccolor.c"
"libjpeg/jcdctmgr.c"
"libjpeg/jchuff.c"
"libjpeg/jcinit.c"
"libjpeg/jcmainct.c"
"libjpeg/jcmarker.c"
"libjpeg/jcmaster.c"
"libjpeg/jcomapi.c"
"libjpeg/jcparam.c"
"libjpeg/jcprepct.c"
"libjpeg/jcsample.c"
"libjpeg/jctrans.c"
"libjpeg/jdapimin.c"
"libjpeg/jdapistd.c"
"libjpeg/jdarith.c"
"libjpeg/jdatadst.c"
"libjpeg/jdcoefct.c"
"libjpeg/jdcolor.c"
"libjpeg/jddctmgr.c"
"libjpeg/jdhuff.c"
"libjpeg/jdinput.c"
"libjpeg/jdmainct.c"
"libjpeg/jdmarker.c"
"libjpeg/jdmaster.c"
"libjpeg/jdmerge.c"
"libjpeg/jdpostct.c"
"libjpeg/jdsample.c"
"libjpeg/jdtrans.c"
"libjpeg/jerror.c"
"libjpeg/jfdctflt.c"
"libjpeg/jfdctfst.c"
"libjpeg/jfdctint.c"
"libjpeg/jutils.c"
"libjpeg/jidctflt.c"
"libjpeg/jidctfst.c"
"libjpeg/jidctint.c"
"libjpeg/jmemansi.c"
"libjpeg/jmemmgr.c"
"libjpeg/jmemname.c"
"libjpeg/jmemnobs.c"
"libjpeg/jquant1.c"
"libjpeg/jquant2.c"
"${JPEG_DIR}/cdjpeg.c"
"${JPEG_DIR}/cjpeg.c"
"${JPEG_DIR}/ckconfig.c"
"${JPEG_DIR}/djpeg.c"
"${JPEG_DIR}/jaricom.c"
"${JPEG_DIR}/jcapimin.c"
"${JPEG_DIR}/jcapistd.c"
"${JPEG_DIR}/jcarith.c"
"${JPEG_DIR}/jccoefct.c"
"${JPEG_DIR}/jccolor.c"
"${JPEG_DIR}/jcdctmgr.c"
"${JPEG_DIR}/jchuff.c"
"${JPEG_DIR}/jcinit.c"
"${JPEG_DIR}/jcmainct.c"
"${JPEG_DIR}/jcmarker.c"
"${JPEG_DIR}/jcmaster.c"
"${JPEG_DIR}/jcomapi.c"
"${JPEG_DIR}/jcparam.c"
"${JPEG_DIR}/jcprepct.c"
"${JPEG_DIR}/jcsample.c"
"${JPEG_DIR}/jctrans.c"
"${JPEG_DIR}/jdapimin.c"
"${JPEG_DIR}/jdapistd.c"
"${JPEG_DIR}/jdarith.c"
"${JPEG_DIR}/jdatadst.c"
"${JPEG_DIR}/jdcoefct.c"
"${JPEG_DIR}/jdcolor.c"
"${JPEG_DIR}/jddctmgr.c"
"${JPEG_DIR}/jdhuff.c"
"${JPEG_DIR}/jdinput.c"
"${JPEG_DIR}/jdmainct.c"
"${JPEG_DIR}/jdmarker.c"
"${JPEG_DIR}/jdmaster.c"
"${JPEG_DIR}/jdmerge.c"
"${JPEG_DIR}/jdpostct.c"
"${JPEG_DIR}/jdsample.c"
"${JPEG_DIR}/jdtrans.c"
"${JPEG_DIR}/jerror.c"
"${JPEG_DIR}/jfdctflt.c"
"${JPEG_DIR}/jfdctfst.c"
"${JPEG_DIR}/jfdctint.c"
"${JPEG_DIR}/jutils.c"
"${JPEG_DIR}/jidctflt.c"
"${JPEG_DIR}/jidctfst.c"
"${JPEG_DIR}/jidctint.c"
"${JPEG_DIR}/jmemansi.c"
"${JPEG_DIR}/jmemmgr.c"
"${JPEG_DIR}/jmemname.c"
"${JPEG_DIR}/jmemnobs.c"
"${JPEG_DIR}/jquant1.c"
"${JPEG_DIR}/jquant2.c"
)
source_group("" FILES ${JPEG_SRC})
list(APPEND JPEG_HPP
"${JPEG_DIR}/jconfig.h"
"${JPEG_DIR}/jdct.h"
"${JPEG_DIR}/jerror.h"
"${JPEG_DIR}/jinclude.h"
"${JPEG_DIR}/jmemsys.h"
"${JPEG_DIR}/jmorecfg.h"
"${JPEG_DIR}/jpegint.h"
"${JPEG_DIR}/jpeglib.h"
"${JPEG_DIR}/jversion.h"
)
add_library("jpeg" ${JPEG_SRC})
source_group("Source Files" FILES ${JPEG_SRC})
source_group("Header Files" FILES ${JPEG_HPP})
add_library("jpeg" ${JPEG_SRC} ${JPEG_HPP})
disable_project_warnings("jpeg")
@@ -63,4 +83,7 @@ set_property(TARGET "jpeg" PROPERTY FOLDER "External Libraries")
if(MSVC)
sm_add_compile_definition("jpeg" _CRT_SECURE_NO_WARNINGS)
endif(MSVC)
endif(MSVC)
target_include_directories("jpeg" PUBLIC "${JPEG_DIR}")
+53
View File
@@ -0,0 +1,53 @@
/* Auto-generated config.h file powered by cmake. */
/* Defined to 1 if the compiler supports prototype functions. */
#cmakedefine HAVE_PROTOTYPES 1
/* Defined to 1 if we have access to stddef.h */
#cmakedefine HAVE_STDDEF_H 1
/* Defined to 1 if we have access to stdlib.h */
#cmakedefine HAVE_STDLIB_H 1
/* Defined to 1 if we only have the BSD style strings.h file. */
#cmakedefine HAVE_STRING_H 1
#cmakedefine HAVE_STRINGS_H 1
#if defined(HAVE_STRINGS_H) && !defined(HAVE_STRING_H)
#define NEED_BSD_STRINGS 1
#endif
/* Defined to 1 if we have an unsigned char type. */
#cmakedefine HAVE_SIZEOF_UNSIGNED_CHAR 1
#if defined(HAVE_SIZEOF_UNSIGNED_CHAR)
#define HAVE_UNSIGNED_CHAR 1
#endif
/* Defined to 1 if we have an unsigned short type. */
#cmakedefine HAVE_SIZEOF_UNSIGNED_SHORT 1
#if defined(HAVE_SIZEOF_UNSIGNED_SHORT)
#define HAVE_UNSIGNED_SHORT 1
#endif
/* At some point, allow for defining CHAR_IS_UNSIGNED. */
/* Define to 1 if the sys types header is required. */
/* TODO: Figure out the right way of using this with size_t. */
#cmakedefine HAVE_SYS_TYPES_H 1
#if defined(HAVE_SYS_TYPES_H)
#define NEED_SYS_TYPES_H 1
#endif
/* Defined to 1 if short external names are needed for linking. */
#cmakedefine NEED_SHORT_EXTERNAL_NAMES 1
/* Defined to 1 if incomplete types are broken. */
#cmakedefine INCOMPLETE_TYPES_BROKEN 1
/* Windows gets a special definition of boolean for some reason. */
#if defined(WIN32)
#if !defined(__RPCNDR_H__)
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN
#endif
-54
View File
@@ -1,54 +0,0 @@
/* jconfig.h. Generated from jconfig.cfg by configure. */
/* jconfig.cfg --- source file edited by configure script */
/* see jconfig.txt for explanations */
#define HAVE_PROTOTYPES 1
#define HAVE_UNSIGNED_CHAR 1
#define HAVE_UNSIGNED_SHORT 1
/* #undef void */
/* #undef const */
/* #undef CHAR_IS_UNSIGNED */
/* #undef NEED_BSD_STRINGS */
/* #undef NEED_SYS_TYPES_H */
/* #undef NEED_FAR_POINTERS */
/* #undef NEED_SHORT_EXTERNAL_NAMES */
/* Define this if you get warnings about undefined structures. */
/* #undef INCOMPLETE_TYPES_BROKEN */
/* Define "boolean" as unsigned char, not int, on Windows systems. */
#ifdef _WIN32
#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
#ifdef JPEG_INTERNALS
/* #undef RIGHT_SHIFT_IS_UNSIGNED */
#define INLINE __inline__
/* These are for configuring the JPEG memory manager. */
/* #undef DEFAULT_MAX_MEM */
/* #undef NO_MKTEMP */
#endif /* JPEG_INTERNALS */
#ifdef JPEG_CJPEG_DJPEG
#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 */
#define TARGA_SUPPORTED /* Targa image file format */
/* #undef TWO_FILE_COMMANDLINE */
/* #undef NEED_SIGNAL_CATCHER */
/* #undef DONT_USE_B_MODE */
/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
/* #undef PROGRESS_REPORT */
#endif /* JPEG_CJPEG_DJPEG */