| %YAML 1.2 |
| --- | |
| // swift-tools-version:5.5 |
| // The swift-tools-version declares the minimum version of Swift required to build this package. |
| import PackageDescription |
| import Foundation |
| |
| var basePath = FileManager.default.fileExists(atPath: "native") ? "native" : "." |
| |
| let package = Package( |
| name: "gRPC", |
| products: [ |
| .library( |
| name: "gRPC-Core", |
| targets: [ |
| "gRPC-Core", |
| ] |
| ), |
| .library( |
| name: "gRPC-cpp", |
| targets: [ |
| "gRPC-cpp", |
| ] |
| ) |
| ], |
| |
| dependencies: [ |
| .package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20220623.0"..<"0.20220624.0"), |
| .package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.9.0"..<"0.10.0"), |
| ], |
| |
| targets: [ |
| .target( |
| name: "gRPC-Core", |
| dependencies: [ |
| .product(name:"abseil", package: "abseil-cpp-SwiftPM"), |
| .product(name:"openssl_grpc", package: "boringssl-SwiftPM"), |
| ], |
| path: basePath, |
| exclude: [ |
| "examples/", |
| "src/objective-c/", |
| ], |
| <% |
| files = [] |
| lib_maps = {lib.name: lib for lib in libs} |
| for dep in swift_package.get('deps', []): |
| lib = lib_maps[dep] |
| files.extend(lib.get('public_headers', []) + lib.headers + lib.src) |
| files = sorted(set(files)) |
| %> |
| sources: [ |
| % for file in files: |
| "${file}", |
| % endfor |
| ], |
| publicHeadersPath: "spm-core-include", |
| resources: [ |
| .copy("src/objective-c/PrivacyInfo.xcprivacy"), |
| ], |
| cSettings: [ |
| .headerSearchPath("./"), |
| .headerSearchPath("include/"), |
| .headerSearchPath("third_party/re2/"), |
| .headerSearchPath("third_party/upb/"), |
| .headerSearchPath("third_party/utf8_range/"), |
| .headerSearchPath("third_party/xxhash/"), |
| .headerSearchPath("src/core/ext/upb-gen/"), |
| .headerSearchPath("src/core/ext/upbdefs-gen/"), |
| .define("GRPC_ARES", to: "0"), |
| ], |
| linkerSettings: [ |
| .linkedFramework("CoreFoundation"), |
| .linkedLibrary("z"), |
| ] |
| ), |
| .target( |
| name: "gRPC-cpp", |
| dependencies: [ |
| .product(name:"abseil", package: "abseil-cpp-SwiftPM"), |
| "gRPC-Core", |
| ], |
| path: basePath, |
| exclude: [ |
| "examples/", |
| "src/cpp/client/cronet_credentials.cc", |
| "src/cpp/client/channel_test_peer.cc", |
| "src/cpp/common/alts_util.cc", |
| "src/cpp/common/alts_context.cc", |
| "src/cpp/common/insecure_create_auth_context.cc", |
| "src/cpp/server/admin/", |
| "src/cpp/server/channelz/", |
| "src/cpp/server/csds/", |
| "src/cpp/server/load_reporter/", |
| "src/cpp/ext/", |
| "src/cpp/util/core_stats.cc", |
| "src/cpp/util/core_stats.h", |
| "src/cpp/util/error_details.cc", |
| "src/objective-c/examples/", |
| "src/objective-c/manual_tests/", |
| "src/objective-c/tests/", |
| ], |
| sources: [ |
| "src/cpp/", |
| ], |
| publicHeadersPath: "spm-cpp-include", |
| resources: [ |
| .copy("src/objective-c/PrivacyInfo.xcprivacy"), |
| ], |
| cSettings: [ |
| .headerSearchPath("./"), |
| .headerSearchPath("include/"), |
| .headerSearchPath("third_party/upb/"), |
| .headerSearchPath("src/core/ext/upb-gen"), |
| ] |
| ), |
| .testTarget( |
| name: "build-test", |
| dependencies: [ |
| "gRPC-cpp", |
| ], |
| path: basePath + "/test/spm_build" |
| ), |
| ], |
| cLanguageStandard: .gnu11, |
| cxxLanguageStandard: .cxx14 |
| ) |