Commit 3e2905d5 authored by Danny Hindson's avatar Danny Hindson
Browse files

Improve precompiled header files to speed up Windows build time

Add some extra headers to various PrecompiledHeader.h
Remove some files that were having a marginal impact
Turn on precompiled headers for the PythonInterface targets
Fix up pch functionality on C++ unit tests
parent a27c971f
......@@ -7,33 +7,15 @@
#pragma once
// Mantid
#include "MantidAPI/DllConfig.h"
#include "MantidGeometry/IComponent.h"
#include "MantidGeometry/IDetector.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/ArrayProperty.h"
#include "MantidKernel/DateAndTime.h"
#include "MantidKernel/DynamicFactory.h"
#include "MantidKernel/Exception.h"
#include "MantidKernel/IPropertyManager.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/Quat.h"
#include "MantidKernel/System.h"
#include "MantidKernel/V3D.h"
// STL
#include <cfloat>
#include <cmath>
#include <cstddef>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
// Boost
#include <boost/variant.hpp>
#include <memory>
// Poco
#include <Poco/DOM/DOMParser.h>
#include <Poco/XML/XML.h>
......@@ -7,8 +7,15 @@
#pragma once
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAlgorithms/DllConfig.h"
#include "MantidKernel/Exception.h"
// STL
// No speed up from including STL headers for some reason
// Boost
#include <memory>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/function.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/math/special_functions.hpp>
......@@ -11,6 +11,7 @@
// Mantid
#include "MantidAPI/Algorithm.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
// STL
#include <set>
......
......@@ -227,6 +227,9 @@ if(COVERALLS)
endforeach(loop_var)
endif()
# Add a precompiled header where they are supported
enable_precompiled_headers(inc/MantidCrystal/PrecompiledHeader.h SRC_FILES)
# Add the target for this directory
add_library(Crystal ${SRC_FILES} ${INC_FILES})
# Set the name of the generated library
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/Algorithm.h"
#include "MantidCrystal/DllConfig.h"
// STL
......@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include <set>
#include <string>
#include <vector>
#include "MantidAPI/IFunction1D.h"
#include "MantidCurveFitting/DllConfig.h"
// STL
......@@ -6,8 +6,15 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
// Algorithm
#include "MantidAPI/Algorithm.h"
#include "MantidDataHandling/DllConfig.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/FileDescriptor.h"
#include "MantidKernel/System.h"
// STL
// NeXus
// clang-format off
......
......@@ -11,8 +11,10 @@
#include "MantidAPI/Algorithm.h"
#include "MantidKernel/System.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
// STL
#include <set>
#include <string>
#include <vector>
// Poco
#include <Poco/File.h>
#include <Poco/Path.h>
......@@ -68,7 +68,7 @@ public:
void test_create() {
const double radius = 2;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -92,7 +92,7 @@ public:
const double radius = 2;
const double backgroundInnerRadius = 3;
const double backgroundOuterRadius = 4;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......
......@@ -36,7 +36,7 @@ public:
void test_constructor() {
const double radius = 2;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -55,7 +55,7 @@ public:
const double radius = 2;
const double backgroundInnerRadius = 3;
const double backgroundOuterRadius = 4;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -97,7 +97,7 @@ public:
const double radius = 2;
const double backgroundInnerRadius = 3;
const double backgroundOuterRadius = 4;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -119,7 +119,7 @@ public:
const double radius = 2;
const double backgroundInnerRadius = 3;
const double backgroundOuterRadius = 4;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -146,7 +146,7 @@ public:
const double radius = 2;
const double backgroundInnerRadius = 3;
const double backgroundOuterRadius = 4;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -169,7 +169,7 @@ public:
void test_toJSON() {
const double radius = 2;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -191,7 +191,7 @@ public:
const double radius = 2;
const double backgroundInnerRadius = 3;
const double backgroundOuterRadius = 4;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
const std::string algorithmName = "foo";
const int algorithmVersion = 3;
......@@ -240,7 +240,7 @@ public:
void test_shape_name() {
const double radius = 1;
const SpecialCoordinateSystem frame = HKL;
const SpecialCoordinateSystem frame = SpecialCoordinateSystem::HKL;
// Construct it.
PeakShapeSpherical shape(radius, frame);
......
......@@ -7,4 +7,6 @@
#pragma once
#include "MantidAPI/Algorithm.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidDataObjects/MDEventWorkspace.h"
#include "MantidKernel/Exception.h"
......@@ -57,7 +57,9 @@ namespace {
* @return function map
*/
SmoothFunctionMap makeFunctionMap(Mantid::MDAlgorithms::SmoothMD *instance) {
using namespace std::placeholders;
using std::placeholders::_1;
using std::placeholders::_2;
using std::placeholders::_3;
return {
{"Hat", std::bind(&Mantid::MDAlgorithms::SmoothMD::hatSmooth, instance,
_1, _2, _3)},
......
......@@ -105,9 +105,10 @@ void ThresholdMD::exec() {
using namespace std::placeholders;
boost::function<bool(double)> comparitor =
std::bind(std::less<double>(), _1, referenceValue);
std::bind(std::less<double>(), std::placeholders::_1, referenceValue);
if (condition == GreaterThan()) {
comparitor = std::bind(std::greater<double>(), _1, referenceValue);
comparitor = std::bind(std::greater<double>(), std::placeholders::_1,
referenceValue);
}
Progress prog(this, 0.0, 1.0, 100);
......
......@@ -6,6 +6,11 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
// Mantid
#include "MantidAPI/AnalysisDataService.h"
#include "MantidTestHelpers/MDEventsTestHelper.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
// cxxtest
#include <cxxtest/WrappedTestSuite.h>
......
......@@ -64,6 +64,10 @@ set(INC_FILES
inc/MantidPythonInterface/core/Policies/VectorToNumpy.h
)
# Add a precompiled header where they are supported
enable_precompiled_headers(inc/MantidPythonInterface/core/PrecompiledHeader.h SRC_FILES)
# Add the target for this directory
set(_target_name PythonInterfaceCore)
add_library(${_target_name} ${SRC_FILES} ${INC_FILES})
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2021 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
// STL
#include <memory>
#include <string>
#include <boost/python/class.hpp>
#include <boost/python/dict.hpp>
#include <boost/python/extract.hpp>
#include <boost/python/list.hpp>
......@@ -120,10 +120,14 @@ set(INC_FILES
inc/MantidPythonInterface/api/WorkspacePropertyExporter.h
)
# Add a precompiled header where they are supported
list (APPEND ALL_FILES ${EXPORT_FILES} ${SRC_FILES})
enable_precompiled_headers(inc/MantidPythonInterface/api/PrecompiledHeader.h ALL_FILES)
# Create the target for this directory
add_library(
PythonAPIModule ${EXPORT_FILES} ${MODULE_DEFINITION} ${SRC_FILES}
PythonAPIModule ${ALL_FILES} ${MODULE_DEFINITION}
${INC_FILES} ${PYTHON_INSTALL_FILES}
)
set_python_properties(PythonAPIModule _api)
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2021 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/Algorithm.h"
// STL
// Boost
#include <boost/mpl/and.hpp>
#include <boost/mpl/if.hpp>
#include <boost/optional.hpp>
#include <boost/python/call_method.hpp>
#include <boost/python/class.hpp>
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/def.hpp>
#include <boost/python/dict.hpp>
#include <boost/python/enum.hpp>
#include <boost/python/make_constructor.hpp>
#include <boost/python/make_function.hpp>
#include <boost/python/object.hpp>
#include <boost/python/overloads.hpp>
#include <boost/python/register_ptr_to_python.hpp>
#include <boost/python/return_value_policy.hpp>
#include <boost/python/tuple.hpp>
#include <boost/python/wrapper.hpp>
......@@ -58,9 +58,13 @@ set(INC_FILES inc/MantidPythonInterface/geometry/ComponentInfoPythonIterator.h
inc/MantidPythonInterface/geometry/DetectorInfoPythonIterator.h
)
# Add a precompiled header where they are supported
list (APPEND ALL_FILES ${EXPORT_FILES} ${SRC_FILES})
enable_precompiled_headers(inc/MantidPythonInterface/geometry/PrecompiledHeader.h ALL_FILES)
# Create the target for this directory
add_library(
PythonGeometryModule ${EXPORT_FILES} ${MODULE_DEFINITION} ${SRC_FILES}
PythonGeometryModule ${ALL_FILES} ${MODULE_DEFINITION}
${INC_FILES} ${PYTHON_INSTALL_FILES}
)
set_python_properties(PythonGeometryModule _geometry)
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidGeometry/DllConfig.h"
#include "MantidGeometry/IObjComponent.h"
#include "MantidGeometry/Instrument/DetectorInfo.h"
#include "MantidGeometry/Objects/IObject.h"
// STL
#include <memory>
#include <string>
#include <vector>
#include <boost/python/class.hpp>
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/def.hpp>
#include <boost/python/default_call_policies.hpp>
#include <boost/python/dict.hpp>
#include <boost/python/enum.hpp>
#include <boost/python/make_constructor.hpp>
#include <boost/python/make_function.hpp>
#include <boost/python/overloads.hpp>
#include <boost/python/register_ptr_to_python.hpp>
#include <boost/python/return_value_policy.hpp>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment