- bump libczi submodule
- asserts in tests
This commit is contained in:
@@ -45,7 +45,10 @@ fn lib_name_from_path(
|
||||
if target_is_windows {
|
||||
Ok(file_name.to_string())
|
||||
} else {
|
||||
Ok(file_name.strip_prefix("lib").unwrap_or(file_name).to_string())
|
||||
Ok(file_name
|
||||
.strip_prefix("lib")
|
||||
.unwrap_or(file_name)
|
||||
.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,11 +159,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let host = env::var("HOST")?;
|
||||
let target = env::var("TARGET")?;
|
||||
let is_cross = host != target
|
||||
|| env::var(format!(
|
||||
"CMAKE_TOOLCHAIN_FILE_{}",
|
||||
target.replace('-', "_")
|
||||
))
|
||||
.is_ok()
|
||||
|| env::var(format!("CMAKE_TOOLCHAIN_FILE_{}", target.replace('-', "_"))).is_ok()
|
||||
|| env::var("TARGET_CMAKE_TOOLCHAIN_FILE").is_ok()
|
||||
|| env::var("CMAKE_TOOLCHAIN_FILE").is_ok();
|
||||
let is_windows = target.contains("windows");
|
||||
@@ -175,10 +174,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut cmake_config = cmake::Config::new(&libczi_dir);
|
||||
cmake_config
|
||||
.cxxflag("-fms-extensions")
|
||||
.define(
|
||||
"ADDITIONAL_LIBS_REQUIRED_FOR_ATOMIC",
|
||||
"",
|
||||
)
|
||||
.define("ADDITIONAL_LIBS_REQUIRED_FOR_ATOMIC", "")
|
||||
.define("LIBCZI_BUILD_UNITTESTS", "OFF")
|
||||
.define("LIBCZI_BUILD_CZICMD", "OFF")
|
||||
.define("LIBCZI_BUILD_DYNLIB", "OFF")
|
||||
@@ -197,11 +193,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.define("CRASH_ON_UNALIGNED_ACCESS", "FALSE");
|
||||
|
||||
let has_toolchain_file = env::var("TARGET_CMAKE_TOOLCHAIN_FILE").is_ok()
|
||||
|| env::var(format!(
|
||||
"CMAKE_TOOLCHAIN_FILE_{}",
|
||||
target.replace('-', "_")
|
||||
))
|
||||
.is_ok()
|
||||
|| env::var(format!("CMAKE_TOOLCHAIN_FILE_{}", target.replace('-', "_")))
|
||||
.is_ok()
|
||||
|| env::var("CMAKE_TOOLCHAIN_FILE").is_ok();
|
||||
|
||||
if !has_toolchain_file {
|
||||
@@ -304,16 +297,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("cargo::rustc-link-lib=static={}", libcziapi_name);
|
||||
|
||||
if libczi_dir.exists() {
|
||||
println!(
|
||||
"cargo::rustc-link-search=native={}",
|
||||
libczi_dir.display()
|
||||
);
|
||||
println!("cargo::rustc-link-search=native={}", libczi_dir.display());
|
||||
}
|
||||
if libczi_dir2.exists() {
|
||||
println!(
|
||||
"cargo::rustc-link-search=native={}",
|
||||
libczi_dir2.display()
|
||||
);
|
||||
println!("cargo::rustc-link-search=native={}", libczi_dir2.display());
|
||||
}
|
||||
println!("cargo::rustc-link-lib=static={}", libczi_name);
|
||||
|
||||
@@ -329,20 +316,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let zstd_dir = dst.join("build/_deps/zstd-build/lib");
|
||||
let zstd_dir2 = dst.join("_deps/zstd-build/lib");
|
||||
if zstd_dir.exists() {
|
||||
println!(
|
||||
"cargo::rustc-link-search=native={}",
|
||||
zstd_dir.display()
|
||||
);
|
||||
println!("cargo::rustc-link-search=native={}", zstd_dir.display());
|
||||
}
|
||||
if zstd_dir2.exists() {
|
||||
println!(
|
||||
"cargo::rustc-link-search=native={}",
|
||||
zstd_dir2.display()
|
||||
);
|
||||
println!("cargo::rustc-link-search=native={}", zstd_dir2.display());
|
||||
}
|
||||
let zstd_name = find_static_lib(&zstd_dir, "zstd_static", is_windows)
|
||||
.or_else(|| find_static_lib(&zstd_dir2, "zstd_static", is_windows))
|
||||
.map(|p| lib_name_from_path(&p, is_windows).unwrap_or_else(|_| "zstd_static".to_string()))
|
||||
.map(|p| {
|
||||
lib_name_from_path(&p, is_windows)
|
||||
.unwrap_or_else(|_| "zstd_static".to_string())
|
||||
})
|
||||
.unwrap_or_else(|| "zstd_static".to_string());
|
||||
println!("cargo::rustc-link-lib=static={}", zstd_name);
|
||||
} else {
|
||||
@@ -368,5 +352,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
}
|
||||
println!("cargo::rerun-if-changed=build.rs");
|
||||
println!("cargo::rerun-if-changed=libczi");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user