Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported a few commits from master to fix build on MSYS #914

Merged
merged 2 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 21 additions & 10 deletions src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
#include <map>
#include <set>

#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;
Expand Down Expand Up @@ -74,36 +85,36 @@ 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;
int myID;
double myBallDiameter;
std::vector<int> 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<int>& quanities, bool isQuad=false )
SMESH_EXPORT_MSVC ElemFeatures& Init( std::vector<int>& quanities, bool isQuad=false )
{ myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad;
myPolyhedQuantities.swap( quanities ); return *this; }

SMESH_EXPORT ElemFeatures& Init( const std::vector<int>& quanities, bool isQuad=false )
SMESH_EXPORT_MSVC ElemFeatures& Init( const std::vector<int>& 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; }
};

/*!
Expand Down
4 changes: 0 additions & 4 deletions src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 4 additions & 1 deletion src/App/PropertyExpressionEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, int>;
// 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<App::ObjectIdentifier, ExpressionInfo>;

#else
using ExpressionMap = std::map<const App::ObjectIdentifier, ExpressionInfo>;
#endif
std::vector<App::ObjectIdentifier> computeEvaluationOrder(ExecuteOption option);

void buildGraphStructures(const App::ObjectIdentifier &path,
Expand Down
26 changes: 13 additions & 13 deletions src/App/StringHasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ class AppExport StringID: public Base::BaseClass, public Base::Handled {
long value() const {return _id;}
const QVector<StringIDRef> &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
{
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -343,13 +343,13 @@ class StringIDRef
return QVector<StringIDRef>();
}

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;
Expand All @@ -373,7 +373,7 @@ class StringIDRef
_sid->mark();
}

bool isMarked() const {
inline bool isMarked() const {
return _sid && _sid->isMarked();
}

Expand Down
1 change: 1 addition & 0 deletions src/Base/Builder3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <sstream>
#include <vector>
#include <stdint.h>
#include <Base/Tools3D.h>
#ifndef FC_GLOBAL_H
#include <FCGlobal.h>
Expand Down
7 changes: 5 additions & 2 deletions src/Base/Observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
#include "Observer.h"


namespace Base {
namespace Base
{

#if !defined(__MINGW32__)
template class BaseExport Observer<const char*>;
template class BaseExport Subject<const char*>;
#endif

} //namespace Base
} // namespace Base
4 changes: 4 additions & 0 deletions src/Base/Observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,19 @@ class Subject
std::set<Observer <_MessageType> *> _ObserverSet;
};


// Workaround for MSVC
#if defined (FreeCADBase_EXPORTS) && defined(_MSC_VER)
# define Base_EXPORT
#else
# define Base_EXPORT BaseExport
#endif


#if !defined(__MINGW32__)
extern template class Base_EXPORT Observer<const char*>;
extern template class Base_EXPORT Subject<const char*>;
#endif


} //namespace Base
Expand Down
2 changes: 2 additions & 0 deletions src/Gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
Expand Down
1 change: 1 addition & 0 deletions src/Main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
Expand Down
Loading