Base: split export/import macros from FCConfig.h and move them to FCGlobal.h

The FCGlobal.h can be included in a Global.h header file of an extension module.

The reason is that some IDEs (e.g. QtCreator) fails to detect the export/import macros when only defined in the PreCompiled.h files and thus raise a parser warning.
This commit is contained in:
wmayer
2021-09-14 16:40:30 +02:00
parent 2abe1611f7
commit a40d37a980
44 changed files with 327 additions and 67 deletions

View File

@@ -24,6 +24,9 @@
#define RANGE_H
#include <string>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace App {

View File

@@ -29,6 +29,9 @@
#include <sstream>
#include <vector>
#include "Vector3D.h"
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base
{

View File

@@ -26,6 +26,9 @@
#include <QObject>
#include <QEventLoop>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base {
/**

View File

@@ -25,11 +25,13 @@
#ifndef BASE_FACTORY_H
#define BASE_FACTORY_H
#include<typeinfo>
#include<string>
#include<map>
#include<list>
#include"../FCConfig.h"
#include <typeinfo>
#include <string>
#include <map>
#include <list>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base

View File

@@ -27,6 +27,9 @@
// Std. configurations
#include <string>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base
{

View File

@@ -30,6 +30,9 @@
#include <string>
#include <map>
#include <typeinfo>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
class QAtomicInt;

View File

@@ -32,6 +32,9 @@
#include <xercesc/util/XercesVersion.hpp>
#include <xercesc/sax/InputSource.hpp>
#include <QTextCodec>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
XERCES_CPP_NAMESPACE_BEGIN

View File

@@ -25,12 +25,15 @@
#define BASE_MATRIX_H
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <string>
#include "Vector3D.h"
#include <float.h>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base {

View File

@@ -22,30 +22,34 @@
#ifndef BASE_MEMDEBUG_H
#define BASE_MEMDEBUG_H
#ifndef FC_GLOBAL_H
#include <crtdbg.h>
#include <FCGlobal.h>
#endif
namespace Base
{
// Std. configurations
#if defined(_MSC_VER)
class BaseExport MemCheck
{
public:
MemCheck();
~MemCheck();
void setNextCheckpoint();
static bool checkMemory();
static bool dumpLeaks();
static bool isValidHeapPointer(const void*);
private:
_CrtMemState s1, s2, s3;
};
#if defined(_MSC_VER)
class BaseExport MemCheck
{
public:
MemCheck();
~MemCheck();
void setNextCheckpoint();
static bool checkMemory();
static bool dumpLeaks();
static bool isValidHeapPointer(const void*);
private:
_CrtMemState s1, s2, s3;
};
#endif
} //namespace Base
#endif // BASE_MEMDEBUG_H

View File

@@ -73,6 +73,9 @@ extern "C" { /* a C library, but callable from C++ */
# undef _POSIX_C_SOURCE
#endif // (re-)defined in pyconfig.h
#include <Python.h>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
extern int PP_RELOAD; /* 1=reload py modules when attributes referenced */
extern int PP_DEBUG; /* 1=start debugger when string/function/member run */

View File

@@ -25,6 +25,9 @@
#define BASE_ROTATION_H
#include "Vector3D.h"
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base {

View File

@@ -36,7 +36,10 @@
// so we need not to check the version (because we only support _MSC_VER >= 1100)!
#pragma once
#include <windows.h>
#include <Windows.h>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
// special defines for VC5/6 (if no actual PSDK is installed):
#if _MSC_VER < 1300

View File

@@ -24,6 +24,9 @@
#ifndef BASE_TOOLS_H
#define BASE_TOOLS_H
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
#include <functional>
#include <algorithm>
#include <cmath>

View File

@@ -28,11 +28,14 @@
#include <algorithm>
#include <cmath>
#include <cfloat>
#include <stdio.h>
#include <cstdio>
#include <list>
#include <vector>
#include "Vector3D.h"
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base {

View File

@@ -26,6 +26,9 @@
#include <CXX/Extensions.hxx>
#include <CXX/Objects.hxx>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base {

View File

@@ -30,6 +30,9 @@
#include <map>
#include <set>
#include <vector>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base
{

View File

@@ -27,6 +27,9 @@
// Std. configurations
#include <string>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
#endif
namespace Base
{

View File

@@ -304,39 +304,7 @@ typedef unsigned __int64 uint64_t;
//**************************************************************************
// Windows import export DLL defines
#if defined (FC_OS_WIN32) || defined(FC_OS_CYGWIN)
# ifdef FCApp
# define AppExport __declspec(dllexport)
# define DataExport __declspec(dllexport)
# else
# define AppExport __declspec(dllimport)
# define DataExport __declspec(dllimport)
# endif
# ifdef FCBase
# define BaseExport __declspec(dllexport)
# else
# define BaseExport __declspec(dllimport)
# endif
# ifdef FCGui
# define GuiExport __declspec(dllexport)
# else
# define GuiExport __declspec(dllimport)
# endif
#else
# ifndef BaseExport
# define BaseExport
# endif
# ifndef GuiExport
# define GuiExport
# endif
# ifndef AppExport
# define AppExport
# endif
# ifndef DataExport
# define DataExport
# endif
#endif
#include <FCGlobal.h>
//**************************************************************************
// here get the warnings of too long specifiers disabled (needed for VC6)

62
src/FCGlobal.h Normal file
View File

@@ -0,0 +1,62 @@
/***************************************************************************
* Copyright (c) 2019 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
/** \file FCGlobal.h
* \brief Include export or import macros.
*/
#ifndef FC_GLOBAL_H
#define FC_GLOBAL_H
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(__CYGWIN__)
# define FREECAD_DECL_EXPORT __declspec(dllexport)
# define FREECAD_DECL_IMPORT __declspec(dllimport)
#else
# define FREECAD_DECL_EXPORT
# define FREECAD_DECL_IMPORT
#endif
// FreeCADBase
#ifdef FreeCADBase_EXPORTS
# define BaseExport FREECAD_DECL_EXPORT
#else
# define BaseExport FREECAD_DECL_IMPORT
#endif
// FreeCADApp
#ifdef FreeCADApp_EXPORTS
# define AppExport FREECAD_DECL_EXPORT
# define DataExport FREECAD_DECL_EXPORT
#else
# define AppExport FREECAD_DECL_IMPORT
# define DataExport FREECAD_DECL_IMPORT
#endif
// FreeCADGui
#ifdef FreeCADGui_EXPORTS
# define GuiExport FREECAD_DECL_EXPORT
#else
# define GuiExport FREECAD_DECL_IMPORT
#endif
#endif //FC_GLOBAL_H

View File

@@ -18,6 +18,8 @@
#ifndef IMAGEBASE_H
#define IMAGEBASE_H
#include <Mod/Image/ImageGlobal.h>
namespace Image
{

View File

@@ -27,6 +27,7 @@
#include <App/GeoFeature.h>
#include <App/PropertyFile.h>
#include <App/PropertyUnits.h>
#include <Mod/Image/ImageGlobal.h>
namespace Image
{

View File

@@ -25,6 +25,7 @@
#else
#include "GLImageBox.h"
#endif
#include <Mod/Image/ImageGlobal.h>
class QSlider;
class QAction;

View File

@@ -25,6 +25,7 @@
#define IMAGE_ViewProviderImagePlane_H
#include <Gui/ViewProviderGeometryObject.h>
#include <Mod/Image/ImageGlobal.h>
class SoCoordinate3;
class SoDrawStyle;
@@ -48,12 +49,12 @@ public:
void attach(App::DocumentObject *pcObject);
void setDisplayMode(const char* ModeName);
std::vector<std::string> getDisplayModes() const;
void updateData(const App::Property*);
private:
bool loadSvg(const char*, float x, float y, QImage& img);
protected:
void updateData(const App::Property*);
private:
bool loadSvg(const char*, float x, float y, QImage& img);
protected:
SoCoordinate3 * pcCoords;
SoTexture2 * texture;
};

View File

@@ -25,6 +25,7 @@
#define IMAGE_WORKBENCH_H
#include <Gui/Workbench.h>
#include <Mod/Image/ImageGlobal.h>
namespace ImageGui {

View File

@@ -0,0 +1,32 @@
/***************************************************************************
* Copyright (c) Imetric 4D Imaging Sarl *
* *
* Author: Werner Mayer *
* *
***************************************************************************/
#include <FCGlobal.h>
#ifndef IMAGE_GLOBAL_H
#define IMAGE_GLOBAL_H
// Image
#ifndef ImageExport
#ifdef Image_EXPORTS
# define ImageExport FREECAD_DECL_EXPORT
#else
# define ImageExport FREECAD_DECL_IMPORT
#endif
#endif
// ImageGui
#ifndef ImageGuiExport
#ifdef ImageGui_EXPORTS
# define ImageGuiExport FREECAD_DECL_EXPORT
#else
# define ImageGuiExport FREECAD_DECL_IMPORT
#endif
#endif
#endif //IMAGE_GLOBAL_H

View File

@@ -28,6 +28,9 @@
#include <Mod/Mesh/App/WildMagic4/Wm4QuadricSurface.h>
#include <Mod/Mesh/App/WildMagic4/Wm4Eigen.h>
#include <Mod/Mesh/App/WildMagic4/Wm4ImplicitSurface.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
#include <algorithm>
#include <list>
#include <set>

View File

@@ -24,6 +24,10 @@
#ifndef MESH_DEFINITIONS_H
#define MESH_DEFINITIONS_H
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
// default values
#define MESH_MIN_PT_DIST 1.0e-6f
#define MESH_MIN_EDGE_LEN 1.0e-3f

View File

@@ -24,6 +24,10 @@
#ifndef VISITOR_H
#define VISITOR_H
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
namespace MeshCore {
class MeshFacet;

View File

@@ -27,6 +27,9 @@
#include <App/DocumentObject.h>
#include <App/PropertyStandard.h>
#include <App/PropertyLinks.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
namespace Mesh
{

View File

@@ -24,10 +24,13 @@
#ifndef MESH_MESHPOINT_H
#define MESH_MESHPOINT_H
#include <climits>
#include <Base/Matrix.h>
#include <Base/Vector3D.h>
#include "Mesh.h"
#include <Base/Handle.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
using Base::Vector3d;
@@ -59,4 +62,4 @@ public:
} // namespace Mesh
#endif // MESH_MESH_H
#endif // MESH_MESHPOINT_H

View File

@@ -24,6 +24,9 @@
#ifndef MESHGUI_DLGSETTINGSIMPORTEXPORTIMP_H
#define MESHGUI_DLGSETTINGSIMPORTEXPORTIMP_H
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
#include <Gui/PropertyPage.h>
namespace MeshGui {

View File

@@ -24,6 +24,9 @@
#ifndef MESHGUI_DLGSETTINGSMESHVIEW_H
#define MESHGUI_DLGSETTINGSMESHVIEW_H
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
#include <Gui/PropertyPage.h>
#include <memory>

View File

@@ -27,6 +27,9 @@
#include <QDialog>
#include <Gui/TaskView/TaskDialog.h>
#include <Gui/TaskView/TaskView.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
class QButtonGroup;

View File

@@ -30,6 +30,9 @@
#include <Gui/SelectionObject.h>
#include <Gui/TaskView/TaskDialog.h>
#include <Gui/TaskView/TaskView.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
namespace Gui {
class View3DInventorViewer;

View File

@@ -24,6 +24,9 @@
#define MESHGUI_PROPERTYEDITOR_MESH_H
#include <Gui/propertyeditor/PropertyItem.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
namespace MeshGui {

View File

@@ -27,6 +27,9 @@
#include <QWidget>
#include <Gui/TaskView/TaskDialog.h>
#include <Gui/TaskView/TaskView.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
// forward declarations
namespace Mesh { class Feature; }

View File

@@ -28,6 +28,9 @@
#include <Inventor/engines/SoSubEngine.h>
#include <Inventor/fields/SoSFBool.h>
#include <Inventor/fields/SoMFColor.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
class SoGLCoordinateElement;
class SoTextureCoordinateBundle;

View File

@@ -30,6 +30,9 @@
#include <Inventor/nodes/SoSubNode.h>
#include <Inventor/nodes/SoShape.h>
#include <Inventor/elements/SoReplacedElement.h>
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
namespace MeshGui {

View File

@@ -24,6 +24,9 @@
#ifndef MESH_WORKBENCH_H
#define MESH_WORKBENCH_H
#ifndef MESH_GLOBAL_H
#include <Mod/Mesh/MeshGlobal.h>
#endif
#include <Gui/Workbench.h>
namespace MeshGui {

47
src/Mod/Mesh/MeshGlobal.h Normal file
View File

@@ -0,0 +1,47 @@
/***************************************************************************
* Copyright (c) 2019 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <FCGlobal.h>
#ifndef MESH_GLOBAL_H
#define MESH_GLOBAL_H
// Mesh
#ifndef MeshExport
#ifdef Mesh_EXPORTS
# define MeshExport FREECAD_DECL_EXPORT
#else
# define MeshExport FREECAD_DECL_IMPORT
#endif
#endif
// MeshGui
#ifndef MeshGuiExport
#ifdef MeshGui_EXPORTS
# define MeshGuiExport FREECAD_DECL_EXPORT
#else
# define MeshGuiExport FREECAD_DECL_IMPORT
#endif
#endif
#endif //MESH_GLOBAL_H

View File

@@ -34,6 +34,7 @@
#include <App/PropertyStandard.h>
#include <App/PropertyGeo.h>
#include <Mod/Points/PointsGlobal.h>
namespace Points
{

View File

@@ -28,6 +28,7 @@
#include <Gui/ViewProviderPythonFeature.h>
#include <Gui/ViewProviderBuilder.h>
#include <Inventor/SbVec2f.h>
#include <Mod/Points/PointsGlobal.h>
class SoSwitch;

View File

@@ -25,6 +25,7 @@
#define POINTS_WORKBENCH_H
#include <Gui/Workbench.h>
#include <Mod/Points/PointsGlobal.h>
namespace PointsGui {

View File

@@ -0,0 +1,47 @@
/***************************************************************************
* Copyright (c) 2019 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include <FCGlobal.h>
#ifndef POINTS_GLOBAL_H
#define POINTS_GLOBAL_H
// Points
#ifndef PointsExport
#ifdef Points_EXPORTS
# define PointsExport FREECAD_DECL_EXPORT
#else
# define PointsExport FREECAD_DECL_IMPORT
#endif
#endif
// PointsGui
#ifndef PointsGuiExport
#ifdef PointsGui_EXPORTS
# define PointsGuiExport FREECAD_DECL_EXPORT
#else
# define PointsGuiExport FREECAD_DECL_IMPORT
#endif
#endif
#endif //POINTS_GLOBAL_H