From 9a71b30e7a57a4044c8e8a20b434c7ceac0daffd Mon Sep 17 00:00:00 2001
From: Simon Heybrock <simon.heybrock@esss.se>
Date: Fri, 15 Apr 2016 10:48:57 +0200
Subject: [PATCH] Re #16086. WIP creating Histogram module.

---
 Framework/CMakeLists.txt                      |  6 +-
 Framework/Histogram/CMakeLists.txt            | 61 +++++++++++++++++++
 .../inc/MantidHistogram}/BinEdges.h           |  0
 .../inc/MantidHistogram}/ConstIterable.h      |  0
 .../Histogram/inc/MantidHistogram/DllConfig.h | 37 +++++++++++
 .../inc/MantidHistogram}/Histogram.h          |  0
 .../inc/MantidHistogram}/HistogramData.h      |  0
 .../inc/MantidHistogram}/HistogramX.h         |  0
 .../inc/MantidHistogram}/Points.h             |  0
 .../inc/MantidHistogram}/VectorOf.h           |  0
 .../Histogram => Histogram/src}/BinEdges.cpp  |  0
 .../Histogram => Histogram/src}/Histogram.cpp |  0
 .../src}/HistogramX.cpp                       |  0
 .../Histogram => Histogram/src}/Points.cpp    |  0
 .../test/BinEdgesTest.h}                      |  0
 Framework/Histogram/test/CMakeLists.txt       | 16 +++++
 .../test/ConstIterableTest.h}                 |  0
 .../test/HistogramDataTest.h}                 |  0
 .../test/HistogramTest.h                      |  0
 .../test/HistogramXTest.h}                    |  0
 .../test/PointsTest.h}                        |  0
 .../test/VectorOfTest.h}                      |  0
 Framework/Kernel/CMakeLists.txt               | 18 ------
 23 files changed, 119 insertions(+), 19 deletions(-)
 create mode 100644 Framework/Histogram/CMakeLists.txt
 rename Framework/{Kernel/inc/MantidKernel/Histogram => Histogram/inc/MantidHistogram}/BinEdges.h (100%)
 rename Framework/{Kernel/inc/MantidKernel/Histogram => Histogram/inc/MantidHistogram}/ConstIterable.h (100%)
 create mode 100644 Framework/Histogram/inc/MantidHistogram/DllConfig.h
 rename Framework/{Kernel/inc/MantidKernel/Histogram => Histogram/inc/MantidHistogram}/Histogram.h (100%)
 rename Framework/{Kernel/inc/MantidKernel/Histogram => Histogram/inc/MantidHistogram}/HistogramData.h (100%)
 rename Framework/{Kernel/inc/MantidKernel/Histogram => Histogram/inc/MantidHistogram}/HistogramX.h (100%)
 rename Framework/{Kernel/inc/MantidKernel/Histogram => Histogram/inc/MantidHistogram}/Points.h (100%)
 rename Framework/{Kernel/inc/MantidKernel/Histogram => Histogram/inc/MantidHistogram}/VectorOf.h (100%)
 rename Framework/{Kernel/src/Histogram => Histogram/src}/BinEdges.cpp (100%)
 rename Framework/{Kernel/src/Histogram => Histogram/src}/Histogram.cpp (100%)
 rename Framework/{Kernel/src/Histogram => Histogram/src}/HistogramX.cpp (100%)
 rename Framework/{Kernel/src/Histogram => Histogram/src}/Points.cpp (100%)
 rename Framework/{Kernel/test/HistogramBinEdgesTest.h => Histogram/test/BinEdgesTest.h} (100%)
 create mode 100644 Framework/Histogram/test/CMakeLists.txt
 rename Framework/{Kernel/test/HistogramConstIterableTest.h => Histogram/test/ConstIterableTest.h} (100%)
 rename Framework/{Kernel/test/HistogramHistogramDataTest.h => Histogram/test/HistogramDataTest.h} (100%)
 rename Framework/{Kernel => Histogram}/test/HistogramTest.h (100%)
 rename Framework/{Kernel/test/HistogramHistogramXTest.h => Histogram/test/HistogramXTest.h} (100%)
 rename Framework/{Kernel/test/HistogramPointsTest.h => Histogram/test/PointsTest.h} (100%)
 rename Framework/{Kernel/test/HistogramVectorOfTest.h => Histogram/test/VectorOfTest.h} (100%)

diff --git a/Framework/CMakeLists.txt b/Framework/CMakeLists.txt
index 42bf261dc53..0b63e7af95e 100644
--- a/Framework/CMakeLists.txt
+++ b/Framework/CMakeLists.txt
@@ -70,6 +70,10 @@ include_directories (Kernel/inc)
 add_subdirectory (Kernel)
 set ( MANTIDLIBS ${MANTIDLIBS} Kernel )
 
