@@ -6,80 +6,63 @@ import Foundation
6
6
7
7
var cBindingsBase = " /Users/arik/Developer/ldk-c-bindings "
8
8
if let bindingsBase = getenv ( " LDK_C_BINDINGS_BASE " ) {
9
- cBindingsBase = String ( utf8String: bindingsBase) !
9
+ cBindingsBase = String ( utf8String: bindingsBase) !
10
10
}
11
11
12
- var fileExtension = " .dylib "
13
- #if os(Linux)
14
- fileExtension = " .a "
15
- #endif
16
-
17
12
var linkerSettings : [ PackageDescription . LinkerSetting ] = [
18
- . linkedLibrary( " \( cBindingsBase) /lightning-c-bindings/target/debug/libldk \( fileExtension ) " )
13
+ . linkedLibrary( " \( cBindingsBase) /lightning-c-bindings/target/debug/libldk.a " )
19
14
]
20
15
21
- #if os(Linux)
22
- linkerSettings. append ( . linkedLibrary( String ( utf8String: getenv ( " LLVM_CLANG_ASAN_PATH " ) !) !) )
16
+ #if os(macOS)
17
+ linkerSettings = [
18
+ . unsafeFlags( [ " -L \( cBindingsBase) /lightning-c-bindings/target/debug " ] ) ,
19
+ . linkedLibrary( " ldk " )
20
+ ]
21
+ #elseif os(Linux)
22
+ linkerSettings. append ( . linkedLibrary( String ( utf8String: getenv ( " LLVM_CLANG_ASAN_PATH " ) !) !, . when( platforms: [ . linux] ) ) )
23
23
#endif
24
24
25
25
let package = Package (
26
- name: " LDKSwift " ,
27
- products: [
28
- . library(
29
- name: " LDKSwift " ,
30
- targets: [ " LDKSwift " ] ) ,
31
- // .library(name: "LDKSwift", type: .dynamic, targets: ["LDKSwift"])
32
- ] ,
33
- dependencies: [
34
- . package ( url: " https://github.com/apple/swift-crypto.git " , " 1.0.0 " ..< " 3.0.0 " )
35
- ] ,
36
- targets: [
37
- // Targets are the basic building blocks of a package. A target can define a module or a test suite.
38
- // Targets can depend on other targets in this package, and on products in packages this package depends on.
39
- . target( name: " LDKHeaders " ) ,
40
- // .systemLibrary(name: "LDKHeaders"),
41
- . target(
42
- name: " LDKSwift " ,
43
- dependencies: [
44
- " LDKHeaders "
45
- ] ,
46
- path: nil ,
47
- exclude: [ ] ,
48
- sources: nil ,
49
- // sources: [
50
- // "ldk_net.h",
51
- // "ldk_net.c",
52
- // "ldk_rust_types.h",
53
- // "ldk_ver.h",
54
- // "lightning.h",
55
- // "SanitySample.swift"
56
- // ],
57
- resources: nil ,
58
- publicHeadersPath: " include " ,
59
- cSettings: nil ,
60
- // cSettings: [
61
- // .headerSearchPath("include"),
62
- // ],
63
- cxxSettings: nil ,
64
- swiftSettings: nil ,
65
- linkerSettings: linkerSettings
66
- ) ,
67
- . testTarget(
68
- name: " LDKSwiftTests " ,
69
- dependencies: [
70
- " LDKSwift " ,
71
- " LDKHeaders " ,
72
- . product( name: " Crypto " , package : " swift-crypto " )
73
- ] ,
74
- path: nil ,
75
- exclude: [ ] ,
76
- // exclude: ["SampleTest.swift"],
77
- sources: nil ,
78
- // sources: [
79
- // "SampleTest.swift"
80
- // ],
81
- cSettings: nil , cxxSettings: nil , swiftSettings: nil ,
82
- linkerSettings: nil )
26
+ name: " LDKSwift " ,
27
+ products: [
28
+ . library(
29
+ name: " LDKSwift " ,
30
+ targets: [ " LDKSwift " ] ) ,
31
+ ] ,
32
+ dependencies: [
33
+ . package ( url: " https://github.com/apple/swift-crypto.git " , " 1.0.0 " ..< " 3.0.0 " )
34
+ ] ,
35
+ targets: [
36
+ // Targets are the basic building blocks of a package. A target can define a module or a test suite.
37
+ // Targets can depend on other targets in this package, and on products in packages this package depends on.
38
+ . target( name: " LDKHeaders " ) ,
39
+ . target(
40
+ name: " LDKSwift " ,
41
+ dependencies: [
42
+ " LDKHeaders "
43
+ ] ,
44
+ path: nil ,
45
+ exclude: [ ] ,
46
+ sources: nil ,
47
+ resources: nil ,
48
+ publicHeadersPath: " include " ,
49
+ cSettings: nil ,
50
+ cxxSettings: nil ,
51
+ swiftSettings: nil ,
52
+ linkerSettings: linkerSettings
53
+ ) ,
54
+ . testTarget(
55
+ name: " LDKSwiftTests " ,
56
+ dependencies: [
57
+ " LDKSwift " ,
58
+ " LDKHeaders " ,
59
+ . product( name: " Crypto " , package : " swift-crypto " )
60
+ ] ,
61
+ path: nil ,
62
+ exclude: [ ] ,
63
+ sources: nil ,
64
+ cSettings: nil , cxxSettings: nil , swiftSettings: nil ,
65
+ linkerSettings: nil )
83
66
84
- ]
67
+ ]
85
68
)
0 commit comments