Update for LibPack3 (#10337)

* cMake: Add base support for LibPack3

Minor changes to FreeCAD source code to support compiling with Qt 6.5 on MSVC,
and changes to cMake setup to support the new Libpack.

* NETGENPlugin: Fix compilation with MSVC and OCCT 7.8

* Material: Switch to Wrapped_ParseTupleAndKeywords for /fpermissive- on MSVC

* Base: Prevent accidental definition of MIN and MAX by MSVC

* cMake: Prevent accidentally finding an old LibPack

* Material: Wrap another ParseTuple call

* OCCT: Modify includes for 7.8.x

* Part: Change TNP code to use Wrapped_ParseTupleAndArgs

* Spreadsheet: Workaround for MSVC macro pollution

* Mesh: Workaround for MSVC macro pollution

* Base: Remove extra MSVC flag (moved to CMake)

* Tests: Fix compiling with /permissive-

* FEM: Fix Qt warnings about duplicate element names

* cMake: Ensure major version numbers are set

* Address review comments.

* cMake: Further tweaks for LibPack3

* cMake: Modify specification of compiler flags for MSVC

* Main: Remove QtQuick testing code

* cmake: Find Boost before SMESH (which uses it)

* Fixes for LibPack2

* cMake: Another try at importinhg VTK cleanly
This commit is contained in:
Chris Hennes
2024-06-24 11:25:05 -05:00
committed by GitHub
parent c06cbce42c
commit 5e47f6804f
42 changed files with 421 additions and 156 deletions

View File

@@ -19,7 +19,7 @@ link_directories(${OCC_LIBRARY_DIR})
if(NOT FREECAD_USE_PYBIND11)
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER OR FREECAD_LIBPACK_CHECKFILE_VERSION)
# boost-python >= 1.67 on some platforms has suffix
if (FORCE_BOOST_PY_SUFFIX)
set(BOOST_PY_SUFFIX ${FORCE_BOOST_PY_SUFFIX})

View File

@@ -550,7 +550,7 @@
</widget>
</item>
<item row="7" column="1">
<spacer name="horizontalSpacer_2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -605,7 +605,7 @@
</widget>
</item>
<item row="8" column="1">
<spacer name="horizontalSpacer_2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>

View File

@@ -21,7 +21,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout1">
<item>
<widget class="QLabel" name="label">
<property name="text">
@@ -39,7 +39,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout2">
<item>
<widget class="QLabel" name="label">
<property name="text">

View File

