1 // swift-tools-version:5.0
2 // The swift-tools-version declares the minimum version of Swift required to build this package.
3 
4 import PackageDescription
5 
6 let package = Package(
7   name: "nanopb",
8   products: [
9     .library(
10       name: "nanopb",
11       targets: ["nanopb"]
12     )
13   ],
14 
15   targets: [
16     .target(
17       name: "nanopb",
18       path: ".",
19       sources: [
20         "pb.h",
21         "pb_common.h",
22         "pb_common.c",
23         "pb_decode.h",
24         "pb_decode.c",
25         "pb_encode.h",
26         "pb_encode.c"
27       ],
28       publicHeadersPath: "spm_headers",
29       cSettings: [
30         .define("PB_FIELD_32BIT", to: "1"),
31         .define("PB_NO_PACKED_STRUCTS", to: "1"),
32         .define("PB_ENABLE_MALLOC", to: "1"),
33       ]
34     ),
35     .testTarget(
36       name: "swift-test",
37       dependencies: [
38         "nanopb",
39       ],
40       path: "spm-test/swift",
41       cSettings: [
42         .headerSearchPath("../"),
43         .define("PB_FIELD_32BIT", to: "1"),
44         .define("PB_NO_PACKED_STRUCTS", to: "1"),
45         .define("PB_ENABLE_MALLOC", to: "1"),
46       ]
47     ),
48     .testTarget(
49       name: "objc-test",
50       dependencies: [
51         "nanopb",
52       ],
53       path: "spm-test/objc",
54       cSettings: [
55         .headerSearchPath("../"),
56         .define("PB_FIELD_32BIT", to: "1"),
57         .define("PB_NO_PACKED_STRUCTS", to: "1"),
58         .define("PB_ENABLE_MALLOC", to: "1"),
59       ]
60     )
61   ]
62 )
63 
64