From 0d4e0f3859616f12f7e207a4141dde1bd0aef81d Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@c-s.fr> Date: Thu, 25 Sep 2008 15:44:49 +0000 Subject: [PATCH] COMP: Trying to correct Visual compilation errors on dllimport/dllexport --- CMakeLists.txt | 9 +++ .../include/ossim/base/ossimConstants.h | 37 ++++------- Utilities/otbossim/src/ossim/CMakeLists.txt | 66 +------------------ 3 files changed, 23 insertions(+), 89 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 574c52a387..446765a35f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ SET(OTB_VERSION_MAJOR "2") SET(OTB_VERSION_MINOR "4") SET(OTB_VERSION_PATCH "0") + # Version string should not include patch level. The major.minor is # enough to distinguish available features of the toolkit. SET(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}") @@ -184,8 +185,15 @@ ELSE(OPENTHREADS_FOUND) SET(OPENTHREADS_INCLUDE_DIR "${OTB_SOURCE_DIR}/Utilities/otbopenthreads/OpenThreads/include") SET(OPENTHREADS_LIBRARY "OpenThreads" ) INCLUDE_DIRECTORIES(${OPENTHREADS_INCLUDE_DIR}) + IF(NOT BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DOT_LIBRARY_STATIC) + ENDIF(NOT BUILD_SHARED_LIBS) ENDIF(OPENTHREADS_FOUND) +IF(NOT BUILD_SHARED_LIBS) + ADD_DEFINITIONS(-DOSSIM_STATIC) +ENDIF(NOT BUILD_SHARED_LIBS) + #----------------------------------------------------------------------------- # Option for generate Visu tools !!! @@ -560,6 +568,7 @@ OPTION(BUILD_EXAMPLES "Build the Examples directory." OFF) #----------------------------------------------------------------------------- # Dispatch the build into the proper subdirectories. + SUBDIRS(Utilities Code) SUBDIRS(Wrapping) diff --git a/Utilities/otbossim/include/ossim/base/ossimConstants.h b/Utilities/otbossim/include/ossim/base/ossimConstants.h index 1285f5d4ca..0e74836891 100644 --- a/Utilities/otbossim/include/ossim/base/ossimConstants.h +++ b/Utilities/otbossim/include/ossim/base/ossimConstants.h @@ -7,7 +7,7 @@ * Description: Common file for global constants. * ************************************************************************** - * $Id: ossimConstants.h 11959 2007-10-31 19:22:56Z gpotts $ + * $Id$ */ #ifndef ossimConstants_HEADER #define ossimConstants_HEADER @@ -41,7 +41,15 @@ extern "C" { /** * DLL IMPORT/EXORT SECTION */ -#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(_MSC_VER) || defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) +#if defined(OSSIM_STATIC) +# define OSSIMEXPORT +# define OSSIMIMPORT +# define OSSIMDLLEXPORT +# define OSSIM_DLL +# define OSSIMDLLEXPORT_DATA(type) type +# define OSSIM_DLL_DATA(type) type +# define OSSIMDLLEXPORT_CTORFN +#elif defined(__MINGW32__) || defined(__CYGWIN__) || defined(_MSC_VER) || defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) # define OSSIMEXPORT __declspec(dllexport) # define OSSIMIMPORT __declspec(dllimport) # ifdef OSSIMMAKINGDLL @@ -230,34 +238,11 @@ typedef signed int ossim_sint32; typedef float ossim_float32; typedef double ossim_float64; -/* - these are in ossimConfig.h. For platforms that dont have a configure - you just copy the ossimConfig.h.in to ossimConfig.h found in src directory - and make modifications based on your platform -*/ -#ifdef OSSIM_SIZEOF_LONG_INT -# if OSSIM_SIZEOF_LONG_INT == 8 -typedef long int ossim_int64; -typedef unsigned long int ossim_uint64; -typedef signed long int ossim_sint64; -# elif OSSIM_SIZEOF_LONG_LONG == 8 typedef long long ossim_int64; typedef unsigned long long ossim_uint64; typedef signed long long ossim_sint64; -# else -typedef long int ossim_int64; -typedef unsigned long int ossim_uint64; -typedef signed long int ossim_sint64; -# endif - -#else -typedef long int ossim_int64; -typedef unsigned long int ossim_uint64; -typedef signed long int ossim_sint64; -#endif - - + typedef ossim_int32 ossimErrorCode; enum ossimVertexOrdering diff --git a/Utilities/otbossim/src/ossim/CMakeLists.txt b/Utilities/otbossim/src/ossim/CMakeLists.txt index 8eee1f2f6a..5d0602feb8 100644 --- a/Utilities/otbossim/src/ossim/CMakeLists.txt +++ b/Utilities/otbossim/src/ossim/CMakeLists.txt @@ -36,22 +36,15 @@ ENDIF(WIN32) INCLUDE_DIRECTORIES(${OTB_BINARY_DIR}/Utilities/otbgeotiff/) #Specify that we are making DLL here -ADD_DEFINITIONS(-DOSSIMMAKINGDLL -DNOMINMAX) +ADD_DEFINITIONS(-DNOMINMAX -DOSSIMMAKINGDLL) -# For alls platform (except MINGW): -IF( NOT MINGW ) - -ADD_LIBRARY(otbossimBase +ADD_LIBRARY(otbossim ${ossim_base_SRCS} ${ossim_kbool_SRCS} ${ossim_matrix_SRCS} ${ossim_vec_SRCS} ${ossim_vpfutil_SRCS} ${ossim_plugin_SRCS} -) -TARGET_LINK_LIBRARIES(otbossimBase) - -ADD_LIBRARY(otbossim ${ossim_init_SRCS} ${ossim_font_SRCS} ${ossim_support_data_SRCS} @@ -60,63 +53,10 @@ ${ossim_imaging_SRCS} ${ossim_parallel_SRCS} ${ossim_elevation_SRCS} ) -TARGET_LINK_LIBRARIES(otbossim otbossimBase otbgeotiff otbxtiff itktiff itkjpeg8 itkjpeg12 itkjpeg16 OpenThreads) - -INSTALL(TARGETS otbossimBase -RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries -LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries -ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development) - -INSTALL(TARGETS otbossim -RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries -LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries -ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development) - - -ELSE( NOT MINGW ) - -ADD_LIBRARY(otbossimBase -${ossim_base_SRCS} -${ossim_kbool_SRCS} -${ossim_matrix_SRCS} -${ossim_vec_SRCS} -${ossim_vpfutil_SRCS} -${ossim_plugin_SRCS} -) - -ADD_LIBRARY(otbossimBase2 -${ossim_font_SRCS} -${ossim_support_data_SRCS} -${ossim_projection_SRCS} -${ossim_elevation_SRCS} -) - - -ADD_LIBRARY(otbossim -${ossim_init_SRCS} -${ossim_imaging_SRCS} -${ossim_parallel_SRCS} -) - -TARGET_LINK_LIBRARIES(otbossimBase otbossimBase2 otbossim) -TARGET_LINK_LIBRARIES(otbossimBase2 otbossimBase otbossim) -TARGET_LINK_LIBRARIES(otbossim otbossimBase2 otbossimBase otbgeotiff otbxtiff itktiff itkjpeg8 itkjpeg12 itkjpeg16 OpenThreads ) - -INSTALL(TARGETS otbossimBase -RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries -LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries -ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development) - -INSTALL(TARGETS otbossimBase2 -RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries -LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries -ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development) +TARGET_LINK_LIBRARIES(otbossim otbgeotiff otbxtiff itktiff itkjpeg8 itkjpeg12 itkjpeg16 OpenThreads) INSTALL(TARGETS otbossim RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR} COMPONENT RuntimeLibraries LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT RuntimeLibraries ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR} COMPONENT Development) - -ENDIF( NOT MINGW ) - -- GitLab