Add zenzai cuda support

This commit is contained in:
fkunn1326
2024-09-14 08:22:39 +09:00
parent 31ce9911ac
commit 3215fb7470
6 changed files with 4005 additions and 73 deletions

View File

@ -14,6 +14,107 @@ let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("ImportObjcForwardDeclarations")
]
var dependencies: [Package.Dependency] = [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMajor(from: "1.0.0"))
]
var targets: [Target] = [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SwiftUtils",
dependencies: [
.product(name: "Algorithms", package: "swift-algorithms")
],
resources: [],
swiftSettings: swiftSettings
),
.target(
name: "KanaKanjiConverterModuleWithDefaultDictionary",
dependencies: [
"KanaKanjiConverterModule"
],
exclude: [
"azooKey_dictionary_storage/README.md",
"azooKey_dictionary_storage/LICENSE",
],
resources: [
.copy("azooKey_dictionary_storage/Dictionary"),
],
swiftSettings: swiftSettings
),
.executableTarget(
name: "CliTool",
dependencies: [
"KanaKanjiConverterModuleWithDefaultDictionary",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),
.testTarget(
name: "SwiftUtilsTests",
dependencies: ["SwiftUtils"],
resources: [],
swiftSettings: swiftSettings
),
.testTarget(
name: "KanaKanjiConverterModuleTests",
dependencies: ["KanaKanjiConverterModule"],
resources: [
.copy("DictionaryMock")
],
swiftSettings: swiftSettings
),
.testTarget(
name: "KanaKanjiConverterModuleWithDefaultDictionaryTests",
dependencies: [
"KanaKanjiConverterModuleWithDefaultDictionary",
.product(name: "Collections", package: "swift-collections")
],
swiftSettings: swiftSettings
)
]
#if !(os(Windows))
dependencies.append(
.package(url: "https://github.com/ensan-hcl/llama.cpp", branch: "b5cc30f"),
)
#endif
#if os(Windows)
targets.append(contentsOf: [
.systemLibrary(
name: "llama.cpp"
),
.target(
name: "KanaKanjiConverterModule",
dependencies: [
"SwiftUtils",
"llama.cpp",
.product(name: "Collections", package: "swift-collections")
],
swiftSettings: swiftSettings
)
])
#else
targets.append(contentsOf: [
.target(
name: "KanaKanjiConverterModule",
dependencies: [
"SwiftUtils",
.product(name: "llama", package: "llama.cpp"),
.product(name: "Collections", package: "swift-collections")
],
swiftSettings: swiftSettings
)
])
#endif
let package = Package(
name: "AzooKeyKanakanjiConverter",
platforms: [.iOS(.v14), .macOS(.v12)],
@ -34,77 +135,6 @@ let package = Package(
targets: ["KanaKanjiConverterModule"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMajor(from: "1.0.0")),
// local package
.package(url: "https://github.com/ensan-hcl/llama.cpp", branch: "b5cc30f"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SwiftUtils",
dependencies: [
.product(name: "Algorithms", package: "swift-algorithms")
],
resources: [],
swiftSettings: swiftSettings
),
.target(
name: "KanaKanjiConverterModule",
dependencies: [
"SwiftUtils",
.product(name: "llama", package: "llama.cpp"),
.product(name: "Collections", package: "swift-collections")
],
swiftSettings: swiftSettings
),
.target(
name: "KanaKanjiConverterModuleWithDefaultDictionary",
dependencies: [
"KanaKanjiConverterModule"
],
exclude: [
"azooKey_dictionary_storage/README.md",
"azooKey_dictionary_storage/LICENSE",
],
resources: [
.copy("azooKey_dictionary_storage/Dictionary"),
],
swiftSettings: swiftSettings
),
.executableTarget(
name: "CliTool",
dependencies: [
"KanaKanjiConverterModuleWithDefaultDictionary",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),
.testTarget(
name: "SwiftUtilsTests",
dependencies: ["SwiftUtils"],
resources: [],
swiftSettings: swiftSettings
),
.testTarget(
name: "KanaKanjiConverterModuleTests",
dependencies: ["KanaKanjiConverterModule"],
resources: [
.copy("DictionaryMock")
],
swiftSettings: swiftSettings
),
.testTarget(
name: "KanaKanjiConverterModuleWithDefaultDictionaryTests",
dependencies: [
"KanaKanjiConverterModuleWithDefaultDictionary",
.product(name: "Collections", package: "swift-collections")
],
swiftSettings: swiftSettings
)
]
dependencies: dependencies,
targets: targets
)