diff options
author | Matthieu Volat <mazhe@alkumuna.eu> | 2024-09-04 19:52:21 +0000 |
---|---|---|
committer | Diane Bruce <db@FreeBSD.org> | 2024-09-04 19:54:27 +0000 |
commit | 4096ff4c7985a6cc2a8f52f39389ea6b4e99f38f (patch) | |
tree | afaaaa711af2bae4ec54c6220050c9dbec69ff9a | |
parent | c1b40ecb251b919eb205d3919d36b5bbb029bfea (diff) | |
download | ports-4096ff4c7985a6cc2a8f52f39389ea6b4e99f38f.tar.gz ports-4096ff4c7985a6cc2a8f52f39389ea6b4e99f38f.zip |
devel/py-pynest2d: upgrade for Cura 5.7
- Change of build system replacing upstream build system
-rw-r--r-- | devel/py-pynest2d/Makefile | 22 | ||||
-rw-r--r-- | devel/py-pynest2d/distinfo | 6 | ||||
-rw-r--r-- | devel/py-pynest2d/files/CMakeLists.txt | 63 | ||||
-rw-r--r-- | devel/py-pynest2d/files/COPYING-CMAKE-SCRIPTS | 22 | ||||
-rw-r--r-- | devel/py-pynest2d/files/FindClipper.cmake | 88 | ||||
-rw-r--r-- | devel/py-pynest2d/files/FindNLopt.cmake | 83 | ||||
-rw-r--r-- | devel/py-pynest2d/files/FindSIP.cmake | 64 | ||||
-rw-r--r-- | devel/py-pynest2d/files/FindSIP.py | 60 | ||||
-rw-r--r-- | devel/py-pynest2d/files/Findlibnest2d.cmake | 29 | ||||
-rw-r--r-- | devel/py-pynest2d/files/SIPMacros.cmake | 231 | ||||
-rw-r--r-- | devel/py-pynest2d/files/patch-cmake_FindClipper.cmake | 13 | ||||
-rw-r--r-- | devel/py-pynest2d/files/patch-src_ItemGroup.sip | 42 | ||||
-rw-r--r-- | devel/py-pynest2d/files/patch-src_Pynest2D.sip | 35 |
13 files changed, 655 insertions, 103 deletions
diff --git a/devel/py-pynest2d/Makefile b/devel/py-pynest2d/Makefile index b0cc564a598a..ff78129d0d9d 100644 --- a/devel/py-pynest2d/Makefile +++ b/devel/py-pynest2d/Makefile @@ -1,7 +1,5 @@ PORTNAME= pynest2d -# XXX there is no 4.13.1 -DISTVERSION= 4.12.1 -PORTREVISION= 5 +DISTVERSION= 5.3.0 CATEGORIES= devel python PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -12,22 +10,26 @@ WWW= https://github.com/Ultimaker/libnest2d LICENSE= LGPL3 LICENSE_FILE= ${WRKSRC}/LICENSE -DEPRECATED= Fails to build with modern python -EXPIRATION_DATE= 2024-06-29 - RUN_DEPENDS= ${LOCALBASE}/include/libnest2d/libnest2d.hpp:devel/libnest2d-ultimaker -BUILD_DEPENDS= ${LOCALBASE}/include/libnest2d/libnest2d.hpp:devel/libnest2d-ultimaker \ - sip:devel/py-sip4 +BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sip>=0:devel/py-sip@${PY_FLAVOR} LIB_DEPENDS= libpolyclipping.so:graphics/polyclipping \ libboost_system.so:devel/boost-libs \ libnlopt.so:math/nlopt -USES= python cmake compiler:c++11-lang pyqt:5 pkgconfig +USES= python cmake compiler:c++11-lang pyqt:6 pkgconfig USE_PYTHON= flavors USE_GITHUB= yes -GH_TUPLE= Ultimaker:pynest2d:baec470 +GH_ACCOUNT= Ultimaker CMAKE_ARGS= -DLIBNEST2D_INCLUDE_DIRS=${PREFIX}/include/libnest2d CONFIGURE_ENV= CLIPPER_PATH=${LOCALBASE} VERBOSE=y + +post-extract: + @${MKDIR} ${WRKSRC}/cmake + @for f in COPYING-CMAKE-SCRIPTS FindClipper.cmake FindNLopt.cmake FindSIP.cmake FindSIP.py Findlibnest2d.cmake SIPMacros.cmake; do \ + ${CP} ${FILESDIR}/$$f ${WRKSRC}/cmake; \ + done + @${CP} ${FILESDIR}/CMakeLists.txt ${WRKSRC} + .include <bsd.port.mk> diff --git a/devel/py-pynest2d/distinfo b/devel/py-pynest2d/distinfo index 62094dc9c723..71c5f39d7ca3 100644 --- a/devel/py-pynest2d/distinfo +++ b/devel/py-pynest2d/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1638125132 -SHA256 (Ultimaker-pynest2d-4.12.1-baec470_GH0.tar.gz) = 199116bd9baa13a8231806c1af4e6ac54261c69188a5ba3f58b1ac38b56238c4 -SIZE (Ultimaker-pynest2d-4.12.1-baec470_GH0.tar.gz) = 18449 +TIMESTAMP = 1713678690 +SHA256 (Ultimaker-pynest2d-5.3.0_GH0.tar.gz) = 637c303396f4ffcb8962cd0ff7a1f4178d4e4986abd96b52015a9be4f7c4dc56 +SIZE (Ultimaker-pynest2d-5.3.0_GH0.tar.gz) = 25143 diff --git a/devel/py-pynest2d/files/CMakeLists.txt b/devel/py-pynest2d/files/CMakeLists.txt new file mode 100644 index 000000000000..5e195d253227 --- /dev/null +++ b/devel/py-pynest2d/files/CMakeLists.txt @@ -0,0 +1,63 @@ +# Copyright (c) 2020 Ultimaker B.V. +# pynest2d is released under the terms of the LGPLv3 or higher. + +project(pynest2d) +cmake_minimum_required(VERSION 3.6) # Lowest version it's been tested with. + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +# Requirements. +# FIXME: Remove the code for CMake <3.12 once we have switched over completely. +# FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs. +if(${CMAKE_VERSION} VERSION_LESS 3.12) + # FIXME: Use FindPython3 to find Python, new in CMake 3.12. + # However currently on our CI server it finds the wrong Python version and then doesn't find the headers. + find_package(PythonInterp 3.5 REQUIRED) + find_package(PythonLibs 3.5 REQUIRED) + +else() + # Use FindPython3 for CMake >=3.12 + find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter Development) +endif() +execute_process(COMMAND ${Python_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'), end='')" OUTPUT_VARIABLE Python_SITEARCH) + +find_package(SIP REQUIRED) # To create Python bindings. +include(SIPMacros) +find_package(libnest2d REQUIRED) # The library we're creating bindings for. +find_package(Clipper REQUIRED) # Dependency of libnest2d. +find_package(NLopt REQUIRED) # Dependency of libnest2d. +find_package(Boost REQUIRED) # Dependency of libnest2d. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLIBNEST2D_GEOMETRIES_clipper -DLIBNEST2D_OPTIMIZERS_nlopt -DLIBNEST2D_THREADING_std") # Tell libnest2d to use Clipper and NLopt, and standard threads. + +# Some build options. +set(CMAKE_CXX_STANDARD 17) +if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +endif() +if(UNIX) + # Want to be able to move symbols from the Clipper library. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +endif() +if(NOT DEFINED LIB_SUFFIX) + set(LIB_SUFFIX "") +endif() + +# Building and linking. +set(SIP_EXTRA_FILES_DEPEND + python/BottomLeftConfig.sip + python/Box.sip + python/Circle.sip + python/DJDHeuristicConfig.sip + python/Item.sip + python/ItemGroup.sip + python/NfpConfig.sip + python/Point.sip + python/Rectangle.sip + python/String.sip +) + +set(SIP_EXTRA_OPTIONS -g -n PyQt6.sip) # Always release the GIL before calling C++ methods. -n PyQt6.sip is required to not get the PyCapsule error +set(SIP_EXTRA_INCLUDE_DIRS ${SIP_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS} ${CLIPPER_INCLUDE_DIRS} ${NLopt_INCLUDE_DIRS} ${LIBNEST2D_INCLUDE_DIRS}) +generate_sip_python_module_code(pynest2d python/pynest2d.sip python/pynest2d.sip "" pynest2d_cpp_files) +build_sip_python_module(pynest2d python/pynest2d.sip "${pynest2d_cpp_files}" "${CLIPPER_LIBRARIES};${NLopt_LIBRARIES}") diff --git a/devel/py-pynest2d/files/COPYING-CMAKE-SCRIPTS b/devel/py-pynest2d/files/COPYING-CMAKE-SCRIPTS new file mode 100644 index 000000000000..4b417765f3a8 --- /dev/null +++ b/devel/py-pynest2d/files/COPYING-CMAKE-SCRIPTS @@ -0,0 +1,22 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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. diff --git a/devel/py-pynest2d/files/FindClipper.cmake b/devel/py-pynest2d/files/FindClipper.cmake new file mode 100644 index 000000000000..a399dfde5e43 --- /dev/null +++ b/devel/py-pynest2d/files/FindClipper.cmake @@ -0,0 +1,88 @@ +#Find Clipper library (http://www.angusj.com/delphi/clipper.php). +#The following variables are set +# +#CLIPPER_FOUND +#CLIPPER_INCLUDE_DIRS +#CLIPPER_LIBRARIES +# +#It searches the environment variable $CLIPPER_PATH automatically. + +unset(CLIPPER_FOUND CACHE) +unset(CLIPPER_INCLUDE_DIRS CACHE) +unset(CLIPPER_LIBRARIES CACHE) +unset(CLIPPER_LIBRARIES_RELEASE CACHE) +unset(CLIPPER_LIBRARIES_DEBUG CACHE) + +if($<LOWER_CASE:${CMAKE_BUILD_TYPE}> EQUAL "debug") + set(CLIPPER_BUILD_TYPE DEBUG) +else() + set(CLIPPER_BUILD_TYPE RELEASE) +endif() + +find_path(CLIPPER_INCLUDE_DIRS clipper.hpp + $ENV{CLIPPER_PATH} + $ENV{CLIPPER_PATH}/cpp/ + $ENV{CLIPPER_PATH}/include/ + $ENV{CLIPPER_PATH}/include/polyclipping/ + ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/include/ + ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/include/polyclipping/ + ${CMAKE_PREFIX_PATH}/include/polyclipping + ${CMAKE_PREFIX_PATH}/include/ + /opt/local/include/ + /opt/local/include/polyclipping/ + /usr/local/include/ + /usr/local/include/polyclipping/ + /usr/include + /usr/include/polyclipping/ +) + +set(LIB_SEARCHDIRS + $ENV{CLIPPER_PATH} + $ENV{CLIPPER_PATH}/cpp/ + $ENV{CLIPPER_PATH}/cpp/build/ + $ENV{CLIPPER_PATH}/lib/ + $ENV{CLIPPER_PATH}/lib/polyclipping/ + ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/lib/ + ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/lib/polyclipping/ + ${CMAKE_PREFIX_PATH}/lib/ + ${CMAKE_PREFIX_PATH}/lib/polyclipping/ + /opt/local/lib/ + /opt/local/lib/polyclipping/ + /usr/local/lib/ + /usr/local/lib/polyclipping/ + /usr/lib/polyclipping +) + +set(_deb_postfix "d") + +find_library(CLIPPER_LIBRARIES_RELEASE polyclipping ${LIB_SEARCHDIRS}) +find_library(CLIPPER_LIBRARIES_DEBUG polyclipping${_deb_postfix} ${LIB_SEARCHDIRS}) + +if(CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}) + set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}}") +else() + set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_RELEASE}") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Clipper + "Clipper library cannot be found. Consider set CLIPPER_PATH environment variable" + CLIPPER_INCLUDE_DIRS + CLIPPER_LIBRARIES +) + +mark_as_advanced(CLIPPER_INCLUDE_DIRS CLIPPER_LIBRARIES) + +if(CLIPPER_FOUND) + add_library(Clipper::Clipper UNKNOWN IMPORTED) + set_target_properties(Clipper::Clipper PROPERTIES IMPORTED_LOCATION ${CLIPPER_LIBRARIES}) + set_target_properties(Clipper::Clipper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CLIPPER_INCLUDE_DIRS}) + if(CLIPPER_LIBRARIES_RELEASE AND CLIPPER_LIBRARIES_DEBUG) + set_target_properties(Clipper::Clipper PROPERTIES + IMPORTED_LOCATION_DEBUG ${CLIPPER_LIBRARIES_DEBUG} + IMPORTED_LOCATION_RELWITHDEBINFO ${CLIPPER_LIBRARIES_RELEASE} + IMPORTED_LOCATION_RELEASE ${CLIPPER_LIBRARIES_RELEASE} + IMPORTED_LOCATION_MINSIZEREL ${CLIPPER_LIBRARIES_RELEASE} + ) + endif() +endif() diff --git a/devel/py-pynest2d/files/FindNLopt.cmake b/devel/py-pynest2d/files/FindNLopt.cmake new file mode 100644 index 000000000000..bf2ed3527dc7 --- /dev/null +++ b/devel/py-pynest2d/files/FindNLopt.cmake @@ -0,0 +1,83 @@ +#Find NLopt library. +#The following variables are set +# +#NLopt_FOUND +#NLopt_INCLUDE_DIRS +#NLopt_LIBRARIES +# +#It searches the environment variable $NLopt_PATH automatically. + +unset(NLopt_FOUND CACHE) +unset(NLopt_INCLUDE_DIRS CACHE) +unset(NLopt_LIBRARIES CACHE) +unset(NLopt_LIBRARIES_RELEASE CACHE) +unset(NLopt_LIBRARIES_DEBUG CACHE) + +if($<LOWER_CASE:${CMAKE_BUILD_TYPE}> EQUAL "debug") + set(NLopt_BUILD_TYPE DEBUG) +else() + set(NLopt_BUILD_TYPE RELEASE) +endif() + +find_path(NLopt_INCLUDE_DIRS nlopt.hpp + $ENV{NLopt_PATH} + $ENV{NLopt_PATH}/cpp/ + $ENV{NLopt_PATH}/include/ + ${CMAKE_PREFIX_PATH}/include/nlopt + ${CMAKE_PREFIX_PATH}/include/ + /opt/local/include/ + /opt/local/include/nlopt/ + /usr/local/include/ + /usr/local/include/nlopt/ + /usr/include + /usr/include/nlopt/ +) + +set(LIB_SEARCHDIRS + $ENV{NLopt_PATH} + $ENV{NLopt_PATH}/cpp/ + $ENV{NLopt_PATH}/cpp/build/ + $ENV{NLopt_PATH}/lib/ + $ENV{NLopt_PATH}/lib/nlopt/ + ${CMAKE_PREFIX_PATH}/lib/ + ${CMAKE_PREFIX_PATH}/lib/nlopt/ + /opt/local/lib/ + /opt/local/lib/nlopt/ + /usr/local/lib/ + /usr/local/lib/nlopt/ + /usr/lib/nlopt +) + +set(_deb_postfix "d") + +find_library(NLopt_LIBRARIES_RELEASE nlopt ${LIB_SEARCHDIRS}) +find_library(NLopt_LIBRARIES_DEBUG nlopt${_deb_postfix} ${LIB_SEARCHDIRS}) + +if(NLopt_LIBRARIES_${NLopt_BUILD_TYPE}) + set(NLopt_LIBRARIES "${NLopt_LIBRARIES_${NLopt_BUILD_TYPE}}") +else() + set(NLopt_LIBRARIES "${NLopt_LIBRARIES_RELEASE}") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(NLopt + "NLopt library cannot be found. Consider set NLopt_PATH environment variable" + NLopt_INCLUDE_DIRS + NLopt_LIBRARIES +) + +mark_as_advanced(NLopt_INCLUDE_DIRS NLopt_LIBRARIES) + +if(NLopt_FOUND) + add_library(NLopt::nlopt UNKNOWN IMPORTED) + set_target_properties(NLopt::nlopt PROPERTIES IMPORTED_LOCATION ${NLopt_LIBRARIES}) + set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${NLopt_INCLUDE_DIRS}) + if(NLopt_LIBRARIES_RELEASE AND NLopt_LIBRARIES_DEBUG) + set_target_properties(NLopt::nlopt PROPERTIES + IMPORTED_LOCATION_DEBUG ${NLopt_LIBRARIES_DEBUG} + IMPORTED_LOCATION_RELWITHDEBINFO ${NLopt_LIBRARIES_RELEASE} + IMPORTED_LOCATION_RELEASE ${NLopt_LIBRARIES_RELEASE} + IMPORTED_LOCATION_MINSIZEREL ${NLopt_LIBRARIES_RELEASE} + ) + endif() +endif() diff --git a/devel/py-pynest2d/files/FindSIP.cmake b/devel/py-pynest2d/files/FindSIP.cmake new file mode 100644 index 000000000000..101a991d7de1 --- /dev/null +++ b/devel/py-pynest2d/files/FindSIP.cmake @@ -0,0 +1,64 @@ +# 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) + # Already in cache, be silent + SET(SIP_FOUND TRUE) +ELSE(SIP_VERSION) + + 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(SIP_VERSION) + +ADD_DEFINITIONS(-DSIP_VERSION=0x${SIP_VERSION}) diff --git a/devel/py-pynest2d/files/FindSIP.py b/devel/py-pynest2d/files/FindSIP.py new file mode 100644 index 000000000000..2e8eea04bb56 --- /dev/null +++ b/devel/py-pynest2d/files/FindSIP.py @@ -0,0 +1,60 @@ +# -*- 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) + + import sysconfig + if "deb_system" in sysconfig.get_scheme_names(): + python_modules_dir = sysconfig.get_path("purelib", "deb_system") + else: + python_modules_dir = sysconfig.get_path("purelib") + 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) diff --git a/devel/py-pynest2d/files/Findlibnest2d.cmake b/devel/py-pynest2d/files/Findlibnest2d.cmake new file mode 100644 index 000000000000..5ba4e45c5c6b --- /dev/null +++ b/devel/py-pynest2d/files/Findlibnest2d.cmake @@ -0,0 +1,29 @@ +# Copyright (c) 2020 Ultimaker B.V. +# pynest2d is released under the terms of the LGPLv3 or higher. + +# This script finds libnest2d on your computer. +# +# The output of this script is the following variables: +# - LIBNEST2D_INCLUDE_DIR: The include directory for libnest2d. + +find_package(PkgConfig) # To easily find files on your computer. + +# First try with packageconfig to get a beginning of an idea where to search. +pkg_check_modules(PC_LIBNEST2D QUIET libnest2d) + +find_path(LIBNEST2D_INCLUDE_DIRS NAMES libnest2d/libnest2d.hpp HINTS + ${PC_LIBNEST2D_INCLUDE_DIRS} + ${PC_LIBNEST2D_INCLUDE_DIRS}/libnest2d + ${CMAKE_PREFIX_PATH}/include/ + ${CMAKE_PREFIX_PATH}/include/libnest2d + /opt/local/include/ + /opt/local/include/libnest2d/ + /usr/local/include/ + /usr/local/include/libnest2d/ + /usr/include + /usr/include/libnest2d/ +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBNEST2D DEFAULT_MSG + LIBNEST2D_INCLUDE_DIRS) diff --git a/devel/py-pynest2d/files/SIPMacros.cmake b/devel/py-pynest2d/files/SIPMacros.cmake new file mode 100644 index 000000000000..9b3affa1ee1f --- /dev/null +++ b/devel/py-pynest2d/files/SIPMacros.cmake @@ -0,0 +1,231 @@ +# Macros for SIP +# ~~~~~~~~~~~~~~ +# 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. +# +# SIP website: http://www.riverbankcomputing.co.uk/sip/index.php +# +# This file defines the following macros: +# +# ADD_SIP_PYTHON_MODULE (MODULE_NAME MODULE_SIP [library1, libaray2, ...]) +# Specifies a SIP file to be built into a Python module and installed. +# MODULE_NAME is the name of Python module including any path name. (e.g. +# os.sys, Foo.bar etc). MODULE_SIP the path and filename of the .sip file +# to process and compile. libraryN are libraries that the Python module, +# which is typically a shared library, should be linked to. The built +# module will also be install into Python's site-packages directory. +# +# The behavior of the ADD_SIP_PYTHON_MODULE macro can be controlled by a +# number of variables: +# +# SIP_INCLUDES - List of directories which SIP will scan through when looking +# for included .sip files. (Corresponds to the -I option for SIP.) +# +# SIP_TAGS - List of tags to define when running SIP. (Corresponds to the -t +# option for SIP.) +# +# SIP_CONCAT_PARTS - An integer which defines the number of parts the C++ code +# of each module should be split into. Defaults to 8. (Corresponds to the +# -j option for SIP.) +# +# SIP_DISABLE_FEATURES - List of feature names which should be disabled +# running SIP. (Corresponds to the -x option for SIP.) +# +# SIP_EXTRA_OPTIONS - Extra command line options which should be passed on to +# SIP. + +# SIP_BUILD_EXTRA_OPTIONS - Extra command line options which should be passed on to +# sip-build. + +SET(SIP_INCLUDES) +SET(SIP_TAGS) +SET(SIP_CONCAT_PARTS 16) +SET(SIP_DISABLE_FEATURES) +SET(SIP_EXTRA_OPTIONS) +SET(SIP_EXTRA_OBJECTS) +SET(SIP_BUILD_EXTRA_OPTIONS) + +MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES) + + STRING(REPLACE "." "/" _x ${MODULE_NAME}) + GET_FILENAME_COMPONENT(_parent_module_path ${_x} PATH) + GET_FILENAME_COMPONENT(_child_module_name ${_x} NAME) + GET_FILENAME_COMPONENT(_module_path ${MODULE_SIP} PATH) + GET_FILENAME_COMPONENT(_abs_module_sip ${MODULE_SIP} ABSOLUTE) + + # If this is not need anymore (using input configuration file for SIP files) + # SIP could be run in the source rather than in binary directory + #SET(_configured_module_sip ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/${_module_path}.sip) + SET(_configured_module_sip ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/${_child_module_name}.sip) + FOREACH (_sip_file ${SIP_FILES}) + GET_FILENAME_COMPONENT(_sip_file_path ${_sip_file} PATH) + GET_FILENAME_COMPONENT(_sip_file_name_we ${_sip_file} NAME_WE) + #FILE(RELATIVE_PATH _sip_file_relpath ${BINDING_FILES_ROOT_DIR} "${_sip_file_path}/${_sip_file_name_we}") + SET(_sip_file_relpath "${_sip_file_path}/${_sip_file_name_we}") + SET(_out_sip_file "${CMAKE_CURRENT_BINARY_DIR}/${_sip_file_relpath}.sip") + CONFIGURE_FILE(${_sip_file} ${_out_sip_file}) + ENDFOREACH (_sip_file) + + SET(_message "-DMESSAGE=Generating CPP code for module ${MODULE_NAME}") + SET(_sip_output_files) + + # Suppress warnings + IF(PEDANTIC) + IF(MSVC) + ADD_DEFINITIONS( + /wd4189 # local variable is initialized but not referenced + /wd4996 # deprecation warnings (bindings re-export deprecated methods) + /wd4701 # potentially uninitialized variable used (sip generated code) + /wd4702 # unreachable code (sip generated code) + /wd4703 # potentially uninitialized local pointer variable 'sipType' used + ) + ELSE(MSVC) + # disable all warnings + ADD_DEFINITIONS( -w -Wno-deprecated-declarations ) + IF(NOT APPLE) + ADD_DEFINITIONS( -fpermissive ) + ENDIF(NOT APPLE) + ENDIF(MSVC) + ENDIF(PEDANTIC) + + IF(MSVC) + ADD_DEFINITIONS( /bigobj ) + ENDIF(MSVC) + + IF (SIP_BUILD_EXECUTABLE) + + FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}) # Output goes in this dir. + + SET(_sip_output_files + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_array.c + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_bool.cpp + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_core.c + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_descriptors.c + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_enum.c + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_int_convertors.c + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_object_map.c + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_threads.c + ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_voidptr.c) + FOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} ) + IF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} ) + SET(_sip_output_files ${_sip_output_files} ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip${_child_module_name}part${CONCAT_NUM}.cpp ) + ENDIF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} ) + ENDFOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} ) + + #SET(SIPCMD ${SIP_BUILD_EXECUTABLE} --no-protected-is-public --pep484-pyi --no-make --concatenate=${SIP_CONCAT_PARTS} --qmake=${QMAKE_EXECUTABLE} --include-dir=${CMAKE_CURRENT_BINARY_DIR} --include-dir=${PYQT_SIP_DIR} --api-dir ${CMAKE_BINARY_DIR}/python ${SIP_BUILD_EXTRA_OPTIONS}) + LIST(JOIN SIP_EXTRA_INCLUDE_DIRS "\",\"" _sip_extra_includes) + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/pyproject.toml "\ +[build-system]\n\ +requires = [\"sip >=6, <7\"]\n\ +build-backend = \"sipbuild.api\" +[tool.sip.metadata]\n\ +name = \"${_child_module_name}\"\n\ +[tool.sip.bindings.${_child_module_name}]\n\ +concatenate = ${SIP_CONCAT_PARTS}\n\ +include-dirs = [\"${_sip_extra_includes}\"]\n\ +protected-is-public = false\n\ +pep484-pyi = true\n\ +[tool.sip.project]\n\ +sip-files-dir = \"${CMAKE_CURRENT_SOURCE_DIR}/${_module_path}\"\n\ +") + SET(SIPCMD ${SIP_BUILD_EXECUTABLE} --no-compile ${SIP_BUILD_EXTRA_OPTIONS}) + + ADD_CUSTOM_COMMAND( + OUTPUT ${_sip_output_files} + COMMAND ${CMAKE_COMMAND} -E echo ${message} + COMMAND ${SIPCMD} + COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files} + WORKING_DIRECTORY ${_module_path} + MAIN_DEPENDENCY ${_configured_module_sip} + DEPENDS ${SIP_EXTRA_FILES_DEPEND} + VERBATIM + ) + + ELSE (SIP_BUILD_EXECUTABLE) + + FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}) # Output goes in this dir. + + SET(_sip_includes) + FOREACH (_inc ${SIP_INCLUDES}) + GET_FILENAME_COMPONENT(_abs_inc ${_inc} ABSOLUTE) + LIST(APPEND _sip_includes -I ${_abs_inc}) + ENDFOREACH (_inc ) + + SET(_sip_tags) + FOREACH (_tag ${SIP_TAGS}) + LIST(APPEND _sip_tags -t ${_tag}) + ENDFOREACH (_tag) + + SET(_sip_x) + FOREACH (_x ${SIP_DISABLE_FEATURES}) + LIST(APPEND _sip_x -x ${_x}) + ENDFOREACH (_x ${SIP_DISABLE_FEATURES}) + + FOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} ) + IF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} ) + SET(_sip_output_files ${_sip_output_files} ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/sip${_child_module_name}part${CONCAT_NUM}.cpp ) + ENDIF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} ) + ENDFOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} ) + + SET(SIPCMD ${SIP_BINARY_PATH} ${_sip_tags} -w -e ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} -I ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_configured_module_sip}) + ADD_CUSTOM_COMMAND( + OUTPUT ${_sip_output_files} + COMMAND ${CMAKE_COMMAND} -E echo ${message} + COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files} + COMMAND ${SIPCMD} + MAIN_DEPENDENCY ${_configured_module_sip} + DEPENDS ${SIP_EXTRA_FILES_DEPEND} + VERBATIM + ) + + ENDIF (SIP_BUILD_EXECUTABLE) + + ADD_CUSTOM_TARGET(generate_sip_${MODULE_NAME}_cpp_files DEPENDS ${_sip_output_files}) + + SET(CPP_FILES ${_sip_output_files}) +ENDMACRO(GENERATE_SIP_PYTHON_MODULE_CODE) + +# Will compile and link the module +MACRO(BUILD_SIP_PYTHON_MODULE MODULE_NAME SIP_FILES EXTRA_OBJECTS) + SET(EXTRA_LINK_LIBRARIES ${ARGN}) + + # We give this target a long logical target name. + # (This is to avoid having the library name clash with any already + # install library names. If that happens then cmake dependency + # tracking get confused.) + STRING(REPLACE "." "_" _logical_name ${MODULE_NAME}) + SET(_logical_name "python_module_${_logical_name}") + GET_FILENAME_COMPONENT(_module_path ${SIP_FILES} PATH) + + ADD_LIBRARY(${_logical_name} MODULE ${_sip_output_files} ${EXTRA_OBJECTS}) + SET_PROPERTY(TARGET ${_logical_name} PROPERTY AUTOMOC OFF) + TARGET_INCLUDE_DIRECTORIES(${_logical_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build ${SIP_EXTRA_INCLUDE_DIRS}) + + IF (${SIP_VERSION_STR} VERSION_LESS 5.0.0) + # require c++14 only -- sip breaks with newer versions due to reliance on throw(...) annotations removed in c++17 + TARGET_COMPILE_FEATURES(${_logical_name} PRIVATE cxx_std_14) + ENDIF (${SIP_VERSION_STR} VERSION_LESS 5.0.0) + + SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES CXX_VISIBILITY_PRESET default) + IF (NOT APPLE) + TARGET_LINK_LIBRARIES(${_logical_name} ${Python_LIBRARIES}) + ENDIF (NOT APPLE) + TARGET_LINK_LIBRARIES(${_logical_name} ${EXTRA_LINK_LIBRARIES}) + IF (APPLE) + SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + ENDIF (APPLE) + SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES PREFIX "" OUTPUT_NAME ${_child_module_name}) + + IF (WIN32) + SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES SUFFIX ".pyd") + GET_TARGET_PROPERTY(_runtime_output ${_logical_name} RUNTIME_OUTPUT_DIRECTORY) + ADD_CUSTOM_COMMAND(TARGET ${_logical_name} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "Copying extension ${_child_module_name}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${_logical_name}>" "${_runtime_output}/${_child_module_name}.pyd" + DEPENDS ${_logical_name} + ) + ENDIF(WIN32) + + INSTALL(TARGETS ${_logical_name} DESTINATION "${Python_SITEARCH}/${_parent_module_path}") +ENDMACRO(BUILD_SIP_PYTHON_MODULE MODULE_NAME SIP_FILES EXTRA_OBJECTS) diff --git a/devel/py-pynest2d/files/patch-cmake_FindClipper.cmake b/devel/py-pynest2d/files/patch-cmake_FindClipper.cmake deleted file mode 100644 index 14295387103f..000000000000 --- a/devel/py-pynest2d/files/patch-cmake_FindClipper.cmake +++ /dev/null @@ -1,13 +0,0 @@ ---- cmake/FindClipper.cmake.orig 2020-12-24 21:19:11 UTC -+++ cmake/FindClipper.cmake -@@ -55,8 +55,8 @@ set(LIB_SEARCHDIRS - - set(_deb_postfix "d") - --find_library(CLIPPER_LIBRARIES_RELEASE polyclipping ${LIB_SEARCHDIRS}) --find_library(CLIPPER_LIBRARIES_DEBUG polyclipping${_deb_postfix} ${LIB_SEARCHDIRS}) -+find_library(CLIPPER_LIBRARIES_RELEASE libpolyclipping.so ${LIB_SEARCHDIRS}) -+find_library(CLIPPER_LIBRARIES_DEBUG libpolyclipping${_deb_postfix} ${LIB_SEARCHDIRS}) - - if(CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}) - set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}}") diff --git a/devel/py-pynest2d/files/patch-src_ItemGroup.sip b/devel/py-pynest2d/files/patch-src_ItemGroup.sip deleted file mode 100644 index eea87008bdf2..000000000000 --- a/devel/py-pynest2d/files/patch-src_ItemGroup.sip +++ /dev/null @@ -1,42 +0,0 @@ ---- src/ItemGroup.sip.orig 2020-12-24 22:41:47 UTC -+++ src/ItemGroup.sip -@@ -23,7 +23,7 @@ - for(size_t i = 0; i < size; ++i) - { - Item item = sipCpp->at(0); -- PyObject* python_item = sipConvertFromInstance(&item, sipClass_Item, sipTransferObj); -+ PyObject* python_item = sipConvertFromType(&item, sipType_Item, sipTransferObj); - if(!python_item) - { - Py_DECREF(result_list); -@@ -48,20 +48,20 @@ - PyObject* list_item; - while(list_item = PyIter_Next(iterator)) - { -- if(!sipCanConvertToInstance(list_item, sipClass_Item, SIP_NOT_NONE)) -+ if(!sipCanConvertToType(list_item, sipType_Item, SIP_NOT_NONE)) - { - PyErr_Format(PyExc_TypeError, "Object in iterable cannot be converted to a libnest2d Item."); - *sipIsErr = 1; - break; - } - int state; -- Item* item = reinterpret_cast<Item*>(sipConvertToInstance(list_item, sipClass_Item, 0, SIP_NOT_NONE, &state, sipIsErr)); -+ Item* item = reinterpret_cast<Item*>(sipConvertToType(list_item, sipType_Item, 0, SIP_NOT_NONE, &state, sipIsErr)); - if(!*sipIsErr) - { - result->push_back(*item); - } - -- sipReleaseInstance(item, sipClass_Item, state); -+ sipReleaseType(item, sipType_Item, state); - Py_DECREF(list_item); - } - -@@ -74,4 +74,4 @@ - *sipCppPtr = result; - return sipGetState(sipTransferObj); - %End --}; -\ No newline at end of file -+}; diff --git a/devel/py-pynest2d/files/patch-src_Pynest2D.sip b/devel/py-pynest2d/files/patch-src_Pynest2D.sip deleted file mode 100644 index 14aa63905d9d..000000000000 --- a/devel/py-pynest2d/files/patch-src_Pynest2D.sip +++ /dev/null @@ -1,35 +0,0 @@ ---- src/Pynest2D.sip.orig 2020-12-24 22:47:54 UTC -+++ src/Pynest2D.sip -@@ -49,7 +49,7 @@ using namespace placers; - for(size_t i = 0; i < size; ++i) - { - Item* item = sipCpp->at(0); -- PyObject* python_item = sipConvertFromInstance(item, sipClass_Item, sipTransferObj); -+ PyObject* python_item = sipConvertFromType(item, sipType_Item, sipTransferObj); - if(!python_item) - { - Py_DECREF(result_list); -@@ -74,20 +74,20 @@ using namespace placers; - PyObject* list_item; - while(list_item = PyIter_Next(iterator)) - { -- if(!sipCanConvertToInstance(list_item, sipClass_Item, SIP_NOT_NONE)) -+ if(!sipCanConvertToType(list_item, sipType_Item, SIP_NOT_NONE)) - { - PyErr_Format(PyExc_TypeError, "Object in iterable cannot be converted to a libnest2d Item."); - *sipIsErr = 1; - break; - } - int state; -- Item* item = reinterpret_cast<Item*>(sipConvertToInstance(list_item, sipClass_Item, 0, SIP_NOT_NONE, &state, sipIsErr)); -+ Item* item = reinterpret_cast<Item*>(sipConvertToType(list_item, sipType_Item, 0, SIP_NOT_NONE, &state, sipIsErr)); - if(!*sipIsErr) - { - storage_vector->push_back(item); - } - -- sipReleaseInstance(item, sipClass_Item, state); -+ sipReleaseType(item, sipType_Item, state); - Py_DECREF(list_item); - } - |