Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cura 8640 PyQt6 upgrade #17

Merged
merged 25 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 31 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright (c) 2020 Ultimaker B.V.
# Copyright (c) 2022 Ultimaker B.V.
# pynest2d is released under the terms of the LGPLv3 or higher.

project(pynest2d)
cmake_minimum_required(VERSION 3.18) # Lowest version it's been tested with.
cmake_minimum_required(VERSION 3.20) # Lowest version it's been tested with.
include(cmake/StandardProjectSettings.cmake)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(NOT DEFINED Python_VERSION)
set(Python_VERSION
3.10
Expand All @@ -17,39 +16,49 @@ endif()
if(APPLE)
set(Python_FIND_FRAMEWORK NEVER)
endif()
find_package(Python ${Python_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development)
find_package(cpython ${Python_VERSION} QUIET COMPONENTS Interpreter Development)
if(NOT TARGET cpython::cpython)
find_package(Python ${Python_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development)
else()
add_library(Python::Python ALIAS cpython::python)
set(Python_SITEARCH "${CMAKE_INSTALL_PREFIX}/lib/python${Python_VERSION}/site-packages")
set(Python_EXECUTABLE ${cpython_PACKAGE_FOLDER_RELEASE}/bin/python3)
set(ENV{PYTHONPATH} ${Python_SITEARCH})
endif()
message(STATUS "Linking and building ${project_name} against Python ${Python_VERSION}")

find_package(SIP REQUIRED 6.5.0)

find_package(libnest2d REQUIRED) # The library we're creating bindings for.
find_package(Libnest2D REQUIRED) # The library we're creating bindings for.

add_library(pynest2d INTERFACE)
set_project_standards(pynest2d)
use_threads(pynest2d)
set_rpath(TARGETS
pynest2d
PATHS
"$<$<PLATFORM_ID:Linux>:usr/bin>"
"$<$<PLATFORM_ID:Linux>:usr/bin/lib>"
"$<$<PLATFORM_ID:Darwin>:../lib>"
"$<$<PLATFORM_ID:Darwin>:../Resources/lib>"
"../../" # In distributions of Cura, the libnest2d dependency is 2 directories up from where pynest2d gets installed.
RELATIVE)

target_include_directories(pynest2d
INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/>
)

# Use C++17 Standard
message(STATUS "Setting C++17 support with extensions off and standard required")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
target_compile_features(pynest2d INTERFACE cxx_std_17)

if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
if (APPLE)
message(STATUS "Compiling ${project_name} against libc++")
target_compile_options(pynest2d INTERFACE "-stdlib=libc++")
endif()
endif()

find_package(Threads)
find_package(clipper)
find_package(NLopt)
target_link_libraries(pynest2d INTERFACE libnest2d::libnest2d Python::Python Threads::Threads clipper::clipper NLopt::nlopt)
find_package(Boost)
target_link_libraries(pynest2d INTERFACE Libnest2D::libnest2d Python::Python Threads::Threads clipper::clipper NLopt::nlopt boost::boost)

add_sip_module(pynest2d)
install_sip_module(pynest2d)
if(Python_SITELIB_LOCAL)
install_sip_module(pynest2d ${Python_SITELIB_LOCAL})
else()
install_sip_module(pynest2d)
endif()
94 changes: 0 additions & 94 deletions cmake/FindNLopt.cmake

This file was deleted.

6 changes: 3 additions & 3 deletions cmake/FindSIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@



IF(SIP_VERSION)
IF(SIP_VERSION OR SIP_BUILD_EXECUTABLE)
# Already in cache, be silent
SET(SIP_FOUND TRUE)
ELSE(SIP_VERSION)
ELSE()

FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH} NO_CMAKE_FIND_ROOT_PATH)

Expand Down Expand Up @@ -59,7 +59,7 @@ ELSE(SIP_VERSION)
ENDIF(SIP_FIND_REQUIRED)
ENDIF(SIP_FOUND)

ENDIF(SIP_VERSION)
ENDIF()

include(${CMAKE_SOURCE_DIR}/cmake/SIPMacros.cmake)
ADD_DEFINITIONS(-DSIP_VERSION=0x${SIP_VERSION})
88 changes: 0 additions & 88 deletions cmake/Findclipper.cmake

This file was deleted.

65 changes: 0 additions & 65 deletions cmake/Findlibnest2d.cmake

This file was deleted.

Loading