From fad82c6a63026d71ba61a0f5a2d2d656a3e06f95 Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Fri, 20 Sep 2024 17:30:03 -0700 Subject: [PATCH 1/6] Create Package.swift --- Package.swift | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Package.swift diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..96f24ff4f --- /dev/null +++ b/Package.swift @@ -0,0 +1,31 @@ +// swift-tools-version:5.10 +import PackageDescription + +let package = Package( + name: "manifold", + platforms: [ + .macOS(.v11), .iOS(.v13) + ], + products: [ + .library( + name: "manifold", + targets: ["manifold"]) + ], + dependencies: [ + .package(url: "https://github.com/audulus/glm", branch: "spm"), + .package(url: "https://github.com/audulus/Clipper2", branch: "spm"), + ], + targets: [ + .target( + name: "manifold", + dependencies: ["glm", "Clipper2"], + path: "src", + publicHeadersPath: "manifold/include", + cxxSettings: [.headerSearchPath("collider/include"), + .headerSearchPath("cross_section/include"), + .headerSearchPath("polygon/include"), + .headerSearchPath("utilities/include")] + ) + ], + cxxLanguageStandard: .cxx20 +) From a5998e781e8bea3c36e9f0713d6ebbe6cea0f03b Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Fri, 20 Sep 2024 22:08:28 -0700 Subject: [PATCH 2/6] move files --- .../xcschemes/xcschememanagement.plist | 14 ++++ Package.resolved | 24 ++++++ Package.swift | 6 +- src/{manifold/src => }/boolean3.cpp | 0 src/{manifold/src => }/boolean3.h | 0 src/{manifold/src => }/boolean_result.cpp | 0 src/collider/CMakeLists.txt | 23 ------ src/{manifold/src => }/constructors.cpp | 0 src/{cross_section/src => }/cross_section.cpp | 0 src/cross_section/CMakeLists.txt | 36 --------- src/{manifold/src => }/csg_tree.cpp | 0 src/{manifold/src => }/csg_tree.h | 0 src/{manifold/src => }/edge_op.cpp | 0 src/{manifold/src => }/face_op.cpp | 0 src/{manifold/src => }/impl.cpp | 0 src/{manifold/src => }/impl.h | 0 .../include/manifold/collider.h | 0 src/{utilities => }/include/manifold/common.h | 0 .../include/manifold/cross_section.h | 0 .../include/manifold/hashtable.h | 0 src/{utilities => }/include/manifold/iters.h | 0 .../include/manifold/manifold.h | 0 .../include/manifold/optional_assert.h | 0 .../include/manifold/parallel.h | 0 src/{polygon => }/include/manifold/polygon.h | 0 src/{utilities => }/include/manifold/sparse.h | 0 src/{utilities => }/include/manifold/svd.h | 0 .../include/manifold/tri_dist.h | 0 src/{utilities => }/include/manifold/utils.h | 0 src/{utilities => }/include/manifold/vec.h | 0 .../include/manifold/vec_view.h | 0 src/{manifold/src => }/manifold.cpp | 0 src/manifold/CMakeLists.txt | 35 -------- src/{manifold/src => }/mesh_fixes.h | 0 src/{polygon/src => }/polygon.cpp | 0 src/polygon/CMakeLists.txt | 31 ------- src/{manifold/src => }/properties.cpp | 0 src/{manifold/src => }/quickhull.cpp | 0 src/{manifold/src => }/quickhull.h | 0 src/{manifold/src => }/sdf.cpp | 0 src/{manifold/src => }/shared.h | 0 src/{manifold/src => }/smoothing.cpp | 0 src/{manifold/src => }/sort.cpp | 0 src/{manifold/src => }/subdivision.cpp | 0 src/utilities/CMakeLists.txt | 81 ------------------- 45 files changed, 39 insertions(+), 211 deletions(-) create mode 100644 .swiftpm/xcode/xcuserdata/holliday.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 Package.resolved rename src/{manifold/src => }/boolean3.cpp (100%) rename src/{manifold/src => }/boolean3.h (100%) rename src/{manifold/src => }/boolean_result.cpp (100%) delete mode 100644 src/collider/CMakeLists.txt rename src/{manifold/src => }/constructors.cpp (100%) rename src/{cross_section/src => }/cross_section.cpp (100%) delete mode 100644 src/cross_section/CMakeLists.txt rename src/{manifold/src => }/csg_tree.cpp (100%) rename src/{manifold/src => }/csg_tree.h (100%) rename src/{manifold/src => }/edge_op.cpp (100%) rename src/{manifold/src => }/face_op.cpp (100%) rename src/{manifold/src => }/impl.cpp (100%) rename src/{manifold/src => }/impl.h (100%) rename src/{collider => }/include/manifold/collider.h (100%) rename src/{utilities => }/include/manifold/common.h (100%) rename src/{cross_section => }/include/manifold/cross_section.h (100%) rename src/{utilities => }/include/manifold/hashtable.h (100%) rename src/{utilities => }/include/manifold/iters.h (100%) rename src/{manifold => }/include/manifold/manifold.h (100%) rename src/{utilities => }/include/manifold/optional_assert.h (100%) rename src/{utilities => }/include/manifold/parallel.h (100%) rename src/{polygon => }/include/manifold/polygon.h (100%) rename src/{utilities => }/include/manifold/sparse.h (100%) rename src/{utilities => }/include/manifold/svd.h (100%) rename src/{utilities => }/include/manifold/tri_dist.h (100%) rename src/{utilities => }/include/manifold/utils.h (100%) rename src/{utilities => }/include/manifold/vec.h (100%) rename src/{utilities => }/include/manifold/vec_view.h (100%) rename src/{manifold/src => }/manifold.cpp (100%) delete mode 100644 src/manifold/CMakeLists.txt rename src/{manifold/src => }/mesh_fixes.h (100%) rename src/{polygon/src => }/polygon.cpp (100%) delete mode 100644 src/polygon/CMakeLists.txt rename src/{manifold/src => }/properties.cpp (100%) rename src/{manifold/src => }/quickhull.cpp (100%) rename src/{manifold/src => }/quickhull.h (100%) rename src/{manifold/src => }/sdf.cpp (100%) rename src/{manifold/src => }/shared.h (100%) rename src/{manifold/src => }/smoothing.cpp (100%) rename src/{manifold/src => }/sort.cpp (100%) rename src/{manifold/src => }/subdivision.cpp (100%) delete mode 100644 src/utilities/CMakeLists.txt diff --git a/.swiftpm/xcode/xcuserdata/holliday.xcuserdatad/xcschemes/xcschememanagement.plist b/.swiftpm/xcode/xcuserdata/holliday.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 000000000..ac9ec027e --- /dev/null +++ b/.swiftpm/xcode/xcuserdata/holliday.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + manifold.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 000000000..3c3fdcdfb --- /dev/null +++ b/Package.resolved @@ -0,0 +1,24 @@ +{ + "originHash" : "a1d7099091da1685ddf8f93ffc52f05b84fab2679861fe610116d2e59b3e0dd9", + "pins" : [ + { + "identity" : "clipper2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/audulus/Clipper2", + "state" : { + "branch" : "spm", + "revision" : "73a65374f4fec1682bf6af8855e177aa1b02ea3c" + } + }, + { + "identity" : "glm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/audulus/glm", + "state" : { + "branch" : "spm", + "revision" : "ad839f90fcd1e630ae134d12b0f21c1d80c58271" + } + } + ], + "version" : 3 +} diff --git a/Package.swift b/Package.swift index 96f24ff4f..978c23744 100644 --- a/Package.swift +++ b/Package.swift @@ -20,11 +20,7 @@ let package = Package( name: "manifold", dependencies: ["glm", "Clipper2"], path: "src", - publicHeadersPath: "manifold/include", - cxxSettings: [.headerSearchPath("collider/include"), - .headerSearchPath("cross_section/include"), - .headerSearchPath("polygon/include"), - .headerSearchPath("utilities/include")] + publicHeadersPath: "include" ) ], cxxLanguageStandard: .cxx20 diff --git a/src/manifold/src/boolean3.cpp b/src/boolean3.cpp similarity index 100% rename from src/manifold/src/boolean3.cpp rename to src/boolean3.cpp diff --git a/src/manifold/src/boolean3.h b/src/boolean3.h similarity index 100% rename from src/manifold/src/boolean3.h rename to src/boolean3.h diff --git a/src/manifold/src/boolean_result.cpp b/src/boolean_result.cpp similarity index 100% rename from src/manifold/src/boolean_result.cpp rename to src/boolean_result.cpp diff --git a/src/collider/CMakeLists.txt b/src/collider/CMakeLists.txt deleted file mode 100644 index 2f5d20a25..000000000 --- a/src/collider/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2020 The Manifold Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project (collider) - -add_library(${PROJECT_NAME} INTERFACE) -target_include_directories(${PROJECT_NAME} INTERFACE - $ - $) -target_link_libraries(${PROJECT_NAME} INTERFACE utilities) -target_compile_options(${PROJECT_NAME} INTERFACE ${MANIFOLD_FLAGS}) -target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) diff --git a/src/manifold/src/constructors.cpp b/src/constructors.cpp similarity index 100% rename from src/manifold/src/constructors.cpp rename to src/constructors.cpp diff --git a/src/cross_section/src/cross_section.cpp b/src/cross_section.cpp similarity index 100% rename from src/cross_section/src/cross_section.cpp rename to src/cross_section.cpp diff --git a/src/cross_section/CMakeLists.txt b/src/cross_section/CMakeLists.txt deleted file mode 100644 index 600a40b46..000000000 --- a/src/cross_section/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2023 The Manifold Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project (cross_section) -file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) -add_library(${PROJECT_NAME} ${SOURCE_FILES}) -target_include_directories(${PROJECT_NAME} PUBLIC - $ - $) - -if(TARGET Clipper2::Clipper2) - target_link_libraries(${PROJECT_NAME} - PUBLIC utilities - PRIVATE Clipper2::Clipper2) -else() - target_link_libraries(${PROJECT_NAME} - PUBLIC utilities - PRIVATE Clipper2) -endif() - -target_compile_options(${PROJECT_NAME} PRIVATE ${MANIFOLD_FLAGS}) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) - -install(TARGETS ${PROJECT_NAME} EXPORT manifoldTargets) -install(FILES include/manifold/cross_section.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}) diff --git a/src/manifold/src/csg_tree.cpp b/src/csg_tree.cpp similarity index 100% rename from src/manifold/src/csg_tree.cpp rename to src/csg_tree.cpp diff --git a/src/manifold/src/csg_tree.h b/src/csg_tree.h similarity index 100% rename from src/manifold/src/csg_tree.h rename to src/csg_tree.h diff --git a/src/manifold/src/edge_op.cpp b/src/edge_op.cpp similarity index 100% rename from src/manifold/src/edge_op.cpp rename to src/edge_op.cpp diff --git a/src/manifold/src/face_op.cpp b/src/face_op.cpp similarity index 100% rename from src/manifold/src/face_op.cpp rename to src/face_op.cpp diff --git a/src/manifold/src/impl.cpp b/src/impl.cpp similarity index 100% rename from src/manifold/src/impl.cpp rename to src/impl.cpp diff --git a/src/manifold/src/impl.h b/src/impl.h similarity index 100% rename from src/manifold/src/impl.h rename to src/impl.h diff --git a/src/collider/include/manifold/collider.h b/src/include/manifold/collider.h similarity index 100% rename from src/collider/include/manifold/collider.h rename to src/include/manifold/collider.h diff --git a/src/utilities/include/manifold/common.h b/src/include/manifold/common.h similarity index 100% rename from src/utilities/include/manifold/common.h rename to src/include/manifold/common.h diff --git a/src/cross_section/include/manifold/cross_section.h b/src/include/manifold/cross_section.h similarity index 100% rename from src/cross_section/include/manifold/cross_section.h rename to src/include/manifold/cross_section.h diff --git a/src/utilities/include/manifold/hashtable.h b/src/include/manifold/hashtable.h similarity index 100% rename from src/utilities/include/manifold/hashtable.h rename to src/include/manifold/hashtable.h diff --git a/src/utilities/include/manifold/iters.h b/src/include/manifold/iters.h similarity index 100% rename from src/utilities/include/manifold/iters.h rename to src/include/manifold/iters.h diff --git a/src/manifold/include/manifold/manifold.h b/src/include/manifold/manifold.h similarity index 100% rename from src/manifold/include/manifold/manifold.h rename to src/include/manifold/manifold.h diff --git a/src/utilities/include/manifold/optional_assert.h b/src/include/manifold/optional_assert.h similarity index 100% rename from src/utilities/include/manifold/optional_assert.h rename to src/include/manifold/optional_assert.h diff --git a/src/utilities/include/manifold/parallel.h b/src/include/manifold/parallel.h similarity index 100% rename from src/utilities/include/manifold/parallel.h rename to src/include/manifold/parallel.h diff --git a/src/polygon/include/manifold/polygon.h b/src/include/manifold/polygon.h similarity index 100% rename from src/polygon/include/manifold/polygon.h rename to src/include/manifold/polygon.h diff --git a/src/utilities/include/manifold/sparse.h b/src/include/manifold/sparse.h similarity index 100% rename from src/utilities/include/manifold/sparse.h rename to src/include/manifold/sparse.h diff --git a/src/utilities/include/manifold/svd.h b/src/include/manifold/svd.h similarity index 100% rename from src/utilities/include/manifold/svd.h rename to src/include/manifold/svd.h diff --git a/src/utilities/include/manifold/tri_dist.h b/src/include/manifold/tri_dist.h similarity index 100% rename from src/utilities/include/manifold/tri_dist.h rename to src/include/manifold/tri_dist.h diff --git a/src/utilities/include/manifold/utils.h b/src/include/manifold/utils.h similarity index 100% rename from src/utilities/include/manifold/utils.h rename to src/include/manifold/utils.h diff --git a/src/utilities/include/manifold/vec.h b/src/include/manifold/vec.h similarity index 100% rename from src/utilities/include/manifold/vec.h rename to src/include/manifold/vec.h diff --git a/src/utilities/include/manifold/vec_view.h b/src/include/manifold/vec_view.h similarity index 100% rename from src/utilities/include/manifold/vec_view.h rename to src/include/manifold/vec_view.h diff --git a/src/manifold/src/manifold.cpp b/src/manifold.cpp similarity index 100% rename from src/manifold/src/manifold.cpp rename to src/manifold.cpp diff --git a/src/manifold/CMakeLists.txt b/src/manifold/CMakeLists.txt deleted file mode 100644 index 00136b5da..000000000 --- a/src/manifold/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2020 The Manifold Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project (manifold) - -file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) -add_library(${PROJECT_NAME} ${SOURCE_FILES}) - -target_include_directories(${PROJECT_NAME} PUBLIC - $ - $) -target_link_libraries(${PROJECT_NAME} - PUBLIC utilities - PRIVATE $ polygon ${MANIFOLD_INCLUDE} -) - -target_compile_options(${PROJECT_NAME} PRIVATE ${MANIFOLD_FLAGS}) - -target_compile_features(${PROJECT_NAME} - PUBLIC cxx_std_17 -) - -install(TARGETS ${PROJECT_NAME} EXPORT manifoldTargets) -install(FILES include/manifold/manifold.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}) diff --git a/src/manifold/src/mesh_fixes.h b/src/mesh_fixes.h similarity index 100% rename from src/manifold/src/mesh_fixes.h rename to src/mesh_fixes.h diff --git a/src/polygon/src/polygon.cpp b/src/polygon.cpp similarity index 100% rename from src/polygon/src/polygon.cpp rename to src/polygon.cpp diff --git a/src/polygon/CMakeLists.txt b/src/polygon/CMakeLists.txt deleted file mode 100644 index 44338336d..000000000 --- a/src/polygon/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2020 The Manifold Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project (polygon) - -file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp) -add_library(${PROJECT_NAME} ${SOURCE_FILES}) -target_include_directories(${PROJECT_NAME} PUBLIC - $ - $) -target_link_libraries(${PROJECT_NAME} - PUBLIC utilities - PRIVATE $ -) - -target_compile_options(${PROJECT_NAME} PRIVATE ${MANIFOLD_FLAGS}) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) - -install(TARGETS ${PROJECT_NAME} EXPORT manifoldTargets) -install(FILES include/manifold/polygon.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}) diff --git a/src/manifold/src/properties.cpp b/src/properties.cpp similarity index 100% rename from src/manifold/src/properties.cpp rename to src/properties.cpp diff --git a/src/manifold/src/quickhull.cpp b/src/quickhull.cpp similarity index 100% rename from src/manifold/src/quickhull.cpp rename to src/quickhull.cpp diff --git a/src/manifold/src/quickhull.h b/src/quickhull.h similarity index 100% rename from src/manifold/src/quickhull.h rename to src/quickhull.h diff --git a/src/manifold/src/sdf.cpp b/src/sdf.cpp similarity index 100% rename from src/manifold/src/sdf.cpp rename to src/sdf.cpp diff --git a/src/manifold/src/shared.h b/src/shared.h similarity index 100% rename from src/manifold/src/shared.h rename to src/shared.h diff --git a/src/manifold/src/smoothing.cpp b/src/smoothing.cpp similarity index 100% rename from src/manifold/src/smoothing.cpp rename to src/smoothing.cpp diff --git a/src/manifold/src/sort.cpp b/src/sort.cpp similarity index 100% rename from src/manifold/src/sort.cpp rename to src/sort.cpp diff --git a/src/manifold/src/subdivision.cpp b/src/subdivision.cpp similarity index 100% rename from src/manifold/src/subdivision.cpp rename to src/subdivision.cpp diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt deleted file mode 100644 index c973f5352..000000000 --- a/src/utilities/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright 2020 The Manifold Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project(utilities) - -add_library(${PROJECT_NAME} INTERFACE) -message("Parallel Backend: ${MANIFOLD_PAR}") - -include(FetchContent) -if (TRACY_ENABLE) - include(FetchContent) - FetchContent_Declare(tracy - GIT_REPOSITORY https://github.com/wolfpld/tracy.git - GIT_TAG v0.10 - GIT_SHALLOW TRUE - GIT_PROGRESS TRUE - ) - FetchContent_MakeAvailable(tracy) - target_link_libraries(${PROJECT_NAME} INTERFACE TracyClient) -endif() - -if(MANIFOLD_PAR STREQUAL "TBB") - target_compile_options(${PROJECT_NAME} INTERFACE -DMANIFOLD_PAR='T') - if(TARGET TBB::tbb) - target_link_libraries(${PROJECT_NAME} INTERFACE TBB::tbb) - else() - target_include_directories(${PROJECT_NAME} INTERFACE $) - target_link_libraries(${PROJECT_NAME} INTERFACE ${TBB_LINK_LIBRARIES}) - endif() - if(APPLE) - if(oneDPL_FOUND) - target_link_libraries(${PROJECT_NAME} INTERFACE oneDPL) - else() - message(WARNING "oneDPL not found, sequential implementation is used instead") - endif() - endif() -elseif(MANIFOLD_PAR STREQUAL "NONE") - set(MANIFOLD_PAR "CPP") -else() - message(FATAL_ERROR "Invalid value for MANIFOLD_PAR: ${MANIFOLD_PAR}. " - "Should be \"TBB\" or \"NONE\"") -endif() - -target_include_directories(${PROJECT_NAME} INTERFACE - $ - $) -target_link_libraries(${PROJECT_NAME} INTERFACE glm::glm) - -if(MANIFOLD_EXCEPTIONS) - target_compile_options(${PROJECT_NAME} INTERFACE - -DMANIFOLD_EXCEPTIONS=1 - ) -endif() - -if(MANIFOLD_DEBUG) - target_compile_options(${PROJECT_NAME} - INTERFACE -DMANIFOLD_DEBUG) -endif() - -target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) - -install(TARGETS ${PROJECT_NAME} EXPORT manifoldTargets) -install(FILES - include/manifold/common.h - include/manifold/vec_view.h - include/manifold/tri_dist.h - include/manifold/optional_assert.h - include/manifold/iters.h - include/manifold/parallel.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}) From 63bb1f05fafc4b88c6e1ea9e5dfddffab74a0b71 Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Wed, 25 Sep 2024 14:17:40 -0700 Subject: [PATCH 3/6] try to update src/CMakeLists.txt --- src/CMakeLists.txt | 72 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 52f079f5d..a67100b98 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,10 +12,70 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_subdirectory(utilities) -add_subdirectory(collider) -if(MANIFOLD_CROSS_SECTION) - add_subdirectory(cross_section) +project(manifold) + +add_library(${PROJECT_NAME} INTERFACE) +message("Parallel Backend: ${MANIFOLD_PAR}") + +include(FetchContent) +if (TRACY_ENABLE) + include(FetchContent) + FetchContent_Declare(tracy + GIT_REPOSITORY https://github.com/wolfpld/tracy.git + GIT_TAG v0.10 + GIT_SHALLOW TRUE + GIT_PROGRESS TRUE + ) + FetchContent_MakeAvailable(tracy) + target_link_libraries(${PROJECT_NAME} INTERFACE TracyClient) +endif() + +if(MANIFOLD_PAR STREQUAL "TBB") + target_compile_options(${PROJECT_NAME} INTERFACE -DMANIFOLD_PAR='T') + if(TARGET TBB::tbb) + target_link_libraries(${PROJECT_NAME} INTERFACE TBB::tbb) + else() + target_include_directories(${PROJECT_NAME} INTERFACE $) + target_link_libraries(${PROJECT_NAME} INTERFACE ${TBB_LINK_LIBRARIES}) + endif() + if(APPLE) + if(oneDPL_FOUND) + target_link_libraries(${PROJECT_NAME} INTERFACE oneDPL) + else() + message(WARNING "oneDPL not found, sequential implementation is used instead") + endif() + endif() +elseif(MANIFOLD_PAR STREQUAL "NONE") + set(MANIFOLD_PAR "CPP") +else() + message(FATAL_ERROR "Invalid value for MANIFOLD_PAR: ${MANIFOLD_PAR}. " + "Should be \"TBB\" or \"NONE\"") endif() -add_subdirectory(polygon) -add_subdirectory(manifold) + +target_include_directories(${PROJECT_NAME} INTERFACE + $ + $) +target_link_libraries(${PROJECT_NAME} INTERFACE glm::glm) + +if(MANIFOLD_EXCEPTIONS) + target_compile_options(${PROJECT_NAME} INTERFACE + -DMANIFOLD_EXCEPTIONS=1 + ) +endif() + +if(MANIFOLD_DEBUG) + target_compile_options(${PROJECT_NAME} + INTERFACE -DMANIFOLD_DEBUG) +endif() + +target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17) + +install(TARGETS ${PROJECT_NAME} EXPORT manifoldTargets) +install(FILES + include/manifold/common.h + include/manifold/vec_view.h + include/manifold/tri_dist.h + include/manifold/optional_assert.h + include/manifold/iters.h + include/manifold/parallel.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}) From 466c3659899c68788539d3dba95e719f7a92032b Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Thu, 26 Sep 2024 22:15:23 -0700 Subject: [PATCH 4/6] add oneTBB --- Package.resolved | 11 ++++++++++- Package.swift | 8 ++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Package.resolved b/Package.resolved index 3c3fdcdfb..442b4f80a 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "a1d7099091da1685ddf8f93ffc52f05b84fab2679861fe610116d2e59b3e0dd9", + "originHash" : "901e0bae4da1f7f4fbef3b93426983bda80047d658efcd9730e185ce553af2aa", "pins" : [ { "identity" : "clipper2", @@ -18,6 +18,15 @@ "branch" : "spm", "revision" : "ad839f90fcd1e630ae134d12b0f21c1d80c58271" } + }, + { + "identity" : "onetbb", + "kind" : "remoteSourceControl", + "location" : "https://github.com/audulus/oneTBB", + "state" : { + "branch" : "spm", + "revision" : "b597dfb31989aff7cf981d5872f504c7b4c4d13a" + } } ], "version" : 3 diff --git a/Package.swift b/Package.swift index 978c23744..1b3058257 100644 --- a/Package.swift +++ b/Package.swift @@ -14,13 +14,17 @@ let package = Package( dependencies: [ .package(url: "https://github.com/audulus/glm", branch: "spm"), .package(url: "https://github.com/audulus/Clipper2", branch: "spm"), + .package(url: "https://github.com/audulus/oneTBB", branch: "spm"), ], targets: [ .target( name: "manifold", - dependencies: ["glm", "Clipper2"], + dependencies: ["glm", "Clipper2", "oneTBB"], path: "src", - publicHeadersPath: "include" + publicHeadersPath: "include", + cxxSettings: [ + .define("MANIFOLD_PAR", to: "'T'"), + ] ) ], cxxLanguageStandard: .cxx20 From b5a00ba4e3954e2f48773966e67e96884788379a Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Thu, 26 Sep 2024 23:14:28 -0700 Subject: [PATCH 5/6] try prebuilt tbb --- Package.resolved | 10 +++++----- Package.swift | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Package.resolved b/Package.resolved index 442b4f80a..1e98763a9 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "901e0bae4da1f7f4fbef3b93426983bda80047d658efcd9730e185ce553af2aa", + "originHash" : "3e2f64f29576d5c20d33a6b24091e7d829288ea5ac3d2f3c511a81a1b60bbab2", "pins" : [ { "identity" : "clipper2", @@ -20,12 +20,12 @@ } }, { - "identity" : "onetbb", + "identity" : "tbb-spm", "kind" : "remoteSourceControl", - "location" : "https://github.com/audulus/oneTBB", + "location" : "https://github.com/audulus/tbb-spm", "state" : { - "branch" : "spm", - "revision" : "b597dfb31989aff7cf981d5872f504c7b4c4d13a" + "branch" : "main", + "revision" : "5b7e50f890cbe03f1fa9cc1e6b1606cf1c347d2b" } } ], diff --git a/Package.swift b/Package.swift index 1b3058257..8ef2d57fe 100644 --- a/Package.swift +++ b/Package.swift @@ -14,12 +14,12 @@ let package = Package( dependencies: [ .package(url: "https://github.com/audulus/glm", branch: "spm"), .package(url: "https://github.com/audulus/Clipper2", branch: "spm"), - .package(url: "https://github.com/audulus/oneTBB", branch: "spm"), + .package(url: "https://github.com/audulus/tbb-spm", branch: "main"), ], targets: [ .target( name: "manifold", - dependencies: ["glm", "Clipper2", "oneTBB"], + dependencies: ["glm", "Clipper2", .product(name: "tbb", package: "tbb-spm")], path: "src", publicHeadersPath: "include", cxxSettings: [ From 31f465ac92d54f1543b86b00e60511748dfadfeb Mon Sep 17 00:00:00 2001 From: Taylor Holliday Date: Thu, 26 Sep 2024 23:25:22 -0700 Subject: [PATCH 6/6] Update Package.resolved --- Package.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.resolved b/Package.resolved index 1e98763a9..be64744a6 100644 --- a/Package.resolved +++ b/Package.resolved @@ -25,7 +25,7 @@ "location" : "https://github.com/audulus/tbb-spm", "state" : { "branch" : "main", - "revision" : "5b7e50f890cbe03f1fa9cc1e6b1606cf1c347d2b" + "revision" : "3b7877905112736ef6143e990ac9f07434d0abdf" } } ],