pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

prusaslicer: Add package option glesv2 to build targeting OpenGL ES v2.



Module Name:	pkgsrc-wip
Committed By:	Paul Ripke <stix%stix.id.au@localhost>
Pushed By:	stix
Date:		Sun Jun 23 18:29:39 2024 +1000
Changeset:	31011db6d327a2c74569d9d61f792dc8cae8755c

Modified Files:
	prusaslicer/Makefile
	prusaslicer/distinfo
	prusaslicer/patches/patch-CMakeLists.txt
	prusaslicer/patches/patch-src_slic3r_GUI_OpenGLManager.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.cpp
Added Files:
	prusaslicer/options.mk
	prusaslicer/patches/patch-src_slic3r_GUI_Gizmos_GLGizmoMeasure.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_ImGuiPureWrap.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.hpp

Log Message:
prusaslicer: Add package option glesv2 to build targeting OpenGL ES v2.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=31011db6d327a2c74569d9d61f792dc8cae8755c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 prusaslicer/Makefile                               |  5 ++--
 prusaslicer/distinfo                               |  9 ++++---
 prusaslicer/options.mk                             | 12 +++++++++
 prusaslicer/patches/patch-CMakeLists.txt           | 14 ++++++++--
 .../patch-src_slic3r_GUI_Gizmos_GLGizmoMeasure.cpp | 16 ++++++++++++
 .../patches/patch-src_slic3r_GUI_ImGuiPureWrap.cpp | 15 +++++++++++
 .../patches/patch-src_slic3r_GUI_OpenGLManager.cpp | 30 ++++++++++++++++++++++
 ...tch-src_slic3r_GUI_UserAccountCommunication.cpp | 17 +++++++++---
 ...tch-src_slic3r_GUI_UserAccountCommunication.hpp | 15 +++++++++++
 9 files changed, 123 insertions(+), 10 deletions(-)

diffs:
diff --git a/prusaslicer/Makefile b/prusaslicer/Makefile
index 34e54484bf..a097889305 100644
--- a/prusaslicer/Makefile
+++ b/prusaslicer/Makefile
@@ -28,11 +28,12 @@ BUILDLINK_TRANSFORM.NetBSD+=	rm:-ldl
 BUILDLINK_TRANSFORM.NetBSD+=	l:libexpat:expat
 
 .include "../../mk/bsd.prefs.mk"
+.include "options.mk"
 
 CMAKE_ARGS+=	-DSLIC3R_FHS:BOOL=TRUE
-#CMAKE_ARGS+=	-DCMAKE_CXX_FLAGS:STRING=-g
+CMAKE_ARGS+=	-DSLIC3R_PCH:BOOL=FALSE
 
-# CMake goes looking for this binary. Make it happy.
+# CMake goes looking for these binaries. Make it happy.
 pre-configure:
 	${LN} -sf ${PREFIX}/bin/heatshrink ${BUILDLINK_DIR}/bin/
 	${LN} -sf ${PREFIX}/bin/bgcode ${BUILDLINK_DIR}/bin/
diff --git a/prusaslicer/distinfo b/prusaslicer/distinfo
index 94e9381d54..a8f18642ba 100644
--- a/prusaslicer/distinfo
+++ b/prusaslicer/distinfo
@@ -3,7 +3,7 @@ $NetBSD$
 BLAKE2s (PrusaSlicer-2.8.0-alpha5.tar.gz) = dc9a5bb49396b753d45d48c02f66eef5c647a2afafb1433247fda8a5dc3a148f
 SHA512 (PrusaSlicer-2.8.0-alpha5.tar.gz) = 1fb9749646f08dac750f7ef08194bd7e7e55c81cdfb2c1b5352f1846305c894c05d780f5a4ff164a40f0d46388472431e4ac5c35426eb18e6275c5762329d5e6
 Size (PrusaSlicer-2.8.0-alpha5.tar.gz) = 68915023 bytes
-SHA1 (patch-CMakeLists.txt) = 33eb39d85ba7b33226f2cc022250872c3ffa28d8
+SHA1 (patch-CMakeLists.txt) = 115d6354b7e5a512c802037ae2794e76be54b083
 SHA1 (patch-cmake_modules_FindOpenVDB.cmake) = 4f2afc423a70fe60617b33ff7f26859b39775faa
 SHA1 (patch-src_CMakeLists_txt) = 1e2d07daef1ed2160f0a5e429efe4d1b01989484
 SHA1 (patch-src_avrdude_arduino.c) = ff02a4cab1c2d8c82ec7b22c7447ed5ec360ac57
