diff --git a/.gitignore b/.gitignore index d941c7a..43eef9b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ DerivedData/ .swiftpm/config/registries.json .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc +/.vscode diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9ecc08a --- /dev/null +++ b/CMakeLists.txt @@ -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() \ No newline at end of file diff --git a/Package.swift b/Package.swift index a4a9d88..dc019d4 100644 --- a/Package.swift +++ b/Package.swift @@ -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" + ] ) ] ) diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt new file mode 100644 index 0000000..4a10c2c --- /dev/null +++ b/Sources/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(LevenshteinTransformations) \ No newline at end of file diff --git a/Sources/LevenshteinTransformations/CMakeLists.txt b/Sources/LevenshteinTransformations/CMakeLists.txt new file mode 100644 index 0000000..f4f34f8 --- /dev/null +++ b/Sources/LevenshteinTransformations/CMakeLists.txt @@ -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 +) \ No newline at end of file diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt new file mode 100644 index 0000000..5d5a5c1 --- /dev/null +++ b/Tests/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable(Tests + LevenshteinTransformationsTests.swift +) + +target_compile_options(Tests PUBLIC + -parse-as-library +) + +target_link_libraries(Tests PRIVATE + LevenshteinTransformations +) \ No newline at end of file