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..be64744a6
--- /dev/null
+++ b/Package.resolved
@@ -0,0 +1,33 @@
+{
+ "originHash" : "3e2f64f29576d5c20d33a6b24091e7d829288ea5ac3d2f3c511a81a1b60bbab2",
+ "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"
+ }
+ },
+ {
+ "identity" : "tbb-spm",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/audulus/tbb-spm",
+ "state" : {
+ "branch" : "main",
+ "revision" : "3b7877905112736ef6143e990ac9f07434d0abdf"
+ }
+ }
+ ],
+ "version" : 3
+}
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 000000000..8ef2d57fe
--- /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"),
+ .package(url: "https://github.com/audulus/tbb-spm", branch: "main"),
+ ],
+ targets: [
+ .target(
+ name: "manifold",
+ dependencies: ["glm", "Clipper2", .product(name: "tbb", package: "tbb-spm")],
+ path: "src",
+ publicHeadersPath: "include",
+ cxxSettings: [
+ .define("MANIFOLD_PAR", to: "'T'"),
+ ]
+ )
+ ],
+ cxxLanguageStandard: .cxx20
+)
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})
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})