Merge pull request 'Add CMake Support' (#1) from Zaph/levenshtein-transformations:main into main
Some checks failed
Deploy Docs / publish (push) Failing after 13s
SwiftLint / SwiftLint (push) Successful in 4s

Reviewed-on: #1
Reviewed-by: david-swift <david-swift@noreply.aproksha.uber.space>
This commit is contained in:
david-swift 2025-04-06 16:38:21 +02:00
commit 2217c71ad8
6 changed files with 52 additions and 2 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
/.vscode

16
CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.29)
cmake_policy(SET CMP0157 NEW)
project(LevenshteinTransformations
LANGUAGES Swift)
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_subdirectory(Sources)
if(CMAKE_PROJECT_NAME STREQUAL "LevenshteinTransformations")
add_subdirectory(Tests)
endif()

View File

@ -23,12 +23,18 @@ let package = Package(
],
targets: [
.target(
name: "LevenshteinTransformations"
name: "LevenshteinTransformations",
exclude: [
"CMakeLists.txt"
]
),
.executableTarget(
name: "LevenshteinTransformationsTests",
dependencies: ["LevenshteinTransformations"],
path: "Tests"
path: "Tests",
exclude: [
"CMakeLists.txt"
]
)
]
)

1
Sources/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory(LevenshteinTransformations)

View File

@ -0,0 +1,15 @@
add_library(LevenshteinTransformations
Extensions/Array.swift
Extensions/String.swift
AsyncFunctions.swift
EditOperation.swift
Functions.swift
LevenshteinTransformations.swift
Transformation.swift
)
install(TARGETS LevenshteinTransformations
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)

11
Tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
add_executable(Tests
LevenshteinTransformationsTests.swift
)
target_compile_options(Tests PUBLIC
-parse-as-library
)
target_link_libraries(Tests PRIVATE
LevenshteinTransformations
)