-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
81 lines (76 loc) · 2.5 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// swift-tools-version: 6.0
import PackageDescription
import Foundation
let packageDir = URL(fileURLWithPath: #file).deletingLastPathComponent().path
#if os(Windows)
let cuPath: String = ProcessInfo.processInfo.environment["CUDA_HOME"] ?? "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.5"
let cuLibPath = "-L\(cuPath)\\lib\\x64"
let cuIncludePath = "-I\(cuPath)\\include"
#elseif os(Linux)
let cuPath = ProcessInfo.processInfo.environment["CUDA_HOME"] ?? "/usr/local/cuda"
let cuLibPath = "-L\(cuPath)/lib/x64"
let cuIncludePath = "-I\(cuPath)/include"
#else
fatalError("OS not supported \(os)")
#endif
let package = Package(
name: "SwiftCUBLASLt",
products: [
.library(
name: "SwiftCUBLASLt",
targets: ["SwiftCUBLASLt"]),
.library(
name: "cxxCUBLASLt",
targets: ["cxxCUBLASLt"]),
],
dependencies:
[
.package(url: "https://github.com/machineko/SwiftCU", branch: "main"),
.package(url: "https://github.com/machineko/SwiftCUBLAS", branch: "main")
// .package(url: "https://github.com/apple/swift-testing.git", from: "0.10.0"),
],
targets: [
.target(
name: "cxxCUBLASLt",
publicHeadersPath: "include",
cxxSettings: [
.headerSearchPath(cuIncludePath)
],
linkerSettings: [
.unsafeFlags([
cuLibPath, cuIncludePath
]),
.linkedLibrary("cublas"),
.linkedLibrary("cublasLt"),
]
),
.target(
name: "SwiftCUBLASLt",
dependencies: [
"cxxCUBLASLt",
.product(name: "SwiftCU", package: "SwiftCU"),
.product(name: "SwiftCUBLAS", package: "SwiftCUBLAS")
],
swiftSettings: [
.interoperabilityMode(.Cxx),
.unsafeFlags(
[cuIncludePath]
)
]
),
.testTarget(
name: "SwiftCUBLASTests",
dependencies: [
"SwiftCU", "cxxCUBLASLt", "SwiftCUBLASLt",
// .product(name: "Testing", package: "swift-testing"),
],
swiftSettings: [
.interoperabilityMode(.Cxx),
.unsafeFlags(
[cuIncludePath]
)
]
)
],
cxxLanguageStandard: .cxx17
)