From 3f69aa50d38d86dfbb4d46b4a8b84b5c72ae5431 Mon Sep 17 00:00:00 2001 From: darknight Date: Sat, 9 Dec 2023 23:15:28 +0800 Subject: [PATCH] revert change --- crates/aim-downloader/src/lib.rs | 2 +- crates/llama-cpp-bindings/build.rs | 32 ++++--------------------- crates/llama-cpp-bindings/src/engine.cc | 3 ++- crates/tabby-common/Cargo.toml | 1 - crates/tabby-common/src/path.rs | 2 +- 5 files changed, 9 insertions(+), 31 deletions(-) diff --git a/crates/aim-downloader/src/lib.rs b/crates/aim-downloader/src/lib.rs index 22db8b64583a..29286037163d 100644 --- a/crates/aim-downloader/src/lib.rs +++ b/crates/aim-downloader/src/lib.rs @@ -1,5 +1,5 @@ -pub mod https; pub mod bar; +pub mod https; mod address; mod consts; diff --git a/crates/llama-cpp-bindings/build.rs b/crates/llama-cpp-bindings/build.rs index 25a413668a87..b4e09f6c8506 100644 --- a/crates/llama-cpp-bindings/build.rs +++ b/crates/llama-cpp-bindings/build.rs @@ -10,14 +10,11 @@ fn main() { "Please init submodules with `git submodule update --init --recursive` and try again" ); - println!("cargo:rerun-if-changed=include/engine.h"); - println!("cargo:rerun-if-changed=src/engine.cc"); - - build_llama_cpp(); - build_cxx_binding(); -} + println!("cargo:rerun-if-changed=cc/*.h"); + println!("cargo:rerun-if-changed=cc/*.cc"); + println!("cargo:rustc-link-lib=llama"); + println!("cargo:rustc-link-lib=ggml_static"); -fn build_llama_cpp() { let mut config = Config::new("llama.cpp"); if cfg!(target_os = "macos") { config.define("LLAMA_METAL", "ON"); @@ -72,27 +69,8 @@ fn build_llama_cpp() { println!("cargo:rustc-link-lib=hipblas"); } - // By default, this value is automatically inferred from Rust’s compilation profile. - // For Windows platform, we always build llama.cpp in release mode. - // See https://github.com/TabbyML/tabby/pull/948 for more details. - #[cfg(target_os = "windows")] - config.profile("Release"); - let dst = config.build(); - if cfg!(target_os = "windows") { - println!( - "cargo:rustc-link-search=native={}\\build\\{}", - dst.display(), - config.get_profile() - ); - } else { - println!("cargo:rustc-link-search=native={}/build", dst.display()); - } -} - -fn build_cxx_binding() { - println!("cargo:rustc-link-lib=llama"); - println!("cargo:rustc-link-lib=ggml_static"); + println!("cargo:rustc-link-search=native={}/build", dst.display()); cxx_build::bridge("src/lib.rs") .file("src/engine.cc") diff --git a/crates/llama-cpp-bindings/src/engine.cc b/crates/llama-cpp-bindings/src/engine.cc index 8178dc101e95..468584b73dad 100644 --- a/crates/llama-cpp-bindings/src/engine.cc +++ b/crates/llama-cpp-bindings/src/engine.cc @@ -1,3 +1,5 @@ +#include "engine.h" + #include #include #include @@ -7,7 +9,6 @@ #include #include -#include "llama-cpp-bindings/include/engine.h" #include "llama-cpp-bindings/src/lib.rs.h" namespace llama { diff --git a/crates/tabby-common/Cargo.toml b/crates/tabby-common/Cargo.toml index b91d34c85b5e..72af440a2663 100644 --- a/crates/tabby-common/Cargo.toml +++ b/crates/tabby-common/Cargo.toml @@ -5,7 +5,6 @@ edition = "2021" [dependencies] filenamify = "0.1.0" -home = "0.5.5" lazy_static = { workspace = true } serde = { workspace = true } serdeconv = { workspace = true } diff --git a/crates/tabby-common/src/path.rs b/crates/tabby-common/src/path.rs index 2dc5305fe542..44a1cab80f79 100644 --- a/crates/tabby-common/src/path.rs +++ b/crates/tabby-common/src/path.rs @@ -6,7 +6,7 @@ lazy_static! { static ref TABBY_ROOT: Mutex> = { Mutex::new(Cell::new(match env::var("TABBY_ROOT") { Ok(x) => PathBuf::from(x), - Err(_) => home::home_dir().unwrap().join(".tabby"), + Err(_) => PathBuf::from(env::var("HOME").unwrap()).join(".tabby"), })) }; }