backports/cura: new aport #276

Merged
ayakael merged 5 commits from cura/initial into edge 2024-01-19 03:12:15 +00:00
20 changed files with 1365 additions and 0 deletions

73
backports/cura/APKBUILD Normal file
View file

@ -0,0 +1,73 @@
# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=cura
# uranium and curaengine packages must be updated in sync with this verion number
# py3-pynest2d and fdm-materials should be checked as well, but their versions are not always in sync
pkgver=5.2.2
pkgrel=0
pkgdesc="3D printer / slicing GUI built on top of the Uranium framework"
url="https://ultimaker.com/software/ultimaker-cura"
arch="noarch !ppc64le !x86 !armhf !riscv64 !s390x !armv7" # ppc64le: no py3-keyring
# x86: no curaengine
# armhf: no uranium, qt5-qtquickcontrols, qt5-qtquickcontrols2, qt5-qtgraphicaleffects
# riscv64: no uranium
# s390x: no py3-trimesh, no py3-numpy-stl
# armv7: no py3-trimesh
license="LGPL-3.0-or-later"
# add cura-binary-data to depends when packaged
depends="
curaengine
fdm-materials
uranium
py3-arcus
py3-keyring
py3-numpy-stl
py3-pyclipper
py3-pynest2d
py3-pyserial
py3-qt6
py3-requests
py3-trimesh
py3-zeroconf
"
makedepends="samurai cmake gettext gettext-dev" # needs msginit from gettext
checkdepends="py3-pytest"
subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/Ultimaker/Cura/archive/refs/tags/$pkgver.tar.gz
AppDesktopData.patch
CuraVersion.patch
cmake-helpers.patch
cmake.patch"
builddir="$srcdir/Cura-$pkgver"
options="!check" # tests broken after v5.x
build() {
cmake -B build -G Ninja \
-DCURA_VERSION=$pkgver \
-DURANIUM_DIR=/usr/share/uranium \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DGETTEXT_MSGINIT_EXECUTABLE=msginit \
-DCURA_BINARY_DATA_DIRECTORY=/usr/share/cura \
-DCMAKE_BUILD_TYPE=minsizerel
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
mv $pkgdir/usr/bin/cura_app.py $pkgdir/usr/bin/cura
# don't ever send any user or print info through the internet to Ultimaker
rm -rf "$pkgdir/usr/lib/cura/plugins/SliceInfoPlugin"
install -d "$pkgdir"/usr/share/locale
mv "$pkgdir"/usr/share/cura/resources/i18n/* "$pkgdir"/usr/share/locale/
}
sha512sums="
5d4e0fdc740d0c048905e2b87cc8c73eedea59b54766b74760505902007b365582d22b46b1cfdcd6914828840865c10a3beb0ef6a1f04ea181c81d44f42434bc cura-5.2.2.tar.gz
214e373f6cab7e3ccac12c96d1b5ca636d8d1e9ecdadaae84fc28fb429969c7c2d6055ce2a01b6db3ad85ab6cbc8d135cf2c26c77d7cfe13a73eb81aa5e85f11 AppDesktopData.patch
e3bb302db70ca195b2ce9831e71302c8ee2a51955fecc7264a495d7d4fc9c107cfd48811aa5865f16671e7b1ae126f95d3d7bbb6a70f367f7f91a2b32bce377b CuraVersion.patch
0db4ff97e7f82ae1a9dbc9c330d08c3e46249feeb3fb630f7c4e2de73749327337ec041680c39a07e0b5034c1b3f3656d75614ab4dc2f39861c8e27bdb2a58ef cmake-helpers.patch
05a73f892700ff6279230385b04180873a62b7413fa7f7d55ae150f1bcee57ef05eda0bd7fe444fe660ab66a044c958f42badd33b743fca81033ae8f19dd3805 cmake.patch
"

View file

@ -0,0 +1,58 @@
--- /dev/null
+++ ./com.ultimaker.cura.appdata.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2016 Richard Hughes <richard@hughsie.com> -->
+<component type="desktop">
+ <id>com.ultimaker.cura.desktop</id>
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>LGPL-3.0 and CC-BY-SA-4.0</project_license>
+ <name>Cura</name>
+ <summary>The world's most advanced 3d printer software</summary>
+ <description>
+ <p>
+ Cura creates a seamless integration between hardware, software and
+ materials for the best 3D printing experience around.
+ Cura supports the 3MF, OBJ and STL file formats and is available on
+ Windows, Mac and Linux.
+ </p>
+ <ul>
+ <li>Novices can start printing right away</li>
+ <li>Experts are able to customize 300 settings to achieve the best results</li>
+ <li>Optimized profiles for Ultimaker materials</li>
+ <li>Supported by a global network of Ultimaker certified service partners</li>
+ <li>Print multiple objects at once with different settings for each object</li>
+ <li>Cura supports STL, 3MF and OBJ file formats</li>
+ <li>Open source and completely free</li>
+ </ul>
+ </description>
+ <screenshots>
+ <screenshot type="default">
+ <image>https://raw.githubusercontent.com/Ultimaker/Cura/master/screenshot.png</image>
+ </screenshot>
+ </screenshots>
+ <url type="homepage">https://ultimaker.com/software/ultimaker-cura?utm_source=cura&amp;utm_medium=software&amp;utm_campaign=cura-update-linux</url>
+ <translation type="gettext">Cura</translation>
+</component>
--- /dev/null
+++ ./com.ultimaker.cura.desktop.in
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Name=Ultimaker Cura
+Name[de]=Ultimaker Cura
+Name[nl]=Ultimaker Cura
+GenericName=3D Printing Software
+GenericName[de]=3D-Druck-Software
+GenericName[nl]=3D-printsoftware
+Comment=Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great.
+Comment[de]=Cura wandelt 3D-Modelle in Pfade für einen 3D-Drucker um. Es bereitet Ihren Druck für maximale Genauigkeit, minimale Druckzeit und guter Zuverlässigkeit mit vielen zusätzlichen Funktionen vor, damit Ihr Druck großartig wird.
+Comment[nl]=Cura converteert 3D-modellen naar paden voor een 3D printer. Het bereidt je print voor om zeer precies, snel en betrouwbaar te kunnen printen, met veel extra functionaliteit om je print er goed uit te laten komen.
+Exec=@CMAKE_INSTALL_FULL_BINDIR@/cura %F
+TryExec=@CMAKE_INSTALL_FULL_BINDIR@/cura
+Icon=cura-icon
+Terminal=false
+Type=Application
+MimeType=model/stl;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;image/bmp;image/gif;image/jpeg;image/png;text/x-gcode;application/x-amf;application/x-ply;application/x-ctm;model/vnd.collada+xml;model/gltf-binary;model/gltf+json;model/vnd.collada+xml+zip;
+Categories=Graphics;
+Keywords=3D;Printing;Slicer;
+StartupWMClass=cura.real

View file

@ -0,0 +1,16 @@
--- /dev/null
+++ ./cura/CuraVersion.py.in
@@ -0,0 +1,13 @@
+# Copyright (c) 2020 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
+
+CuraAppName = "@CURA_APP_NAME@"
+CuraAppDisplayName = "@CURA_APP_DISPLAY_NAME@"
+CuraVersion = "@CURA_VERSION@"
+CuraBuildType = "@CURA_BUILDTYPE@"
+CuraDebugMode = True if "@_cura_debugmode@" == "ON" else False
+CuraCloudAPIRoot = "@CURA_CLOUD_API_ROOT@"
+CuraCloudAPIVersion = "@CURA_CLOUD_API_VERSION@"
+CuraCloudAccountAPIRoot = "@CURA_CLOUD_ACCOUNT_API_ROOT@"
+CuraMarketplaceRoot = "@CURA_MARKETPLACE_ROOT@"
+CuraDigitalFactoryURL = "@CURA_DIGITAL_FACTORY_URL@"

View file

@ -0,0 +1,95 @@
--- /dev/null
+++ ./cmake/CuraPluginInstall.cmake
@@ -0,0 +1,92 @@
+# Copyright (c) 2022 Ultimaker B.V.
+# CuraPluginInstall.cmake is released under the terms of the LGPLv3 or higher.
+
+#
+# This module detects all plugins that need to be installed and adds them using the CMake install() command.
+# It detects all plugin folder in the path "plugins/*" where there's a "plugin.json" in it.
+#
+# Plugins can be configured to NOT BE INSTALLED via the variable "CURA_NO_INSTALL_PLUGINS" as a list of string in the
+# form of "a;b;c" or "a,b,c". By default all plugins will be installed.
+#
+
+option(PRINT_PLUGIN_LIST "Should the list of plugins that are installed be printed?" ON)
+
+# Options or configuration variables
+set(CURA_NO_INSTALL_PLUGINS "" CACHE STRING "A list of plugins that should not be installed, separated with ';' or ','.")
+
+file(GLOB_RECURSE _plugin_json_list ${CMAKE_SOURCE_DIR}/plugins/*/plugin.json)
+list(LENGTH _plugin_json_list _plugin_json_list_len)
+
+# Sort the lists alphabetically so we can handle cases like this:
+# - plugins/my_plugin/plugin.json
+# - plugins/my_plugin/my_module/plugin.json
+# In this case, only "plugins/my_plugin" should be added via install().
+set(_no_install_plugin_list ${CURA_NO_INSTALL_PLUGINS})
+# Sanitize the string so the comparison will be case-insensitive.
+string(STRIP "${_no_install_plugin_list}" _no_install_plugin_list)
+string(TOLOWER "${_no_install_plugin_list}" _no_install_plugin_list)
+
+# WORKAROUND counterpart of what's in cura-build.
+string(REPLACE "," ";" _no_install_plugin_list "${_no_install_plugin_list}")
+
+list(LENGTH _no_install_plugin_list _no_install_plugin_list_len)
+
+if(_no_install_plugin_list_len GREATER 0)
+ list(SORT _no_install_plugin_list)
+endif()
+if(_plugin_json_list_len GREATER 0)
+ list(SORT _plugin_json_list)
+endif()
+
+# Check all plugin directories and add them via install() if needed.
+set(_install_plugin_list "")
+foreach(_plugin_json_path ${_plugin_json_list})
+ get_filename_component(_plugin_dir ${_plugin_json_path} DIRECTORY)
+ file(RELATIVE_PATH _rel_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_plugin_dir})
+ get_filename_component(_plugin_dir_name ${_plugin_dir} NAME)
+
+ # Make plugin name comparison case-insensitive
+ string(TOLOWER "${_plugin_dir_name}" _plugin_dir_name_lowercase)
+
+ # Check if this plugin needs to be skipped for installation
+ set(_add_plugin ON) # Indicates if this plugin should be added to the build or not.
+ set(_is_no_install_plugin OFF) # If this plugin will not be added, this indicates if it's because the plugin is
+ # specified in the NO_INSTALL_PLUGINS list.
+ if(_no_install_plugin_list)
+ if("${_plugin_dir_name_lowercase}" IN_LIST _no_install_plugin_list)
+ set(_add_plugin OFF)
+ set(_is_no_install_plugin ON)
+ endif()
+ endif()
+
+ # Make sure this is not a subdirectory in a plugin that's already in the install list
+ if(_add_plugin)
+ foreach(_known_install_plugin_dir ${_install_plugin_list})
+ if(_plugin_dir MATCHES "${_known_install_plugin_dir}.+")
+ set(_add_plugin OFF)
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(_add_plugin)
+ if(${PRINT_PLUGIN_LIST})
+ message(STATUS "[+] PLUGIN TO INSTALL: ${_rel_plugin_dir}")
+ endif()
+ get_filename_component(_rel_plugin_parent_dir ${_rel_plugin_dir} DIRECTORY)
+ install(DIRECTORY ${_rel_plugin_dir}
+ DESTINATION lib${LIB_SUFFIX}/cura/${_rel_plugin_parent_dir}
+ PATTERN "__pycache__" EXCLUDE
+ PATTERN "*.qmlc" EXCLUDE
+ )
+ list(APPEND _install_plugin_list ${_plugin_dir})
+ elseif(_is_no_install_plugin)
+ if(${PRINT_PLUGIN_LIST})
+ message(STATUS "[-] PLUGIN TO REMOVE : ${_rel_plugin_dir}")
+ endif()
+ execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mod_bundled_packages_json.py
+ -d ${CMAKE_CURRENT_SOURCE_DIR}/resources/bundled_packages
+ ${_plugin_dir_name}
+ RESULT_VARIABLE _mod_json_result)
+ endif()
+endforeach()

