From 5e4063a508a8c61b72181ed0e049c173026797a5 Mon Sep 17 00:00:00 2001 From: kchro3 Date: Sun, 3 Sep 2023 12:38:09 -0700 Subject: [PATCH] update the package --- Package.swift | 9 +++++++-- common/common.cpp | 4 ++++ spm-headers/common.h | 1 + spm-headers/log.h | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) create mode 120000 spm-headers/common.h create mode 120000 spm-headers/log.h diff --git a/Package.swift b/Package.swift index 96f52c4f0..5670136df 100644 --- a/Package.swift +++ b/Package.swift @@ -16,13 +16,18 @@ let package = Package( "ggml.c", "llama.cpp", "ggml-alloc.c", - "k_quants.c" + "k_quants.c", + "common/common.cpp", + "common/console.cpp", + "common/grammar-parser.cpp", ], publicHeadersPath: "spm-headers", cSettings: [ + .headerSearchPath("common"), .unsafeFlags(["-Wno-shorten-64-to-32"]), .define("GGML_USE_K_QUANTS"), - .define("GGML_USE_ACCELERATE") + .define("GGML_USE_ACCELERATE"), + .define("LLAMA_USE_SWIFT") ], linkerSettings: [ .linkedFramework("Accelerate") diff --git a/common/common.cpp b/common/common.cpp index 41fc59ced..f5415cb97 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1,5 +1,7 @@ #include "common.h" +#ifndef LLAMA_USE_SWIFT #include "build-info.h" +#endif #include "llama.h" #include @@ -971,8 +973,10 @@ std::string get_sortable_timestamp() { void dump_non_result_info_yaml(FILE * stream, const gpt_params & params, const llama_context * lctx, const std::string & timestamp, const std::vector & prompt_tokens, const char * model_desc) { +#ifndef LLAMA_USE_SWIFT fprintf(stream, "build_commit: %s\n", BUILD_COMMIT); fprintf(stream, "build_number: %d\n", BUILD_NUMBER); +#endif fprintf(stream, "cpu_has_arm_fma: %s\n", ggml_cpu_has_arm_fma() ? "true" : "false"); fprintf(stream, "cpu_has_avx: %s\n", ggml_cpu_has_avx() ? "true" : "false"); fprintf(stream, "cpu_has_avx2: %s\n", ggml_cpu_has_avx2() ? "true" : "false"); diff --git a/spm-headers/common.h b/spm-headers/common.h new file mode 120000 index 000000000..a7a0ec768 --- /dev/null +++ b/spm-headers/common.h @@ -0,0 +1 @@ +../common/common.h \ No newline at end of file diff --git a/spm-headers/log.h b/spm-headers/log.h new file mode 120000 index 000000000..aad60170e --- /dev/null +++ b/spm-headers/log.h @@ -0,0 +1 @@ +../common/log.h \ No newline at end of file