Skip to content

Commit

Permalink
fix: remove outdated uses_cxx11() setting in cmake-rs and add -mmacos…
Browse files Browse the repository at this point in the history
…x-version-min=10.12 to fix build on macOS (issue #10)
  • Loading branch information
notCuteSocks committed Jan 14, 2025
1 parent b387ca4 commit 2dbbe0b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lightgbm3-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ fn main() {
let mut cfg = Config::new(&lgbm_root);
let cfg = cfg
.profile("Release")
.uses_cxx11()
.cxxflag("-std=c++11")
.define("BUILD_STATIC_LIB", "ON");
#[cfg(not(feature = "openmp"))]
Expand All @@ -59,10 +58,14 @@ fn main() {
let dst = cfg.build();

// bindgen build
let mut clang_args = vec!["-x", "c++", "-std=c++11"];
if target.contains("apple") {
clang_args.push("-mmacosx-version-min=10.12");
}
let bindings = bindgen::Builder::default()
.header("lightgbm/include/LightGBM/c_api.h")
.allowlist_file("lightgbm/include/LightGBM/c_api.h")
.clang_args(&["-x", "c++", "-std=c++11"])
.clang_args(&clang_args)
.clang_arg(format!("-I{}", lgbm_root.join("include").display()))
.parse_callbacks(Box::new(DoxygenCallback))
.generate()
Expand Down

0 comments on commit 2dbbe0b

Please sign in to comment.