View file

@ -0,0 +1,85 @@
--- ./CMakeLists.txt.orig
+++ ./CMakeLists.txt
@@ -1,10 +1,6 @@
# Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
-# NOTE: This is only being used for translation scripts.
-
-# For MSVC flags, will be ignored on non-Windows OS's and this project in general. Only needed for cura-build-environment.
-cmake_policy(SET CMP0091 NEW)
project(cura)
cmake_minimum_required(VERSION 3.18)
@@ -15,8 +11,44 @@
set(URANIUM_DIR "${CMAKE_SOURCE_DIR}/../Uranium" CACHE PATH "The location of the Uranium repository")
set(URANIUM_SCRIPTS_DIR "${URANIUM_DIR}/scripts" CACHE PATH "The location of the scripts directory of the Uranium repository")
+option(CURA_DEBUGMODE "Enable debug dialog and other debug features" OFF)
+if(CURA_DEBUGMODE)
+ set(_cura_debugmode "ON")
+endif()
+
option(GENERATE_TRANSLATIONS "Should the translations be generated?" ON)
+set(CURA_APP_NAME "cura" CACHE STRING "Short name of Cura, used for configuration folder")
+set(CURA_APP_DISPLAY_NAME "Ultimaker Cura" CACHE STRING "Display name of Cura")
+set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
+set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
+set(CURA_CLOUD_API_ROOT "" CACHE STRING "Alternative Cura cloud API root")
+set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version")
+set(CURA_CLOUD_ACCOUNT_API_ROOT "" CACHE STRING "Alternative Cura cloud account API version")
+set(CURA_MARKETPLACE_ROOT "" CACHE STRING "Alternative Marketplace location")
+set(CURA_DIGITAL_FACTORY_URL "" CACHE STRING "Alternative Digital Factory location")
+
+configure_file(${CMAKE_SOURCE_DIR}/com.ultimaker.cura.desktop.in ${CMAKE_BINARY_DIR}/com.ultimaker.cura.desktop @ONLY)
+
+configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
+
+if(NOT DEFINED Python_VERSION)
+ set(Python_VERSION
+ 3.11
+ CACHE STRING "Python Version" FORCE)
+ message(STATUS "Setting Python version to ${Python_VERSION}. Set Python_VERSION if you want to compile against an other version.")
+endif()
+if(APPLE)
+ set(Python_FIND_FRAMEWORK NEVER)
+endif()
+find_package(Python ${Python_VERSION} EXACT REQUIRED COMPONENTS Interpreter)
+message(STATUS "Linking and building ${project_name} against Python ${Python_VERSION}")
+if(NOT DEFINED Python_SITELIB_LOCAL)
+ set(Python_SITELIB_LOCAL
+ "${Python_SITELIB}"
+ CACHE PATH "Local alternative site-package location to install Cura" FORCE)
+endif()
+
if(NOT ${URANIUM_DIR} STREQUAL "")
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${URANIUM_DIR}/cmake")
endif()
@@ -29,4 +61,24 @@
if(${GENERATE_TRANSLATIONS})
CREATE_TRANSLATION_TARGETS()
endif()
-endif()
\ No newline at end of file
+endif()
+
+install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
+
+include(CuraPluginInstall)
+
+install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+install(DIRECTORY cura DESTINATION "${Python_SITELIB_LOCAL}")
+install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py DESTINATION "${Python_SITELIB_LOCAL}/cura/")
+if(NOT APPLE AND NOT WIN32)
+ install(FILES ${CMAKE_BINARY_DIR}/com.ultimaker.cura.desktop
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
+ install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
+ install(FILES com.ultimaker.cura.appdata.xml
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
+ install(FILES cura.sharedmimeinfo
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/
+ RENAME cura.xml )
+endif()

View file

@ -0,0 +1,27 @@
# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
pkgname=fdm-materials
pkgver=5.2.2
pkgrel=0
pkgdesc="FDM Material Database"
url="https://github.com/Ultimaker/fdm_materials"
arch="noarch"
license="CC0-1.0"
makedepends="cmake samurai"
options="!check" # no checks provided
source="$pkgname-$pkgver.tar.gz::https://github.com/Ultimaker/fdm_materials/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/fdm_materials-$pkgver"
build() {
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
73eefec8b7b88af73afc578ffba583480bda30309945b1720d7a1a075bd7ab3279599d53fe83f4c96695f294a5a3e11297abc334ca6cc9db163d4eb0fbdaf0f9 fdm-materials-5.2.2.tar.gz
"

View file

@ -0,0 +1,42 @@
# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
pkgname=py3-arcus
# Needs to be upgraded in sync with libarcus
pkgver=5.2.2
pkgrel=3
pkgdesc="Python bindings for libarcus"
url="https://github.com/Ultimaker/pyArcus"
arch="all"
license="LGPL-3.0-only"
makedepends="
cmake
libarcus-dev
protobuf-dev
py3-sip
python3-dev
samurai
"
options="!check" # package doesn't provide any tests
source="$pkgname-$pkgver.tar.gz::https://github.com/Ultimaker/pyArcus/archive/refs/tags/$pkgver.tar.gz
cmake.patch
cmake-helpers.patch
pyproject.patch"
builddir="$srcdir/pyArcus-$pkgver"
build() {
cmake -G Ninja -B build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
b24cbb9a5d7aa917b1b21e46f935b1293645e731d4e475a5abe364237f35708e8e96a1c6f06fe78e2e0e381737f4a27a6db87e42a5f4de9d48091d9de096f9b0 py3-arcus-5.2.2.tar.gz
f14e55cd31c13051981f26364e34da8c94e8eb5227b1cfd6fe44b9f97b5a4dcf6142a1751fa62eb0514a47583e6ec2d51dc253f23cf72c3fe6a1cb5dca136f21 cmake.patch
de75b985607feae0a9c511742915814e9c3d4bc467183f010ccc334ce4d0d952b6ff86020360b78558c4738cc03cf62c386b44ed76bcec12075c4a93dd03eeb7 cmake-helpers.patch
ef593230d5c78da8ba0fc6ea83225c4543857de1837d3151c45e59ffd7c98063b8f97f25d01c15b6a8f90c26c919206f9f7fa26c9650117f4ce7be49ebca876f pyproject.patch
"

View file

@ -0,0 +1,254 @@
--- /dev/null
+++ ./cmake/CMakeBuilder.py
@@ -0,0 +1,13 @@
+from sipbuild import SetuptoolsBuilder
+
+
+class CMakeBuilder(SetuptoolsBuilder):
+ def __init__(self, project, **kwargs):
+ print("Using the CMake builder")
+ super().__init__(project, **kwargs)
+
+ def build(self):
+ """ Only Generate the source files """
+ print("Generating the source files")
+ self._generate_bindings()
+ self._generate_scripts()
--- /dev/null
+++ ./cmake/FindSIP.cmake
@@ -0,0 +1,65 @@
+# Find SIP
+# ~~~~~~~~
+#
+# SIP website: http://www.riverbankcomputing.co.uk/sip/index.php
+#
+# Find the installed version of SIP. FindSIP should be called after Python
+# has been found.
+#
+# This file defines the following variables:
+#
+# SIP_VERSION - The version of SIP found expressed as a 6 digit hex number
+# suitable for comparison as a string.
+#
+# SIP_VERSION_STR - The version of SIP found as a human readable string.
+#
+# SIP_BINARY_PATH - Path and filename of the SIP command line executable.
+#
+# SIP_INCLUDE_DIR - Directory holding the SIP C++ header file.
+#
+# SIP_DEFAULT_SIP_DIR - Default directory where .sip files should be installed
+# into.
+
+# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+
+IF(SIP_VERSION OR SIP_BUILD_EXECUTABLE)
+ # Already in cache, be silent
+ SET(SIP_FOUND TRUE)
+ELSE()
+
+ FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH} NO_CMAKE_FIND_ROOT_PATH)
+
+ EXECUTE_PROCESS(COMMAND ${Python_EXECUTABLE} ${_find_sip_py} OUTPUT_VARIABLE sip_config)
+ IF(sip_config)
+ STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_version_num:([^\n]+).*$" "\\1" SIP_VERSION_NUM ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config})
+ STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config})
+ IF(${SIP_VERSION_STR} VERSION_LESS 5)
+ STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_BINARY_PATH ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_module_dir:([^\n]+).*$" "\\1" SIP_MODULE_DIR ${sip_config})
+ ELSE(${SIP_VERSION_STR} VERSION_LESS 5)
+ FIND_PROGRAM(SIP_BUILD_EXECUTABLE sip-build)
+ ENDIF(${SIP_VERSION_STR} VERSION_LESS 5)
+ SET(SIP_FOUND TRUE)
+ ENDIF(sip_config)
+
+ IF(SIP_FOUND)
+ IF(NOT SIP_FIND_QUIETLY)
+ MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}")
+ ENDIF(NOT SIP_FIND_QUIETLY)
+ ELSE(SIP_FOUND)
+ IF(SIP_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find SIP")
+ ENDIF(SIP_FIND_REQUIRED)
+ ENDIF(SIP_FOUND)
+
+ENDIF()
+
+include(${CMAKE_SOURCE_DIR}/cmake/SIPMacros.cmake)
+ADD_DEFINITIONS(-DSIP_VERSION=0x${SIP_VERSION})
--- /dev/null
+++ ./cmake/FindSIP.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the Simon Edwards <simon@simonzone.com> nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY Simon Edwards <simon@simonzone.com> ''AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL Simon Edwards <simon@simonzone.com> BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# FindSIP.py
+# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+try:
+ import sipbuild
+
+ print("sip_version:%06.0x" % sipbuild.version.SIP_VERSION)
+ print("sip_version_num:%d" % sipbuild.version.SIP_VERSION)
+ print("sip_version_str:%s" % sipbuild.version.SIP_VERSION_STR)
+
+ from distutils.sysconfig import get_python_lib
+ python_modules_dir = get_python_lib(plat_specific=1)
+ print("default_sip_dir:%s" % python_modules_dir)
+except ImportError: # Code for SIP v4
+ import sipconfig
+
+ sipcfg = sipconfig.Configuration()
+ print("sip_version:%06.0x" % sipcfg.sip_version)
+ print("sip_version_num:%d" % sipcfg.sip_version)
+ print("sip_version_str:%s" % sipcfg.sip_version_str)
+ print("sip_bin:%s" % sipcfg.sip_bin)
+ print("default_sip_dir:%s" % sipcfg.default_sip_dir)
+ print("sip_inc_dir:%s" % sipcfg.sip_inc_dir)
+ # SIP 4.19.10+ has new sipcfg.sip_module_dir
+ if hasattr(sipcfg, "sip_module_dir"):
+ print("sip_module_dir:%s" % sipcfg.sip_module_dir)
+ else:
+ print("sip_module_dir:%s" % sipcfg.sip_mod_dir)
--- /dev/null
+++ ./cmake/SIPMacros.cmake
@@ -0,0 +1,107 @@
+
+
+# Macros for SIP
+# ~~~~~~~~~~~~~~
+
+set(SIP_ARGS --pep484-pyi --no-protected-is-public)
+
+function(add_sip_module MODULE_TARGET)
+ if(NOT SIP_BUILD_EXECUTABLE)
+ set(SIP_BUILD_EXECUTABLE ${CMAKE_PREFIX_PATH}/Scripts/sip-build)
+ endif()
+
+ message(STATUS "SIP: Generating pyproject.toml")
+ configure_file(${CMAKE_SOURCE_DIR}/pyproject.toml.in ${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml)
+ configure_file(${CMAKE_SOURCE_DIR}/cmake/CMakeBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/CMakeBuilder.py)
+ if(WIN32)
+ set(ext .pyd)
+ set(env_path_sep ";")
+ else()
+ set(ext .so)
+ set(env_path_sep ":")
+ endif()
+
+ message(STATUS "SIP: Generating source files")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${PYTHONPATH}${env_path_sep}$ENV{PYTHONPATH}${env_path_sep}${CMAKE_CURRENT_BINARY_DIR}" ${SIP_BUILD_EXECUTABLE} ${SIP_ARGS}
+ COMMAND_ECHO STDOUT
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ )
+ # This will generate the source-files during the configuration step in CMake. Needed to obtain the sources
+
+ # Touch the generated files (8 in total) to make them dirty and force them to rebuild
+ message(STATUS "SIP: Touching the source files")
+ set(_sip_output_files)
+ list(LENGTH SIP_FILES _no_outputfiles)
+ foreach(_concat_file_nr RANGE 0 ${_no_outputfiles})
+ if(${_concat_file_nr} LESS 8)
+ list(APPEND _sip_output_files "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/sip${MODULE_TARGET}part${_concat_file_nr}.cpp")
+ endif()
+ endforeach()
+
+ # Find the generated source files
+ message(STATUS "SIP: Collecting the generated source files")
+ file(GLOB sip_c "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/*.c")
+ file(GLOB sip_cpp "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/*.cpp")
+ file(GLOB sip_hdr "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/*.h")
+
+ # Add the user specified source files
+ message(STATUS "SIP: Collecting the user specified source files")
+ get_target_property(usr_src ${MODULE_TARGET} SOURCES)
+
+ # create the target library and link all the files (generated and user specified
+ message(STATUS "SIP: Linking the interface target against the shared library")
+ set(sip_sources "${sip_c}" "${sip_cpp}" "${usr_src}")
+
+ if (BUILD_SHARED_LIBS)
+ add_library("sip_${MODULE_TARGET}" SHARED ${sip_sources})
+ else()
+ add_library("sip_${MODULE_TARGET}" STATIC ${sip_sources})
+ endif()
+
+ # Make sure that the library name of the target is the same as the MODULE_TARGET with the appropriate extension
+ target_link_libraries("sip_${MODULE_TARGET}" PRIVATE "${MODULE_TARGET}")
+ set_target_properties("sip_${MODULE_TARGET}" PROPERTIES PREFIX "")
+ set_target_properties("sip_${MODULE_TARGET}" PROPERTIES SUFFIX ${ext})
+ set_target_properties("sip_${MODULE_TARGET}" PROPERTIES OUTPUT_NAME "${MODULE_TARGET}")
+
+ # Add the custom command to (re-)generate the files and mark them as dirty. This allows the user to actually work
+ # on the sip definition files without having to reconfigure the complete project.
+ if (NOT DEFINED PYTHONPATH)
+ set(PYTHONPATH "")
+ endif ()
+ add_custom_command(
+ TARGET "sip_${MODULE_TARGET}"
+ COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${PYTHONPATH}${env_path_sep}$ENV{PYTHONPATH}${env_path_sep}${CMAKE_CURRENT_BINARY_DIR}" ${SIP_BUILD_EXECUTABLE} ${SIP_ARGS}
+ COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ MAIN_DEPENDENCY ${MODULE_SIP}
+ DEPENDS ${sip_sources}
+ VERBATIM
+ )
+
+ set_target_properties("sip_${MODULE_TARGET}"
+ PROPERTIES
+ RESOURCE "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/${MODULE_TARGET}.pyi")
+endfunction()
+
+function(install_sip_module MODULE_TARGET)
+ if(DEFINED ARGV1)
+ set(_install_path ${ARGV1})
+ else()
+ if(DEFINED Python_SITEARCH)
+ set(_install_path ${Python_SITEARCH})
+ elseif(DEFINED Python_SITELIB)
+ set(_install_path ${Python_SITELIB})
+ else()
+ message(FATAL_ERROR "SIP: Specify the site-packages location")
+ endif()
+ endif()
+ message(STATUS "SIP: Installing Python module and PEP 484 file in ${_install_path}")
+ install(TARGETS "sip_${MODULE_TARGET}"
+ ARCHIVE DESTINATION ${_install_path}
+ LIBRARY DESTINATION ${_install_path}
+ RUNTIME DESTINATION ${_install_path}
+ RESOURCE DESTINATION ${_install_path}
+ )
+endfunction()

View file

@ -0,0 +1,32 @@
--- ./CMakeLists.txt.orig
+++ ./CMakeLists.txt
@@ -2,22 +2,22 @@
project(pyarcus)
cmake_minimum_required(VERSION 3.20)
-find_package(protobuf REQUIRED)
-find_package(cpython REQUIRED)
-find_package(arcus REQUIRED)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
-find_package(standardprojectsettings REQUIRED)
-find_package(sipbuildtool REQUIRED)
+find_package(Protobuf REQUIRED)
+find_package(Python REQUIRED COMPONENTS Interpreter Development)
+find_package(Arcus REQUIRED)
+find_package(SIP 6.5.0 REQUIRED)
+
add_library(pyArcus INTERFACE src/PythonMessage.cpp)
-use_threads(pyArcus)
target_include_directories(pyArcus
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
)
-target_link_libraries(pyArcus INTERFACE arcus::arcus protobuf::libprotobuf cpython::cpython)
+target_link_libraries(pyArcus INTERFACE Arcus protobuf::libprotobuf Python::Python)
add_sip_module(pyArcus)
install_sip_module(pyArcus)

View file

@ -0,0 +1,20 @@
--- /dev/null
+++ ./pyproject.toml.in
@@ -0,0 +1,17 @@
+[build-system]
+requires = ["sip >=6, <7"]
+build-backend = "sipbuild.api"
+
+[tool.sip.metadata]
+name = "pyArcus"
+
+[tool.sip.project]
+builder-factory = "CMakeBuilder"
+sip-files-dir = "${CMAKE_CURRENT_SOURCE_DIR}/python/"
+sip-include-dirs = ["CMAKE_CURRENT_SOURCE_DIR/python/"]
+build-dir = "${CMAKE_CURRENT_BINARY_DIR}/pyArcus/"
+
+[tool.sip.bindings.pyArcus]
+exceptions = true
+release-gil = true
+concatenate = 8

View file

@ -0,0 +1,49 @@
# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=py3-pynest2d
pkgver=5.2.2
pkgrel=2
pkgdesc="Python bindings for libnest2d"
url="https://github.com/Ultimaker/pynest2d"
arch="all"
license="LGPL-3.0-or-later"
makedepends="samurai cmake libnest2d-dev clipper-dev py3-sip nlopt-dev boost-dev python3-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/Ultimaker/pynest2d/archive/refs/tags/$pkgver.tar.gz
cmake.patch
cmake-helpers.patch
pyproject.patch"
builddir="$srcdir/pynest2d-$pkgver"
options="!check" # doesn't seem like tests are packaged anymore
prepare() {
mv ./python ./src
default_prepare
}
build() {
if [ "$CBUILD" != "$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=Release \
$CMAKE_CROSSOPTS
cmake --build build
}
check() {
cd build
CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
f5d701e431c81f8d2da7b14ca5677d3303064cf7910e80d289d7ff8fe99117fb9c470242f25f21fa8e1f064c63accf5349f4956981e316b09b14342223f79b61 py3-pynest2d-5.2.2.tar.gz
c8133d221a2fd8ed5fb32933a69f992dab2e83cdb9db30dcb715ebdfe6d403be3e94df393a921f506b63ef9d8b30a107f26b57cd39810faa9bee461afe5e1afd cmake.patch
dbf6609a21e39ae87fa89f2faf9c98a011f287cb383c5b74f92f41e3a350b487e69643c94110f7fcc25e9e25921a698cc20d9ee021d36ff908d03c0d5ca88a46 cmake-helpers.patch
f1b710509d97b5a2a4d021747e73884d27ae00fd93a04c90be01f123cdcc59be4757b4a73dff9c9921b7794551e531cf6729e4211144c60294d107b92a928b51 pyproject.patch
"

View file

@ -0,0 +1,253 @@
--- /dev/null
+++ ./cmake/CMakeBuilder.py
@@ -0,0 +1,13 @@
+from sipbuild import SetuptoolsBuilder
+
+
+class CMakeBuilder(SetuptoolsBuilder):
+ def __init__(self, project, **kwargs):
+ print("Using the CMake builder")
+ super().__init__(project, **kwargs)
+
+ def build(self):
+ """ Only Generate the source files """
+ print("Generating the source files")
+ self._generate_bindings()
+ self._generate_scripts()
\ No newline at end of file
--- /dev/null
+++ ./cmake/FindSIP.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the Simon Edwards <simon@simonzone.com> nor the
+# names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY Simon Edwards <simon@simonzone.com> ''AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL Simon Edwards <simon@simonzone.com> BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# FindSIP.py
+# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+try:
+ import sipbuild
+
+ print("sip_version:%06.0x" % sipbuild.version.SIP_VERSION)
+ print("sip_version_num:%d" % sipbuild.version.SIP_VERSION)
+ print("sip_version_str:%s" % sipbuild.version.SIP_VERSION_STR)
+
+ from distutils.sysconfig import get_python_lib
+ python_modules_dir = get_python_lib(plat_specific=1)
+ print("default_sip_dir:%s" % python_modules_dir)
+except ImportError: # Code for SIP v4
+ import sipconfig
+
+ sipcfg = sipconfig.Configuration()
+ print("sip_version:%06.0x" % sipcfg.sip_version)
+ print("sip_version_num:%d" % sipcfg.sip_version)
+ print("sip_version_str:%s" % sipcfg.sip_version_str)
+ print("sip_bin:%s" % sipcfg.sip_bin)
+ print("default_sip_dir:%s" % sipcfg.default_sip_dir)
+ print("sip_inc_dir:%s" % sipcfg.sip_inc_dir)
+ # SIP 4.19.10+ has new sipcfg.sip_module_dir
+ if hasattr(sipcfg, "sip_module_dir"):
+ print("sip_module_dir:%s" % sipcfg.sip_module_dir)
+ else:
+ print("sip_module_dir:%s" % sipcfg.sip_mod_dir)
--- /dev/null
+++ ./cmake/FindSIP.cmake
@@ -0,0 +1,65 @@
+# Find SIP
+# ~~~~~~~~
+#
+# SIP website: http://www.riverbankcomputing.co.uk/sip/index.php
+#
+# Find the installed version of SIP. FindSIP should be called after Python
+# has been found.
+#
+# This file defines the following variables:
+#
+# SIP_VERSION - The version of SIP found expressed as a 6 digit hex number
+# suitable for comparison as a string.
+#
+# SIP_VERSION_STR - The version of SIP found as a human readable string.
+#
+# SIP_BINARY_PATH - Path and filename of the SIP command line executable.
+#
+# SIP_INCLUDE_DIR - Directory holding the SIP C++ header file.
+#
+# SIP_DEFAULT_SIP_DIR - Default directory where .sip files should be installed
+# into.
+
+# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+
+IF(SIP_VERSION OR SIP_BUILD_EXECUTABLE)
+ # Already in cache, be silent
+ SET(SIP_FOUND TRUE)
+ELSE()
+
+ FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH} NO_CMAKE_FIND_ROOT_PATH)
+
+ EXECUTE_PROCESS(COMMAND ${Python_EXECUTABLE} ${_find_sip_py} OUTPUT_VARIABLE sip_config)
+ IF(sip_config)
+ STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_version_num:([^\n]+).*$" "\\1" SIP_VERSION_NUM ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config})
+ STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config})
+ IF(${SIP_VERSION_STR} VERSION_LESS 5)
+ STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_BINARY_PATH ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config})
+ STRING(REGEX REPLACE ".*\nsip_module_dir:([^\n]+).*$" "\\1" SIP_MODULE_DIR ${sip_config})
+ ELSE(${SIP_VERSION_STR} VERSION_LESS 5)
+ FIND_PROGRAM(SIP_BUILD_EXECUTABLE sip-build)
+ ENDIF(${SIP_VERSION_STR} VERSION_LESS 5)
+ SET(SIP_FOUND TRUE)
+ ENDIF(sip_config)
+
+ IF(SIP_FOUND)
+ IF(NOT SIP_FIND_QUIETLY)
+ MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}")
+ ENDIF(NOT SIP_FIND_QUIETLY)
+ ELSE(SIP_FOUND)
+ IF(SIP_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find SIP")
+ ENDIF(SIP_FIND_REQUIRED)
+ ENDIF(SIP_FOUND)
+
+ENDIF()
+
+include(${CMAKE_SOURCE_DIR}/cmake/SIPMacros.cmake)
+ADD_DEFINITIONS(-DSIP_VERSION=0x${SIP_VERSION})
--- /dev/null
+++ ./cmake/SIPMacros.cmake
@@ -0,0 +1,105 @@
+# Macros for SIP
+# ~~~~~~~~~~~~~~
+
+set(SIP_ARGS --pep484-pyi --no-protected-is-public)
+
+function(add_sip_module MODULE_TARGET)
+ if(NOT SIP_BUILD_EXECUTABLE)
+ set(SIP_BUILD_EXECUTABLE ${CMAKE_PREFIX_PATH}/Scripts/sip-build)
+ endif()
+
+ message(STATUS "SIP: Generating pyproject.toml")
+ configure_file(${CMAKE_SOURCE_DIR}/pyproject.toml.in ${CMAKE_CURRENT_BINARY_DIR}/pyproject.toml)
+ configure_file(${CMAKE_SOURCE_DIR}/cmake/CMakeBuilder.py ${CMAKE_CURRENT_BINARY_DIR}/CMakeBuilder.py)
+ if(WIN32)
+ set(ext .pyd)
+ set(env_path_sep ";")
+ else()
+ set(ext .so)
+ set(env_path_sep ":")
+ endif()
+
+ message(STATUS "SIP: Generating source files")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${PYTHONPATH}${env_path_sep}$ENV{PYTHONPATH}${env_path_sep}${CMAKE_CURRENT_BINARY_DIR}" ${SIP_BUILD_EXECUTABLE} ${SIP_ARGS}
+ COMMAND_ECHO STDOUT
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ )
+ # This will generate the source-files during the configuration step in CMake. Needed to obtain the sources
+
+ # Touch the generated files (8 in total) to make them dirty and force them to rebuild
+ message(STATUS "SIP: Touching the source files")
+ set(_sip_output_files)
+ list(LENGTH SIP_FILES _no_outputfiles)
+ foreach(_concat_file_nr RANGE 0 ${_no_outputfiles})
+ if(${_concat_file_nr} LESS 8)
+ list(APPEND _sip_output_files "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/sip${MODULE_TARGET}part${_concat_file_nr}.cpp")
+ endif()
+ endforeach()
+
+ # Find the generated source files
+ message(STATUS "SIP: Collecting the generated source files")
+ file(GLOB sip_c "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/*.c")
+ file(GLOB sip_cpp "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/*.cpp")
+ file(GLOB sip_hdr "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/*.h")
+
+ # Add the user specified source files
+ message(STATUS "SIP: Collecting the user specified source files")
+ get_target_property(usr_src ${MODULE_TARGET} SOURCES)
+
+ # create the target library and link all the files (generated and user specified
+ message(STATUS "SIP: Linking the interface target against the shared library")
+ set(sip_sources "${sip_c}" "${sip_cpp}")
+ if(${usr_src})
+ list(APPEND sip_sources "${usr_src}")
+ endif()
+
+ if (BUILD_SHARED_LIBS)
+ add_library("sip_${MODULE_TARGET}" SHARED ${sip_sources})
+ else()
+ add_library("sip_${MODULE_TARGET}" STATIC ${sip_sources})
+ endif()
+
+ # Make sure that the library name of the target is the same as the MODULE_TARGET with the appropriate extension
+ target_link_libraries("sip_${MODULE_TARGET}" PRIVATE "${MODULE_TARGET}")
+ set_target_properties("sip_${MODULE_TARGET}" PROPERTIES PREFIX "")
+ set_target_properties("sip_${MODULE_TARGET}" PROPERTIES SUFFIX ${ext})
+ set_target_properties("sip_${MODULE_TARGET}" PROPERTIES OUTPUT_NAME "${MODULE_TARGET}")
+
+ # Add the custom command to (re-)generate the files and mark them as dirty. This allows the user to actually work
+ # on the sip definition files without having to reconfigure the complete project.
+ add_custom_command(
+ TARGET "sip_${MODULE_TARGET}"
+ COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${PYTHONPATH}${env_path_sep}$ENV{PYTHONPATH}${env_path_sep}${CMAKE_CURRENT_BINARY_DIR}" ${SIP_BUILD_EXECUTABLE} ${SIP_ARGS}
+ COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
+ MAIN_DEPENDENCY ${MODULE_SIP}
+ DEPENDS ${sip_sources}
+ VERBATIM
+ )
+
+ set_target_properties("sip_${MODULE_TARGET}"
+ PROPERTIES
+ RESOURCE "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET}/${MODULE_TARGET}/${MODULE_TARGET}.pyi")
+endfunction()
+
+function(install_sip_module MODULE_TARGET)
+ if(DEFINED ARGV1)
+ set(_install_path ${ARGV1})
+ else()
+ if(DEFINED Python_SITEARCH)
+ set(_install_path ${Python_SITEARCH})
+ elseif(DEFINED Python_SITELIB)
+ set(_install_path ${Python_SITELIB})
+ else()
+ message(FATAL_ERROR "SIP: Specify the site-packages location")
+ endif()
+ endif()
+ message(STATUS "SIP: Installing Python module and PEP 484 file in ${_install_path}")
+ install(TARGETS "sip_${MODULE_TARGET}"
+ ARCHIVE DESTINATION ${_install_path}
+ LIBRARY DESTINATION ${_install_path}
+ RUNTIME DESTINATION ${_install_path}
+ RESOURCE DESTINATION ${_install_path}
+ )
+endfunction()

