From 51fe5a93131c167a70ba2052fe449ca865120996 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 5 Oct 2023 14:27:34 +0200 Subject: [PATCH] Trying to fix stdlib issue in `tokenizers`. --- Cargo.lock | 2 +- Cargo.toml | 2 +- build.rs | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ebc6f37..95af004 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -212,7 +212,7 @@ dependencies = [ [[package]] name = "esaxx-rs" -version = "0.1.8" +version = "0.1.10" dependencies = [ "cc", "criterion", diff --git a/Cargo.toml b/Cargo.toml index aa16940..f610e45 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "esaxx-rs" -version = "0.1.9" +version = "0.1.10" authors = ["Nicolas Patry "] edition = "2018" description = "Wrapping around sentencepiece's esaxxx library." diff --git a/build.rs b/build.rs index 25df38b..3b0ea12 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,5 @@ #[cfg(feature = "cpp")] +#[cfg(not(target_os = "macos"))] fn main() { cc::Build::new() .cpp(true) @@ -9,5 +10,18 @@ fn main() { .compile("esaxx"); } +#[cfg(feature = "cpp")] +#[cfg(target_os = "macos")] +fn main() { + cc::Build::new() + .cpp(true) + .flag("-std=c++11") + .flag("-stdlib=libc++") + .static_crt(true) + .file("src/esaxx.cpp") + .include("src") + .compile("esaxx"); +} + #[cfg(not(feature = "cpp"))] fn main() {}