mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-10-12 17:51:11 -04:00
media-gfx/mayo: opencascade 7.8 compatible
Signed-off-by: Ivan Lloro <ivan.lloro.boada@gmail.com>
This commit is contained in:
2 files changed
+225
No files matched your search
@@ -0,0 +1,184 @@
|
||||
From d1b3545e9257b3bba26b3c2805b510af5d163048 Mon Sep 17 00:00:00 2001
|
||||
From: Hugues Delorme <delorme.hugues@fougue.pro>
|
||||
Date: Wed, 10 Jan 2024 16:57:08 +0100
|
||||
Subject: [PATCH] Port to OpenCascade 7.8.0
|
||||
|
||||
---
|
||||
mayo.pro | 36 +++++++++++++++++++++++---------
|
||||
src/app/widget_main_control.cpp | 1 -
|
||||
src/base/brep_utils.cpp | 8 +++++--
|
||||
src/base/brep_utils.h | 2 +-
|
||||
src/base/caf_utils.h | 4 +++-
|
||||
src/base/tkernel_utils.h | 2 ++
|
||||
tests/test_base.cpp | 5 +++--
|
||||
|
||||
diff --git a/mayo.pro b/mayo.pro
|
||||
index a21b22d..f2bd14e 100644
|
||||
--- a/mayo.pro
|
||||
+++ b/mayo.pro
|
||||
@@ -173,19 +173,36 @@ LIBS += \
|
||||
-lTKXmlXCAF \
|
||||
-lTKXSBase \
|
||||
|
||||
-versionAtLeast(OCC_VERSION_STR, 7.7.0) {
|
||||
- LIBS += -lTKXDE
|
||||
+versionAtLeast(OCC_VERSION_STR, 7.8.0) {
|
||||
+ # -- IGES support
|
||||
+ LIBS += -lTKDEIGES
|
||||
+ # -- STEP support
|
||||
+ LIBS += -lTKDESTEP
|
||||
+ # -- STL support
|
||||
+ LIBS += -lTKDESTL
|
||||
+ # -- VRML support
|
||||
+ LIBS += -lTKDEVRML
|
||||
+} else {
|
||||
+ # -- IGES support
|
||||
+ LIBS += -lTKIGES -lTKXDEIGES
|
||||
+ # -- STEP support
|
||||
+ LIBS += -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXDESTEP
|
||||
+ # -- STL support
|
||||
+ LIBS += -lTKSTL
|
||||
+ # -- VRML support
|
||||
+ LIBS += -lTKVRML
|
||||
+
|
||||
+ versionAtLeast(OCC_VERSION_STR, 7.7.0) {
|
||||
+ LIBS += -lTKXDE
|
||||
+ }
|
||||
}
|
||||
|
||||
-# -- IGES support
|
||||
-LIBS += -lTKIGES -lTKXDEIGES
|
||||
-# -- STEP support
|
||||
-LIBS += -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXDESTEP
|
||||
-# -- STL support
|
||||
-LIBS += -lTKSTL
|
||||
# -- OBJ/glTF support
|
||||
versionAtLeast(OCC_VERSION_STR, 7.4.0) {
|
||||
LIBS += -lTKRWMesh
|
||||
+ versionAtLeast(OCC_VERSION_STR, 7.8.0) {
|
||||
+ LIBS += -lTKDEOBJ -lTKDEGLTF
|
||||
+ }
|
||||
} else {
|
||||
SOURCES -= \
|
||||
src/io_occ/io_occ_base_mesh.cpp \
|
||||
@@ -205,8 +222,7 @@ versionAtLeast(OCC_VERSION_STR, 7.4.0) {
|
||||
SOURCES -= src/io_occ/io_occ_obj_writer.cpp
|
||||
message(OBJ writer disabled because OpenCascade < v7.6)
|
||||
}
|
||||
-# -- VRML support
|
||||
-LIBS += -lTKVRML
|
||||
+
|
||||
!versionAtLeast(OCC_VERSION_STR, 7.7.0) {
|
||||
SOURCES -= src/io_occ/io_occ_vrml_reader.cpp
|
||||
message(VRML reader disabled because OpenCascade < v7.7)
|
||||
diff --git a/src/app/widget_main_control.cpp b/src/app/widget_main_control.cpp
|
||||
index 51eca63..3240e3a 100644
|
||||
--- a/src/app/widget_main_control.cpp
|
||||
+++ b/src/app/widget_main_control.cpp
|
||||
@@ -312,7 +312,6 @@ QWidget* WidgetMainControl::recreateLeftHeaderPlaceHolder()
|
||||
|
||||
WidgetGuiDocument* WidgetMainControl::widgetGuiDocument(int idx) const
|
||||
{
|
||||
- assert(idx == -1 || (0 <= idx && idx < m_ui->stack_GuiDocuments->count()));
|
||||
return qobject_cast<WidgetGuiDocument*>(m_ui->stack_GuiDocuments->widget(idx));
|
||||
}
|
||||
|
||||
diff --git a/src/base/brep_utils.cpp b/src/base/brep_utils.cpp
|
||||
index 1b2f119..b694f5b 100644
|
||||
--- a/src/base/brep_utils.cpp
|
||||
+++ b/src/base/brep_utils.cpp
|
||||
@@ -59,9 +59,13 @@ bool BRepUtils::moreComplex(TopAbs_ShapeEnum lhs, TopAbs_ShapeEnum rhs)
|
||||
return lhs < rhs;
|
||||
}
|
||||
|
||||
-int BRepUtils::hashCode(const TopoDS_Shape& shape)
|
||||
+size_t BRepUtils::hashCode(const TopoDS_Shape& shape)
|
||||
{
|
||||
- return !shape.IsNull() ? shape.HashCode(INT_MAX) : -1;
|
||||
+#if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 8, 0)
|
||||
+ return std::hash<TopoDS_Shape>{}(shape);
|
||||
+#else
|
||||
+ return shape.HashCode(INT_MAX);
|
||||
+#endif
|
||||
}
|
||||
|
||||
std::string BRepUtils::shapeToString(const TopoDS_Shape& shape)
|
||||
diff --git a/src/base/brep_utils.h b/src/base/brep_utils.h
|
||||
index 76830e8..a98dd2e 100644
|
||||
--- a/src/base/brep_utils.h
|
||||
+++ b/src/base/brep_utils.h
|
||||
@@ -53,7 +53,7 @@ struct BRepUtils {
|
||||
// Returns hash code computed from 'shape'
|
||||
// Computation uses the internal TShape and Location, but Orientation is not considered
|
||||
// Returned hash code is in the range [1, max(int)]
|
||||
- static int hashCode(const TopoDS_Shape& shape);
|
||||
+ static size_t hashCode(const TopoDS_Shape& shape);
|
||||
|
||||
// Serializes 'shape' into a string representation
|
||||
static std::string shapeToString(const TopoDS_Shape& shape);
|
||||
diff --git a/src/base/caf_utils.h b/src/base/caf_utils.h
|
||||
index d849de5..8863aa5 100644
|
||||
--- a/src/base/caf_utils.h
|
||||
+++ b/src/base/caf_utils.h
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
+#include <Standard_Version.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
@@ -43,7 +44,7 @@ struct CafUtils {
|
||||
|
||||
} // namespace Mayo
|
||||
|
||||
-
|
||||
+#if OCC_VERSION_HEX < 0x070800
|
||||
#include <TDF_LabelMapHasher.hxx>
|
||||
namespace std {
|
||||
|
||||
@@ -55,6 +56,7 @@ template<> struct hash<TDF_Label> {
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
+#endif
|
||||
|
||||
// --
|
||||
// -- Implementation
|
||||
diff --git a/src/base/tkernel_utils.h b/src/base/tkernel_utils.h
|
||||
index 3dd4500..4f1d97a 100644
|
||||
--- a/src/base/tkernel_utils.h
|
||||
+++ b/src/base/tkernel_utils.h
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
|
||||
} // namespace Mayo
|
||||
|
||||
+#if OCC_VERSION_HEX < OCC_VERSION_CHECK(7, 8, 0)
|
||||
namespace std {
|
||||
|
||||
// Specialization of C++11 std::hash<> functor for opencascade::handle<> objects
|
||||
@@ -65,3 +66,4 @@ template<typename T> struct hash<opencascade::handle<T>> {
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
+#endif
|
||||
diff --git a/tests/test_base.cpp b/tests/test_base.cpp
|
||||
index e98f482..b28040e 100644
|
||||
--- a/tests/test_base.cpp
|
||||
+++ b/tests/test_base.cpp
|
||||
@@ -653,9 +653,10 @@ void TestBase::BRepUtils_test()
|
||||
const TopoDS_Shape shapeNull;
|
||||
const TopoDS_Shape shapeBase = BRepPrimAPI_MakeBox(25, 25, 25);
|
||||
const TopoDS_Shape shapeCopy = shapeBase;
|
||||
- QCOMPARE(BRepUtils::hashCode(shapeNull), -1);
|
||||
- QVERIFY(BRepUtils::hashCode(shapeBase) >= 0);
|
||||
+ const TopoDS_Shape shapeOther = BRepPrimAPI_MakeBox(40, 40, 40);
|
||||
+ QCOMPARE(BRepUtils::hashCode(shapeNull), BRepUtils::hashCode(TopoDS_Shape{}));
|
||||
QCOMPARE(BRepUtils::hashCode(shapeBase), BRepUtils::hashCode(shapeCopy));
|
||||
+ QVERIFY(BRepUtils::hashCode(shapeBase) != BRepUtils::hashCode(shapeOther));
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.45.2
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit qmake-utils desktop xdg
|
||||
|
||||
DESCRIPTION="Opensource 3D CAD viewer and converter"
|
||||
HOMEPAGE="https://github.com/fougue/mayo"
|
||||
SRC_URI="https://github.com/fougue/mayo/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
|
||||
|
||||
LICENSE="BSD-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
RDEPEND="
|
||||
dev-qt/qttranslations:6
|
||||
dev-qt/qtbase:6[opengl]
|
||||
>=media-libs/assimp-5.3.1
|
||||
>=sci-libs/opencascade-7.8.0
|
||||
"
|
||||
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${P}-nogit.patch
|
||||
"${FILESDIR}"/${P}-gcc14.patch
|
||||
"${FILESDIR}"/${P}-opencascade7_8.patch
|
||||
)
|
||||
|
||||
src_configure() {
|
||||
eqmake6 "CASCADE_INC_DIR=/usr/include/opencascade" "CASCADE_LIB_DIR=/usr/$(get_libdir)/opencascade" "ASSIMP_INC_DIR=/usr/include/assimp" "ASSIMP_LIB_DIR=/usr/$(get_libdir)" mayo.pro
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake install INSTALL_ROOT="${ED}"
|
||||
dobin mayo
|
||||
newicon -s scalable images/appicon.svg mayo.svg
|
||||
make_desktop_entry "mayo %F" Mayo mayo "Graphics;" "MimeType=model/step;model/iges;model/brep;image/vnd.dxf;model/obj;model/gltf+json;model/gltf+binary;model/vrml;model/stl;model/x.stl-ascii;model/x.stl-binary;application/x-amf;application/x-coff;application/x-coffexec;model/3mf;image/x-3ds;model/vnd.collada+xml;model/x3d+binary;model/x3d+fastinfoset;model/x3d+vrml;model/x3d+xml;model/x3d-vrml;application/directx;"
|
||||
einstalldocs
|
||||
}
|
||||
Reference in new issue
Block a user