@@ -34,12 +34,14 @@ SHA1 (patch-src_slic3r_GUI_GUI__App.cpp) = 43d46cf899bd42f81720e7254d30bedfe426f
 SHA1 (patch-src_slic3r_GUI_GUI__Factories.cpp) = a3db8dc6e41c4df3cba7282fdd0cdadd1bc7d956
 SHA1 (patch-src_slic3r_GUI_GUI__ObjectLayers.cpp) = da99be89d62efffceaccc81ade8e55e1fadb7919
 SHA1 (patch-src_slic3r_GUI_GUI__Utils.cpp) = bcbc83109ba7806e6371d0ef10f3c05cc480d730
+SHA1 (patch-src_slic3r_GUI_Gizmos_GLGizmoMeasure.cpp) = 2d70ef92abf3c0c8110ca321b6f7ff880f59ed53
+SHA1 (patch-src_slic3r_GUI_ImGuiPureWrap.cpp) = 3c0a1d8b7b3d8eb0ee593495544752920912d29a
 SHA1 (patch-src_slic3r_GUI_InstanceCheck.cpp) = c9ae1ec2db2b493578cc128383fa4cf0b3e2ae6a
 SHA1 (patch-src_slic3r_GUI_InstanceCheck.hpp) = 2af0741f480c41d5cc5bd9d3e55480c8e6ab029c
 SHA1 (patch-src_slic3r_GUI_KBShortcutsDialog.cpp) = 82a395a10e9d0a1b049863d8d30bce2ed99cb5f2
 SHA1 (patch-src_slic3r_GUI_Mouse3DController.cpp) = bf8bf60e17e304a2022b9a80852d7ab38fc2451d
 SHA1 (patch-src_slic3r_GUI_Mouse3DController.hpp) = 6a008114e932b08951428b6fa882b41acaa85c0b
-SHA1 (patch-src_slic3r_GUI_OpenGLManager.cpp) = 9e268c262df27de127d077585c142b941fae8cc1
+SHA1 (patch-src_slic3r_GUI_OpenGLManager.cpp) = 53d116ee715dd3c90bad11c55659c538f49007ea
 SHA1 (patch-src_slic3r_GUI_OptionsGroup.cpp) = c413f24a9a50069b93bdd611b95fa85ccab45567
 SHA1 (patch-src_slic3r_GUI_PhysicalPrinterDialog.cpp) = 5dbe3c5c19ce5d03b5dd310af484b712b091efda
 SHA1 (patch-src_slic3r_GUI_Plater.cpp) = 840abde0ab6e033787c301f8157a291699f31158
@@ -53,7 +55,8 @@ SHA1 (patch-src_slic3r_GUI_TopBar.cpp) = cf899a96bbf324ee2f2e8e15dccaa32a798d094
 SHA1 (patch-src_slic3r_GUI_UnsavedChangesDialog.cpp) = 1594eb7521f23c42700b0fbed7c039b62e9d4029
 SHA1 (patch-src_slic3r_GUI_UnsavedChangesDialog.hpp) = 0bd01147f0b654d190534959708fbf346cbb364e
 SHA1 (patch-src_slic3r_GUI_UpdateDialogs.cpp) = 7fdcc609e66c619c110db2da18b24ddfd0ffe2a2
-SHA1 (patch-src_slic3r_GUI_UserAccountCommunication.cpp) = 42f065373028e91563e6f49339e0e36307e20568
+SHA1 (patch-src_slic3r_GUI_UserAccountCommunication.cpp) = bbb1784d6e0aecace2bf3998cecfb6f50089acc1
+SHA1 (patch-src_slic3r_GUI_UserAccountCommunication.hpp) = f3f8a402e6efd64c13677c17b1bb90194d307745
 SHA1 (patch-src_slic3r_GUI_WipeTowerDialog.cpp) = fc6fd1bfee7001c268bf50209bcfd1cb96f6a9ad
 SHA1 (patch-src_slic3r_GUI_wxExtensions.cpp) = d6e807f3dd1f18fa9c703798067fa1e808112891
 SHA1 (patch-src_slic3r_GUI_wxExtensions.hpp) = 356da6dbd7ca7f60fa8a73c51533a1c1ad1530c1
