Skip to content

Commit

Permalink
revert change
Browse files Browse the repository at this point in the history
  • Loading branch information
darknight committed Dec 9, 2023
1 parent 555b3c3 commit 3f69aa5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 31 deletions.
2 changes: 1 addition & 1 deletion crates/aim-downloader/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod https;
pub mod bar;
pub mod https;

mod address;
mod consts;
Expand Down
32 changes: 5 additions & 27 deletions crates/llama-cpp-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion crates/llama-cpp-bindings/src/engine.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "engine.h"

#include <functional>
#include <vector>
#include <deque>
Expand All @@ -7,7 +9,6 @@
#include <ggml.h>
#include <llama.h>

#include "llama-cpp-bindings/include/engine.h"
#include "llama-cpp-bindings/src/lib.rs.h"

namespace llama {
Expand Down
1 change: 0 additions & 1 deletion crates/tabby-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/tabby-common/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lazy_static! {
static ref TABBY_ROOT: Mutex<Cell<PathBuf>> = {
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"),
}))
};
}
Expand Down

0 comments on commit 3f69aa5

Please sign in to comment.