Commit a8c3109c authored by Danny Hindson's avatar Danny Hindson
Browse files

Further work on applying cmake GenerateExportHeader

Apply change to insert export macros into class definition using cmake GenerateExportHeader
feature to 3 more projects: API, Crystal and CurveFitting
Have replaced DllExport with the cmake macro except in these places:

a) class templates - the definitions of class template member functions need to be in the
same unit as the declaration so dllimport gives a compilation error in the client code
(C2491 in VS) eg SingleValueParameter, SingleValueParameterParser
b) headers which are in a project but aren't included by any .cpp units in the project
eg IBackgroundFunction.h, ICatalogInfoService.h. In these cases I've removed the DLLExport
attribute completely

For the API target there were a couple of special cases\extras:

API has some conditional use of the extern keyword to control instantiation of template
classes. This has been inserted into the automatically created dllconfig.h using a cmake
switch that allows some custom content to be appended to the end of the file. Few of the
targets require this so I've added a boolean parameter to the wrapper function to handle
this GENERATE_MANTID_EXPORT_HEADER

I also had to add explicit include directories to PythonInterfaceCore where it imports an
API target header (in the unit ExtractWorkspace.h) without having API as a dependency
parent f428121b
......@@ -199,7 +199,6 @@ set(INC_FILES
inc/MantidAPI/DeprecatedAlgorithm.h
inc/MantidAPI/DetectorSearcher.h
inc/MantidAPI/DistributedAlgorithm.h
inc/MantidAPI/DllConfig.h
inc/MantidAPI/DomainCreatorFactory.h
inc/MantidAPI/EnabledWhenWorkspaceIsType.h
inc/MantidAPI/EqualBinSizesValidator.h
......@@ -543,6 +542,10 @@ target_link_libraries(API
# Add the unit tests directory
add_subdirectory(test)
# Auto-generate exports header
target_include_directories(API PUBLIC ${CMAKE_BINARY_DIR}/Framework/API)
generate_mantid_export_header(API TRUE)
# Installation settings
mtd_install_targets(TARGETS API INSTALL_DIRS ${LIB_DIR} ${WORKBENCH_LIB_DIR})
......@@ -33,7 +33,7 @@ API::IAlgorithm interface.
@author Martyn Gigg, Tessella Plc
@date 24/03/2011
*/
class DLLExport AlgorithmProperty
class MANTID_API_DLL AlgorithmProperty
: public Kernel::PropertyWithValue<boost::shared_ptr<IAlgorithm>> {
public:
/// Typedef the held type
......
......@@ -40,7 +40,7 @@ class WorkspaceGroup;
Modified to inherit from DataService
*/
class DLLExport AnalysisDataServiceImpl final
class MANTID_API_DLL AnalysisDataServiceImpl final
: public Kernel::DataService<API::Workspace> {
public:
/** @name Extra notifications only applicable to the ADS */
......
......@@ -89,12 +89,12 @@ boost::optional<T> checkForOptionalInstrumentDefault(
* Specializations for std::string
*/
template <>
DLLExport std::string checkForMandatoryInstrumentDefault(
MANTID_API_DLL std::string checkForMandatoryInstrumentDefault(
Mantid::API::Algorithm *const alg, std::string propName,
Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name);
template <>
DLLExport boost::optional<std::string> checkForOptionalInstrumentDefault(
MANTID_API_DLL boost::optional<std::string> checkForOptionalInstrumentDefault(
Mantid::API::Algorithm *const alg, std::string propName,
Mantid::Geometry::Instrument_const_sptr instrument, std::string idf_name);
} // namespace API
......
......@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/IBoxControllerIO.h"
#include "MantidKernel/DiskBuffer.h"
#include "MantidKernel/Exception.h"
......@@ -29,7 +30,7 @@ namespace API {
* @author Janik Zikovsky
* @date Feb 21, 2011
*/
class DLLExport BoxController {
class MANTID_API_DLL BoxController {
public:
//-----------------------------------------------------------------------------------
/** Constructor
......
......@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/SingleValueParameter.h"
#include "MantidGeometry/MDGeometry/IMDDimension.h"
#include "MantidGeometry/MDGeometry/MDTypes.h"
......@@ -28,7 +29,7 @@ DECLARE_SINGLE_VALUE_PARAMETER(OutDimParameter, size_t)
* @author Janik Zikovsky
* @date 2011-04-14
*/
class DLLExport CoordTransform {
class MANTID_API_DLL CoordTransform {
public:
CoordTransform(const size_t inD, const size_t outD);
virtual ~CoordTransform() = default;
......
......@@ -27,7 +27,7 @@ namespace API {
@date 2012-04-04
*/
template <class Base>
class DLLExport GenericDataProcessorAlgorithm : public Base {
class MANTID_API_DLL GenericDataProcessorAlgorithm : public Base {
public:
GenericDataProcessorAlgorithm();
std::string getPropertyValue(const std::string &name) const override;
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2011 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
/*
This file contains the DLLExport/DLLImport linkage configuration for the
API library
@author Martyn Gigg, Tessella plc
*/
#include "MantidKernel/System.h"
#ifdef IN_MANTID_API
#define MANTID_API_DLL DLLExport
#define EXTERN_MANTID_API
#else
#define MANTID_API_DLL DLLImport
#define EXTERN_MANTID_API EXTERN_IMPORT
#endif /* IN_MANTID_API*/
......@@ -39,7 +39,8 @@ namespace API {
FileAction type parameter in the constructor.
*/
class DLLExport FileProperty : public Kernel::PropertyWithValue<std::string> {
class MANTID_API_DLL FileProperty
: public Kernel::PropertyWithValue<std::string> {
public:
/// An enumeration for load/save types. This is passed on to the FileValidator
/// as a constructor parameter.
......
......@@ -28,7 +28,7 @@ Virtual method isSourceName(name) decides to which function a parameter
belongs to. By default if a name has the signature of a composite function
(f<number>.name) then it is attributed to the target function.
*/
class DLLExport FunctionGenerator : public IFunction {
class MANTID_API_DLL FunctionGenerator : public IFunction {
public:
/// Constructor
FunctionGenerator(IFunction_sptr source);
......
......@@ -19,7 +19,7 @@ namespace API {
@author Anders Markvardsen, ISIS, RAL
@date 2/11/2009
*/
class DLLExport IBackgroundFunction : public IFunctionWithLocation {
class IBackgroundFunction : public IFunctionWithLocation {
public:
/// Fits the function
/// @param X :: a vector of x values
......
......@@ -5,6 +5,7 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/DllConfig.h"
#include "MantidKernel/DiskBuffer.h"
#include "MantidKernel/System.h"
......@@ -22,7 +23,7 @@ namespace API {
*/
class DLLExport IBoxControllerIO : public Kernel::DiskBuffer {
class MANTID_API_DLL IBoxControllerIO : public Kernel::DiskBuffer {
public:
/** open file for i/o operations
* @param fileName -- the name of the file to open
......
......@@ -25,7 +25,7 @@ namespace API {
@author Sofia Antony, ISIS Rutherford Appleton Laboratory
@date 23/09/2010
*/
class DLLExport ICatalog {
class MANTID_API_DLL ICatalog {
public:
/// Virtual destructor
virtual ~ICatalog() = default;
......
......@@ -19,7 +19,7 @@ namespace API {
@author Jay Rainey, ISIS Rutherford Appleton Laboratory
@date 24/02/2010
*/
class DLLExport ICatalogInfoService {
class ICatalogInfoService {
public:
// Virtual destructor
virtual ~ICatalogInfoService() = default;
......
......@@ -36,7 +36,7 @@ data.
@author Roman Tolchenov, Tessella plc
@date 22/03/2012
*/
class DLLExport IDomainCreator {
class MANTID_API_DLL IDomainCreator {
public:
/// Type of domain to create.
enum DomainType { Simple = 0, Sequential, Parallel };
......
......@@ -23,7 +23,7 @@ namespace API {
@author Michael Wedel, Paul Scherrer Institut - SINQ
@date 03/06/2014
*/
class DLLExport IFunction1DSpectrum : public virtual IFunction {
class MANTID_API_DLL IFunction1DSpectrum : public virtual IFunction {
public:
void function(const FunctionDomain &domain,
FunctionValues &values) const override;
......
......@@ -23,7 +23,7 @@ namespace API {
The domain and the values object can have different sizes.
In particular the domain can be empty.
*/
class DLLExport IFunctionGeneral : public virtual IFunction {
class MANTID_API_DLL IFunctionGeneral : public virtual IFunction {
public:
void function(const FunctionDomain &domain,
FunctionValues &values) const override;
......
......@@ -19,8 +19,8 @@ namespace API {
@date 2011-11-09
*/
class DLLExport IMDHistoWorkspace : public IMDWorkspace,
public MultipleExperimentInfos {
class MANTID_API_DLL IMDHistoWorkspace : public IMDWorkspace,
public MultipleExperimentInfos {
public:
IMDHistoWorkspace() = default;
IMDHistoWorkspace &operator=(const IMDHistoWorkspace &) = delete;
......
......@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/DllConfig.h"
#include "MantidGeometry/IDTypes.h"
#include <boost/shared_ptr.hpp>
......@@ -18,7 +19,7 @@ namespace API {
/** This class provides an interface to a MaskWorkspace.
*/
class DLLExport IMaskWorkspace {
class MANTID_API_DLL IMaskWorkspace {
public:
IMaskWorkspace() = default;
IMaskWorkspace &operator=(const IMaskWorkspace &) = delete;
......
......@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/DllConfig.h"
#include "MantidGeometry/IDTypes.h"
#include "MantidHistogramData/Histogram.h"
#include "MantidKernel/System.h"
......@@ -35,7 +36,7 @@ class MatrixWorkspace;
@author Janik Zikovsky
@date 2011-07-01
*/
class DLLExport ISpectrum {
class MANTID_API_DLL ISpectrum {
public:
ISpectrum() = default;
ISpectrum(const specnum_t specNo);
......
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