From c2de1e452e66ca7ea3d83f44187562faa330a439 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 7 Sep 2023 19:55:04 +0300 Subject: [PATCH] Add MSP build files and some adjustments jconfig.h is copied from the jconfig.vc, because that's the platform I'll mostly use this on, and the definitions seem like a good match for other modern systems as well. --- .gitignore | 5 ++++ Build | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ jconfig.h | 45 +++++++++++++++++++++++++++++++++ jerror.c | 3 +++ jmemmgr.c | 3 +++ jmorecfg.h | 18 ++++++++++++-- 6 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Build create mode 100644 jconfig.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f6c2a16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +temp/ +/jpeg.dll +/jpeg.pdb +/jpeg.lib +/jpeg_static.lib diff --git a/Build b/Build new file mode 100644 index 0000000..04b0382 --- /dev/null +++ b/Build @@ -0,0 +1,73 @@ +package "libjpeg" +{ + library "jpeg" + { + source "jcomapi.c"; + source "jutils.c"; + source "jerror.c"; + source "jmemmgr.c"; + source "jmemnobs.c"; + source "jcapimin.c"; + source "jcapistd.c"; + source "jctrans.c"; + source "jcparam.c"; + source "jdatadst.c"; + source "jcinit.c"; + source "jcmaster.c"; + source "jcmarker.c"; + source "jcmainct.c"; + source "jcprepct.c"; + source "jccoefct.c"; + source "jccolor.c"; + source "jcsample.c"; + source "jchuff.c"; + source "jcphuff.c"; + source "jcdctmgr.c"; + source "jfdctfst.c"; + source "jfdctflt.c"; + source "jfdctint.c"; + source "jdapimin.c"; + source "jdapistd.c"; + source "jdtrans.c"; + source "jdatasrc.c"; + source "jdmaster.c"; + source "jdinput.c"; + source "jdmarker.c"; + source "jdhuff.c"; + source "jdphuff.c"; + source "jdmainct.c"; + source "jdcoefct.c"; + source "jdpostct.c"; + source "jddctmgr.c"; + source "jidctfst.c"; + source "jidctflt.c"; + source "jidctint.c"; + source "jidctred.c"; + source "jdsample.c"; + source "jdcolor.c"; + source "jquant1.c"; + source "jquant2.c"; + source "jdmerge.c"; + source "jchuff.h"; + source "jconfig.h"; + source "jdct.h"; + source "jdhuff.h"; + source "jerror.h"; + source "jinclude.h"; + source "jmemsys.h"; + source "jmorecfg.h"; + source "jpegint.h"; + source "jpeglib.h"; + source "jversion.h"; + install true; + install_headers false; + }; + + install "include" + { + source "jconfig.h"; + source "jerror.h"; + source "jmorecfg.h"; + source "jpeglib.h"; + }; +}; diff --git a/jconfig.h b/jconfig.h new file mode 100644 index 0000000..7e291c7 --- /dev/null +++ b/jconfig.h @@ -0,0 +1,45 @@ +/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ +/* see jconfig.doc for explanations */ + +#define HAVE_PROTOTYPES +#define HAVE_UNSIGNED_CHAR +#define HAVE_UNSIGNED_SHORT +/* #define void char */ +/* #define const */ +#undef CHAR_IS_UNSIGNED +#define HAVE_STDDEF_H +#define HAVE_STDLIB_H +#undef NEED_BSD_STRINGS +#undef NEED_SYS_TYPES_H +#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ +#undef NEED_SHORT_EXTERNAL_NAMES +#undef INCOMPLETE_TYPES_BROKEN + +/* 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 */ + + +#ifdef JPEG_INTERNALS + +#undef RIGHT_SHIFT_IS_UNSIGNED + +#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 /* Utah RLE image file format */ +#define TARGA_SUPPORTED /* Targa image file format */ + +#define TWO_FILE_COMMANDLINE /* optional */ +#define USE_SETMODE /* Microsoft has setmode() */ +#undef NEED_SIGNAL_CATCHER +#undef DONT_USE_B_MODE +#undef PROGRESS_REPORT /* optional */ + +#endif /* JPEG_CJPEG_DJPEG */ diff --git a/jerror.c b/jerror.c index 3da7be8..274e8ec 100644 --- a/jerror.c +++ b/jerror.c @@ -19,6 +19,9 @@ */ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ +#ifdef _WIN32 +#define _CRT_SECURE_NO_WARNINGS +#endif #include "jinclude.h" #include "jpeglib.h" #include "jversion.h" diff --git a/jmemmgr.c b/jmemmgr.c index d801b32..f196559 100644 --- a/jmemmgr.c +++ b/jmemmgr.c @@ -26,6 +26,9 @@ #define JPEG_INTERNALS #define AM_MEMORY_MANAGER /* we define jvirt_Xarray_control structs */ +#ifdef _WIN32 +#define _CRT_SECURE_NO_WARNINGS +#endif #include "jinclude.h" #include "jpeglib.h" #include "jmemsys.h" /* import the system-dependent declarations */ diff --git a/jmorecfg.h b/jmorecfg.h index 54a7d1c..565f13e 100644 --- a/jmorecfg.h +++ b/jmorecfg.h @@ -180,14 +180,28 @@ typedef unsigned int JDIMENSION; * or code profilers that require it. */ +#if defined(_WIN32) +#if defined(JPEG_BUILD) +#define LIBJPEG_API __declspec(dllexport) +#elif defined(LIBJPEG_IMPORT) +#define LIBJPEG_API __declspec(dllimport) +#else +#define LIBJPEG_API +#endif +#elif defined(__GNUC__) +#define LIBJPEG_API __attribute__((visibility("default"))) +#else +#define LIBJPEG_API +#endif + /* a function called through method pointers: */ #define METHODDEF(type) static type /* a function used only in its module: */ #define LOCAL(type) static type /* a function referenced thru EXTERNs: */ -#define GLOBAL(type) type +#define GLOBAL(type) LIBJPEG_API type /* a reference to a GLOBAL function: */ -#define EXTERN(type) extern type +#define EXTERN(type) LIBJPEG_API extern type /* This macro is used to declare a "method", that is, a function pointer. -- 2.45.2