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

simplify directory structure for compatibility with Swift Package Manager #953

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>manifold.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
33 changes: 33 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -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
}
31 changes: 31 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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
)
72 changes: 66 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BUILD_INTERFACE:${TBB_INCLUDE_DIRS}>)
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
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>)
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})
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 0 additions & 23 deletions src/collider/CMakeLists.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
36 changes: 0 additions & 36 deletions src/cross_section/CMakeLists.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 0 additions & 35 deletions src/manifold/CMakeLists.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
31 changes: 0 additions & 31 deletions src/polygon/CMakeLists.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
81 changes: 0 additions & 81 deletions src/utilities/CMakeLists.txt

This file was deleted.

Loading