From 2c12f636b3e5784fa9f452320cc4f7cdc8c657f9 Mon Sep 17 00:00:00 2001 From: Gennady Pospelov <g.pospelov@fz-juelich.de> Date: Tue, 27 Oct 2015 14:53:51 +0100 Subject: [PATCH] Bunch of BA_CORE_API for windows compilation. --- Core/Geometry/inc/Ellipse.h | 2 +- Core/Geometry/inc/Line.h | 6 ++-- Core/Geometry/inc/Polygon.h | 2 +- Core/Geometry/inc/Rectangle.h | 2 +- Core/Tools/inc/Histogram1D.h | 2 +- Core/Tools/inc/Histogram2D.h | 2 +- Core/Tools/inc/IHistogram.h | 2 +- .../UnitTests/TestCore/CumulativeValueTest.h | 4 +-- cmake/modules/FindTIFF.cmake | 36 +++++++++++-------- cmake/modules/SearchInstalledSoftware.cmake | 2 +- 10 files changed, 33 insertions(+), 27 deletions(-) diff --git a/Core/Geometry/inc/Ellipse.h b/Core/Geometry/inc/Ellipse.h index 893576cf803..9109517db07 100644 --- a/Core/Geometry/inc/Ellipse.h +++ b/Core/Geometry/inc/Ellipse.h @@ -25,7 +25,7 @@ namespace Geometry { //! @ingroup tools //! @brief Ellipse shape -class Ellipse : public IShape2D { +class BA_CORE_API_ Ellipse : public IShape2D { public: //! Ellipse constructor //! @param xcenter x-coordinate of Ellipse's center diff --git a/Core/Geometry/inc/Line.h b/Core/Geometry/inc/Line.h index 6584ea20164..7ddf8e6def3 100644 --- a/Core/Geometry/inc/Line.h +++ b/Core/Geometry/inc/Line.h @@ -25,7 +25,7 @@ namespace Geometry { //! @ingroup tools //! @brief The line segment -class Line : public IShape2D { +class BA_CORE_API_ Line : public IShape2D { public: //! Line segment constructor Line(double x1, double y1, double x2, double y2); @@ -47,7 +47,7 @@ private: //! @ingroup tools //! @brief Vertical infinite line -class VerticalLine : public IShape2D { +class BA_CORE_API_ VerticalLine : public IShape2D { public: //! Infinite vertical line constructor //! @param x The value at which it crosses x-axes @@ -70,7 +70,7 @@ private: //! @ingroup tools //! @brief Horizontal infinite line -class HorizontalLine : public IShape2D { +class BA_CORE_API_ HorizontalLine : public IShape2D { public: //! Infinite vertical line constructor //! @param y The value at which it crosses y-axes diff --git a/Core/Geometry/inc/Polygon.h b/Core/Geometry/inc/Polygon.h index d261b2a7fe7..a8bb16cda50 100644 --- a/Core/Geometry/inc/Polygon.h +++ b/Core/Geometry/inc/Polygon.h @@ -27,7 +27,7 @@ class PolygonPrivate; //! @ingroup tools //! @brief The polygon in 2D space -class Polygon : public IShape2D { +class BA_CORE_API_ Polygon : public IShape2D { public: //! Polygon defined by two arrays with x and y coordinates of points. //! Sizes of arrays should coincide. If polygon is unclosed (the last point diff --git a/Core/Geometry/inc/Rectangle.h b/Core/Geometry/inc/Rectangle.h index 66230efaa3f..5687bd670a8 100644 --- a/Core/Geometry/inc/Rectangle.h +++ b/Core/Geometry/inc/Rectangle.h @@ -25,7 +25,7 @@ namespace Geometry { //! @ingroup tools //! @brief The rectangle shape having its axis aligned to the coordinate system (non-rotated so far). -class Rectangle : public IShape2D { +class BA_CORE_API_ Rectangle : public IShape2D { public: //! Rectangle constructor with lower left and upper right coordinates //! @param xlow x-coordinate of lower left corner diff --git a/Core/Tools/inc/Histogram1D.h b/Core/Tools/inc/Histogram1D.h index ed5454f4f3a..48a27901498 100644 --- a/Core/Tools/inc/Histogram1D.h +++ b/Core/Tools/inc/Histogram1D.h @@ -22,7 +22,7 @@ ////! @ingroup tools ////! @brief One dimensional histogram -class Histogram1D : public IHistogram +class BA_CORE_API_ Histogram1D : public IHistogram { public: //! Constructor for fix bin size histograms. diff --git a/Core/Tools/inc/Histogram2D.h b/Core/Tools/inc/Histogram2D.h index c2e725d7815..12e74bee525 100644 --- a/Core/Tools/inc/Histogram2D.h +++ b/Core/Tools/inc/Histogram2D.h @@ -31,7 +31,7 @@ typedef _object PyObject; ////! @ingroup tools ////! @brief Two dimensional histogram -class Histogram2D : public IHistogram +class BA_CORE_API_ Histogram2D : public IHistogram { public: //! Constructor for fix bin size histograms. diff --git a/Core/Tools/inc/IHistogram.h b/Core/Tools/inc/IHistogram.h index 76e0a4c3e7e..2ee92d66128 100644 --- a/Core/Tools/inc/IHistogram.h +++ b/Core/Tools/inc/IHistogram.h @@ -33,7 +33,7 @@ class Histogram2D; //! @ingroup tools //! @brief Base class for 1D and 2D histograms holding values of double type -class IHistogram +class BA_CORE_API_ IHistogram { public: enum DataType {INTEGRAL, AVERAGE, ERROR, NENTRIES}; diff --git a/Tests/UnitTests/TestCore/CumulativeValueTest.h b/Tests/UnitTests/TestCore/CumulativeValueTest.h index 882fe59f65e..ecb69a5912f 100644 --- a/Tests/UnitTests/TestCore/CumulativeValueTest.h +++ b/Tests/UnitTests/TestCore/CumulativeValueTest.h @@ -65,14 +65,14 @@ TEST_F(CumulativeValueTest, AddValuesWithWeights) EXPECT_EQ(2, cv1.getNumberOfEntries()); EXPECT_DOUBLE_EQ(4.0, cv1.getContent()); EXPECT_DOUBLE_EQ(1.5, cv1.getAverage()); - EXPECT_FLOAT_EQ(0.75, cv1.getRMS()*cv1.getRMS()); + EXPECT_FLOAT_EQ(0.75, (float)cv1.getRMS()*cv1.getRMS()); cv1.add(3.0); cv1.add(3.0); EXPECT_EQ(4, cv1.getNumberOfEntries()); EXPECT_DOUBLE_EQ(10.0, cv1.getContent()); EXPECT_DOUBLE_EQ(2.0, cv1.getAverage()); - EXPECT_FLOAT_EQ(1.0, cv1.getRMS()); + EXPECT_FLOAT_EQ(1.0, (float)cv1.getRMS()); } TEST_F(CumulativeValueTest, Comparison) diff --git a/cmake/modules/FindTIFF.cmake b/cmake/modules/FindTIFF.cmake index ecef9c41e0f..172418627b7 100644 --- a/cmake/modules/FindTIFF.cmake +++ b/cmake/modules/FindTIFF.cmake @@ -31,10 +31,14 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -find_path(TIFF_INCLUDE_DIR tiff.h QUIET) +if(WIN32) + find_path(TIFF_INCLUDE_DIR tiff.h PATHS ${CMAKE_INCLUDE_PATH}/libtiff) +else() + find_path(TIFF_INCLUDE_DIR tiff.h) +endif() set(TIFF_NAMES ${TIFF_NAMES} tiff libtiff tiff3 libtiff3) -find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES} QUIET) +find_library(TIFF_LIBRARY NAMES ${TIFF_NAMES}) if(TIFF_INCLUDE_DIR AND EXISTS "${TIFF_INCLUDE_DIR}/tiffvers.h") file(STRINGS "${TIFF_INCLUDE_DIR}/tiffvers.h" tiff_version_str @@ -60,21 +64,23 @@ if(TIFF_FOUND) message(STATUS "Found Tiff version ${TIFF_VERSION_STRING}") message(STATUS "--> TIFF_INCLUDE_DIR: ${TIFF_INCLUDE_DIR} TIFF_LIBRARIES: ${TIFF_LIBRARIES}") - # looking for C++ version of library - list(LENGTH TIFF_LIBRARIES len) - if(len EQUAL 1) - get_filename_component(tiff_library_name ${TIFF_LIBRARIES} NAME_WE ) - get_filename_component(tiff_path ${TIFF_LIBRARIES} DIRECTORY ) - set(cpp_tiff_library "${tiff_path}/${tiff_library_name}xx.so") - if(EXISTS ${cpp_tiff_library}) - set(TIFF_LIBRARIES ${TIFF_LIBRARIES};${cpp_tiff_library}) - message(STATUS "--> Adding to the path also C++ version TIFF_LIBRARIES:${TIFF_LIBRARIES}") - else() - message(STATUS "--> Can't find C++ version ${cpp_tiff_library}. Will proceed as if TIFF is absent on the system.") - set(TIFF_FOUND FALSE) + if(NOT WIN32) + # looking for C++ version of library + list(LENGTH TIFF_LIBRARIES len) + if(len EQUAL 1) + get_filename_component(tiff_library_name ${TIFF_LIBRARIES} NAME_WE ) + get_filename_component(tiff_path ${TIFF_LIBRARIES} DIRECTORY ) + get_filename_component(tiff_ext ${TIFF_LIBRARIES} EXT ) + set(cpp_tiff_library "${tiff_path}/${tiff_library_name}xx.${tiff_ext}") + if(EXISTS ${cpp_tiff_library}) + set(TIFF_LIBRARIES ${TIFF_LIBRARIES};${cpp_tiff_library}) + message(STATUS "--> Adding to the path also C++ version TIFF_LIBRARIES:${TIFF_LIBRARIES}") + else() + message(WARNING "--> Can't find C++ version ${cpp_tiff_library}. Compilation may fail.") + endif() endif() endif() - + message(STATUS "--> TIFF_INCLUDE_DIR: ${TIFF_INCLUDE_DIR} TIFF_LIBRARIES: ${TIFF_LIBRARIES}") endif() diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake index bc0fb0b816d..218de3afc49 100644 --- a/cmake/modules/SearchInstalledSoftware.cmake +++ b/cmake/modules/SearchInstalledSoftware.cmake @@ -40,7 +40,7 @@ find_package(GSL REQUIRED) # Tiff # ----------------------------------------------------------------------------- if(BORNAGAIN_TIFF_SUPPORT) -# find_package(TIFF) + find_package(TIFF REQUIRED) if(NOT TIFF_FOUND) message(STATUS "No TIFF library found, local version will be build.") endif() -- GitLab