Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pathの適切ではないlossyなUTF-8変換をやめる #12

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions crates/open_jtalk-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
env,
path::{Path, PathBuf},
process::Command,
str,
};
fn main() {
let mut cmake_conf = cmake::Config::new("open_jtalk");
Expand Down Expand Up @@ -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);
Expand All @@ -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());
}
Expand All @@ -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::<Vec<_>>();
println!("cargo:rerun-if-changed=wrapper.hpp");
println!("cargo:rerun-if-changed=src/generated/bindings.rs");
Expand Down