diff --git a/cad/horizon-eda/Makefile b/cad/horizon-eda/Makefile index 87d18d0e6ac8..88054f80ba35 100644 --- a/cad/horizon-eda/Makefile +++ b/cad/horizon-eda/Makefile @@ -1,52 +1,53 @@ PORTNAME= horizon-eda DISTVERSIONPREFIX= v DISTVERSION= 2.7.2 +PORTREVISION= 1 CATEGORIES= cad MAINTAINER= yuri@FreeBSD.org COMMENT= EDA package for printed circuit board design WWW= https://horizon-eda.org/ \ https://github.com/horizon-eda/horizon LICENSE= GPLv3+ LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= ${LOCALBASE}/include/boost/optional.hpp:devel/boost-libs \ cmake:devel/cmake-core \ cppzmq>0:net/cppzmq \ glm>0:math/glm LIB_DEPENDS= libcurl.so:ftp/curl \ libepoxy.so:graphics/libepoxy \ libfreeimage.so:graphics/freeimage \ libgit2.so:devel/libgit2 \ libpng16.so:graphics/png \ libpodofo09.so:graphics/podofo09 \ libspnav.so:misc/libspnav \ libTKDESTEP.so:cad/opencascade \ libuuid.so:misc/libuuid \ libzmq.so:net/libzmq4 USES= desktop-file-utils gnome libarchive localbase meson pkgconfig \ python:build sqlite USE_GNOME= atkmm gdkpixbuf gtkmm30 librsvg2 USE_GITHUB= yes GH_PROJECT= horizon BINARY_ALIAS= python3=${PYTHON_CMD} # Patch sources to force using include files installed by graphics/podofo09 pre-configure: @${REINPLACE_CMD} -e '/^#include/s|podofo/podofo.h|podofo09/podofo.h|' \ ${WRKSRC}/src/export_pdf/export_pdf.cpp \ ${WRKSRC}/src/export_pdf/export_pdf_board.cpp \ ${WRKSRC}/src/python_module/board.cpp \ ${WRKSRC}/src/python_module/schematic.cpp \ ${WRKSRC}/src/imp/pdf_export_window.cpp \ ${WRKSRC}/src/export_pdf/export_pdf_util.hpp \ ${WRKSRC}/src/export_pdf/canvas_pdf.hpp post-install: # https://github.com/horizon-eda/horizon/issues/558 @cd ${STAGEDIR}${PREFIX}/bin && ${STRIP_CMD} horizon-eda horizon-imp .include diff --git a/cad/horizon-eda/files/patch-src_export__step_export__step.cpp b/cad/horizon-eda/files/patch-src_export__step_export__step.cpp new file mode 100644 index 000000000000..c5ff213bb02f --- /dev/null +++ b/cad/horizon-eda/files/patch-src_export__step_export__step.cpp @@ -0,0 +1,82 @@ +--- src/export_step/export_step.cpp.orig 2025-12-03 22:56:50 UTC ++++ src/export_step/export_step.cpp +@@ -27,7 +27,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -97,13 +97,13 @@ class CanvasHole : public Canvas { (public) + + class CanvasHole : public Canvas { + public: +- CanvasHole(TopTools_ListOfShape &cs, uint64_t mdia = 0) : cutouts(cs), min_diameter(mdia) ++ CanvasHole(NCollection_List &cs, uint64_t mdia = 0) : cutouts(cs), min_diameter(mdia) + { + img_mode = true; + } + + private: +- TopTools_ListOfShape &cutouts; ++ NCollection_List &cutouts; + uint64_t min_diameter; + + void img_hole(const class Hole &hole) override +@@ -302,7 +302,7 @@ static TDF_Label transferModel(Handle(TDocStd_Document + Handle(XCAFDoc_ShapeTool) s_assy = XCAFDoc_DocumentTool::ShapeTool(source->Main()); + + // retrieve all free shapes within the assembly +- TDF_LabelSequence frshapes; ++ NCollection_Sequence frshapes; + s_assy->GetFreeShapes(frshapes); + + // d_assy = shape tool for the destination +@@ -431,7 +431,7 @@ void export_step(const std::string &filename, const Bo + auto outline = brd.get_outline(); + if (outline.outline.vertices.size()) { // board has valid outline + progress_cb("Board cutouts…"); +- TopTools_ListOfShape cutouts; ++ NCollection_List cutouts; + + progress_cb("Holes…"); + { +@@ -451,12 +451,12 @@ void export_step(const std::string &filename, const Bo + if (!cutouts.IsEmpty()) { + BRepAlgoAPI_Cut builder; + +- TopTools_ListOfShape board_shapes; ++ NCollection_List board_shapes; + board_shapes.Append(board_face); + + builder.SetArguments(board_shapes); + builder.SetTools(cutouts); +- builder.SetRunParallel(Standard_True); ++ builder.SetRunParallel(true); + builder.Build(); + + board = BRepPrimAPI_MakePrism(builder.Shape(), v); +@@ -546,9 +546,9 @@ void export_step(const std::string &filename, const Bo + assy->UpdateAssemblies(); + #endif + STEPCAFControl_Writer writer; +- writer.SetColorMode(Standard_True); +- writer.SetNameMode(Standard_True); +- if (Standard_False == writer.Transfer(doc, STEPControl_AsIs)) { ++ writer.SetColorMode(true); ++ writer.SetNameMode(true); ++ if (false == writer.Transfer(doc, STEPControl_AsIs)) { + throw std::runtime_error("transfer error"); + } + +@@ -559,7 +559,7 @@ void export_step(const std::string &filename, const Bo + hdr.SetOriginatingSystem(new TCollection_HAsciiString("horizon EDA")); + hdr.SetDescriptionValue(1, new TCollection_HAsciiString("Electronic assembly")); + +- if (Standard_False == writer.Write(filename.c_str())) ++ if (false == writer.Write(filename.c_str())) + throw std::runtime_error("write error"); + + progress_cb("Done"); diff --git a/cad/horizon-eda/files/patch-src_import__step_step__importer.cpp b/cad/horizon-eda/files/patch-src_import__step_step__importer.cpp new file mode 100644 index 000000000000..932e884f7465 --- /dev/null +++ b/cad/horizon-eda/files/patch-src_import__step_step__importer.cpp @@ -0,0 +1,152 @@ +--- src/import_step/step_importer.cpp.orig 2025-12-03 22:56:50 UTC ++++ src/import_step/step_importer.cpp +@@ -30,7 +30,7 @@ + + #include + #include +-#include ++#include + #include + #include + #include +@@ -38,7 +38,7 @@ + #include + + #include +-#include ++#include + #include + #include + +@@ -143,7 +143,7 @@ bool STEPImporter::processFace(const TopoDS_Face &face + + bool STEPImporter::processFace(const TopoDS_Face &face, Quantity_Color *color, const glm::dmat4 &mat) + { +- if (Standard_True == face.IsNull()) ++ if (face.IsNull()) + return false; + + { +@@ -163,18 +163,18 @@ bool STEPImporter::processFace(const TopoDS_Face &face + // bool useBothSides = false; + + TopLoc_Location loc; +- Standard_Boolean isTessellate(Standard_False); ++ bool isTessellate = false; + Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(face, loc); + + if (triangulation.IsNull() || triangulation->Deflection() > USER_PREC + Precision::Confusion()) +- isTessellate = Standard_True; ++ isTessellate = true; + + if (isTessellate) { +- BRepMesh_IncrementalMesh IM(face, USER_PREC, Standard_False, USER_ANGLE); ++ BRepMesh_IncrementalMesh IM(face, USER_PREC, false, USER_ANGLE); + triangulation = BRep_Tool::Triangulation(face, loc); + } + +- if (triangulation.IsNull() == Standard_True) ++ if (triangulation.IsNull()) + return false; + + Quantity_Color lcolor; +@@ -192,13 +192,6 @@ bool STEPImporter::processFace(const TopoDS_Face &face + + Poly::ComputeNormals(triangulation); + +-#ifndef HORIZON_NEW_OCC +- const TColgp_Array1OfPnt &arrPolyNodes = triangulation->Nodes(); +- const Poly_Array1OfTriangle &arrTriangles = triangulation->Triangles(); +- const TShort_Array1OfShortReal &arrNormals = triangulation->Normals(); +-#endif +- +- + result->faces.emplace_back(); + auto &face_out = result->faces.back(); + if (color) { +@@ -213,11 +206,7 @@ bool STEPImporter::processFace(const TopoDS_Face &face + + std::map> pts_map; + for (int i = 1; i <= triangulation->NbNodes(); i++) { +-#ifdef HORIZON_NEW_OCC + gp_XYZ v(triangulation->Node(i).Coord()); +-#else +- gp_XYZ v(arrPolyNodes(i).Coord()); +-#endif + const glm::vec4 vg(v.X(), v.Y(), v.Z(), 1); + const auto vt = mat * vg; + const Vertex vertex(vt.x, vt.y, vt.z); +@@ -227,16 +216,8 @@ bool STEPImporter::processFace(const TopoDS_Face &face + + face_out.normals.reserve(triangulation->NbNodes()); + for (int i = 1; i <= triangulation->NbNodes(); i++) { +-#ifdef HORIZON_NEW_OCC + const auto n = triangulation->Normal(i); + glm::vec4 vg(n.X(), n.Y(), n.Z(), 0); +-#else +- auto offset = (i - 1) * 3 + 1; +- auto x = arrNormals(offset + 0); +- auto y = arrNormals(offset + 1); +- auto z = arrNormals(offset + 2); +- glm::vec4 vg(x, y, z, 0); +-#endif + auto vt = mat * vg; + vt /= vt.length(); + face_out.normals.emplace_back(vt.x, vt.y, vt.z); +@@ -259,11 +240,7 @@ bool STEPImporter::processFace(const TopoDS_Face &face + face_out.triangle_indices.reserve(triangulation->NbTriangles()); + for (int i = 1; i <= triangulation->NbTriangles(); i++) { + int a, b, c; +-#ifdef HORIZON_NEW_OCC + triangulation->Triangle(i).Get(a, b, c); +-#else +- arrTriangles(i).Get(a, b, c); +-#endif + face_out.triangle_indices.emplace_back(a - 1, b - 1, c - 1); + } + +@@ -306,7 +283,7 @@ bool STEPImporter::processSolid(const TopoDS_Shape &sh + + bool STEPImporter::processSolid(const TopoDS_Shape &shape, const glm::dmat4 &mat_in) + { +- TDF_Label label = m_assy->FindShape(shape, Standard_False); ++ TDF_Label label = m_assy->FindShape(shape, false); + bool ret = false; + + hasSolid = true; +@@ -328,7 +305,7 @@ bool STEPImporter::processSolid(const TopoDS_Shape &sh + auto mat = mat_in * glm::translate(glm::dvec3(coord.X(), coord.Y(), coord.Z())); + + gp_XYZ axis; +- Standard_Real angle; ++ double angle; + + if (T.GetRotation(axis, angle)) { + glm::dvec3 gaxis(axis.X(), axis.Y(), axis.Z()); +@@ -358,7 +335,7 @@ bool STEPImporter::processComp(const TopoDS_Shape &sha + auto mat = mat_in * glm::translate(glm::dvec3(coord.X(), coord.Y(), coord.Z())); + + gp_XYZ axis; +- Standard_Real angle; ++ double angle; + + if (T.GetRotation(axis, angle)) { + glm::dvec3 gaxis(axis.X(), axis.Y(), axis.Z()); +@@ -442,7 +419,7 @@ Result STEPImporter::get_faces_and_points() + Result res; + result = &res; + +- TDF_LabelSequence frshapes; ++ NCollection_Sequence frshapes; + m_assy->GetFreeShapes(frshapes); + + int nshapes = frshapes.Length(); +@@ -461,7 +438,7 @@ std::vector STEPImporter::get_shapes() + std::vector STEPImporter::get_shapes() + { + std::vector r; +- TDF_LabelSequence frshapes; ++ NCollection_Sequence frshapes; + m_assy->GetFreeShapes(frshapes); + + int nshapes = frshapes.Length();