From a97bf22dbe1d27b2a09c545b883c437e2c562af4 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 11 Dec 2024 22:20:12 -0500 Subject: [PATCH 1/3] Remove duplicate target code for Clipper2 --- cmake/manifoldDeps.cmake | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/cmake/manifoldDeps.cmake b/cmake/manifoldDeps.cmake index c4ace570a..267f7e3ae 100644 --- a/cmake/manifoldDeps.cmake +++ b/cmake/manifoldDeps.cmake @@ -84,20 +84,7 @@ if(MANIFOLD_CROSS_SECTION) pkg_check_modules(Clipper2 Clipper2) endif() endif() - if(Clipper2_FOUND) - add_library(Clipper2 SHARED IMPORTED) - set_property( - TARGET Clipper2 - PROPERTY IMPORTED_LOCATION ${Clipper2_LINK_LIBRARIES} - ) - if(WIN32) - set_property( - TARGET Clipper2 - PROPERTY IMPORTED_IMPLIB ${Clipper2_LINK_LIBRARIES} - ) - endif() - target_include_directories(Clipper2 INTERFACE ${Clipper2_INCLUDE_DIRS}) - else() + if(NOT Clipper2_FOUND) logmissingdep("Clipper2" , "cross_section") set(MANIFOLD_USE_BUILTIN_CLIPPER2 ON) set(CLIPPER2_UTILS OFF) From 5ef8313484fcd027831cdccf9bd8656775f596a4 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 11 Dec 2024 22:38:25 -0500 Subject: [PATCH 2/3] Don't look for Clipper2 if it was already found upstream --- cmake/manifoldDeps.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/manifoldDeps.cmake b/cmake/manifoldDeps.cmake index 267f7e3ae..f9abd52e2 100644 --- a/cmake/manifoldDeps.cmake +++ b/cmake/manifoldDeps.cmake @@ -78,7 +78,7 @@ endif() # If we're building cross_section, we need Clipper2 if(MANIFOLD_CROSS_SECTION) - if(NOT MANIFOLD_USE_BUILTIN_CLIPPER2) + if(NOT MANIFOLD_USE_BUILTIN_CLIPPER2 AND NOT Clipper2_FOUND) find_package(Clipper2 QUIET) if(NOT Clipper2_FOUND AND PKG_CONFIG_FOUND) pkg_check_modules(Clipper2 Clipper2) From 567637f07d1be5f488f90b531a554d033e86f8ef Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 17 Dec 2024 22:37:41 -0500 Subject: [PATCH 3/3] Put back pkg-config setup for Clipper2 --- cmake/manifoldDeps.cmake | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cmake/manifoldDeps.cmake b/cmake/manifoldDeps.cmake index f9abd52e2..bd5f8292c 100644 --- a/cmake/manifoldDeps.cmake +++ b/cmake/manifoldDeps.cmake @@ -82,8 +82,22 @@ if(MANIFOLD_CROSS_SECTION) find_package(Clipper2 QUIET) if(NOT Clipper2_FOUND AND PKG_CONFIG_FOUND) pkg_check_modules(Clipper2 Clipper2) - endif() - endif() + if(Clipper2_FOUND) + add_library(Clipper2 SHARED IMPORTED) + set_property( + TARGET Clipper2 + PROPERTY IMPORTED_LOCATION ${Clipper2_LINK_LIBRARIES} + ) + if(WIN32) + set_property( + TARGET Clipper2 + PROPERTY IMPORTED_IMPLIB ${Clipper2_LINK_LIBRARIES} + ) + endif() + target_include_directories(Clipper2 INTERFACE ${Clipper2_INCLUDE_DIRS}) + endif(Clipper2_FOUND) + endif(NOT Clipper2_FOUND AND PKG_CONFIG_FOUND) + endif(NOT MANIFOLD_USE_BUILTIN_CLIPPER2 AND NOT Clipper2_FOUND) if(NOT Clipper2_FOUND) logmissingdep("Clipper2" , "cross_section") set(MANIFOLD_USE_BUILTIN_CLIPPER2 ON)