From 4a3f15d24d46f6906779a1adf4e1dfbac57e888f Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Thu, 5 Aug 2021 15:44:21 +0200 Subject: [PATCH 1/3] Added Conan support - Added conanfile.py - Set C++17 standard - Added .gitignore (always handy) - Changed behaviour of finding clipper It will first try to find polyclipping the target name used by Conan and polyclipping itself. if that fails. It will default back to the original behaviour of the require_package module which looks for the target Clipper::Clipper. This target is then linked to an interface library polyclipping::polyclipping allowing it to link by both use cases. --- .gitignore | 123 ++++++++++++++ CMakeLists.txt | 6 +- conanfile.py | 150 ++++++++++++++++++ .../libnest2d/backends/clipper/CMakeLists.txt | 11 +- .../backends/clipper/clipper_polygon.hpp | 2 +- test_package/CMakeLists.txt | 10 ++ test_package/conanfile.py | 35 ++++ test_package/main.cpp | 6 + 8 files changed, 338 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 conanfile.py create mode 100644 test_package/CMakeLists.txt create mode 100644 test_package/conanfile.py create mode 100644 test_package/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e5af4d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,123 @@ +### C++ template +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +### CMake template +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +.idea/ +tmp/* +test_package/build/* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 82bde89..c778375 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.1) project(Libnest2D) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED) +# Use C++17 Standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Add our own cmake module path. list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules/) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..40b9d37 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,150 @@ +from conans import ConanFile, tools +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake + +class libnest2dConan(ConanFile): + name = "libnest2d" + version = "4.10.0" + license = "LGPL-3.0" + author = "Ultimaker B.V." + url = "https://github.com/Ultimaker/libnest2d" + description = "2D irregular bin packaging and nesting library written in modern C++" + topics = ("conan", "cura", "prusaslicer", "nesting", "c++", "bin packaging") + settings = "os", "compiler", "build_type", "arch" + exports = "LICENSE.txt" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tests": [True, False], + "header_only": [True, False], + "geometries": ["clipper", "boost", "eigen"], + "optimizer": ["nlopt", "optimlib"], + "threading": ["std", "tbb", "omp", "none"], + "python_version": "ANY" + } + default_options = { + "shared": True, + "tests": False, + "fPIC": True, + "header_only": False, + "geometries": "clipper", + "optimizer": "nlopt", + "threading": "std", + "python_version": "3.9" + } + scm = { + "type": "git", + "subfolder": ".", + "url": "auto", + "revision": "auto" + } + + # TODO: Move lib naming logic to python_requires project + _ext = None + + @property + def ext(self): + if self._ext: + return self._ext + self._ext = "lib" if self.settings.os == "Windows" else "a" + if self.options.shared: + if self.settings.os == "Windows": + self._ext = "dll" + elif self.settings.os == "Macos": + self._ext = "dylib" + else: + self._ext = "so" + return self._ext + + _lib_name = None + + @property + def lib_name(self): + if self._lib_name: + return self._lib_name + ext = "d" if self.settings.build_type == "Debug" else "" + ext += "" if self.settings.os == "Windows" else f".{self.ext}" + self._lib_name = f"{self.name}_{self.options.geometries}_{self.options.optimizer}{ext}" + return self._lib_name + + def configure(self): + if self.options.shared or self.settings.compiler == "Visual Studio": + del self.options.fPIC + if self.options.geometries == "clipper": + self.options["clipper"].shared = self.options.shared + self.options["boost"].header_only = True + self.options["boost"].python_version = self.options.python_version + self.options["boost"].shared = self.options.shared + if self.options.optimizer == "nlopt": + self.options["nlopt"].shared = self.options.shared + + def build_requirements(self): + self.build_requires("cmake/[>=3.16.2]") + if self.options.tests: + self.build_requires("catch2/[>=2.13.6]", force_host_context=True) + + def requirements(self): + if self.options.geometries == "clipper": + self.requires("clipper/[>=6.4.2]") + self.requires("boost/1.70.0") + elif self.options.geometries == "eigen": + self.requires("eigen/[>=3.3.7]") + if self.options.optimizer == "nlopt": + self.requires("nlopt/[>=2.7.0]") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 17) + + def generate(self): + cmake = CMakeDeps(self) + cmake.generate() + + tc = CMakeToolchain(self) + + # FIXME: This shouldn't be necessary (maybe a bug in Conan????) + if self.settings.compiler == "Visual Studio": + tc.blocks["generic_system"].values["generator_platform"] = None + tc.blocks["generic_system"].values["toolset"] = None + + tc.variables["LIBNEST2D_HEADER_ONLY"] = self.options.header_only + if self.options.header_only: + tc.variables["BUILD_SHARED_LIBS"] = False + else: + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["LIBNEST2D_BUILD_UNITTESTS"] = self.options.tests + tc.variables["LIBNEST2D_GEOMETRIES"] = self.options.geometries + tc.variables["LIBNEST2D_OPTIMIZER"] = self.options.optimizer + tc.variables["LIBNEST2D_THREADING"] = self.options.threading + tc.generate() + + _cmake = None + + def configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure() + return self._cmake + + def build(self): + cmake = self.configure_cmake() + cmake.build() + + def package(self): + cmake = self.configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.includedirs = ["include"] + if self.in_local_cache: + self.cpp_info.libdirs = ["lib"] + else: + self.cpp_info.libdirs = [f"cmake-build-{self.settings.build_type}".lower()] + self.cpp_info.libs = [self.lib_name] + self.cpp_info.defines.append(f"LIBNEST2D_GEOMETRIES_{self.options.geometries}") + self.cpp_info.defines.append(f"LIBNEST2D_OPTIMIZERS_{self.options.optimizer}") + self.cpp_info.defines.append(f"LIBNEST2D_THREADING_{self.options.threading}") + self.cpp_info.names["cmake_find_package"] = self.name + self.cpp_info.names["cmake_find_package_multi"] = self.name + if self.settings.os in ["Linux", "FreeBSD", "Macos"]: + self.cpp_info.system_libs.append("pthread") diff --git a/include/libnest2d/backends/clipper/CMakeLists.txt b/include/libnest2d/backends/clipper/CMakeLists.txt index 031a0a0..3dee7cb 100644 --- a/include/libnest2d/backends/clipper/CMakeLists.txt +++ b/include/libnest2d/backends/clipper/CMakeLists.txt @@ -1,7 +1,14 @@ add_library(clipperBackend INTERFACE) -require_package(Clipper 6.1 REQUIRED) -target_link_libraries(clipperBackend INTERFACE Clipper::Clipper) +find_package(polyclipping 6.1 QUIET) +if(NOT TARGET polyclipping::polyclipping) + message(STATUS "Using require_package to obtain Clipper") + require_package(Clipper 6.1 REQUIRED) + add_library(polyclipping::polyclipping INTERFACE IMPORTED) + target_link_libraries(polyclipping::polyclipping INTERFACE Clipper::Clipper) +endif() +target_link_libraries(clipperBackend INTERFACE polyclipping::polyclipping) + # Clipper backend is not enough on its own, it still need some functions # from Boost geometry diff --git a/include/libnest2d/backends/clipper/clipper_polygon.hpp b/include/libnest2d/backends/clipper/clipper_polygon.hpp index 6511fbb..5993221 100644 --- a/include/libnest2d/backends/clipper/clipper_polygon.hpp +++ b/include/libnest2d/backends/clipper/clipper_polygon.hpp @@ -1,7 +1,7 @@ #ifndef CLIPPER_POLYGON_HPP #define CLIPPER_POLYGON_HPP -#include +#include namespace ClipperLib { diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt new file mode 100644 index 0000000..50a416a --- /dev/null +++ b/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.13) + +project(Libnest2D_example) +set(CMAKE_CXX_STANDARD 17) +find_package(libnest2d REQUIRED) + +add_executable(test main.cpp) + +target_link_libraries(test PRIVATE libnest2d::libnest2d) +target_include_directories(test PRIVATE ${libnest2d_INCLUDE_DIRS}) \ No newline at end of file diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 index 0000000..1077b94 --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,35 @@ +import os +from conans import ConanFile, CMake, tools +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake + + +class LibNest2DTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + def build_requirements(self): + self.build_requires("cmake/[>=3.16.2]") + + def requirements(self): + self.requires(f"libnest2d/4.10.0@ultimaker/testing") + + def generate(self): + cmake = CMakeDeps(self) + cmake.generate() + tc = CMakeToolchain(self) + if self.settings.compiler == "Visual Studio": + tc.blocks["generic_system"].values["generator_platform"] = None + tc.blocks["generic_system"].values["toolset"] = None + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def imports(self): + self.copy("*.dll", str(self.settings.build_type), "lib") + self.copy("*.dll", str(self.settings.build_type), "lib") + self.copy("*.dylib", str(self.settings.build_type), "lib") + + def test(self): + pass # only interested in compiling and linking \ No newline at end of file diff --git a/test_package/main.cpp b/test_package/main.cpp new file mode 100644 index 0000000..044700f --- /dev/null +++ b/test_package/main.cpp @@ -0,0 +1,6 @@ +#include + +int main(void /*int argc, char **argv*/) { + auto pi = libnest2d::Pi; + return 0; +} \ No newline at end of file From 7439af3d9e55e1ca02521850b17f1fad5bd0d401 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 8 Sep 2021 10:46:17 +0200 Subject: [PATCH 2/3] Updated to 4.11 --- conanfile.py | 48 ++++++--------------------------------- test_package/conanfile.py | 5 ++-- 2 files changed, 9 insertions(+), 44 deletions(-) diff --git a/conanfile.py b/conanfile.py index 40b9d37..115ce6a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,13 +3,15 @@ class libnest2dConan(ConanFile): name = "libnest2d" - version = "4.10.0" + version = "4.11.0" license = "LGPL-3.0" author = "Ultimaker B.V." url = "https://github.com/Ultimaker/libnest2d" description = "2D irregular bin packaging and nesting library written in modern C++" topics = ("conan", "cura", "prusaslicer", "nesting", "c++", "bin packaging") settings = "os", "compiler", "build_type", "arch" + revision_mode = "scm" + build_policy = "missing" exports = "LICENSE.txt" options = { "shared": [True, False], @@ -18,8 +20,7 @@ class libnest2dConan(ConanFile): "header_only": [True, False], "geometries": ["clipper", "boost", "eigen"], "optimizer": ["nlopt", "optimlib"], - "threading": ["std", "tbb", "omp", "none"], - "python_version": "ANY" + "threading": ["std", "tbb", "omp", "none"] } default_options = { "shared": True, @@ -28,8 +29,7 @@ class libnest2dConan(ConanFile): "header_only": False, "geometries": "clipper", "optimizer": "nlopt", - "threading": "std", - "python_version": "3.9" + "threading": "std" } scm = { "type": "git", @@ -38,41 +38,12 @@ class libnest2dConan(ConanFile): "revision": "auto" } - # TODO: Move lib naming logic to python_requires project - _ext = None - - @property - def ext(self): - if self._ext: - return self._ext - self._ext = "lib" if self.settings.os == "Windows" else "a" - if self.options.shared: - if self.settings.os == "Windows": - self._ext = "dll" - elif self.settings.os == "Macos": - self._ext = "dylib" - else: - self._ext = "so" - return self._ext - - _lib_name = None - - @property - def lib_name(self): - if self._lib_name: - return self._lib_name - ext = "d" if self.settings.build_type == "Debug" else "" - ext += "" if self.settings.os == "Windows" else f".{self.ext}" - self._lib_name = f"{self.name}_{self.options.geometries}_{self.options.optimizer}{ext}" - return self._lib_name - def configure(self): if self.options.shared or self.settings.compiler == "Visual Studio": del self.options.fPIC if self.options.geometries == "clipper": self.options["clipper"].shared = self.options.shared self.options["boost"].header_only = True - self.options["boost"].python_version = self.options.python_version self.options["boost"].shared = self.options.shared if self.options.optimizer == "nlopt": self.options["nlopt"].shared = self.options.shared @@ -135,16 +106,11 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.includedirs = ["include"] - if self.in_local_cache: - self.cpp_info.libdirs = ["lib"] - else: + self.cpp_info.libs = tools.collect_libs(self) + if not self.in_local_cache: self.cpp_info.libdirs = [f"cmake-build-{self.settings.build_type}".lower()] - self.cpp_info.libs = [self.lib_name] self.cpp_info.defines.append(f"LIBNEST2D_GEOMETRIES_{self.options.geometries}") self.cpp_info.defines.append(f"LIBNEST2D_OPTIMIZERS_{self.options.optimizer}") self.cpp_info.defines.append(f"LIBNEST2D_THREADING_{self.options.threading}") - self.cpp_info.names["cmake_find_package"] = self.name - self.cpp_info.names["cmake_find_package_multi"] = self.name if self.settings.os in ["Linux", "FreeBSD", "Macos"]: self.cpp_info.system_libs.append("pthread") diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 1077b94..0f2840e 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -1,5 +1,4 @@ -import os -from conans import ConanFile, CMake, tools +from conans import ConanFile, CMake from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake @@ -10,7 +9,7 @@ def build_requirements(self): self.build_requires("cmake/[>=3.16.2]") def requirements(self): - self.requires(f"libnest2d/4.10.0@ultimaker/testing") + self.requires(f"libnest2d/4.11.0@ultimaker/testing") def generate(self): cmake = CMakeDeps(self) From ff5b9d0790b9a6d39114c7d066c580eeeaac234e Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Thu, 11 Nov 2021 16:49:06 +0100 Subject: [PATCH 3/3] Use modern layout --- CMakeLists.txt | 2 +- .../{FindClipper.cmake => Findclipper.cmake} | 8 ++-- conanfile.py | 47 ++++++++++--------- external/+Clipper/CMakeLists.txt | 4 +- .../libnest2d/backends/clipper/CMakeLists.txt | 15 +++--- 5 files changed, 38 insertions(+), 38 deletions(-) rename cmake_modules/{FindClipper.cmake => Findclipper.cmake} (92%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c778375..c0d8cea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,7 @@ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/FindClipper.cmake" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/Findclipper.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/FindNLopt.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/FindTBB.cmake" DESTINATION diff --git a/cmake_modules/FindClipper.cmake b/cmake_modules/Findclipper.cmake similarity index 92% rename from cmake_modules/FindClipper.cmake rename to cmake_modules/Findclipper.cmake index bdc9353..07582d5 100644 --- a/cmake_modules/FindClipper.cmake +++ b/cmake_modules/Findclipper.cmake @@ -74,11 +74,11 @@ MARK_AS_ADVANCED( 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}) + 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 + set_target_properties(clipper::clipper PROPERTIES IMPORTED_LOCATION_DEBUG ${CLIPPER_LIBRARIES_DEBUG} IMPORTED_LOCATION_RELWITHDEBINFO ${CLIPPER_LIBRARIES_RELEASE} IMPORTED_LOCATION_RELEASE ${CLIPPER_LIBRARIES_RELEASE} diff --git a/conanfile.py b/conanfile.py index 115ce6a..1a079ee 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,5 +1,13 @@ +from typing import Optional + from conans import ConanFile, tools from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake +from conan.tools.layout import cmake_layout +from conan.tools.files.packager import AutoPackager +from conans.model.layout import Folders, Infos + +required_conan_version = ">=1.42" + class libnest2dConan(ConanFile): name = "libnest2d" @@ -13,6 +21,7 @@ class libnest2dConan(ConanFile): revision_mode = "scm" build_policy = "missing" exports = "LICENSE.txt" + exports_sources = "*", "!cmake-build-*", "!tmp", "test_package" options = { "shared": [True, False], "fPIC": [True, False], @@ -49,7 +58,6 @@ def configure(self): self.options["nlopt"].shared = self.options.shared def build_requirements(self): - self.build_requires("cmake/[>=3.16.2]") if self.options.tests: self.build_requires("catch2/[>=2.13.6]", force_host_context=True) @@ -66,6 +74,16 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, 17) + def layout(self): + cmake_layout(self) + self.cpp.package.libs = tools.collect_libs(self) + self.cpp.package.defines = [f"LIBNEST2D_GEOMETRIES_{self.options.geometries}", + f"LIBNEST2D_OPTIMIZERS_{self.options.optimizer}", + f"LIBNEST2D_THREADING_{self.options.threading}"] + self.cpp.package.system_libs = [] + if self.settings.os in ["Linux", "FreeBSD", "Macos"]: + self.cpp.package.system_libs.append("pthread") + def generate(self): cmake = CMakeDeps(self) cmake.generate() @@ -88,29 +106,12 @@ def generate(self): tc.variables["LIBNEST2D_THREADING"] = self.options.threading tc.generate() - _cmake = None - - def configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake - def build(self): - cmake = self.configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() - - def package(self): - cmake = self.configure_cmake() cmake.install() - def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - if not self.in_local_cache: - self.cpp_info.libdirs = [f"cmake-build-{self.settings.build_type}".lower()] - self.cpp_info.defines.append(f"LIBNEST2D_GEOMETRIES_{self.options.geometries}") - self.cpp_info.defines.append(f"LIBNEST2D_OPTIMIZERS_{self.options.optimizer}") - self.cpp_info.defines.append(f"LIBNEST2D_THREADING_{self.options.threading}") - if self.settings.os in ["Linux", "FreeBSD", "Macos"]: - self.cpp_info.system_libs.append("pthread") + def package(self): + packager = AutoPackager(self) + packager.run() diff --git a/external/+Clipper/CMakeLists.txt b/external/+Clipper/CMakeLists.txt index 6ea945a..db51720 100644 --- a/external/+Clipper/CMakeLists.txt +++ b/external/+Clipper/CMakeLists.txt @@ -1,5 +1,5 @@ -require_dependency(Boost) +require_dependency(boost) -rp_add_cmake_project(Clipper +rp_add_cmake_project(clipper GIT_REPOSITORY https://github.com/tamasmeszaros/libpolyclipping.git ) diff --git a/include/libnest2d/backends/clipper/CMakeLists.txt b/include/libnest2d/backends/clipper/CMakeLists.txt index 3dee7cb..2c7d6ad 100644 --- a/include/libnest2d/backends/clipper/CMakeLists.txt +++ b/include/libnest2d/backends/clipper/CMakeLists.txt @@ -1,21 +1,20 @@ add_library(clipperBackend INTERFACE) -find_package(polyclipping 6.1 QUIET) -if(NOT TARGET polyclipping::polyclipping) +find_package(clipper 6.1 QUIET) +if(NOT TARGET clipper::clipper) message(STATUS "Using require_package to obtain Clipper") require_package(Clipper 6.1 REQUIRED) - add_library(polyclipping::polyclipping INTERFACE IMPORTED) - target_link_libraries(polyclipping::polyclipping INTERFACE Clipper::Clipper) + add_library(clipper::clipper INTERFACE IMPORTED) endif() -target_link_libraries(clipperBackend INTERFACE polyclipping::polyclipping) +target_link_libraries(clipperBackend INTERFACE clipper::clipper) # Clipper backend is not enough on its own, it still need some functions # from Boost geometry -require_package(Boost 1.58 REQUIRED) +require_package(boost 1.58 REQUIRED) -if(TARGET Boost::boost) - target_link_libraries(clipperBackend INTERFACE Boost::boost ) +if(TARGET boost::boost) + target_link_libraries(clipperBackend INTERFACE boost::boost ) elseif(Boost_INCLUDE_DIRS_FOUND) target_include_directories(clipperBackend INTERFACE $ ) endif()