From fc09dfc8d652d8ee0307152a15849f4e99cd3b56 Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet Date: Tue, 19 Apr 2016 17:27:06 +0200 Subject: [PATCH 1/2] COMP: add ITKCommon_EXPORT to fix link issues with external applications commit 3ed8e8af5215dd545f0955542cfcd204a9a5218d in itk NumericTraits leads to compilation error in orfeo toolbox. I was able to solve them adding ITKCommon_EXPORT macro in the declaration. Not sure to understand why it is necessary as the related commit in ITK seems to handle linkage resolution. The link error related to new declaration of inlined Zero for integers type can be seen on otb dashboard: http://dash.orfeo-toolbox.org/viewBuildError.php?buildid=225288 Configurations for ITK and OTB which leads to the linking issue can also be found on otb git repositories: itk configuration: https://git.orfeo-toolbox.org/otb-devutils.git/blob/HEAD:/Config/pc-christophe/pc-christophe-ITK-trunk.cmake otb configuration: https://git.orfeo-toolbox.org/otb-devutils.git/blob/HEAD:/Config/pc-christophe/pc-christophe-OTB-Nightly-clang-ThirdPartyTrunk.cmake Change-Id: I3b528d2ccdf61c061b84f3ed5417a6eeb771f3dc --- .../Core/Common/include/itkNumericTraits.h | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Modules/Core/Common/include/itkNumericTraits.h b/Modules/Core/Common/include/itkNumericTraits.h index 073e5016a0b..2204d7d361e 100644 --- a/Modules/Core/Common/include/itkNumericTraits.h +++ b/Modules/Core/Common/include/itkNumericTraits.h @@ -302,8 +302,8 @@ class NumericTraits< char > :public std::numeric_limits< char > typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR char Zero = 0; - static ITK_CONSTEXPR char One = 1; + static ITK_CONSTEXPR char ITKCommon_EXPORT Zero = 0; + static ITK_CONSTEXPR char ITKCommon_EXPORT One = 1; static ITK_CONSTEXPR_FUNC char min() { return char(255) < char(0) ? char(-128) : char(0); } static ITK_CONSTEXPR_FUNC char max() { return char(255) < char(0) ? char(127) : char(255); } @@ -366,8 +366,8 @@ class NumericTraits< signed char > :public std::numeric_limits< signed char > typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR signed char Zero = 0; - static ITK_CONSTEXPR signed char One = 1; + static ITK_CONSTEXPR signed char ITKCommon_EXPORT Zero = 0; + static ITK_CONSTEXPR signed char ITKCommon_EXPORT One = 1; static ITK_CONSTEXPR_FUNC signed char min() { return -128; } static ITK_CONSTEXPR_FUNC signed char max() { return 127; } @@ -422,8 +422,8 @@ class NumericTraits< unsigned char > :public std::numeric_limits< unsigned char typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR unsigned char Zero = 0; - static ITK_CONSTEXPR unsigned char One = 1; + static ITK_CONSTEXPR unsigned char ITKCommon_EXPORT Zero = 0; + static ITK_CONSTEXPR unsigned char ITKCommon_EXPORT One = 1; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); @@ -475,8 +475,8 @@ class NumericTraits< short > :public std::numeric_limits< short > typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR short Zero = 0; - static ITK_CONSTEXPR short One = 1; + static ITK_CONSTEXPR short ITKCommon_EXPORT Zero = 0; + static ITK_CONSTEXPR short ITKCommon_EXPORT One = 1; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); static ITK_CONSTEXPR_FUNC short NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } @@ -528,8 +528,8 @@ class NumericTraits< unsigned short > :public std::numeric_limits< unsigned shor typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR unsigned short Zero = 0; - static ITK_CONSTEXPR unsigned short One = 1; + static ITK_CONSTEXPR unsigned short ITKCommon_EXPORT Zero = 0; + static ITK_CONSTEXPR unsigned short ITKCommon_EXPORT One = 1; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); static ITK_CONSTEXPR_FUNC unsigned short NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } @@ -580,8 +580,8 @@ class NumericTraits< int > :public std::numeric_limits< int > typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR int Zero = 0; - static ITK_CONSTEXPR int One = 1; + static ITK_CONSTEXPR int ITKCommon_EXPORT Zero = 0; + static ITK_CONSTEXPR int ITKCommon_EXPORT One = 1; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); static ITK_CONSTEXPR_FUNC int NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } @@ -633,8 +633,8 @@ class NumericTraits< unsigned int > :public std::numeric_limits< unsigned int > typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR unsigned int Zero = 0; - static ITK_CONSTEXPR unsigned int One = 1; + static ITK_CONSTEXPR unsigned int ITKCommon_EXPORT Zero = 0; + static ITK_CONSTEXPR unsigned int ITKCommon_EXPORT One = 1; static ITK_CONSTEXPR_FUNC unsigned int min(void) { return 0; } static ITK_CONSTEXPR_FUNC unsigned int max(void) { return static_cast< unsigned int >( -1 ); } @@ -689,8 +689,8 @@ class NumericTraits< long > :public std::numeric_limits< long > typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR long Zero = 0L; - static ITK_CONSTEXPR long One = 1L; + static ITK_CONSTEXPR long ITKCommon_EXPORT Zero = 0L; + static ITK_CONSTEXPR long ITKCommon_EXPORT One = 1L; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); static ITK_CONSTEXPR_FUNC long NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } @@ -742,8 +742,8 @@ class NumericTraits< unsigned long > :public std::numeric_limits< unsigned long typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR unsigned long Zero = 0UL; - static ITK_CONSTEXPR unsigned long One = 1UL; + static ITK_CONSTEXPR unsigned long ITKCommon_EXPORT Zero = 0UL; + static ITK_CONSTEXPR unsigned long ITKCommon_EXPORT One = 1UL; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); static ITK_CONSTEXPR_FUNC unsigned long NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } From bd49c10ac2aeebab1c90906e6b9b6b79f8b8a7c7 Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet Date: Wed, 20 Apr 2016 09:30:23 +0200 Subject: [PATCH 2/2] COMP: add ITKCommon_EXPORT for remaining integers types Change-Id: I0fe477009d2a209a0893347989d3d912b71c9ce6 --- Modules/Core/Common/include/itkNumericTraits.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/Core/Common/include/itkNumericTraits.h b/Modules/Core/Common/include/itkNumericTraits.h index 2204d7d361e..3d07be610b6 100644 --- a/Modules/Core/Common/include/itkNumericTraits.h +++ b/Modules/Core/Common/include/itkNumericTraits.h @@ -965,8 +965,8 @@ class NumericTraits< long long > : typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR ValueType Zero = 0LL; - static ITK_CONSTEXPR ValueType One = 1LL; + static ITK_CONSTEXPR ValueType ITKCommon_EXPORT Zero = 0LL; + static ITK_CONSTEXPR ValueType ITKCommon_EXPORT One = 1LL; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); static ITK_CONSTEXPR_FUNC ValueType NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } @@ -1019,8 +1019,8 @@ class NumericTraits< unsigned long long > : typedef float FloatType; typedef FixedArray MeasurementVectorType; - static ITK_CONSTEXPR ValueType Zero = 0ULL; - static ITK_CONSTEXPR ValueType One = 1ULL; + static ITK_CONSTEXPR ValueType ITKCommon_EXPORT Zero = 0ULL; + static ITK_CONSTEXPR ValueType ITKCommon_EXPORT One = 1ULL; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); static ITK_CONSTEXPR_FUNC ValueType NonpositiveMin() { return std::numeric_limits< ValueType >::min(); }