Package.swift 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // swift-tools-version:4.0
  2. /*
  3. * Copyright 2017, gRPC Authors All rights reserved.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import PackageDescription
  18. var packageDependencies: [Package.Dependency] = [
  19. .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.0.2"),
  20. .package(url: "https://github.com/kylef/Commander.git", from: "0.8.0"),
  21. .package(url: "https://github.com/apple/swift-nio-zlib-support.git", from: "1.0.0")
  22. ]
  23. var cGRPCDependencies: [Target.Dependency] = []
  24. #if os(Linux)
  25. // On Linux, Foundation links with openssl, so we'll need to use that instead of BoringSSL.
  26. // See https://github.com/apple/swift-nio-ssl/issues/16#issuecomment-392705505 for details.
  27. packageDependencies.append(.package(url: "https://github.com/apple/swift-nio-ssl-support.git", from: "1.0.0"))
  28. #else
  29. cGRPCDependencies.append("BoringSSL")
  30. #endif
  31. let package = Package(
  32. name: "SwiftGRPC",
  33. products: [
  34. .library(name: "SwiftGRPC", targets: ["SwiftGRPC"]),
  35. ],
  36. dependencies: packageDependencies,
  37. targets: [
  38. .target(name: "SwiftGRPC",
  39. dependencies: ["CgRPC", "SwiftProtobuf"]),
  40. .target(name: "CgRPC",
  41. dependencies: cGRPCDependencies),
  42. .target(name: "RootsEncoder"),
  43. .target(name: "protoc-gen-swiftgrpc",
  44. dependencies: [
  45. "SwiftProtobuf",
  46. "SwiftProtobufPluginLibrary",
  47. "protoc-gen-swift"]),
  48. .target(name: "BoringSSL"),
  49. .target(name: "Echo",
  50. dependencies: [
  51. "SwiftGRPC",
  52. "SwiftProtobuf",
  53. "Commander"],
  54. path: "Sources/Examples/Echo"),
  55. .target(name: "Simple",
  56. dependencies: ["SwiftGRPC", "Commander"],
  57. path: "Sources/Examples/Simple"),
  58. .testTarget(name: "SwiftGRPCTests", dependencies: ["SwiftGRPC"])
  59. ],
  60. cLanguageStandard: .gnu11,
  61. cxxLanguageStandard: .cxx11)