@@ -31,6 +31,8 @@
#include "MaterialManagerPy.cpp"
#include <Base/PyWrapParseTupleAndKeywords.h>
using namespace Materials;
// returns a string which represents the object e.g. when printed in python
@@ -229,12 +231,11 @@ PyObject* MaterialManagerPy::save(PyObject* args, PyObject* kwds)
PyObject* overwrite = Py_False;
PyObject* saveAsCopy = Py_False;
PyObject* saveInherited = Py_False;
static char* kwds_save[] =
{"library", "material", "path", "overwrite", "saveAsCopy", "saveInherited", nullptr};
if (!PyArg_ParseTupleAndKeywords(args,
static const std::array<const char *, 7> kwlist { "library", "material", "path", "overwrite", "saveAsCopy", "saveInherited", nullptr };
if (!Base::Wrapped_ParseTupleAndKeywords(args,
kwds,
"etOet|O!O!O!",
kwds_save,
kwlist,
"utf-8", &libraryName,
&obj,
"utf-8", &path,
@@ -302,18 +303,18 @@ PyObject* MaterialManagerPy::filterMaterials(PyObject* args, PyObject* kwds)
{
PyObject* filterPy {};
PyObject* includeLegacy = Py_False;
static char* kwds_save[] = {"filter",
"includeLegacy",
nullptr};
if (!PyArg_ParseTupleAndKeywords(args,
kwds,
// "O|O!",
"O!|O!",
kwds_save,
&MaterialFilterPy::Type,
&filterPy,
&PyBool_Type,
&includeLegacy)) {
static const std::array<const char*, 3> kwds_save{ "filter",
"includeLegacy",
nullptr };
if (!Base::Wrapped_ParseTupleAndKeywords(args,
kwds,
// "O|O!",
"O!|O!",
kwds_save,
&MaterialFilterPy::Type,
&filterPy,
&PyBool_Type,
&includeLegacy)) {
return nullptr;
}

View File

@@ -95,7 +95,7 @@ bool Reader3MF::LoadModel(std::istream& str)
Base::StdInputSource inputSource(str, "3dmodel.model");
parser->parse(inputSource);
std::unique_ptr<DOMDocument> xmlDocument(parser->adoptDocument());
std::unique_ptr<XERCES_CPP_NAMESPACE::DOMDocument> xmlDocument(parser->adoptDocument());
return LoadModel(*xmlDocument);
}
catch (const XMLException&) {
@@ -106,7 +106,7 @@ bool Reader3MF::LoadModel(std::istream& str)
}
}
bool Reader3MF::LoadModel(DOMDocument& xmlDocument)
bool Reader3MF::LoadModel(XERCES_CPP_NAMESPACE::DOMDocument& xmlDocument)
{
DOMNodeList* nodes = xmlDocument.getElementsByTagName(XStr("model").unicodeForm());
for (XMLSize_t i = 0; i < nodes->getLength(); i++) {

View File

@@ -113,7 +113,7 @@ if (BUILD_FLAT_MESH)
SET_BIN_DIR(flatmesh flatmesh /Mod/MeshPart)
install(TARGETS flatmesh DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER OR FREECAD_LIBPACK_CHECKFILE_VERSION)
# boost-python >= 1.67 on some platforms has suffix
if (FORCE_BOOST_PY_SUFFIX)
set(BOOST_PY_SUFFIX ${FORCE_BOOST_PY_SUFFIX})

View File

@@ -26,8 +26,11 @@
// OpenCASCADE
// Standard*
#include <Standard_Version.hxx>
#include <Standard_AbortiveTransaction.hxx>
#if OCC_VERSION_HEX < 0x070800
#include <Standard_Address.hxx>
#endif
#include <Standard_Boolean.hxx>
#include <Standard_Byte.hxx>
#include <Standard_Character.hxx>
@@ -41,7 +44,9 @@
#include <Standard_DomainError.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_ExtCharacter.hxx>
#if OCC_VERSION_HEX < 0x070800
#include <Standard_ExtString.hxx>
#endif
#include <Standard_Failure.hxx>
#include <Standard_GUID.hxx>
#include <Standard_ImmutableObject.hxx>
@@ -76,7 +81,6 @@
#include <Standard_TypeMismatch.hxx>
#include <Standard_Underflow.hxx>
#include <Standard_UUID.hxx>
#include <Standard_Version.hxx>
#if OCC_VERSION_HEX < 0x070700
# include <Standard_TooManyUsers.hxx>

View File

@@ -156,20 +156,24 @@ PyObject *TopoShapePy::PyMake(struct _typeobject *, PyObject *, PyObject *) //
int TopoShapePy::PyInit(PyObject* args, PyObject* keywds)
{
#ifdef FC_USE_TNP_FIX
static char* kwlist[] = {"shape", "op", "tag", "hasher", nullptr};
static const std::array<const char*, 5> kwlist{ "shape",
"op",
"tag",
"hasher",
nullptr };
long tag = 0;
PyObject* pyHasher = nullptr;
const char* op = nullptr;
PyObject* pcObj = nullptr;
if (!PyArg_ParseTupleAndKeywords(args,
keywds,
"|OsiO!",
kwlist,
&pcObj,
&op,
&tag,
&App::StringHasherPy::Type,
&pyHasher)) {
if (!Base::Wrapped_ParseTupleAndKeywords(args,
keywds,
"|OsiO!",
kwlist,
&pcObj,
&op,
&tag,
&App::StringHasherPy::Type,
&pyHasher)) {
return -1;
}
auto& self = *getTopoShapePtr();
@@ -2476,14 +2480,14 @@ PyObject* TopoShapePy::makeEvolved(PyObject *args, PyObject *kwds)
PyObject* ProfOnSpine = Py_False;
auto JoinType = JoinType::arc;
double Tolerance = 0.0000001;
static char* kwds_evolve[] = {"Profile", "Join", "AxeProf", "Solid", "ProfOnSpine", "Tolerance", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|iO!O!O!d", kwds_evolve,
&TopoShapePy::Type, &Profile, &JoinType,
&PyBool_Type, &AxeProf, &PyBool_Type, &Solid,
&PyBool_Type, &ProfOnSpine, &Tolerance))
static const std::array<const char*, 7> kwds_evolve{"Profile", "Join", "AxeProf", "Solid", "ProfOnSpine", "Tolerance", nullptr};
if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!|iO!O!O!d", kwds_evolve,
&TopoShapePy::Type, &Profile, &JoinType,
&PyBool_Type, &AxeProf, &PyBool_Type, &Solid,
&PyBool_Type, &ProfOnSpine, &Tolerance)) {
return nullptr;
}
try {
return Py::new_reference_to(shape2pyshape(getTopoShapePtr()->makeElementEvolve(
*static_cast<TopoShapePy*>(Profile)->getTopoShapePtr(), JoinType,
@@ -3125,22 +3129,22 @@ PyObject* TopoShapePy::findSubShape(PyObject* args)
PyObject* TopoShapePy::findSubShapesWithSharedVertex(PyObject* args, PyObject* keywds)
{
static char* kwlist[] = {"shape", "needName", "checkGeometry", "tol", "atol", nullptr};
static const std::array<const char*, 6> kwlist {"shape", "needName", "checkGeometry", "tol", "atol", nullptr};
PyObject* pyobj;
PyObject* needName = Py_False;
PyObject* checkGeometry = Py_True;
double tol = 1e-7;
double atol = 1e-12;
if (!PyArg_ParseTupleAndKeywords(args,
keywds,
"O!|OOdd",
kwlist,
&Type,
&pyobj,
&needName,
&checkGeometry,
&tol,
&atol)) {
if (!Base::Wrapped_ParseTupleAndKeywords(args,
keywds,
"O!|OOdd",
kwlist,
&Type,
&pyobj,
&needName,
&checkGeometry,
&tol,
&atol)) {
return nullptr;
}

View File

@@ -46,6 +46,9 @@ FC_LOG_LEVEL_INIT("Spreadsheet", true, true)
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#ifdef PropertySheet
#undef PropertySheet // Microsoft's #define conflicts with the use below
#endif
#endif
using namespace App;