diff --git a/prusaslicer/options.mk b/prusaslicer/options.mk
new file mode 100644
index 0000000000..9708a010cd
--- /dev/null
+++ b/prusaslicer/options.mk
@@ -0,0 +1,12 @@
+# $NetBSD$
+
+PKG_OPTIONS_VAR=		PKG_OPTIONS.prusaslicer
+PKG_SUPPORTED_OPTIONS=		glesv2
+PKG_SUGGESTED_OPTIONS=
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mglesv2)
+CMAKE_ARGS+=		-DSLIC3R_OPENGL_ES:BOOL=TRUE
+CMAKE_ARGS+=		-DCMAKE_C_FLAGS:STRING=-DGLAD_GLES2_USE_SYSTEM_EGL=1
+.endif
diff --git a/prusaslicer/patches/patch-CMakeLists.txt b/prusaslicer/patches/patch-CMakeLists.txt
index 50be1a61de..8b31d295f0 100644
--- a/prusaslicer/patches/patch-CMakeLists.txt
+++ b/prusaslicer/patches/patch-CMakeLists.txt
@@ -2,9 +2,11 @@ $NetBSD$
 
 Use GTK3, since that's how we build wxWidgets.
 
---- CMakeLists.txt.orig	2022-04-22 11:01:19.000000000 +0000
+Define additional macro to OpenGL ES builds.
+
+--- CMakeLists.txt.orig	2024-06-14 21:54:48.000000000 +0000
 +++ CMakeLists.txt
-@@ -38,7 +38,7 @@ CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_IN
+@@ -53,7 +53,7 @@ CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_IN
  
  set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
  
@@ -13,3 +15,11 @@ Use GTK3, since that's how we build wxWidgets.
  
  set(IS_CROSS_COMPILE FALSE)
  
+@@ -112,6 +112,7 @@ endif ()
+ 
+ if (SLIC3R_OPENGL_ES)
+     add_definitions(-DSLIC3R_OPENGL_ES)
++    add_definitions(-DENABLE_OPENGL_ES)
+ endif()
+ 
+ if(SLIC3R_DESKTOP_INTEGRATION)
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_Gizmos_GLGizmoMeasure.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_Gizmos_GLGizmoMeasure.cpp
new file mode 100644
index 0000000000..3f0a715c8e
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_Gizmos_GLGizmoMeasure.cpp
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Don't redefine viewport if building for OpenGL ES.
+
+--- src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp.orig	2024-06-19 22:46:33.687428298 +0000
++++ src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp
+@@ -1561,7 +1561,9 @@ void GLGizmoMeasure::render_dimensioning
+         const Vec3d label_position_world = Geometry::translation_transform(center) * (draw_radius * (Eigen::Quaternion<double>(Eigen::AngleAxisd(step * 0.5 * double(resolution), normal)) * e1_unit));
+ 
+         // label screen coordinates
++#if !SLIC3R_OPENGL_ES
+         const std::array<int, 4>& viewport = camera.get_viewport();
++#endif
+         const Vec2d label_position_ss = TransformHelper::world_to_ss(label_position_world,
+             camera.get_projection_matrix().matrix() * camera.get_view_matrix().matrix(), viewport);
+ 
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_ImGuiPureWrap.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_ImGuiPureWrap.cpp
new file mode 100644
index 0000000000..1e1c3830b9
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_ImGuiPureWrap.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add missing include.
+
+--- src/slic3r/GUI/ImGuiPureWrap.cpp.orig	2024-06-19 23:08:49.135122434 +0000
++++ src/slic3r/GUI/ImGuiPureWrap.cpp
+@@ -5,6 +5,8 @@
+ ///|/
+ #include "ImGuiPureWrap.hpp"
+ 
++#include <cmath>
++
+ #include <boost/algorithm/string/predicate.hpp>
+ #include <boost/nowide/convert.hpp>
+ 
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_OpenGLManager.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_OpenGLManager.cpp
index 7eca9a7e21..42fc749f44 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_OpenGLManager.cpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_OpenGLManager.cpp
@@ -8,6 +8,9 @@ Allow running on machines with OpenGL 3.0 & 3.1.
 Discussion in:
 https://github.com/prusa3d/PrusaSlicer/issues/12334
 