View file

@ -0,0 +1,34 @@
--- ./CMakeLists.txt.orig
+++ ./CMakeLists.txt
@@ -2,16 +2,25 @@
project(pynest2d)
cmake_minimum_required(VERSION 3.20)
-find_package(nest2d REQUIRED)
-find_package(cpython REQUIRED)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
-find_package(standardprojectsettings REQUIRED)
-find_package(sipbuildtool REQUIRED)
+find_package(Libnest2D REQUIRED)
+find_package(Python REQUIRED COMPONENTS Interpreter Development)
+find_package(SIP REQUIRED 6.5.0)
+
add_library(pynest2d INTERFACE)
-use_threads(pynest2d)
-target_link_libraries(pynest2d INTERFACE nest2d::nest2d cpython::cpython)
+target_include_directories(pynest2d
+ INTERFACE
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
+ $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/python/>
+ )
+
+find_package(Threads REQUIRED)
+find_package(Boost REQUIRED)
+target_link_libraries(pynest2d INTERFACE Libnest2D::libnest2d Python::Python Threads::Threads Boost::boost)
+
add_sip_module(pynest2d)
install_sip_module(pynest2d)

View file

@ -0,0 +1,21 @@
--- /dev/null
+++ ./pyproject.toml.in
@@ -0,0 +1,17 @@
+[build-system]
+requires = ["sip >=6, <7"]
+build-backend = "sipbuild.api"
+
+[tool.sip.metadata]
+name = "pynest2d"
+
+[tool.sip.project]
+builder-factory = "CMakeBuilder"
+sip-files-dir = "${CMAKE_CURRENT_SOURCE_DIR}/src/"
+sip-include-dirs = ["CMAKE_CURRENT_SOURCE_DIR/src/"]
+build-dir = "${CMAKE_CURRENT_BINARY_DIR}/pynest2d/"
+
+[tool.sip.bindings.pynest2d]
+exceptions = true
+release-gil = true
+concatenate = 8
\ No newline at end of file

