ENH: Move to a def solution to avoid polluting header file with declspec

This commit is contained in:
Mathieu Malaterre 2006-01-31 14:20:06 +00:00
parent 72de930d08
commit c5c3ca370e
3 changed files with 34 additions and 20 deletions

View 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)

View File

@ -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

View File

@ -32,19 +32,7 @@
#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
/*
==========================================================