Skip to content

Commit 0e562e9

Browse files
committed
fix: FFI safety, static assertions, selection tests, macOS linkage
1 parent eca41a3 commit 0e562e9

3 files changed

Lines changed: 1366 additions & 374 deletions

File tree

litehtml-sys/build.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ fn build_vendored(manifest_dir: &Path, out_dir: &Path, csrc_dir: &Path) {
148148
println!("cargo:rustc-link-lib=static=litehtml_c");
149149
println!("cargo:rustc-link-lib=static=litehtml");
150150
println!("cargo:rustc-link-lib=static=gumbo");
151-
println!("cargo:rustc-link-lib=stdc++");
151+
// Link C++ standard library
152+
if cfg!(target_os = "macos") {
153+
println!("cargo:rustc-link-lib=c++");
154+
} else {
155+
println!("cargo:rustc-link-lib=stdc++");
156+
}
152157

153158
println!("cargo:rerun-if-changed={}", vendor_dir.display());
154159
}
@@ -193,7 +198,12 @@ fn build_system(out_dir: &Path, csrc_dir: &Path) {
193198
println!("cargo:rustc-link-search=native={}", lib_dir.display());
194199
println!("cargo:rustc-link-lib=static=litehtml_c");
195200
println!("cargo:rustc-link-lib=static=litehtml");
196-
println!("cargo:rustc-link-lib=stdc++");
201+
// Link C++ standard library
202+
if cfg!(target_os = "macos") {
203+
println!("cargo:rustc-link-lib=c++");
204+
} else {
205+
println!("cargo:rustc-link-lib=stdc++");
206+
}
197207
}
198208

199209
/// Search include paths for a header file, return the directory containing it

0 commit comments

Comments
 (0)