From 7ab5d36cc109d95125d927436be0b908e3c632b5 Mon Sep 17 00:00:00 2001 From: malaterre Date: Tue, 7 Jun 2005 21:19:19 +0000 Subject: [PATCH] ENH: getting toward win32 support --- src/gdcmjpegls/Decoder/CMakeLists.txt | 8 ++++++ src/gdcmjpegls/Decoder/global.c | 6 ++++- src/gdcmjpegls/Decoder/global.h | 1 + src/gdcmjpegls/Decoder/jpegls_config.h.in | 30 +++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/gdcmjpegls/Decoder/jpegls_config.h.in diff --git a/src/gdcmjpegls/Decoder/CMakeLists.txt b/src/gdcmjpegls/Decoder/CMakeLists.txt index 6a78b572..8f780915 100644 --- a/src/gdcmjpegls/Decoder/CMakeLists.txt +++ b/src/gdcmjpegls/Decoder/CMakeLists.txt @@ -1,5 +1,13 @@ INCLUDE_REGULAR_EXPRESSION("^.*$") +CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) +CONFIGURE_FILE( + "${GDCMJPEGLS_SOURCE_DIR}/Decoder/jpegls_config.h.in" + "${GDCMJPEGLS_BINARY_DIR}/Decoder/jpegls_config.h" + @ONLY IMMEDIATE) + +INCLUDE_DIRECTORIES("${GDCMJPEGLS_BINARY_DIR}/Decoder") + SET(GDCMJPEGLS_SRCS global.c jpegmark.c diff --git a/src/gdcmjpegls/Decoder/global.c b/src/gdcmjpegls/Decoder/global.c index 55d1ddc7..533e0659 100644 --- a/src/gdcmjpegls/Decoder/global.c +++ b/src/gdcmjpegls/Decoder/global.c @@ -51,8 +51,12 @@ */ #include -#include #include "global.h" +#ifdef HAVE_UNISTD_H +#include +#else +#include +#endif diff --git a/src/gdcmjpegls/Decoder/global.h b/src/gdcmjpegls/Decoder/global.h index 9277ea54..e7412bd0 100644 --- a/src/gdcmjpegls/Decoder/global.h +++ b/src/gdcmjpegls/Decoder/global.h @@ -52,6 +52,7 @@ #include #include #include +#include "jpegls_config.h" #ifndef GLOBAL_H #define GLOBAL_H diff --git a/src/gdcmjpegls/Decoder/jpegls_config.h.in b/src/gdcmjpegls/Decoder/jpegls_config.h.in new file mode 100644 index 00000000..159256d0 --- /dev/null +++ b/src/gdcmjpegls/Decoder/jpegls_config.h.in @@ -0,0 +1,30 @@ +/* Avoid problems due to multiple inclusion. */ +#ifndef JPEGPLS_CONFIG_H +#define JPEGPLS_CONFIG_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H + +#cmakedefine JPEGLSSTATIC + +/* a function referenced thru EXTERNs: */ +#if defined( _WIN32 ) && defined (JPEGLSDLL) +#define GLOBAL(type) __declspec(dllexport) type +#else +#define GLOBAL(type) type +#endif + +/* a reference to a GLOBAL function: */ +#if defined(_WIN32) && !defined(JPEGLSSTATIC) +#ifdef JPEGLSDLL +#define EXTERN(type) __declspec(dllexport) type +#else +#define EXTERN(type) __declspec(dllimport) type +#endif +#else +#define EXTERN(type) extern type +#endif + + +#endif + -- 2.48.1