From e64fcb32fbe0ae6830bc8aca2aee708c7c18af47 Mon Sep 17 00:00:00 2001 From: Ryo Yamashita Date: Mon, 3 Apr 2023 17:47:15 +0900 Subject: [PATCH] =?UTF-8?q?`Path`=E3=81=AE=E9=81=A9=E5=88=87=E3=81=A7?= =?UTF-8?q?=E3=81=AF=E3=81=AA=E3=81=84lossy=E3=81=AAUTF-8=E5=A4=89?= =?UTF-8?q?=E6=8F=9B=E3=82=92=E3=82=84=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/open_jtalk-sys/build.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/open_jtalk-sys/build.rs b/crates/open_jtalk-sys/build.rs index 89643be..6d2789f 100644 --- a/crates/open_jtalk-sys/build.rs +++ b/crates/open_jtalk-sys/build.rs @@ -2,6 +2,7 @@ use std::{ env, path::{Path, PathBuf}, process::Command, + str, }; fn main() { let mut cmake_conf = cmake::Config::new("open_jtalk"); @@ -43,7 +44,8 @@ fn main() { .args(["--sdk", sdk, "--show-sdk-path"]) .output() .expect("Failed to run xcrun command"); - let cmake_osx_sysroot = String::from_utf8_lossy(&cmake_osx_sysroot.stdout) + let cmake_osx_sysroot = str::from_utf8(&cmake_osx_sysroot.stdout) + .unwrap() .trim() .to_string(); cmake_conf.define("CMAKE_OSX_SYSROOT", &cmake_osx_sysroot); @@ -60,7 +62,7 @@ fn main() { let dst_dir = cmake_conf.build(); let lib_dir = dst_dir.join("lib"); - println!("cargo:rustc-link-search={}", lib_dir.display()); + println!("cargo:rustc-link-search={}", lib_dir.to_str().unwrap()); println!("cargo:rustc-link-lib=openjtalk"); generate_bindings(dst_dir.join("include"), include_dirs.iter()); } @@ -80,8 +82,8 @@ fn generate_bindings( ) { let include_dir = allow_dir.as_ref(); let clang_args = include_dirs - .map(|dir| format!("-I{}", dir.as_ref().display())) - .chain([format!("-I{}", include_dir.display())]) + .map(|dir| format!("-I{}", dir.as_ref().to_str().unwrap())) + .chain([format!("-I{}", include_dir.to_str().unwrap())]) .collect::>(); println!("cargo:rerun-if-changed=wrapper.hpp"); println!("cargo:rerun-if-changed=src/generated/bindings.rs");