+include_directories (Histogram/inc)
+add_subdirectory (Histogram)
+set ( MANTIDLIBS ${MANTIDLIBS} Histogram )
+
 include_directories (Geometry/inc)
 # muParser needed by Geometry and subsequent packages
 include_directories ( ${MUPARSER_INCLUDE_DIR} )
@@ -131,7 +135,7 @@ add_subdirectory (ISISLiveData)
 # Add a custom target to build all of the Framework
 ###########################################################################
 
-set ( FRAMEWORK_LIBS Kernel Geometry API DataObjects
+set ( FRAMEWORK_LIBS Kernel Histogram Geometry API DataObjects
                      PythonKernelModule PythonGeometryModule PythonAPIModule
                      PythonDataObjectsModule
                      DataHandling Nexus Algorithms CurveFitting ICat
diff --git a/Framework/Histogram/CMakeLists.txt b/Framework/Histogram/CMakeLists.txt
new file mode 100644
index 00000000000..f1a67c5d71d
--- /dev/null
+++ b/Framework/Histogram/CMakeLists.txt
@@ -0,0 +1,61 @@
+set ( SRC_FILES
+  src/BinEdges.cpp
+  src/Histogram.cpp
+  src/HistogramX.cpp
+  src/Points.cpp
+  )
+
+set ( INC_FILES
+  inc/MantidHistogram/BinEdges.h
+  inc/MantidHistogram/ConstIterable.h
+  inc/MantidHistogram/Histogram.h
+  inc/MantidHistogram/HistogramData.h
+  inc/MantidHistogram/HistogramX.h
+  inc/MantidHistogram/Points.h
+  inc/MantidHistogram/VectorOf.h
+  )
+
+set ( TEST_FILES
+  HistogramDataTest.h
+  BinEdgesTest.h
+  ConstIterableTest.h
+  HistogramXTest.h
+  PointsTest.h
+  HistogramTest.h
+  VectorOfTest.h
+  )
+
+if (COVERALLS)
+  foreach( loop_var ${SRC_FILES} ${INC_FILES})
+    set_property(GLOBAL APPEND PROPERTY COVERAGE_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/${loop_var}")
+  endforeach(loop_var)
+endif()
+
+if(UNITY_BUILD)
+  include(UnityBuild)
+  enable_unity_build(Histogram SRC_FILES SRC_UNITY_IGNORE_FILES 10)
+endif(UNITY_BUILD)
+
+# Add the target for this directory
+add_library ( Histogram ${SRC_FILES} ${INC_FILES} )
+# Set the name of the generated library
+set_target_properties ( Histogram PROPERTIES OUTPUT_NAME MantidHistogram
+  COMPILE_DEFINITIONS IN_MANTID_HISTOGRAM )
+
+if (OSX_VERSION VERSION_GREATER 10.8)
+  set_target_properties ( Histogram PROPERTIES INSTALL_RPATH "@loader_path/../MacOS")
+endif ()
+
+# Add to the 'Framework' group in VS
+set_property ( TARGET Histogram PROPERTY FOLDER "MantidFramework" )
+
+target_link_libraries ( Histogram LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} ${MANTIDLIBS} )
+
+# Add the unit tests directory
+add_subdirectory ( test )
+
+###########################################################################
+# Installation settings
+###########################################################################
+
+install ( TARGETS Histogram  ${SYSTEM_PACKAGE_TARGET} DESTINATION ${LIB_DIR} )
diff --git a/Framework/Kernel/inc/MantidKernel/Histogram/BinEdges.h b/Framework/Histogram/inc/MantidHistogram/BinEdges.h
similarity index 100%
rename from Framework/Kernel/inc/MantidKernel/Histogram/BinEdges.h
rename to Framework/Histogram/inc/MantidHistogram/BinEdges.h
diff --git a/Framework/Kernel/inc/MantidKernel/Histogram/ConstIterable.h b/Framework/Histogram/inc/MantidHistogram/ConstIterable.h
similarity index 100%
rename from Framework/Kernel/inc/MantidKernel/Histogram/ConstIterable.h
rename to Framework/Histogram/inc/MantidHistogram/ConstIterable.h
diff --git a/Framework/Histogram/inc/MantidHistogram/DllConfig.h b/Framework/Histogram/inc/MantidHistogram/DllConfig.h
new file mode 100644
index 00000000000..b2dfc7a76fe
--- /dev/null
+++ b/Framework/Histogram/inc/MantidHistogram/DllConfig.h
@@ -0,0 +1,37 @@
+#ifndef MANTID_HISTOGRAM_DLLCONFIG_H_
+#define MANTID_HISTOGRAM_DLLCONFIG_H_
+
+/*
+  This file contains the DLLExport/DLLImport linkage configuration for the
+  Histogram library
+
+  Copyright &copy; 2016 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
+  National Laboratory & European Spallation Source
+
+  This file is part of Mantid.
+
+  Mantid is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  Mantid is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+  File change history is stored at: <https://github.com/mantidproject/mantid>
+  Code Documentation is available at: <http://doxygen.mantidproject.org>
+*/
+#include "MantidKernel/System.h"
+
+#ifdef IN_MANTID_HISTOGRAM
+#define MANTID_HISTOGRAM_DLL DLLExport
+#else
+#define MANTID_HISTOGRAM_DLL DLLImport
+#endif // IN_MANTID_HISTOGRAM
+
+#endif // MANTID_HISTOGRAM_DLLCONFIG_H_
diff --git a/Framework/Kernel/inc/MantidKernel/Histogram/Histogram.h b/Framework/Histogram/inc/MantidHistogram/Histogram.h
similarity index 100%
rename from Framework/Kernel/inc/MantidKernel/Histogram/Histogram.h
rename to Framework/Histogram/inc/MantidHistogram/Histogram.h
diff --git a/Framework/Kernel/inc/MantidKernel/Histogram/HistogramData.h b/Framework/Histogram/inc/MantidHistogram/HistogramData.h
similarity index 100%
rename from Framework/Kernel/inc/MantidKernel/Histogram/HistogramData.h
rename to Framework/Histogram/inc/MantidHistogram/HistogramData.h
diff --git a/Framework/Kernel/inc/MantidKernel/Histogram/HistogramX.h b/Framework/Histogram/inc/MantidHistogram/HistogramX.h
similarity index 100%
rename from Framework/Kernel/inc/MantidKernel/Histogram/HistogramX.h
rename to Framework/Histogram/inc/MantidHistogram/HistogramX.h
diff --git a/Framework/Kernel/inc/MantidKernel/Histogram/Points.h b/Framework/Histogram/inc/MantidHistogram/Points.h
similarity index 100%
rename from Framework/Kernel/inc/MantidKernel/Histogram/Points.h
rename to Framework/Histogram/inc/MantidHistogram/Points.h
diff --git a/Framework/Kernel/inc/MantidKernel/Histogram/VectorOf.h b/Framework/Histogram/inc/MantidHistogram/VectorOf.h
similarity index 100%
rename from Framework/Kernel/inc/MantidKernel/Histogram/VectorOf.h
rename to Framework/Histogram/inc/MantidHistogram/VectorOf.h
diff --git a/Framework/Kernel/src/Histogram/BinEdges.cpp b/Framework/Histogram/src/BinEdges.cpp
similarity index 100%
rename from Framework/Kernel/src/Histogram/BinEdges.cpp
rename to Framework/Histogram/src/BinEdges.cpp
diff --git a/Framework/Kernel/src/Histogram/Histogram.cpp b/Framework/Histogram/src/Histogram.cpp
similarity index 100%
rename from Framework/Kernel/src/Histogram/Histogram.cpp
rename to Framework/Histogram/src/Histogram.cpp
diff --git a/Framework/Kernel/src/Histogram/HistogramX.cpp b/Framework/Histogram/src/HistogramX.cpp
similarity index 100%
rename from Framework/Kernel/src/Histogram/HistogramX.cpp
rename to Framework/Histogram/src/HistogramX.cpp
diff --git a/Framework/Kernel/src/Histogram/Points.cpp b/Framework/Histogram/src/Points.cpp
similarity index 100%
rename from Framework/Kernel/src/Histogram/Points.cpp
rename to Framework/Histogram/src/Points.cpp
diff --git a/Framework/Kernel/test/HistogramBinEdgesTest.h b/Framework/Histogram/test/BinEdgesTest.h
similarity index 100%
rename from Framework/Kernel/test/HistogramBinEdgesTest.h
rename to Framework/Histogram/test/BinEdgesTest.h
diff --git a/Framework/Histogram/test/CMakeLists.txt b/Framework/Histogram/test/CMakeLists.txt
new file mode 100644
index 00000000000..2bdabefe3d2
--- /dev/null
+++ b/Framework/Histogram/test/CMakeLists.txt
@@ -0,0 +1,16 @@
+if ( CXXTEST_FOUND )
+  include_directories ( SYSTEM ${CXXTEST_INCLUDE_DIR} ${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR} )
+
+  cxxtest_add_test ( HistogramTest ${TEST_FILES} ${GMOCK_TEST_FILES})
+  target_link_libraries( HistogramTest LINK_PRIVATE ${TCMALLOC_LIBRARIES_LINKTIME} 
+    Histogram
+    Kernel
+    ${Boost_LIBRARIES}
+    ${POCO_LIBRARIES}
+    ${GMOCK_LIBRARIES}
+    ${GTEST_LIBRARIES} )
+  
+  add_dependencies ( FrameworkTests HistogramTest )
+  # Add to the 'FrameworkTests' group in VS
+  set_property ( TARGET HistogramTest PROPERTY FOLDER "UnitTests" )
+endif ()
diff --git a/Framework/Kernel/test/HistogramConstIterableTest.h b/Framework/Histogram/test/ConstIterableTest.h
similarity index 100%
rename from Framework/Kernel/test/HistogramConstIterableTest.h
rename to Framework/Histogram/test/ConstIterableTest.h
diff --git a/Framework/Kernel/test/HistogramHistogramDataTest.h b/Framework/Histogram/test/HistogramDataTest.h
similarity index 100%
rename from Framework/Kernel/test/HistogramHistogramDataTest.h
rename to Framework/Histogram/test/HistogramDataTest.h
diff --git a/Framework/Kernel/test/HistogramTest.h b/Framework/Histogram/test/HistogramTest.h
similarity index 100%
rename from Framework/Kernel/test/HistogramTest.h
rename to Framework/Histogram/test/HistogramTest.h
diff --git a/Framework/Kernel/test/HistogramHistogramXTest.h b/Framework/Histogram/test/HistogramXTest.h
similarity index 100%
rename from Framework/Kernel/test/HistogramHistogramXTest.h
rename to Framework/Histogram/test/HistogramXTest.h
diff --git a/Framework/Kernel/test/HistogramPointsTest.h b/Framework/Histogram/test/PointsTest.h
similarity index 100%
rename from Framework/Kernel/test/HistogramPointsTest.h
rename to Framework/Histogram/test/PointsTest.h
diff --git a/Framework/Kernel/test/HistogramVectorOfTest.h b/Framework/Histogram/test/VectorOfTest.h
similarity index 100%
rename from Framework/Kernel/test/HistogramVectorOfTest.h
rename to Framework/Histogram/test/VectorOfTest.h
diff --git a/Framework/Kernel/CMakeLists.txt b/Framework/Kernel/CMakeLists.txt
index 0d92c5d3055..1ae8c3accbe 100644
--- a/Framework/Kernel/CMakeLists.txt
+++ b/Framework/Kernel/CMakeLists.txt
@@ -32,10 +32,6 @@ set ( SRC_FILES
 	src/FloatingPointComparison.cpp
 	src/FreeBlock.cpp
 	src/Glob.cpp
-	src/Histogram/BinEdges.cpp
-	src/Histogram/Histogram.cpp
-	src/Histogram/HistogramX.cpp
-	src/Histogram/Points.cpp
 	src/ICatalogInfo.cpp
 	src/IPropertyManager.cpp
 	src/ISaveable.cpp
@@ -182,13 +178,6 @@ set ( INC_FILES
 	inc/MantidKernel/FreeBlock.h
 	inc/MantidKernel/FunctionTask.h
 	inc/MantidKernel/Glob.h
-	inc/MantidKernel/Histogram/BinEdges.h
-	inc/MantidKernel/Histogram/ConstIterable.h
-	inc/MantidKernel/Histogram/Histogram.h
-	inc/MantidKernel/Histogram/HistogramData.h
-	inc/MantidKernel/Histogram/HistogramX.h
-	inc/MantidKernel/Histogram/Points.h
-	inc/MantidKernel/Histogram/VectorOf.h
 	inc/MantidKernel/ICatalogInfo.h
 	inc/MantidKernel/IPropertyManager.h
 	inc/MantidKernel/IPropertySettings.h
@@ -344,13 +333,6 @@ set ( TEST_FILES
 	FreeBlockTest.h
 	FunctionTaskTest.h
 	GlobTest.h
-	HistogramHistogramDataTest.h
-	HistogramBinEdgesTest.h
-	HistogramConstIterableTest.h
-	HistogramHistogramXTest.h
-	HistogramPointsTest.h
-	HistogramTest.h
-	HistogramVectorOfTest.h
 	IPropertySettingsTest.h
 	ISaveableTest.h
 	IValidatorTest.h
-- 
GitLab