+Drop ForwardCompatible from core profile attributes; this allows my i915 to
+use profile version 3.3.
+
 --- src/slic3r/GUI/OpenGLManager.cpp.orig	2024-06-14 21:54:48.000000000 +0000
 +++ src/slic3r/GUI/OpenGLManager.cpp
 @@ -346,7 +346,7 @@ bool OpenGLManager::init_gl()
@@ -28,3 +31,30 @@ https://github.com/prusa3d/PrusaSlicer/issues/12334
  #endif // SLIC3R_OPENGL_ES
  
          if (!valid_version) {
+@@ -446,7 +446,7 @@ wxGLContext* OpenGLManager::init_glconte
+     if (m_context == nullptr) {
+ #if SLIC3R_OPENGL_ES
+         wxGLContextAttrs attrs;
+-        attrs.PlatformDefaults().ES2().MajorVersion(2).EndList();
++        attrs.PlatformDefaults().ES2().EndList();
+         m_context = new wxGLContext(&canvas, nullptr, &attrs);
+ #else
+         m_debug_enabled = enable_debug;
+@@ -462,7 +462,7 @@ wxGLContext* OpenGLManager::init_glconte
+             wxLogNull logNo;
+             for (auto v = OpenGLVersions::core.rbegin(); v != OpenGLVersions::core.rend(); ++v) {
+                 wxGLContextAttrs attrs;
+-                attrs.PlatformDefaults().MajorVersion(v->first).MinorVersion(v->second).CoreProfile().ForwardCompatible();
++                attrs.PlatformDefaults().MajorVersion(v->first).MinorVersion(v->second).CoreProfile();
+                 if (m_debug_enabled)
+                     attrs.DebugCtx();
+                 attrs.EndList();
+@@ -497,7 +497,7 @@ wxGLContext* OpenGLManager::init_glconte
+                 // disable wxWidgets logging to avoid showing the log dialog in case the following code fails generating a valid gl context
+                 wxLogNull logNo;
+                 wxGLContextAttrs attrs;
+-                attrs.PlatformDefaults().MajorVersion(gl_major).MinorVersion(gl_minor).CoreProfile().ForwardCompatible();
++                attrs.PlatformDefaults().MajorVersion(gl_major).MinorVersion(gl_minor).CoreProfile();
+                 if (m_debug_enabled)
+                     attrs.DebugCtx();
+                 attrs.EndList();
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.cpp
index 93914a27e7..b579124f4b 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.cpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.cpp
@@ -2,9 +2,20 @@ $NetBSD$
 
 Treat NetBSD like linux.
 
---- src/slic3r/GUI/UserAccountCommunication.cpp.orig	2024-06-15 08:30:31.450057675 +0000
+Add missing includes.
+
+--- src/slic3r/GUI/UserAccountCommunication.cpp.orig	2024-06-14 21:54:48.000000000 +0000
 +++ src/slic3r/GUI/UserAccountCommunication.cpp
-@@ -31,7 +31,7 @@
+@@ -7,6 +7,8 @@
+ 
+ #include <boost/log/trivial.hpp>
+ #include <boost/beast/core/detail/base64.hpp>
++#include <boost/algorithm/string/split.hpp>
++#include <boost/nowide/convert.hpp>
+ #include <curl/curl.h>
+ #include <string>
+ 
+@@ -31,7 +33,7 @@
  #include <CommonCrypto/CommonDigest.h>
  #endif
  
@@ -13,7 +24,7 @@ Treat NetBSD like linux.
  #include <openssl/evp.h>
  #include <openssl/bio.h>
  #include <openssl/buffer.h>
-@@ -567,4 +567,4 @@ std::string CodeChalengeGenerator::sha25
+@@ -567,4 +569,4 @@ std::string CodeChalengeGenerator::sha25
      return std::string(reinterpret_cast<char*>(digest), digestLen);
  }
  #endif // __linux__
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.hpp
new file mode 100644
index 0000000000..4990231480
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_UserAccountCommunication.hpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add missing include.
+
+--- src/slic3r/GUI/UserAccountCommunication.hpp.orig	2024-06-19 22:16:43.632775046 +0000
++++ src/slic3r/GUI/UserAccountCommunication.hpp
+@@ -5,6 +5,8 @@
+ #include "Event.hpp"
+ #include "libslic3r/AppConfig.hpp"
+ 
++#include <wx/timer.h>
++
+ #include <queue>
+ #include <condition_variable>
+ #include <map>


Home | Main Index | Thread Index | Old Index