]> granicus.if.org Git - openjpeg/commitdiff
ENH: Move to a def solution to avoid polluting header file with declspec
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Tue, 31 Jan 2006 14:20:06 +0000 (14:20 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Tue, 31 Jan 2006 14:20:06 +0000 (14:20 +0000)
libopenjpeg/CMakeLists.txt
libopenjpeg/openjpeg.def.in [new file with mode: 0644]
libopenjpeg/openjpeg.h

index 752e8945f08f5e9c1827c05d9c6f8cfa363b8deb..cd7b678678227af0bf7697d8953d73b184a699ff 100644 (file)
@@ -23,17 +23,26 @@ SET(OpenJPEG_SRCS
   tgt.c
 )
 
-# Handle the dllimport/dllexport for building shared lib on Win32
-IF (WIN32)
-  IF (BUILD_SHARED_LIBS)
-    ADD_DEFINITIONS(-DOPJ_SHARED)
-  ELSE (BUILD_SHARED_LIBS)
-    ADD_DEFINITIONS(-DOPJ_STATIC)
-  ENDIF (BUILD_SHARED_LIBS)
-ENDIF (WIN32)
+IF(WIN32 AND BUILD_SHARED_LIBS)
+  SET(UNDERSCORE)
+  IF(BORLAND)
+    SET(UNDERSCORE "_")
+  ENDIF(BORLAND)
+  CONFIGURE_FILE(
+    ${OPENJPEG_SOURCE_DIR}/libopenjpeg/openjpeg.def.in
+    ${OPENJPEG_BINARY_DIR}/libopenjpeg/openjpeg.def
+    @ONLY IMMEDIATE
+    )
+  IF(NOT BORLAND)
+    SET(OpenJPEG_SRCS ${OpenJPEG_SRCS}
+      ${OPENJPEG_BINARY_DIR}/libopenjpeg/openjpeg.def
+      )
+  ENDIF(NOT BORLAND)
+ENDIF(WIN32 AND BUILD_SHARED_LIBS)
 
 # Create the library
 ADD_LIBRARY(${OPJ_PREFIX}openjpeg ${OpenJPEG_SRCS})
 
 # Install library
 INSTALL_TARGETS(/lib/ ${OPJ_PREFIX}openjpeg)
+
diff --git a/libopenjpeg/openjpeg.def.in b/libopenjpeg/openjpeg.def.in
new file mode 100644 (file)
index 0000000..85cdd94
--- /dev/null
@@ -0,0 +1,17 @@
+LIBRARY openjpeg.dll
+EXPORTS @UNDERSCORE@opj_image_create
+        @UNDERSCORE@opj_image_destroy
+        @UNDERSCORE@opj_cio_open
+        @UNDERSCORE@opj_cio_close
+        @UNDERSCORE@cio_tell
+        @UNDERSCORE@opj_set_event_mgr
+        @UNDERSCORE@opj_create_decompress
+        @UNDERSCORE@opj_destroy_decompress
+        @UNDERSCORE@opj_set_default_decoder_parameters
+        @UNDERSCORE@opj_setup_decoder
+        @UNDERSCORE@opj_decode
+        @UNDERSCORE@opj_create_compress
+        @UNDERSCORE@opj_destroy_compress
+        @UNDERSCORE@opj_set_default_encoder_parameters
+        @UNDERSCORE@opj_setup_encoder
+        @UNDERSCORE@opj_encode
index ce99e3c5862810fe42d7c8075c994f0bd6f81d57..7feb0133a999114307852a0c52c90a5398f159ab 100644 (file)
 
 #define OPENJPEG_VERSION "1.0.0"
 
-#if defined(_WIN32) && !defined (OPJ_STATIC)
-#ifdef OPJ_SHARED
-#define OPJ_EXPORT __declspec(dllexport)
-#else
-#define OPJ_EXPORT __declspec(dllimport)
-#endif
-#else
-#ifdef OPJ_STATIC
-#define OPJ_EXPORT extern
-#else
 #define OPJ_EXPORT
-#endif
-#endif
 
 /* 
 ==========================================================