View file

@ -0,0 +1,33 @@
From 88fd460a63263d66173f1e0127b0f208577d7f4e Mon Sep 17 00:00:00 2001
From: fieldOfView <aldo@fieldofview.com>
Date: Sat, 20 May 2023 21:14:36 +0200
Subject: [PATCH] Fix SimpleButton use of UM.ColorImage
Fixes https://github.com/Ultimaker/Cura/issues/15524
---
UM/Qt/qml/UM/SimpleButton.qml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/UM/Qt/qml/UM/SimpleButton.qml b/UM/Qt/qml/UM/SimpleButton.qml
index d3d398753c..d3bd0e8e14 100644
--- a/UM/Qt/qml/UM/SimpleButton.qml
+++ b/UM/Qt/qml/UM/SimpleButton.qml
@@ -1,7 +1,8 @@
-// Copyright (c) 2018 Ultimaker B.V.
+// Copyright (c) 2023 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1
+import UM 1.5 as UM
MouseArea
{
@@ -27,7 +28,7 @@ MouseArea
radius: 0
}
- ColorImage
+ UM.ColorImage
{
id: image

View file

@ -0,0 +1,62 @@
# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=uranium
pkgver=5.2.2
pkgrel=3
pkgdesc="A Python framework for building Desktop applications"
url="https://github.com/Ultimaker/Uranium"
arch="noarch !armhf !riscv64" # armhf: no py3-qt5, rv64: no py3-shapely
license="LGPL-3.0-or-later"
depends="
py3-cryptography
py3-numpy
py3-qt6
py3-scipy
python3
"
# add cura-binary-data to makedepends when packaged
makedepends="samurai cmake doxygen gettext-dev graphviz"
checkdepends="py3-pytest py3-pytest-benchmark py3-twisted"
options="!check" # checks broken from 5.x onward
source="$pkgname-$pkgver.tar.gz::https://github.com/Ultimaker/Uranium/archive/refs/tags/$pkgver.tar.gz
cmake.patch
cmake-helpers.patch
874_fix-simplebutton-use-of-um-colorimage.patch
fix-logger-used-but-not-imported.patch
qt-try-ints-then-bytes.patch
"
builddir="$srcdir/Uranium-$pkgver"
build() {
if [ "$CBUILD" != "$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DGETTEXT_MSGINIT_EXECUTABLE=msginit \
-DCURA_BINARY_DATA_DIRECTORY=/usr/share/cura \
$CMAKE_CROSSOPTS
cmake --build build
}
check() {
# useless code style test with another dependency
ctest -j $JOBS --output-on-failure -T Test
}
package() {
DESTDIR="$pkgdir" cmake --install build
mkdir "$pkgdir"/usr/share/uranium/cmake
mv "$pkgdir"/usr/share/cmake-*/Modules/* "$pkgdir"/usr/share/uranium/cmake/
}
sha512sums="
a9c222400022e05b5c42c72843b024204a58f5d233805bdffa610a2d9cbd1873773868b049aabbe52c6e859f235ca5428fcdfdbb86651f428483999060611e10 uranium-5.2.2.tar.gz
196a04164de288f5bffeebb73ace9390059dcffebaf40395368f413d1af2e2c668d85dd4c761ad226732540d41598235c2c368152cc157d2e89445ce27738c9b cmake.patch
aa185ce3592036f045e3386266015cc08443c2e4f9b9a4c03c77c13525af98d68eaa3360e8858e0561417a826c73bf8a2b209bcad91d2cc16cce32fb0231fcf8 cmake-helpers.patch
d0957ec427070f1b8ebe9257447402e09e3af7a89fe9b3c5967a4c40bfc753fab0ea8f0b0c49e17f5895abcd69888b59e4735d130cb47280207af1b8dbec1e71 874_fix-simplebutton-use-of-um-colorimage.patch
b23701d49d6bc7b8e87e7720ca52b96b9b7dc0e20562c12832eb710aed38dad77f93c20413bd93bc1e2f8026a57af44a1aa06a90cf6488b6f887e3ba0b7ca51c fix-logger-used-but-not-imported.patch
2a277b2e6e4acd701bc72924ec718127d8525192ef8e37a4d99d73b03b6c13462c2cb269704b5ee4c58203991cc3d3bd3ed32dadd5f153d5813eb2a946f02942 qt-try-ints-then-bytes.patch
"

View file

@ -0,0 +1,89 @@
--- /dev/null
+++ ./cmake/UraniumPluginInstall.cmake
@@ -0,0 +1,86 @@
+# Copyright (c) 2022 Ultimaker B.V.
+# UraniumPluginInstall.cmake is released under the terms of the LGPLv3 or higher.
+
+#
+# This module detects all plugins that need to be installed and adds them using the CMake install() command.
+# It detects all plugin folder in the path "plugins/*" where there's a "plugin.json" in it.
+#
+# Plugins can be configured to NOT BE INSTALLED via the variable "UM_NO_INSTALL_PLUGINS" as a list of string in the
+# form of "a;b;c" or "a,b,c". By default all plugins will be installed.
+#
+
+# Options or configuration variables
+set(UM_NO_INSTALL_PLUGINS "" CACHE STRING "A list of plugins that should not be installed, separated with ';' or ','.")
+
+file(GLOB_RECURSE _plugin_json_list ${CMAKE_SOURCE_DIR}/plugins/*/plugin.json)
+list(LENGTH _plugin_json_list _plugin_json_list_len)
+
+# Sort the lists alphabetically so we can handle cases like this:
+# - plugins/my_plugin/plugin.json
+# - plugins/my_plugin/my_module/plugin.json
+# In this case, only "plugins/my_plugin" should be added via install().
+set(_no_install_plugin_list ${UM_NO_INSTALL_PLUGINS})
+# Sanitize the string so the comparison will be case-insensitive.
+string(STRIP "${_no_install_plugin_list}" _no_install_plugin_list)
+string(TOLOWER "${_no_install_plugin_list}" _no_install_plugin_list)
+
+# WORKAROUND counterpart of what's in cura-build.
+string(REPLACE "," ";" _no_install_plugin_list "${_no_install_plugin_list}")
+
+list(LENGTH _no_install_plugin_list _no_install_plugin_list_len)
+
+if(_no_install_plugin_list_len GREATER 0)
+ list(SORT _no_install_plugin_list)
+endif()
+if(_plugin_json_list_len GREATER 0)
+ list(SORT _plugin_json_list)
+endif()
+
+# Check all plugin directories and add them via install() if needed.
+set(_install_plugin_list "")
+foreach(_plugin_json_path ${_plugin_json_list})
+ get_filename_component(_plugin_dir ${_plugin_json_path} DIRECTORY)
+ file(RELATIVE_PATH _rel_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_plugin_dir})
+ get_filename_component(_plugin_dir_name ${_plugin_dir} NAME)
+
+ # Make plugin name comparison case-insensitive
+ string(TOLOWER "${_plugin_dir_name}" _plugin_dir_name_lowercase)
+
+ # Check if this plugin needs to be skipped for installation
+ set(_add_plugin ON) # Indicates if this plugin should be added to the build or not.
+ set(_is_no_install_plugin OFF) # If this plugin will not be added, this indicates if it's because the plugin is
+ # specified in the NO_INSTALL_PLUGINS list.
+ if(_no_install_plugin_list)
+ if("${_plugin_dir_name_lowercase}" IN_LIST _no_install_plugin_list)
+ set(_add_plugin OFF)
+ set(_is_no_install_plugin ON)
+ endif()
+ endif()
+
+ # Make sure this is not a subdirectory in a plugin that's already in the install list
+ if(_add_plugin)
+ foreach(_known_install_plugin_dir ${_install_plugin_list})
+ if(_plugin_dir MATCHES "${_known_install_plugin_dir}.+")
+ set(_add_plugin OFF)
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(_add_plugin)
+ message(STATUS "[+] PLUGIN TO INSTALL: ${_rel_plugin_dir}")
+ get_filename_component(_rel_plugin_parent_dir ${_rel_plugin_dir} DIRECTORY)
+ install(DIRECTORY ${_rel_plugin_dir}
+ DESTINATION lib${LIB_SUFFIX}/uranium/${_rel_plugin_parent_dir}
+ PATTERN "__pycache__" EXCLUDE
+ PATTERN "*.qmlc" EXCLUDE
+ )
+ list(APPEND _install_plugin_list ${_plugin_dir})
+ elseif(_is_no_install_plugin)
+ message(STATUS "[-] PLUGIN TO REMOVE : ${_rel_plugin_dir}")
+ execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mod_bundled_packages_json.py
+ -d ${CMAKE_CURRENT_SOURCE_DIR}/resources/bundled_packages
+ ${_plugin_dir_name}
+ RESULT_VARIABLE _mod_json_result)
+ endif()
+endforeach()

