mirror of https://github.com/davisking/dlib.git
Changed how we #include and compile our own copy of libjpeg. This is to make
the build more robust against name conflicts from other libraries that also statically compile libjpeg or stick incompatible versions of libjpeg's header files into folders in the include search path.
This commit is contained in:
parent
73231f43b4
commit
98990e70bd
|
@ -283,7 +283,7 @@ if (NOT TARGET dlib)
|
|||
set (dlib_needed_libraries ${dlib_needed_libraries} ${JPEG_LIBRARY})
|
||||
else()
|
||||
# If we can't find libjpeg then statically compile it in.
|
||||
include_directories(external/libjpeg)
|
||||
add_definitions(-DDLIB_JPEG_STATIC)
|
||||
set(source_files ${source_files}
|
||||
external/libjpeg/jcomapi.cpp
|
||||
external/libjpeg/jdapimin.cpp
|
||||
|
|
|
@ -171,8 +171,13 @@ typedef unsigned int JDIMENSION;
|
|||
#define LOCAL(type) static type
|
||||
/* a function referenced thru EXTERNs: */
|
||||
#define GLOBAL(type) type
|
||||
/* a reference to a GLOBAL function: */
|
||||
#ifdef __cplusplus
|
||||
/*
|
||||
Use C linking unless we are supposed to be compiling our own copy of
|
||||
libjpeg. Then let it use C++ linking so that we are less likely to get
|
||||
linker name conflicts with other libraries that happen to statically include
|
||||
libjpeg as well.
|
||||
*/
|
||||
#if defined(__cplusplus) && !defined(DLIB_JPEG_STATIC)
|
||||
#define EXTERN(type) extern "C" type
|
||||
#else
|
||||
#define EXTERN(type) extern type
|
||||
|
|
|
@ -11,7 +11,11 @@
|
|||
#include "../dir_nav.h"
|
||||
#include "jpeg_loader.h"
|
||||
#include <stdio.h>
|
||||
#include <jpeglib.h>
|
||||
#ifdef DLIB_JPEG_STATIC
|
||||
# include "../external/libjpeg/jpeglib.h"
|
||||
#else
|
||||
# include <jpeglib.h>
|
||||
#endif
|
||||
#include <sstream>
|
||||
#include <setjmp.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
#include "../pixel.h"
|
||||
#include "save_jpeg.h"
|
||||
#include <stdio.h>
|
||||
#include <jpeglib.h>
|
||||
#ifdef DLIB_JPEG_STATIC
|
||||
# include "../external/libjpeg/jpeglib.h"
|
||||
#else
|
||||
# include <jpeglib.h>
|
||||
#endif
|
||||
#include <sstream>
|
||||
#include <setjmp.h>
|
||||
#include "image_saver.h"
|
||||
|
|
Loading…
Reference in New Issue