diff --git a/CMake/GenerateExportHeaderCustom.cmake b/CMake/GenerateExportHeaderCustom.cmake new file mode 100644 index 0000000000000000000000000000000000000000..6cd330485847ad5129253bd0cc6e4593d8baca50 --- /dev/null +++ b/CMake/GenerateExportHeaderCustom.cmake @@ -0,0 +1,463 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Copyright (C) 2019 Centre National d'Etudes Spatiales (CNES) +# - Added support of XXX_EXPORT_TEMPLATE and XXX_EXPORT_EXPLICIT_TEMPLATE macros + +#.rst: +# GenerateExportHeader +# -------------------- +# +# Function for generation of export macros for libraries +# +# This module provides the function GENERATE_EXPORT_HEADER(). +# +# The ``GENERATE_EXPORT_HEADER`` function can be used to generate a file +# suitable for preprocessor inclusion which contains EXPORT macros to be +# used in library classes:: +# +# GENERATE_EXPORT_HEADER( LIBRARY_TARGET +# [BASE_NAME <base_name>] +# [EXPORT_MACRO_NAME <export_macro_name>] +# [EXPORT_FILE_NAME <export_file_name>] +# [DEPRECATED_MACRO_NAME <deprecated_macro_name>] +# [NO_EXPORT_MACRO_NAME <no_export_macro_name>] +# [INCLUDE_GUARD_NAME <include_guard_name>] +# [STATIC_DEFINE <static_define>] +# [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>] +# [DEFINE_NO_DEPRECATED] +# [PREFIX_NAME <prefix_name>] +# [CUSTOM_CONTENT_FROM_VARIABLE <variable>] +# ) +# +# +# The target properties :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` +# and :prop_tgt:`VISIBILITY_INLINES_HIDDEN` can be used to add the appropriate +# compile flags for targets. See the documentation of those target properties, +# and the convenience variables +# :variable:`CMAKE_CXX_VISIBILITY_PRESET <CMAKE_<LANG>_VISIBILITY_PRESET>` and +# :variable:`CMAKE_VISIBILITY_INLINES_HIDDEN`. +# +# By default ``GENERATE_EXPORT_HEADER()`` generates macro names in a file +# name determined by the name of the library. This means that in the +# simplest case, users of ``GenerateExportHeader`` will be equivalent to: +# +# .. code-block:: cmake +# +# set(CMAKE_CXX_VISIBILITY_PRESET hidden) +# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +# add_library(somelib someclass.cpp) +# generate_export_header(somelib) +# install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR}) +# install(FILES +# someclass.h +# ${PROJECT_BINARY_DIR}/somelib_export.h DESTINATION ${INCLUDE_INSTALL_DIR} +# ) +# +# +# And in the ABI header files: +# +# .. code-block:: c++ +# +# #include "somelib_export.h" +# class SOMELIB_EXPORT SomeClass { +# ... +# }; +# +# +# The CMake fragment will generate a file in the +# ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the +# macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``, +# ``SOMELIB_DEPRECATED_EXPORT``, ``SOMELIB_DEPRECATED_NO_EXPORT``, +# ``SOMELIB_EXPORT_TEMPLATE`` and ``SOMELIB_EXPORT_EXPLICIT_TEMPLATE``. +# They will be followed by content taken from the variable specified by +# the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any. +# The resulting file should be installed with other headers in the library. +# +# The ``BASE_NAME`` argument can be used to override the file name and the +# names used for the macros: +# +# .. code-block:: cmake +# +# add_library(somelib someclass.cpp) +# generate_export_header(somelib +# BASE_NAME other_name +# ) +# +# +# Generates a file called ``other_name_export.h`` containing the macros +# ``OTHER_NAME_EXPORT``, ``OTHER_NAME_NO_EXPORT`` and ``OTHER_NAME_DEPRECATED`` +# etc. +# +# The ``BASE_NAME`` may be overridden by specifying other options in the +# function. For example: +# +# .. code-block:: cmake +# +# add_library(somelib someclass.cpp) +# generate_export_header(somelib +# EXPORT_MACRO_NAME OTHER_NAME_EXPORT +# ) +# +# +# creates the macro ``OTHER_NAME_EXPORT`` instead of ``SOMELIB_EXPORT``, but +# other macros and the generated file name is as default: +# +# .. code-block:: cmake +# +# add_library(somelib someclass.cpp) +# generate_export_header(somelib +# DEPRECATED_MACRO_NAME KDE_DEPRECATED +# ) +# +# +# creates the macro ``KDE_DEPRECATED`` instead of ``SOMELIB_DEPRECATED``. +# +# If ``LIBRARY_TARGET`` is a static library, macros are defined without +# values. +# +# If the same sources are used to create both a shared and a static +# library, the uppercased symbol ``${BASE_NAME}_STATIC_DEFINE`` should be +# used when building the static library: +# +# .. code-block:: cmake +# +# add_library(shared_variant SHARED ${lib_SRCS}) +# add_library(static_variant ${lib_SRCS}) +# generate_export_header(shared_variant BASE_NAME libshared_and_static) +# set_target_properties(static_variant PROPERTIES +# COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE) +# +# This will cause the export macros to expand to nothing when building +# the static library. +# +# If ``DEFINE_NO_DEPRECATED`` is specified, then a macro +# ``${BASE_NAME}_NO_DEPRECATED`` will be defined This macro can be used to +# remove deprecated code from preprocessor output: +# +# .. code-block:: cmake +# +# option(EXCLUDE_DEPRECATED "Exclude deprecated parts of the library" FALSE) +# if (EXCLUDE_DEPRECATED) +# set(NO_BUILD_DEPRECATED DEFINE_NO_DEPRECATED) +# endif() +# generate_export_header(somelib ${NO_BUILD_DEPRECATED}) +# +# +# And then in somelib: +# +# .. code-block:: c++ +# +# class SOMELIB_EXPORT SomeClass +# { +# public: +# #ifndef SOMELIB_NO_DEPRECATED +# SOMELIB_DEPRECATED void oldMethod(); +# #endif +# }; +# +# .. code-block:: c++ +# +# #ifndef SOMELIB_NO_DEPRECATED +# void SomeClass::oldMethod() { } +# #endif +# +# +# If ``PREFIX_NAME`` is specified, the argument will be used as a prefix to +# all generated macros. +# +# For example: +# +# .. code-block:: cmake +# +# generate_export_header(somelib PREFIX_NAME VTK_) +# +# Generates the macros ``VTK_SOMELIB_EXPORT`` etc. +# +# :: +# +# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# +# The ``ADD_COMPILER_EXPORT_FLAGS`` function adds ``-fvisibility=hidden`` to +# :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` if supported, and is a no-op +# on Windows which does not need extra compiler flags for exporting support. +# You may optionally pass a single argument to ``ADD_COMPILER_EXPORT_FLAGS`` +# that will be populated with the ``CXX_FLAGS`` required to enable visibility +# support for the compiler/architecture in use. +# +# This function is deprecated. Set the target properties +# :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and +# :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead. +# +# The macro ``SOMELIB_EXPORT_TEMPLATE`` should be used when declaring template +# classes or functions. The macro ``SOMELIB_EXPORT_EXPLICIT_TEMPLATE`` should be +# used when compiling explicit instanciations of template classes/functions. + +include(CheckCCompilerFlag) +include(CheckCXXCompilerFlag) + +# TODO: Install this macro separately? +macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT) + check_cxx_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } + int main() { return somefunc();}" ${_RESULT} + ) +endmacro() + +# TODO: Install this macro separately? +macro(_check_c_compiler_attribute _ATTRIBUTE _RESULT) + check_c_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } + int main() { return somefunc();}" ${_RESULT} + ) +endmacro() + +macro(_test_compiler_hidden_visibility) + + if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2") + set(GCC_TOO_OLD TRUE) + elseif(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2") + set(GCC_TOO_OLD TRUE) + elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0") + set(_INTEL_TOO_OLD TRUE) + endif() + + # Exclude XL here because it misinterprets -fvisibility=hidden even though + # the check_cxx_compiler_flag passes + if(NOT GCC_TOO_OLD + AND NOT _INTEL_TOO_OLD + AND NOT WIN32 + AND NOT CYGWIN + AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL + AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI + AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom) + if (CMAKE_CXX_COMPILER_LOADED) + check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) + check_cxx_compiler_flag(-fvisibility-inlines-hidden + COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) + else() + check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) + check_c_compiler_flag(-fvisibility-inlines-hidden + COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) + endif() + endif() +endmacro() + +macro(_test_compiler_has_deprecated) + # NOTE: Some Embarcadero compilers silently compile __declspec(deprecated) + # without error, but this is not a documented feature and the attribute does + # not actually generate any warnings. + if(CMAKE_CXX_COMPILER_ID MATCHES Borland + OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero + OR CMAKE_CXX_COMPILER_ID MATCHES HP + OR GCC_TOO_OLD + OR CMAKE_CXX_COMPILER_ID MATCHES PGI + OR CMAKE_CXX_COMPILER_ID MATCHES Watcom) + set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL + "Compiler support for a deprecated attribute") + else() + if (CMAKE_CXX_COMPILER_LOADED) + _check_cxx_compiler_attribute("__attribute__((__deprecated__))" + COMPILER_HAS_DEPRECATED_ATTR) + if(COMPILER_HAS_DEPRECATED_ATTR) + set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}" + CACHE INTERNAL "Compiler support for a deprecated attribute") + else() + _check_cxx_compiler_attribute("__declspec(deprecated)" + COMPILER_HAS_DEPRECATED) + endif() + else() + _check_c_compiler_attribute("__attribute__((__deprecated__))" + COMPILER_HAS_DEPRECATED_ATTR) + if(COMPILER_HAS_DEPRECATED_ATTR) + set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}" + CACHE INTERNAL "Compiler support for a deprecated attribute") + else() + _check_c_compiler_attribute("__declspec(deprecated)" + COMPILER_HAS_DEPRECATED) + endif() + + endif() + endif() +endmacro() + +get_filename_component(_GENERATE_EXPORT_HEADER_MODULE_DIR + "${CMAKE_CURRENT_LIST_FILE}" PATH) + +macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) + set(DEFINE_DEPRECATED) + set(DEFINE_EXPORT) + set(DEFINE_IMPORT) + set(DEFINE_NO_EXPORT) + + if (COMPILER_HAS_DEPRECATED_ATTR) + set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") + elseif(COMPILER_HAS_DEPRECATED) + set(DEFINE_DEPRECATED "__declspec(deprecated)") + endif() + + get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) + + if(NOT ${type} STREQUAL "STATIC_LIBRARY") + if(WIN32 OR CYGWIN) + set(DEFINE_EXPORT "__declspec(dllexport)") + set(DEFINE_IMPORT "__declspec(dllimport)") + set(DEFINE_TEMPLATE_EXPORT "") + set(DEFINE_TEMPLATE_IMPORT "") + set(DEFINE_EXPLICIT_TEMPLATE_EXPORT ${DEFINE_EXPORT}) + set(DEFINE_EXPLICIT_TEMPLATE_IMPORT ${DEFINE_IMPORT}) + elseif(COMPILER_HAS_HIDDEN_VISIBILITY) + set(DEFINE_EXPORT "__attribute__((visibility(\"default\")))") + set(DEFINE_IMPORT "__attribute__((visibility(\"default\")))") + set(DEFINE_TEMPLATE_EXPORT ${DEFINE_EXPORT}) + set(DEFINE_TEMPLATE_IMPORT ${DEFINE_IMPORT}) + set(DEFINE_EXPLICIT_TEMPLATE_EXPORT "") + set(DEFINE_EXPLICIT_TEMPLATE_IMPORT "") + set(DEFINE_NO_EXPORT "__attribute__((visibility(\"hidden\")))") + endif() + endif() +endmacro() + +macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) + # Option overrides + set(options DEFINE_NO_DEPRECATED) + set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME + DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE + NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE INCLUDE_GUARD_NAME) + set(multiValueArgs) + + cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}" + ${ARGN}) + + set(BASE_NAME "${TARGET_LIBRARY}") + + if(_GEH_BASE_NAME) + set(BASE_NAME ${_GEH_BASE_NAME}) + endif() + + string(TOUPPER ${BASE_NAME} BASE_NAME_UPPER) + string(TOLOWER ${BASE_NAME} BASE_NAME_LOWER) + + # Default options + set(EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_EXPORT") + set(EXPORT_TEMPLATE_MACRO_NAME "${EXPORT_TEMPLATE_MACRO_NAME}_TEMPLATE") + set(EXPORT_EXPLICIT_TEMPLATE_MACRO_NAME "${EXPORT_MACRO_NAME}_EXPLICIT_TEMPLATE") + set(NO_EXPORT_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_EXPORT") + set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${BASE_NAME_LOWER}_export.h") + set(DEPRECATED_MACRO_NAME "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_DEPRECATED") + set(STATIC_DEFINE "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_STATIC_DEFINE") + set(NO_DEPRECATED_MACRO_NAME + "${_GEH_PREFIX_NAME}${BASE_NAME_UPPER}_NO_DEPRECATED") + + if(_GEH_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to GENERATE_EXPORT_HEADER(): \"${_GEH_UNPARSED_ARGUMENTS}\"") + endif() + + if(_GEH_EXPORT_MACRO_NAME) + set(EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_EXPORT_MACRO_NAME}) + set(EXPORT_TEMPLATE_MACRO_NAME "${EXPORT_MACRO_NAME}_TEMPLATE") + set(EXPORT_EXPLICIT_TEMPLATE_MACRO_NAME "${EXPORT_MACRO_NAME}_EXPLICIT_TEMPLATE") + + endif() + string(MAKE_C_IDENTIFIER ${EXPORT_MACRO_NAME} EXPORT_MACRO_NAME) + if(_GEH_EXPORT_FILE_NAME) + if(IS_ABSOLUTE ${_GEH_EXPORT_FILE_NAME}) + set(EXPORT_FILE_NAME ${_GEH_EXPORT_FILE_NAME}) + else() + set(EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/${_GEH_EXPORT_FILE_NAME}") + endif() + endif() + if(_GEH_DEPRECATED_MACRO_NAME) + set(DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_DEPRECATED_MACRO_NAME}) + endif() + string(MAKE_C_IDENTIFIER ${DEPRECATED_MACRO_NAME} DEPRECATED_MACRO_NAME) + if(_GEH_NO_EXPORT_MACRO_NAME) + set(NO_EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_EXPORT_MACRO_NAME}) + endif() + string(MAKE_C_IDENTIFIER ${NO_EXPORT_MACRO_NAME} NO_EXPORT_MACRO_NAME) + if(_GEH_STATIC_DEFINE) + set(STATIC_DEFINE ${_GEH_PREFIX_NAME}${_GEH_STATIC_DEFINE}) + endif() + string(MAKE_C_IDENTIFIER ${STATIC_DEFINE} STATIC_DEFINE) + + if(_GEH_DEFINE_NO_DEPRECATED) + set(DEFINE_NO_DEPRECATED 1) + else() + set(DEFINE_NO_DEPRECATED 0) + endif() + + if(_GEH_NO_DEPRECATED_MACRO_NAME) + set(NO_DEPRECATED_MACRO_NAME + ${_GEH_PREFIX_NAME}${_GEH_NO_DEPRECATED_MACRO_NAME}) + endif() + string(MAKE_C_IDENTIFIER ${NO_DEPRECATED_MACRO_NAME} NO_DEPRECATED_MACRO_NAME) + + if(_GEH_INCLUDE_GUARD_NAME) + set(INCLUDE_GUARD_NAME ${_GEH_INCLUDE_GUARD_NAME}) + else() + set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H") + endif() + + get_target_property(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY} DEFINE_SYMBOL) + + if(NOT EXPORT_IMPORT_CONDITION) + set(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY}_EXPORTS) + endif() + string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION) + + if(_GEH_CUSTOM_CONTENT_FROM_VARIABLE) + if(DEFINED "${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}") + set(CUSTOM_CONTENT "${${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}}") + else() + set(CUSTOM_CONTENT "") + endif() + endif() + + configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in" + "${EXPORT_FILE_NAME}" @ONLY) +endmacro() + +function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) + get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) + if(NOT ${type} STREQUAL "STATIC_LIBRARY" + AND NOT ${type} STREQUAL "SHARED_LIBRARY" + AND NOT ${type} STREQUAL "OBJECT_LIBRARY" + AND NOT ${type} STREQUAL "MODULE_LIBRARY") + message(WARNING "This macro can only be used with libraries") + return() + endif() + _test_compiler_hidden_visibility() + _test_compiler_has_deprecated() + _do_set_macro_values(${TARGET_LIBRARY}) + _do_generate_export_header(${TARGET_LIBRARY} ${ARGN}) +endfunction() + +function(add_compiler_export_flags) + if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) + message(DEPRECATION "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.") + endif() + + _test_compiler_hidden_visibility() + _test_compiler_has_deprecated() + + option(USE_COMPILER_HIDDEN_VISIBILITY + "Use HIDDEN visibility support if available." ON) + mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY) + if(NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY)) + # Just return if there are no flags to add. + return() + endif() + + set (EXTRA_FLAGS "-fvisibility=hidden") + + if(COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) + set (EXTRA_FLAGS "${EXTRA_FLAGS} -fvisibility-inlines-hidden") + endif() + + # Either return the extra flags needed in the supplied argument, or to the + # CMAKE_CXX_FLAGS if no argument is supplied. + if(ARGC GREATER 0) + set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE) + else() + string(APPEND CMAKE_CXX_FLAGS " ${EXTRA_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" PARENT_SCOPE) + endif() +endfunction() diff --git a/CMake/OTBModuleMacros.cmake b/CMake/OTBModuleMacros.cmake index 1266cd8aea5322f9db23b5dec6c2f4ded9e8803f..4cde0c39e3dc38346559b0db1716854dff1c8b3e 100644 --- a/CMake/OTBModuleMacros.cmake +++ b/CMake/OTBModuleMacros.cmake @@ -37,7 +37,7 @@ elseif(APPLE) set( USE_COMPILER_HIDDEN_VISIBILITY OFF CACHE INTERNAL "" ) endif() -include(GenerateExportHeader) +include(GenerateExportHeaderCustom) if(OTB_CPPCHECK_TEST) include(${_OTBModuleMacros_DIR}/OTBModuleCPPCheckTest.cmake) diff --git a/CMake/exportheader.cmake.in b/CMake/exportheader.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..2c41ce67de532b79117c7ec75a8450a09119aa26 --- /dev/null +++ b/CMake/exportheader.cmake.in @@ -0,0 +1,57 @@ + +#ifndef @INCLUDE_GUARD_NAME@ +#define @INCLUDE_GUARD_NAME@ + +#ifdef @STATIC_DEFINE@ +# define @EXPORT_MACRO_NAME@ +# define @NO_EXPORT_MACRO_NAME@ +# define @EXPORT_TEMPLATE_MACRO_NAME@ +# define @EXPORT_EXPLICIT_TEMPLATE_MACRO_NAME@ +#else +# ifndef @EXPORT_MACRO_NAME@ +# ifdef @EXPORT_IMPORT_CONDITION@ + /* We are building this library */ +# define @EXPORT_MACRO_NAME@ @DEFINE_EXPORT@ +# else + /* We are using this library */ +# define @EXPORT_MACRO_NAME@ @DEFINE_IMPORT@ +# endif +# endif +# ifndef @EXPORT_TEMPLATE_MACRO_NAME@ + /* We are building this library */ +# define @EXPORT_TEMPLATE_MACRO_NAME@ @DEFINE_TEMPLATE_EXPORT@ +# else + /* We are using this library */ +# define @EXPORT_TEMPLATE_MACRO_NAME@ @DEFINE_TEMPLATE_IMPORT@ +# endif +# ifndef @EXPORT_EXPLICIT_TEMPLATE_MACRO_NAME@ + /* We are building this library */ +# define @EXPORT_EXPLICIT_TEMPLATE_MACRO_NAME@ @DEFINE_EXPLICIT_TEMPLATE_EXPORT@ +# else + /* We are using this library */ +# define @EXPORT_EXPLICIT_TEMPLATE_MACRO_NAME@ @DEFINE_EXPLICIT_TEMPLATE_IMPORT@ +# endif +# ifndef @NO_EXPORT_MACRO_NAME@ +# define @NO_EXPORT_MACRO_NAME@ @DEFINE_NO_EXPORT@ +# endif +#endif + +#ifndef @DEPRECATED_MACRO_NAME@ +# define @DEPRECATED_MACRO_NAME@ @DEFINE_DEPRECATED@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_EXPORT +# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT +# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ +#endif + +#if @DEFINE_NO_DEPRECATED@ /* DEFINE_NO_DEPRECATED */ +# ifndef @NO_DEPRECATED_MACRO_NAME@ +# define @NO_DEPRECATED_MACRO_NAME@ +# endif +#endif +@CUSTOM_CONTENT@ +#endif /* @INCLUDE_GUARD_NAME@ */ diff --git a/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h b/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h index dbca823f39cee3782affc548902deef4b9ee9b7b..950c5574131a893ac884212830562c0f3923b77f 100644 --- a/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h +++ b/Modules/Core/ImageBase/include/otbConvertPixelBuffer.h @@ -24,6 +24,7 @@ #include <complex> #include "itkObject.h" +#include "OTBImageBaseExport.h" namespace otb { @@ -46,7 +47,7 @@ template < typename OutputPixelType, class OutputConvertTraits > -class ConvertPixelBuffer +class OTBImageBase_EXPORT_TEMPLATE ConvertPixelBuffer { public: /** Determine the output data type. */ diff --git a/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h b/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h index cf465840088abb0e274b6b8f4a7999a2dc6c107d..0f9067223c137d37d794940df64e1e0040a53a4d 100644 --- a/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h +++ b/Modules/Core/ImageBase/include/otbDefaultConvertPixelTraits.h @@ -22,13 +22,14 @@ #define otbDefaultConvertPixelTraits_h #include "itkDefaultConvertPixelTraits.h" +#include "OTBImageBaseExport.h" namespace otb { template < typename PixelType> -class DefaultConvertPixelTraits +class OTBImageBase_EXPORT_TEMPLATE DefaultConvertPixelTraits : public itk::DefaultConvertPixelTraits < PixelType > { public: diff --git a/Modules/Core/ImageBase/include/otbExtractROI.h b/Modules/Core/ImageBase/include/otbExtractROI.h index a2a294268fc25aa997c9986b17436e8d5524857c..e6346381ed9fb298d6cbd22b0d284880d8589509 100644 --- a/Modules/Core/ImageBase/include/otbExtractROI.h +++ b/Modules/Core/ImageBase/include/otbExtractROI.h @@ -24,6 +24,7 @@ #include "otbExtractROIBase.h" #include "otbImage.h" #include "itkMacro.h" +#include "OTBImageBaseExport.h" namespace otb { @@ -39,7 +40,7 @@ namespace otb * \ingroup OTBImageBase */ template <class TInputPixel, class TOutputPixel> -class ITK_EXPORT ExtractROI : +class OTBImageBase_EXPORT_TEMPLATE ExtractROI : public ExtractROIBase<Image<TInputPixel, 2>, Image<TOutputPixel, 2> > { public: diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.h b/Modules/Core/ImageBase/include/otbExtractROIBase.h index 0fa39bff46f2e415ad18dc45863e0e1542ba009e..913cbc5cd0e92e5b3baa430fed5e85b90302e167 100644 --- a/Modules/Core/ImageBase/include/otbExtractROIBase.h +++ b/Modules/Core/ImageBase/include/otbExtractROIBase.h @@ -45,7 +45,7 @@ namespace otb * \ingroup OTBImageBase */ template <class TInputImage, class TOutputImage> -class ITK_EXPORT ExtractROIBase : +class ExtractROIBase : public itk::ImageToImageFilter<TInputImage, TOutputImage> { public: diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h index 1b7dec317c6c07da3b573454a3aeb37d67ef5959..238c7c06fe20b714cd58749f6e335f6af58b559f 100644 --- a/Modules/Core/ImageBase/include/otbImage.h +++ b/Modules/Core/ImageBase/include/otbImage.h @@ -31,6 +31,7 @@ #endif #include "otbImageMetadataInterfaceBase.h" +#include "OTBImageBaseExport.h" namespace otb { @@ -85,7 +86,7 @@ namespace otb */ template <class TPixel, unsigned int VImageDimension = 2> -class ITK_EXPORT Image : public itk::Image<TPixel, VImageDimension> +class OTBImageBase_EXPORT_TEMPLATE Image : public itk::Image<TPixel, VImageDimension> { public: /** Standard class typedefs. */ @@ -274,4 +275,25 @@ private: #include "otbImage.hxx" #endif +#include <complex> + +namespace otb { + +// Prevent implicit instanciation of common types to improve build performance +// Explicit instanciations are provided in the .cxx +extern template class OTBImageBase_EXPORT_TEMPLATE Image<unsigned int, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<int, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<unsigned char, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<char, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<unsigned short, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<short, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<float, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<double, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<std::complex<int> , 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<std::complex<short> , 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<std::complex<float> , 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE Image<std::complex<double> , 2>; + +} + #endif diff --git a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h index 4beb338e77ad403bacd77ab8a96fce3bc5229b3d..65ab555a26b2075572182cddf5e74f86ce6fb710 100644 --- a/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h +++ b/Modules/Core/ImageBase/include/otbImageFunctionAdaptor.h @@ -24,7 +24,7 @@ #include "itkImageFunction.h" #include "otbVariableLengthVectorConverter.h" - +#include "OTBImageBaseExport.h" #include <complex> @@ -46,7 +46,7 @@ namespace otb */ template< class TInternalImageFunctionType, class TOutputPrecision = double > -class ITK_EXPORT ImageFunctionAdaptor : +class OTBImageBase_EXPORT_TEMPLATE ImageFunctionAdaptor : public itk::ImageFunction< typename TInternalImageFunctionType::InputImageType, itk::VariableLengthVector<TOutputPrecision>, typename TInternalImageFunctionType::CoordRepType > diff --git a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h index b8436d79c44543b4284e556a50b10794c54d3b7c..80f09033585adca016ae0eb52761bcbe955ee3ac 100644 --- a/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbImageOfVectorsToMonoChannelExtractROI.h @@ -24,6 +24,7 @@ #include "otbExtractROIBase.h" #include "otbImage.h" #include "otbVectorImage.h" +#include "OTBImageBaseExport.h" #include "itkMacro.h" @@ -37,7 +38,7 @@ namespace otb * \ingroup OTBImageBase */ template <class TInputImage, class TOutputImage> -class ITK_EXPORT ImageOfVectorsToMonoChannelExtractROI : +class OTBImageBase_EXPORT_TEMPLATE ImageOfVectorsToMonoChannelExtractROI : public ExtractROIBase<TInputImage, TOutputImage> { public: diff --git a/Modules/Core/ImageBase/include/otbMetaImageFunction.h b/Modules/Core/ImageBase/include/otbMetaImageFunction.h index 0706709486ba55dba36155ee1812675ab2f518ea..a7b0970435e2ddba00c88bd545fcbdbe06ba1e1c 100644 --- a/Modules/Core/ImageBase/include/otbMetaImageFunction.h +++ b/Modules/Core/ImageBase/include/otbMetaImageFunction.h @@ -24,6 +24,7 @@ #include "itkFunctionBase.h" #include "itkPoint.h" #include "itkVariableLengthVector.h" +#include "OTBImageBaseExport.h" #include <vector> @@ -44,7 +45,7 @@ namespace otb * \ingroup OTBImageBase */ template <class TOutputPrecision = double, class TCoordRep = double> -class ITK_EXPORT MetaImageFunction +class OTBImageBase_EXPORT_TEMPLATE MetaImageFunction : public itk::FunctionBase<itk::Point<TCoordRep, 2>, itk::VariableLengthVector<TOutputPrecision> > { diff --git a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h index 76bc3f189875094899ff151b1ba62f0c4098d2e4..6a621a2f911b4290d2b000faca2098f7db0146b5 100644 --- a/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbMultiChannelExtractROI.h @@ -23,6 +23,7 @@ #include "otbExtractROIBase.h" #include "otbVectorImage.h" +#include "OTBImageBaseExport.h" #include "itkMacro.h" #include <vector> @@ -43,7 +44,7 @@ namespace otb * \ingroup OTBImageBase */ template <class TInputPixelType, class TOutputPixelType> -class ITK_EXPORT MultiChannelExtractROI : +class OTBImageBase_EXPORT_TEMPLATE MultiChannelExtractROI : public ExtractROIBase<VectorImage<TInputPixelType, 2>, VectorImage<TOutputPixelType, 2> > { public: diff --git a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h index 8c3647fed39e98a1a21ab3849509d62399dfe4a6..f30ca55b4b336d07caf234bd5e00fc840bbfaf95 100644 --- a/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h +++ b/Modules/Core/ImageBase/include/otbMultiToMonoChannelExtractROI.h @@ -24,6 +24,7 @@ #include "otbExtractROIBase.h" #include "otbImage.h" #include "otbVectorImage.h" +#include "OTBImageBaseExport.h" #include "itkMacro.h" @@ -42,7 +43,7 @@ namespace otb * \ingroup OTBImageBase */ template <class TInputPixelType, class TOutputPixelType> -class ITK_EXPORT MultiToMonoChannelExtractROI : +class OTBImageBase_EXPORT_TEMPLATE MultiToMonoChannelExtractROI : // public ExtractROIBase< itk::VectorImage<TInputPixelType, 2> , itk::Image<TOutputPixelType, 2> > public ExtractROIBase<VectorImage<TInputPixelType, 2>, Image<TOutputPixelType, 2> > { diff --git a/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h b/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h index 1c5f411086f34f81bced50ffd4117086fafba66c..756404c1dfabfd5315eb3894e9c120d2702092c9 100644 --- a/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h +++ b/Modules/Core/ImageBase/include/otbRemoteSensingRegion.h @@ -24,7 +24,7 @@ #include <algorithm> #include <iomanip> - +#include "OTBImageBaseExport.h" #include "otbImageKeywordlist.h" #include "itkImageRegion.h" #include <string> @@ -56,7 +56,7 @@ namespace otb */ template <class TType> -class ITK_EXPORT RemoteSensingRegion : public itk::Region +class OTBImageBase_EXPORT_TEMPLATE RemoteSensingRegion : public itk::Region { public: /** Standard class typedefs. */ diff --git a/Modules/Core/ImageBase/include/otbVectorImage.h b/Modules/Core/ImageBase/include/otbVectorImage.h index 95e18662fc851e16a00f15497f9ef406808f8f56..66f7ebe943ec1da0d8f7591760368016b3f666f2 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.h +++ b/Modules/Core/ImageBase/include/otbVectorImage.h @@ -30,6 +30,7 @@ #include "itkVectorImage.h" #endif #include "otbImageMetadataInterfaceBase.h" +#include "OTBImageBaseExport.h" namespace otb { @@ -40,7 +41,7 @@ namespace otb * \ingroup OTBImageBase */ template <class TPixel, unsigned int VImageDimension = 2> -class ITK_EXPORT VectorImage : public itk::VectorImage<TPixel, VImageDimension> +class OTBImageBase_EXPORT_TEMPLATE VectorImage : public itk::VectorImage<TPixel, VImageDimension> { public: @@ -215,4 +216,25 @@ private: #include "otbVectorImage.hxx" #endif +#include <complex> + +namespace otb { + +// Prevent implicit instanciation of common types to improve build performance +// Explicit instanciations are provided in the .cxx +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned int, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<int, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned char, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<char, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned short, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<short, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<float, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<double, 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<int> , 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<short> , 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<float> , 2>; +extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<double> , 2>; + +} + #endif diff --git a/Modules/Core/ImageBase/src/CMakeLists.txt b/Modules/Core/ImageBase/src/CMakeLists.txt index 2a181ffec795f69ec0764a962d588a1fdb2133c9..33ef6597868ea3683554ded0ec49e0b75f54f156 100644 --- a/Modules/Core/ImageBase/src/CMakeLists.txt +++ b/Modules/Core/ImageBase/src/CMakeLists.txt @@ -20,6 +20,8 @@ set(OTBImageBase_SRC otbImageIOBase.cxx + otbImage.cxx + otbVectorImage.cxx ) add_library(OTBImageBase ${OTBImageBase_SRC}) diff --git a/Modules/Core/ImageBase/src/otbImage.cxx b/Modules/Core/ImageBase/src/otbImage.cxx new file mode 100644 index 0000000000000000000000000000000000000000..af7d4ccdef86682ae88bcca89b94c3735e6bd5b7 --- /dev/null +++ b/Modules/Core/ImageBase/src/otbImage.cxx @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbImage.h" + +namespace otb { + +// Explicit instanciation of common types +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<unsigned int, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<int, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<unsigned char, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<char, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<unsigned short, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<short, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<float, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<double, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<std::complex<int>, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<std::complex<short>, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<std::complex<float>, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE Image<std::complex<double>, 2>; +} diff --git a/Modules/Core/ImageBase/src/otbVectorImage.cxx b/Modules/Core/ImageBase/src/otbVectorImage.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f80d3df6f1c6efce94bfd652944aaa49adab8356 --- /dev/null +++ b/Modules/Core/ImageBase/src/otbVectorImage.cxx @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbVectorImage.h" + +namespace otb { + +// Explicit instanciation of common types +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<unsigned int, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<int, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<unsigned char, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<char, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<unsigned short, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<short, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<float, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<double, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<std::complex<int>, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<std::complex<short>, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<std::complex<float>, 2>; +template class OTBImageBase_EXPORT_EXPLICIT_TEMPLATE VectorImage<std::complex<double>, 2>; + +} + diff --git a/Modules/Core/ObjectList/include/otbObjectList.h b/Modules/Core/ObjectList/include/otbObjectList.h index 762cbfdab53b9770a9cfbe9ee285b94c74be538d..7226fd9044208c04bd76d05c743a15ccd6ea568e 100644 --- a/Modules/Core/ObjectList/include/otbObjectList.h +++ b/Modules/Core/ObjectList/include/otbObjectList.h @@ -180,7 +180,6 @@ public: void Set(ObjectPointerType element) { (*m_Iter) = element; - this->Modified(); } /** * Increment. diff --git a/Modules/Core/ObjectList/include/otbObjectList.hxx b/Modules/Core/ObjectList/include/otbObjectList.hxx index 5d871caf646e85d76c624c9278cc6370abdc716f..e16f824ff5443e683c28604c06043de1f2ca810b 100644 --- a/Modules/Core/ObjectList/include/otbObjectList.hxx +++ b/Modules/Core/ObjectList/include/otbObjectList.hxx @@ -247,7 +247,7 @@ ObjectList<TObject> ::Insert(ReverseIterator position, ObjectPointerType element) { ReverseIterator iter( - InternalContainerType::reverse_iterator( + (typename InternalContainerType::reverse_iterator)( m_InternalContainer.insert(position.GetIter().base(), element) ) ); diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.h b/Modules/IO/ImageIO/include/otbImageFileReader.h index da776603a313ee94fa952bd7b3675271c6e38dc5..126aa251d81dae3d778904d53d261cb678602a50 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageFileReader.h @@ -32,39 +32,17 @@ #include "otbImageIOBase.h" #include "itkExceptionObject.h" #include "itkImageRegion.h" +#include "OTBImageIOExport.h" #include "otbDefaultConvertPixelTraits.h" #include "otbImageKeywordlist.h" #include "otbExtendedFilenameToReaderOptions.h" +#include "otbImageFileReaderException.h" #include <string> namespace otb { -/** \class ImageFileReaderException - * - * \brief Base exception class for IO conflicts. - * - * \ingroup OTBImageIO - */ -class ImageFileReaderException : public itk::ExceptionObject -{ -public: - /** Run-time information. */ - itkTypeMacro( ImageFileReaderException, ExceptionObject ); - - /** Constructor. */ - ImageFileReaderException(const char *file, unsigned int line, - const std::string& desc = "", - const std::string& filename = "") : - ExceptionObject(file, line, desc), - m_Filename(filename) - { - } - - std::string m_Filename; -}; - /** \class ImageFileReader * \brief Reads image data. * @@ -89,7 +67,7 @@ public: template <class TOutputImage, class ConvertPixelTraits=DefaultConvertPixelTraits< typename TOutputImage::IOPixelType > > -class ITK_EXPORT ImageFileReader : public itk::ImageSource<TOutputImage> +class OTBImageIO_EXPORT_TEMPLATE ImageFileReader : public itk::ImageSource<TOutputImage> { public: /** Standard class typedefs. */ @@ -212,4 +190,39 @@ private: #include "otbImageFileReader.hxx" #endif +#include "otbImage.h" +#include "otbVectorImage.h" +#include <complex> + +namespace otb { + +// Prevent implicit instanciation of common types to improve build performance +// Explicit instanciations are provided in the .cxx +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<unsigned int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<unsigned char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<unsigned short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<float, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<double, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<int>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<short>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<float>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<double>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<unsigned int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<unsigned char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<unsigned short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<float, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<double, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<int>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<short>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<float>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<double>, 2>>; + +} + #endif // otbImageFileReader_h diff --git a/Modules/IO/ImageIO/include/otbImageFileReaderException.h b/Modules/IO/ImageIO/include/otbImageFileReaderException.h new file mode 100644 index 0000000000000000000000000000000000000000..46e8c55c3fecc2e2df0f8987bfc28eea2817f8f8 --- /dev/null +++ b/Modules/IO/ImageIO/include/otbImageFileReaderException.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef otbImageFileReaderException_h +#define otbImageFileReaderException_h + +#include "itkMacro.h" +#include "OTBImageIOExport.h" + +namespace otb +{ + +/** \class ImageFileReaderException + * + * \brief Base exception class for IO conflicts. + * + * \ingroup OTBImageIO + */ +class OTBImageIO_EXPORT ImageFileReaderException : public itk::ExceptionObject +{ +public: + /** Run-time information. */ + itkTypeMacro( ImageFileReaderException, ExceptionObject ); + + /** Constructor. */ + ImageFileReaderException(const char *file, unsigned int line, + const std::string& desc = "", + const std::string& filename = ""); + + /** Destructor. */ + ~ImageFileReaderException(); + + std::string m_Filename; +}; +} + +#endif diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.h b/Modules/IO/ImageIO/include/otbImageFileWriter.h index 697363336b0466a54298247191075c0894ab80e3..78edc3e678187d3be206dd3ddbc0464857217f86 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.h +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.h @@ -27,6 +27,7 @@ #include "otbExtendedFilenameToWriterOptions.h" #include "itkFastMutexLock.h" #include <string> +#include "OTBImageIOExport.h" namespace otb { @@ -61,7 +62,7 @@ namespace otb * \ingroup OTBImageIO */ template <class TInputImage> -class ITK_EXPORT ImageFileWriter : public itk::ProcessObject +class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter : public itk::ProcessObject { public: /** Standard class typedefs. */ @@ -290,4 +291,39 @@ private: #include "otbImageFileWriter.hxx" #endif +#include "otbImage.h" +#include "otbVectorImage.h" +#include <complex> + +namespace otb { + +// Prevent implicit instanciation of common types to improve build performance +// Explicit instanciations are provided in the .cxx +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<unsigned int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<unsigned char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<unsigned short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<float, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<double, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<int>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<short>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<float>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<double>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<unsigned int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<int, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<unsigned char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<char, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<unsigned short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<short, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<float, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<double, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<int>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<short>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<float>, 2>>; +extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<double>, 2>>; + +} + #endif diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h index 24fb968217c6460bfc043424086cb961e80f48fd..27657553e414860826f9287ad84ab864ebfdfd52 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h @@ -30,6 +30,7 @@ #include "otbExtractROI.h" #include "otbMultiChannelExtractROI.h" #include "otbMultiToMonoChannelExtractROI.h" +#include "OTBImageIOExport.h" namespace otb { @@ -47,7 +48,7 @@ namespace otb { * \ingroup OTBImageIO */ template <class TImage, class TInternalImage = TImage> -class ITK_EXPORT ImageSeriesFileReader +class OTBImageIO_EXPORT_TEMPLATE ImageSeriesFileReader : public ImageSeriesFileReaderBase<TImage, TInternalImage> { public: diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h index 885352cd31d422621e0daa76f0e8654ef490cf0a..bb4a29b8e1bc0df54530852215035fd4dc9ac181 100644 --- a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h +++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h @@ -64,7 +64,7 @@ public: */ template <class TImage, class TInternalImage = TImage> -class ITK_EXPORT ImageSeriesFileReaderBase +class ImageSeriesFileReaderBase : public ImageListSource<TImage> { public: diff --git a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h index 34b967c996e4c246f73bcba1f906a7db6836bafa..406f70ecdf1b06a5aa6b33922128db70f32a9522 100644 --- a/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h +++ b/Modules/IO/ImageIO/include/otbScalarBufferToImageFileWriter.h @@ -24,6 +24,7 @@ #include "otbVectorImage.h" #include "otbImageFileWriter.h" +#include "OTBImageIOExport.h" namespace otb { @@ -39,7 +40,7 @@ namespace otb */ template <class TBufferType, class TOutputPixelType=TBufferType> -class ITK_EXPORT ScalarBufferToImageFileWriter : public itk::ProcessObject +class OTBImageIO_EXPORT_TEMPLATE ScalarBufferToImageFileWriter : public itk::ProcessObject { public: diff --git a/Modules/IO/ImageIO/src/CMakeLists.txt b/Modules/IO/ImageIO/src/CMakeLists.txt index 610e691c847a42370bc98b4005746a1f8ebcc5a7..b5d1f442476c36ff8ea437d563fe150edd14ef25 100644 --- a/Modules/IO/ImageIO/src/CMakeLists.txt +++ b/Modules/IO/ImageIO/src/CMakeLists.txt @@ -21,6 +21,9 @@ set(OTBImageIO_SRC otbImageIOFactory.cxx otbMultiImageFileWriter.cxx + otbImageFileReader.cxx + otbImageFileWriter.cxx + otbImageFileReaderException.cxx ) add_library(OTBImageIO ${OTBImageIO_SRC}) diff --git a/Modules/IO/ImageIO/src/otbImageFileReader.cxx b/Modules/IO/ImageIO/src/otbImageFileReader.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cf4b2c35ab20b64b744ec90be12abc6caec66538 --- /dev/null +++ b/Modules/IO/ImageIO/src/otbImageFileReader.cxx @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbImageFileReader.h" + +namespace otb { + +// Explicit instanciation of common types +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<float, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<double, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<int>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<short>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<float>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<double>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<unsigned int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<unsigned char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<unsigned short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<float, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<double, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<int>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<short>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<float>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<double>, 2>>; + +} diff --git a/Modules/IO/ImageIO/src/otbImageFileReaderException.cxx b/Modules/IO/ImageIO/src/otbImageFileReaderException.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b4961600a40535097eae296ee53541719513c1df --- /dev/null +++ b/Modules/IO/ImageIO/src/otbImageFileReaderException.cxx @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbImageFileReaderException.h" + +namespace otb { + +ImageFileReaderException::ImageFileReaderException(const char *file, unsigned int line, + const std::string& desc, + const std::string& filename) : + ExceptionObject(file, line, desc), + m_Filename(filename) +{ +} + +ImageFileReaderException::~ImageFileReaderException() +{ +} +} diff --git a/Modules/IO/ImageIO/src/otbImageFileWriter.cxx b/Modules/IO/ImageIO/src/otbImageFileWriter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bfa7a93b58b71f3d56088b4183cfc5627dfbad42 --- /dev/null +++ b/Modules/IO/ImageIO/src/otbImageFileWriter.cxx @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbImageFileWriter.h" + +namespace otb { + +// Explicit instanciation of common types +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<float, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<double, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<int>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<short>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<float>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<double>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<unsigned int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<int, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<unsigned char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<char, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<unsigned short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<short, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<float, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<double, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<int>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<short>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<float>, 2>>; +template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<double>, 2>>; + +} diff --git a/Modules/IO/TestKernel/include/otbTestHelper.h b/Modules/IO/TestKernel/include/otbTestHelper.h index bceefad0760367c95c1084fd85a5818494eaa8cf..a29bb598106d9f09bbd3dd1a1c101fe4bdfe0b80 100644 --- a/Modules/IO/TestKernel/include/otbTestHelper.h +++ b/Modules/IO/TestKernel/include/otbTestHelper.h @@ -30,6 +30,7 @@ #include "otbStringUtils.h" #include "otbMetaDataKey.h" +#include "OTBTestKernelExport.h" class OGRFeature; class OGRGeometry; @@ -43,7 +44,7 @@ namespace otb * * \ingroup OTBTestKernel */ -class ITK_ABI_EXPORT TestHelper : public itk::Object +class OTBTestKernel_EXPORT TestHelper : public itk::Object { public: @@ -59,19 +60,9 @@ public: typedef std::vector<std::string> StringList; typedef StringList::const_iterator StringListIt; - TestHelper() : - m_ToleranceDiffValue(0), - m_Epsilon(0), - m_EpsilonBoundaryChecking(1.0e-30), - m_ReportErrors(false), - m_IgnoreLineOrder(false), - m_MaxArea(1024*1024) - { - m_SpecialTokens.push_back(std::pair<std::string,std::string>( - std::string("Integer"),std::string("Integer64"))); - } - - ~TestHelper() override{} + TestHelper(); + + ~TestHelper() override; int RegressionTestAllImages(const StringList& baselineFilenamesImage, const StringList& testFilenamesImage); diff --git a/Modules/IO/TestKernel/otb-module.cmake b/Modules/IO/TestKernel/otb-module.cmake index 11ea49111dec3026b2265a528a919167c9b9af8d..7b0b1b3c8754a42a5c38f342134047985340098a 100644 --- a/Modules/IO/TestKernel/otb-module.cmake +++ b/Modules/IO/TestKernel/otb-module.cmake @@ -25,6 +25,7 @@ to instantiate it and another one which uses the class. The output of each test the result hasn't changed.") otb_module(OTBTestKernel + ENABLE_SHARED DEPENDS OTBGdalAdapters OTBImageIO diff --git a/Modules/IO/TestKernel/src/otbTestHelper.cxx b/Modules/IO/TestKernel/src/otbTestHelper.cxx index f581789891fd89cd7ef21262f54fbbcfc1aa536e..b6a7d12ee080eab094e278a3435d1d169063237a 100644 --- a/Modules/IO/TestKernel/src/otbTestHelper.cxx +++ b/Modules/IO/TestKernel/src/otbTestHelper.cxx @@ -2651,4 +2651,20 @@ void TestHelper::ogrReportOnLayer(OGRLayer * ref_poLayer, } +TestHelper::TestHelper() : + m_ToleranceDiffValue(0), + m_Epsilon(0), + m_EpsilonBoundaryChecking(1.0e-30), + m_ReportErrors(false), + m_IgnoreLineOrder(false), + m_MaxArea(1024*1024) +{ + m_SpecialTokens.push_back(std::pair<std::string,std::string>( + std::string("Integer"),std::string("Integer64"))); +} + +TestHelper::~TestHelper() +{ +} + }