• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // swift-tools-version:5.2
2 // The swift-tools-version declares the minimum version of Swift required to build this package.
3 import PackageDescription
4 
5 let package = Package(
6   name: "gRPC",
7   products: [
8     .library(
9       name: "gRPC-Core",
10       targets: [
11         "gRPC-Core",
12       ]
13     ),
14     .library(
15       name: "gRPC-cpp",
16       targets: [
17         "gRPC-cpp",
18       ]
19     )
20   ],
21 
22   dependencies: [
23     .package(
24       name: "abseil",
25       url: "https://github.com/firebase/abseil-cpp-SwiftPM.git",
26       .revision("05d8107f2971a37e6c77245b7c4c6b0a7e97bc99")
27     ),
28     .package(name: "BoringSSL-GRPC",
29       url: "https://github.com/firebase/boringssl-SwiftPM.git",
30       .branch("7bcafa2660bc58715c39637494550d1ed7cd7229")
31     ),
32   ],
33 
34   targets: [
35     .target(
36       name: "gRPC-Core",
37       dependencies: [
38         .product(name:"abseil", package: "abseil"),
39         .product(name:"openssl_grpc", package: "BoringSSL-GRPC"),
40       ],
41       path: ".",
42       exclude: [
43         "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc",
44         "src/core/ext/filters/client_channel/xds/xds_channel.cc",
45         "src/core/ext/filters/load_reporting/",
46         "src/core/ext/transport/cronet/",
47         "src/core/ext/upb-generated/third_party/",
48         "src/core/ext/upb-generated/src/proto/grpc/auth/",
49         "src/core/ext/upbdefs-generated/envoy/config/rbac/",
50         "src/core/ext/upbdefs-generated/google/api/expr/",
51         "src/core/ext/upbdefs-generated/src/",
52         "src/core/ext/upbdefs-generated/third_party/",
53         "src/core/ext/upbdefs-generated/udpa/data/",
54         "src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h",
55         "src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc",
56         "src/core/lib/surface/init_unsecure.cc",
57         "src/core/lib/security/authorization/",
58         "src/core/plugin_registry/grpc_unsecure_plugin_registry.cc",
59         "third_party/re2/re2/testing/",
60         "third_party/re2/re2/fuzzing/",
61         "third_party/re2/util/benchmark.cc",
62         "third_party/re2/util/test.cc",
63         "third_party/re2/util/fuzz.cc",
64         "third_party/upb/upb/sink.c",
65         "third_party/upb/upb/json_decode.c",
66         "third_party/upb/upb/json_encode.c",
67         "third_party/upb/upb/handlers.h",
68         "third_party/upb/upb/sink.h",
69         "third_party/upb/upb/json_encode.h",
70         "third_party/upb/upb/json_decode.h",
71         "third_party/upb/upb/handlers-inl.h",
72         "third_party/upb/upb/handlers.c",
73         "third_party/upb/upb/bindings/",
74         "third_party/upb/upb/json/",
75         "third_party/upb/upb/pb/",
76       ],
77       sources: [
78         "src/core/ext/filters/",
79         "src/core/ext/transport/",
80         "src/core/ext/upb-generated/",
81         "src/core/ext/upbdefs-generated/",
82         "src/core/ext/xds/",
83         "src/core/lib/",
84         "src/core/plugin_registry/grpc_plugin_registry.cc",
85         "src/core/tsi/",
86         "third_party/re2/re2/",
87         "third_party/re2/util/",
88         "third_party/upb/upb/",
89         "third_party/upb/third_party/wyhash/wyhash.h",
90         "third_party/xxhash/xxhash.h",
91       ],
92       publicHeadersPath: "spm-core-include",
93       cSettings: [
94         .headerSearchPath("./"),
95         .headerSearchPath("include/"),
96         .headerSearchPath("third_party/re2/"),
97         .headerSearchPath("third_party/upb/"),
98         .headerSearchPath("third_party/xxhash/"),
99         .headerSearchPath("src/core/ext/upb-generated/"),
100         .headerSearchPath("src/core/ext/upbdefs-generated/"),
101         .define("GRPC_ARES", to: "0"),
102         .unsafeFlags(["-Wno-module-import-in-extern-c"]),
103       ],
104       linkerSettings: [
105         .linkedFramework("CoreFoundation"),
106         .linkedLibrary("z"),
107       ]
108     ),
109     .target(
110       name: "gRPC-cpp",
111       dependencies: [
112         .product(name:"abseil", package: "abseil"),
113         "gRPC-Core",
114       ],
115       path: ".",
116       exclude: [
117         "src/cpp/client/cronet_credentials.cc",
118         "src/cpp/client/channel_test_peer.cc",
119         "src/cpp/common/alts_util.cc",
120         "src/cpp/common/alts_context.cc",
121         "src/cpp/common/insecure_create_auth_context.cc",
122         "src/cpp/server/admin/",
123         "src/cpp/server/channelz/",
124         "src/cpp/server/csds/",
125         "src/cpp/server/load_reporter/",
126         "src/cpp/ext/",
127         "src/cpp/util/core_stats.cc",
128         "src/cpp/util/core_stats.h",
129         "src/cpp/util/error_details.cc",
130       ],
131       sources: [
132         "src/cpp/",
133       ],
134       publicHeadersPath: "spm-cpp-include",
135       cSettings: [
136         .headerSearchPath("./"),
137         .headerSearchPath("include/"),
138         .headerSearchPath("third_party/upb/"),
139         .headerSearchPath("src/core/ext/upb-generated"),
140         .unsafeFlags(["-Wno-module-import-in-extern-c"]),
141       ]
142     ),
143   ],
144   cLanguageStandard: .gnu11,
145   cxxLanguageStandard: .cxx11
146 )
147