Package.swift 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. "unicode.cpp",
  33. "ggml-alloc.c",
  34. "ggml-backend.c",
  35. "ggml-quants.c",
  36. "ggml-metal.m",
  37. ],
  38. resources: [
  39. .process("ggml-metal.metal")
  40. ],
  41. publicHeadersPath: "spm-headers",
  42. cSettings: [
  43. .unsafeFlags(["-Wno-shorten-64-to-32", "-O3", "-DNDEBUG"]),
  44. .define("GGML_USE_ACCELERATE"),
  45. .unsafeFlags(["-fno-objc-arc"]),
  46. .define("GGML_USE_METAL"),
  47. // NOTE: NEW_LAPACK will required iOS version 16.4+
  48. // We should consider add this in the future when we drop support for iOS 14
  49. // (ref: ref: https://developer.apple.com/documentation/accelerate/1513264-cblas_sgemm?language=objc)
  50. // .define("ACCELERATE_NEW_LAPACK"),
  51. // .define("ACCELERATE_LAPACK_ILP64")
  52. ],
  53. linkerSettings: [
  54. .linkedFramework("Accelerate")
  55. ]
  56. )
  57. ],
  58. cxxLanguageStandard: .cxx11
  59. )