View file

@ -0,0 +1,16 @@
--- ./CMakeLists.txt.orig
+++ ./CMakeLists.txt
@@ -19,9 +19,12 @@
# Build Translations
CREATE_TRANSLATION_TARGETS()
+find_package(Python REQUIRED COMPONENTS Interpreter)
-install(DIRECTORY UM DESTINATION "${Python_SITELIB_LOCAL}")
+install(DIRECTORY UM DESTINATION "${Python_SITELIB}")
install(FILES ${CMAKE_SOURCE_DIR}/cmake/UraniumTranslationTools.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules/ )
install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/uranium)
+
+include(UraniumPluginInstall)

View file

@ -0,0 +1,12 @@
diff --git a/UM/View/SelectionPass.py.orig b/UM/View/SelectionPass.py
index 945b789..ef042a5 100644
--- a/UM/View/SelectionPass.py.orig
+++ b/UM/View/SelectionPass.py
@@ -5,6 +5,7 @@ import enum
import random
from typing import TYPE_CHECKING
+from UM.Logger import Logger
from UM.Resources import Resources
from UM.Application import Application

View file

@ -0,0 +1,94 @@
diff --git a/UM/View/RenderBatch.py.orig b/UM/View/RenderBatch.py
index 6deeeb1..5f1eda5 100644
--- a/UM/View/RenderBatch.py.orig
+++ b/UM/View/RenderBatch.py
@@ -186,10 +186,24 @@ class RenderBatch:
if self._render_type == self.RenderType.Solid:
self._gl.glEnable(self._gl.GL_DEPTH_TEST)
- self._gl.glDepthMask(self._gl.GL_TRUE)
+ try:
+ self._gl.glDepthMask(self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glDepthMask does not like ints, trying bytes...")
+ try:
+ self._gl.glDepthMask(b'1')
+ except:
+ Logger.log("e", "glDepthMask does not like ints or bytes, no idea what it wants")
elif self._render_type == self.RenderType.Transparent:
self._gl.glEnable(self._gl.GL_DEPTH_TEST)
- self._gl.glDepthMask(self._gl.GL_FALSE)
+ try:
+ self._gl.glDepthMask(self._gl.GL_FALSE)
+ except:
+ Logger.log("w", "glDepthMask does not like ints, trying bytes...")
+ try:
+ self._gl.glDepthMask(b'1')
+ except:
+ Logger.log("e", "glDepthMask does not like ints or bytes, no idea what it wants")
elif self._render_type == self.RenderType.Overlay:
self._gl.glDisable(self._gl.GL_DEPTH_TEST)
diff --git a/UM/View/RenderPass.py.orig b/UM/View/RenderPass.py
index 8068ddf..8cb4f67 100644
--- a/UM/View/RenderPass.py.orig
+++ b/UM/View/RenderPass.py
@@ -93,8 +93,22 @@ class RenderPass:
self._fbo.bind()
# Ensure we can actually write to the relevant FBO components.
- self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE,self._gl.GL_TRUE, self._gl.GL_TRUE)
- self._gl.glDepthMask(self._gl.GL_TRUE)
+ try:
+ self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE,self._gl.GL_TRUE, self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glColorMask does not like ints, trying bytes...")
+ try:
+ self._gl.glColorMask(b'1', b'1',b'1', b'1')
+ except:
+ Logger.log("e", "glColorMask does not like ints or bytes, no idea what it wants")
+ try:
+ self._gl.glDepthMask(self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glDepthMask does not like ints, trying bytes...")
+ try:
+ self._gl.glDepthMask(b'1')
+ except:
+ Logger.log("e", "glDepthMask does not like ints or bytes, no idea what it wants")
self._gl.glClear(self._gl.GL_COLOR_BUFFER_BIT | self._gl.GL_DEPTH_BUFFER_BIT)
diff --git a/UM/View/SelectionPass.py.orig b/UM/View/SelectionPass.py
index ef042a5..c28fe4f 100644
--- a/UM/View/SelectionPass.py.orig
+++ b/UM/View/SelectionPass.py
@@ -110,13 +110,27 @@ class SelectionPass(RenderPass):
if selectable_objects:
batch.render(self._scene.getActiveCamera())
- self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_FALSE)
+ try:
+ self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_FALSE)
+ except:
+ Logger.log("w", "glColorMask does not like ints, trying bytes...")
+ try:
+ self._gl.glColorMask(b'1', b'1', b'1', b'0')
+ except:
+ Logger.log("e", "glColorMask does not like ints or bytes, no idea what it wants")
self._gl.glDisable(self._gl.GL_DEPTH_TEST)
tool_handle.render(self._scene.getActiveCamera())
self._gl.glEnable(self._gl.GL_DEPTH_TEST)
- self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE)
+ try:
+ self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glColorMask does not like ints, trying bytes...")
+ try:
+ self._gl.glColorMask(b'1', b'1', b'1', b'1')
+ except:
+ Logger.log("e", "glColorMask does not like ints or bytes, no idea what it wants")
self.release()