diff --git a/cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake b/cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake index 708bad0697ae..fb760fc2fe47 100644 --- a/cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake +++ b/cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake @@ -2,7 +2,7 @@ macro(ConfigureCMakeVariables) # ================================================================================ # Output directories for install target - if(WIN32) + if(MSVC) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Installation root directory") set(CMAKE_INSTALL_BINDIR bin CACHE PATH "Output directory for executables") set(CMAKE_INSTALL_DATADIR data CACHE PATH "Output directory for data and resource files") diff --git a/cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake b/cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake index 1a58efa3e546..923ac5c9b9b6 100644 --- a/cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake +++ b/cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake @@ -75,7 +75,7 @@ macro(SetupSalomeSMESH) if(NOT FREECAD_USE_EXTERNAL_SMESH) find_package(MEDFile REQUIRED) # See https://www.hdfgroup.org/HDF5/release/cmakebuild.html - if (WIN32) + if (MSVC) find_package(HDF5 COMPONENTS NO_MODULE REQUIRED static) else() find_package(PkgConfig) diff --git a/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx b/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx index 560c99812c7f..5a7534515188 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx @@ -45,6 +45,17 @@ #include #include +#if defined(__MINGW32__) +#define SMESH_EXPORT_MINGW SMESH_EXPORT +#define SMESH_EXPORT_MSVC +#elif defined(_MSC_VER) +#define SMESH_EXPORT_MINGW +#define SMESH_EXPORT_MSVC SMESH_EXPORT +#else +#define SMESH_EXPORT_MSVC +#define SMESH_EXPORT_MINGW +#endif + class SMDS_MeshFace; class SMDS_MeshNode; class gp_Ax1; @@ -74,7 +85,7 @@ public: SMESH_ComputeErrorPtr & GetError() { return myError; } // -------------------------------------------------------------------------------- - struct ElemFeatures //!< Features of element to create + struct SMESH_EXPORT_MINGW ElemFeatures //!< Features of element to create { SMDSAbs_ElementType myType; bool myIsPoly, myIsQuad; @@ -82,28 +93,28 @@ public: double myBallDiameter; std::vector myPolyhedQuantities; - SMESH_EXPORT ElemFeatures( SMDSAbs_ElementType type=SMDSAbs_All, bool isPoly=false, bool isQuad=false ) + SMESH_EXPORT_MSVC ElemFeatures( SMDSAbs_ElementType type=SMDSAbs_All, bool isPoly=false, bool isQuad=false ) :myType( type ), myIsPoly(isPoly), myIsQuad(isQuad), myID(-1), myBallDiameter(0) {} - SMESH_EXPORT ElemFeatures& Init( SMDSAbs_ElementType type, bool isPoly=false, bool isQuad=false ) + SMESH_EXPORT_MSVC ElemFeatures& Init( SMDSAbs_ElementType type, bool isPoly=false, bool isQuad=false ) { myType = type; myIsPoly = isPoly; myIsQuad = isQuad; return *this; } - SMESH_EXPORT ElemFeatures& Init( const SMDS_MeshElement* elem, bool basicOnly=true ); + SMESH_EXPORT_MSVC ElemFeatures& Init( const SMDS_MeshElement* elem, bool basicOnly=true ); - SMESH_EXPORT ElemFeatures& Init( double diameter ) + SMESH_EXPORT_MSVC ElemFeatures& Init( double diameter ) { myType = SMDSAbs_Ball; myBallDiameter = diameter; return *this; } - SMESH_EXPORT ElemFeatures& Init( std::vector& quanities, bool isQuad=false ) + SMESH_EXPORT_MSVC ElemFeatures& Init( std::vector& quanities, bool isQuad=false ) { myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad; myPolyhedQuantities.swap( quanities ); return *this; } - SMESH_EXPORT ElemFeatures& Init( const std::vector& quanities, bool isQuad=false ) + SMESH_EXPORT_MSVC ElemFeatures& Init( const std::vector& quanities, bool isQuad=false ) { myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad; myPolyhedQuantities = quanities; return *this; } - SMESH_EXPORT ElemFeatures& SetPoly(bool isPoly) { myIsPoly = isPoly; return *this; } - SMESH_EXPORT ElemFeatures& SetQuad(bool isQuad) { myIsQuad = isQuad; return *this; } - SMESH_EXPORT ElemFeatures& SetID (int ID) { myID = ID; return *this; } + SMESH_EXPORT_MSVC ElemFeatures& SetPoly(bool isPoly) { myIsPoly = isPoly; return *this; } + SMESH_EXPORT_MSVC ElemFeatures& SetQuad(bool isQuad) { myIsQuad = isQuad; return *this; } + SMESH_EXPORT_MSVC ElemFeatures& SetID (int ID) { myID = ID; return *this; } }; /*! diff --git a/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx b/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx index 7f89573efd0d..47a52fe585fe 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx @@ -39,10 +39,6 @@ #define SMDS_EXPORT #endif -#ifdef VTK_HAS_MTIME_TYPE #define VTK_MTIME_TYPE vtkMTimeType -#else -#define VTK_MTIME_TYPE unsigned long -#endif #endif diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp index 7e3de0070a02..e9895d615717 100644 --- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp +++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp @@ -1026,7 +1026,12 @@ void SMDS_UnstructuredGrid::BuildLinks() GetLinks()->Allocate(this->GetNumberOfPoints()); GetLinks()->Register(this); //FIXME: vtk9 + #if VTK_VERSION_NUMBER < VTK_VERSION_CHECK(9,3,0) GetLinks()->BuildLinks(this); + #else + GetLinks()->SetDataSet(this); + GetLinks()->BuildLinks(); + #endif GetLinks()->Delete(); #else this->Links = SMDS_CellLinks::New(); diff --git a/src/App/PropertyExpressionEngine.h b/src/App/PropertyExpressionEngine.h index ac10f3caf6fb..17be3d51a59c 100644 --- a/src/App/PropertyExpressionEngine.h +++ b/src/App/PropertyExpressionEngine.h @@ -194,8 +194,11 @@ class AppExport PropertyExpressionEngine : public App::PropertyExpressionContain using DiGraph = boost::adjacency_list< boost::listS, boost::vecS, boost::directedS >; using Edge = std::pair; // Note: use std::map instead of unordered_map to keep the binding order stable + #if defined(FC_OS_MACOSX) || defined(FC_OS_BSD) || defined(_LIBCPP_VERSION) using ExpressionMap = std::map; - + #else + using ExpressionMap = std::map; + #endif std::vector computeEvaluationOrder(ExecuteOption option); void buildGraphStructures(const App::ObjectIdentifier &path, diff --git a/src/App/StringHasher.h b/src/App/StringHasher.h index 5719437180d2..823f372cef63 100644 --- a/src/App/StringHasher.h +++ b/src/App/StringHasher.h @@ -78,15 +78,15 @@ class AppExport StringID: public Base::BaseClass, public Base::Handled { long value() const {return _id;} const QVector &relatedIDs() const {return _sids;} - bool isBinary() const {return _flags.test(Binary);} - bool isHashed() const {return _flags.test(Hashed);} - bool isPostfixed() const {return _flags.test(Postfixed);} - bool isPostfixEncoded() const {return _flags.test(PostfixEncoded);} - bool isIndexed() const {return _flags.test(Indexed);} - bool isPrefixID() const {return _flags.test(PrefixID);} - bool isPrefixIDIndex() const {return _flags.test(PrefixIDIndex);} - bool isMarked() const {return _flags.test(Marked);} - bool isPersistent() const {return _flags.test(Persistent);} + inline bool isBinary() const {return _flags.test(Binary);} + inline bool isHashed() const {return _flags.test(Hashed);} + inline bool isPostfixed() const {return _flags.test(Postfixed);} + inline bool isPostfixEncoded() const {return _flags.test(PostfixEncoded);} + inline bool isIndexed() const {return _flags.test(Indexed);} + inline bool isPrefixID() const {return _flags.test(PrefixID);} + inline bool isPrefixIDIndex() const {return _flags.test(PrefixIDIndex);} + inline bool isMarked() const {return _flags.test(Marked);} + inline bool isPersistent() const {return _flags.test(Persistent);} bool isFromSameHasher(const StringHasherRef & hasher) const { @@ -146,7 +146,7 @@ class AppExport StringID: public Base::BaseClass, public Base::Handled { void mark() const; - void setPersistent(bool enable) + inline void setPersistent(bool enable) { _flags.set(Persistent, enable); } @@ -343,13 +343,13 @@ class StringIDRef return QVector(); } - bool isBinary() const { + inline bool isBinary() const { if (_sid) return _sid->isBinary(); return false; } - bool isHashed() const { + inline bool isHashed() const { if (_sid) return _sid->isHashed(); return false; @@ -373,7 +373,7 @@ class StringIDRef _sid->mark(); } - bool isMarked() const { + inline bool isMarked() const { return _sid && _sid->isMarked(); } diff --git a/src/Base/Builder3D.h b/src/Base/Builder3D.h index 64e2d662cffb..c86fe1ad182a 100644 --- a/src/Base/Builder3D.h +++ b/src/Base/Builder3D.h @@ -28,6 +28,7 @@ #include #include +#include #include #ifndef FC_GLOBAL_H #include diff --git a/src/Base/Observer.cpp b/src/Base/Observer.cpp index 26813b28ff45..b40317e61663 100644 --- a/src/Base/Observer.cpp +++ b/src/Base/Observer.cpp @@ -26,9 +26,12 @@ #include "Observer.h" -namespace Base { +namespace Base +{ +#if !defined(__MINGW32__) template class BaseExport Observer; template class BaseExport Subject; +#endif -} //namespace Base +} // namespace Base diff --git a/src/Base/Observer.h b/src/Base/Observer.h index 494c1d23cc9d..b37aec97e874 100644 --- a/src/Base/Observer.h +++ b/src/Base/Observer.h @@ -216,6 +216,7 @@ class Subject std::set *> _ObserverSet; }; + // Workaround for MSVC #if defined (FreeCADBase_EXPORTS) && defined(_MSC_VER) # define Base_EXPORT @@ -223,8 +224,11 @@ class Subject # define Base_EXPORT BaseExport #endif + +#if !defined(__MINGW32__) extern template class Base_EXPORT Observer; extern template class Base_EXPORT Subject; +#endif } //namespace Base diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index 11e6a055610b..289a71d2cbff 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -45,6 +45,8 @@ include_directories( ${COIN3D_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${XercesC_INCLUDE_DIRS} + ${QtXml_INCLUDE_DIRS} + ${QtWidgets_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${3DCONNEXION_INCLUDE_DIR} ) diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 3a384371bcc1..e3d9fe077074 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -11,6 +11,7 @@ if(BUILD_GUI) ${COIN3D_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${QT_INCLUDE_DIR} + ${QtWidgets_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${XercesC_INCLUDE_DIRS} ) diff --git a/src/Mod/Import/App/dxf/dxf.h b/src/Mod/Import/App/dxf/dxf.h index 8ab4d3b6d45f..2d2cabf1deda 100644 --- a/src/Mod/Import/App/dxf/dxf.h +++ b/src/Mod/Import/App/dxf/dxf.h @@ -6,6 +6,10 @@ #ifndef _dxf_h_ #define _dxf_h_ +#ifdef _MSC_VER +#pragma warning(disable : 4251) +#endif + #include #include #include @@ -136,7 +140,7 @@ typedef enum } eDXFVersion_t; //******************** -class CDxfWrite{ +class ImportExport CDxfWrite{ private: std::ofstream* m_ofs; bool m_fail; @@ -187,77 +191,77 @@ class CDxfWrite{ std::vector m_blkRecordList; public: - ImportExport CDxfWrite(const char* filepath); - ImportExport ~CDxfWrite(); + CDxfWrite(const char* filepath); + ~CDxfWrite(); - ImportExport void init(void); - ImportExport void endRun(void); + void init(void); + void endRun(void); - ImportExport bool Failed(){return m_fail;} + bool Failed(){return m_fail;} // void setOptions(void); // bool isVersionValid(int vers); - ImportExport std::string getLayerName() { return m_layerName; } - ImportExport void setLayerName(std::string s); - ImportExport void setVersion(int v) { m_version = v;} - ImportExport void setPolyOverride(bool b) { m_polyOverride = b; } - ImportExport void addBlockName(std::string s, std::string blkRecordHandle); - - ImportExport void writeLine(const double* s, const double* e); - ImportExport void writePoint(const double*); - ImportExport void writeArc(const double* s, const double* e, const double* c, bool dir); - ImportExport void writeEllipse(const double* c, double major_radius, double minor_radius, + std::string getLayerName() { return m_layerName; } + void setLayerName(std::string s); + void setVersion(int v) { m_version = v;} + void setPolyOverride(bool b) { m_polyOverride = b; } + void addBlockName(std::string s, std::string blkRecordHandle); + + void writeLine(const double* s, const double* e); + void writePoint(const double*); + void writeArc(const double* s, const double* e, const double* c, bool dir); + void writeEllipse(const double* c, double major_radius, double minor_radius, double rotation, double start_angle, double end_angle, bool endIsCW); - ImportExport void writeCircle(const double* c, double radius ); - ImportExport void writeSpline(const SplineDataOut &sd); - ImportExport void writeLWPolyLine(const LWPolyDataOut &pd); - ImportExport void writePolyline(const LWPolyDataOut &pd); - ImportExport void writeVertex(double x, double y, double z); - ImportExport void writeText(const char* text, const double* location1, const double* location2, + void writeCircle(const double* c, double radius ); + void writeSpline(const SplineDataOut &sd); + void writeLWPolyLine(const LWPolyDataOut &pd); + void writePolyline(const LWPolyDataOut &pd); + void writeVertex(double x, double y, double z); + void writeText(const char* text, const double* location1, const double* location2, const double height, const int horizJust); - ImportExport void writeLinearDim(const double* textMidPoint, const double* lineDefPoint, + void writeLinearDim(const double* textMidPoint, const double* lineDefPoint, const double* extLine1, const double* extLine2, const char* dimText, int type); - ImportExport void writeLinearDimBlock(const double* textMidPoint, const double* lineDefPoint, + void writeLinearDimBlock(const double* textMidPoint, const double* lineDefPoint, const double* extLine1, const double* extLine2, const char* dimText, int type); - ImportExport void writeAngularDim(const double* textMidPoint, const double* lineDefPoint, + void writeAngularDim(const double* textMidPoint, const double* lineDefPoint, const double* startExt1, const double* endExt1, const double* startExt2, const double* endExt2, const char* dimText); - ImportExport void writeAngularDimBlock(const double* textMidPoint, const double* lineDefPoint, + void writeAngularDimBlock(const double* textMidPoint, const double* lineDefPoint, const double* startExt1, const double* endExt1, const double* startExt2, const double* endExt2, const char* dimText); - ImportExport void writeRadialDim(const double* centerPoint, const double* textMidPoint, + void writeRadialDim(const double* centerPoint, const double* textMidPoint, const double* arcPoint, const char* dimText); - ImportExport void writeRadialDimBlock(const double* centerPoint, const double* textMidPoint, + void writeRadialDimBlock(const double* centerPoint, const double* textMidPoint, const double* arcPoint, const char* dimText); - ImportExport void writeDiametricDim(const double* textMidPoint, + void writeDiametricDim(const double* textMidPoint, const double* arcPoint1, const double* arcPoint2, const char* dimText); - ImportExport void writeDiametricDimBlock(const double* textMidPoint, + void writeDiametricDimBlock(const double* textMidPoint, const double* arcPoint1, const double* arcPoint2, const char* dimText); - ImportExport void writeDimBlockPreamble(); - ImportExport void writeBlockTrailer(void); + void writeDimBlockPreamble(); + void writeBlockTrailer(void); - ImportExport void writeHeaderSection(void); - ImportExport void writeTablesSection(void); - ImportExport void writeBlocksSection(void); - ImportExport void writeEntitiesSection(void); - ImportExport void writeObjectsSection(void); - ImportExport void writeClassesSection(void); + void writeHeaderSection(void); + void writeTablesSection(void); + void writeBlocksSection(void); + void writeEntitiesSection(void); + void writeObjectsSection(void); + void writeClassesSection(void); - ImportExport void makeLayerTable(void); - ImportExport void makeBlockRecordTableHead(void); - ImportExport void makeBlockRecordTableBody(void); - ImportExport void makeBlockSectionHead(void); + void makeLayerTable(void); + void makeBlockRecordTableHead(void); + void makeBlockRecordTableBody(void); + void makeBlockSectionHead(void); }; // derive a class from this and implement it's virtual functions -class CDxfRead{ +class ImportExport CDxfRead{ private: std::ifstream* m_ifs; @@ -315,28 +319,27 @@ class CDxfRead{ const char* GeneralToUTF8(const char* encoded) const; public: - ImportExport CDxfRead(const char* filepath); // this opens the file - ImportExport virtual ~CDxfRead(); // this closes the file - - ImportExport bool Failed(){return m_fail;} - ImportExport void DoRead(const bool ignore_errors = false); // this reads the file and calls the following functions + CDxfRead(const char* filepath); // this opens the file + virtual ~CDxfRead(); // this closes the file - ImportExport double mm( double value ) const; + bool Failed(){return m_fail;} + void DoRead(const bool ignore_errors = false); // this reads the file and calls the following functions - ImportExport bool IgnoreErrors() const { return(m_ignore_errors); } + double mm( double value ) const; - ImportExport virtual void OnReadLine(const double* /*s*/, const double* /*e*/, bool /*hidden*/){} - ImportExport virtual void OnReadPoint(const double* /*s*/){} - ImportExport virtual void OnReadText(const double* /*point*/, const double /*height*/, const char* /*text*/){} - ImportExport virtual void OnReadArc(const double* /*s*/, const double* /*e*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){} - ImportExport virtual void OnReadCircle(const double* /*s*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){} - ImportExport virtual void OnReadEllipse(const double* /*c*/, double /*major_radius*/, double /*minor_radius*/, double /*rotation*/, double /*start_angle*/, double /*end_angle*/, bool /*dir*/){} - ImportExport virtual void OnReadSpline(struct SplineData& /*sd*/){} - ImportExport virtual void OnReadInsert(const double* /*point*/, const double* /*scale*/, const char* /*name*/, double /*rotation*/){} - ImportExport virtual void OnReadDimension(const double* /*s*/, const double* /*e*/, const double* /*point*/, double /*rotation*/){} - ImportExport virtual void AddGraphics() const { } + bool IgnoreErrors() const { return(m_ignore_errors); } - ImportExport std::string LayerName() const; + virtual void OnReadLine(const double* /*s*/, const double* /*e*/, bool /*hidden*/){} + virtual void OnReadPoint(const double* /*s*/){} + virtual void OnReadText(const double* /*point*/, const double /*height*/, const char* /*text*/){} + virtual void OnReadArc(const double* /*s*/, const double* /*e*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){} + virtual void OnReadCircle(const double* /*s*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){} + virtual void OnReadEllipse(const double* /*c*/, double /*major_radius*/, double /*minor_radius*/, double /*rotation*/, double /*start_angle*/, double /*end_angle*/, bool /*dir*/){} + virtual void OnReadSpline(struct SplineData& /*sd*/){} + virtual void OnReadInsert(const double* /*point*/, const double* /*scale*/, const char* /*name*/, double /*rotation*/){} + virtual void OnReadDimension(const double* /*s*/, const double* /*e*/, const double* /*point*/, double /*rotation*/){} + virtual void AddGraphics() const { } + std::string LayerName() const; }; #endif