Package.swift 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // swift-tools-version:5.5
  2. import PackageDescription
  3. let package = Package(
  4. name: "llama",
  5. platforms: [
  6. .macOS(.v12),
  7. .iOS(.v14),
  8. .watchOS(.v4),
  9. .tvOS(.v14)
  10. ],
  11. products: [
  12. .library(name: "llama", targets: ["llama"]),
  13. ],
  14. targets: [
  15. .target(
  16. name: "llama",
  17. path: ".",
  18. exclude: [
  19. "cmake",
  20. "examples",
  21. "scripts",
  22. "models",
  23. "tests",
  24. "CMakeLists.txt",
  25. "ggml-cuda.cu",
  26. "ggml-cuda.h",
  27. "Makefile"
  28. ],
  29. sources: [
  30. "ggml.c",
  31. "llama.cpp",
  32. "ggml-alloc.c",
  33. "ggml-backend.c",
  34. "ggml-quants.c",
  35. "ggml-metal.m",
  36. ],
  37. resources: [
  38. .process("ggml-metal.metal")
  39. ],
  40. publicHeadersPath: "spm-headers",
  41. cSettings: [
  42. .unsafeFlags(["-Wno-shorten-64-to-32", "-O3", "-DNDEBUG"]),
  43. .define("GGML_USE_ACCELERATE"),
  44. .unsafeFlags(["-fno-objc-arc"]),
  45. .define("GGML_USE_METAL"),
  46. // NOTE: NEW_LAPACK will required iOS version 16.4+
  47. // We should consider add this in the future when we drop support for iOS 14
  48. // (ref: ref: https://developer.apple.com/documentation/accelerate/1513264-cblas_sgemm?language=objc)
  49. // .define("ACCELERATE_NEW_LAPACK"),
  50. // .define("ACCELERATE_LAPACK_ILP64")
  51. ],
  52. linkerSettings: [
  53. .linkedFramework("Accelerate")
  54. ]
  55. )
  56. ],
  57. cxxLanguageStandard: .cxx11
  58. )