Skip to content

Commit 262dc88

Browse files
committed
help mac
1 parent edf6e75 commit 262dc88

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lightgbm-sys/build.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,32 @@ fn main() {
3535
}
3636
}
3737

38+
let mut dst = Config::new(&lgbm_root);
39+
3840
// CMake
3941
#[cfg(feature = "cuda")]
40-
let dst = Config::new(&lgbm_root)
42+
let dst = dst
4143
.profile("Release")
4244
.uses_cxx11()
4345
.define("BUILD_STATIC_LIB", "ON")
4446
.define("USE_CUDA", "1")
45-
.define("USE_CUDA_EXP", "1")
46-
.build();
47+
.define("USE_CUDA_EXP", "1");
4748

4849
#[cfg(not(feature = "cuda"))]
49-
let dst = Config::new(&lgbm_root)
50+
let dst = dst
5051
.profile("Release")
5152
.uses_cxx11()
52-
.define("BUILD_STATIC_LIB", "ON")
53-
.build();
53+
.define("BUILD_STATIC_LIB", "ON");
54+
55+
#[cfg(target_os = "macos")]
56+
let dst =
57+
dst
58+
.define("CMAKE_C_COMPILER", "/opt/homebrew/opt/llvm/bin/clang")
59+
.define("CMAKE_CXX_COMPILER", "/opt/homebrew/opt/llvm/bin/clang++")
60+
.define("OPENMP_LIBRARIES", "/opt/homebrew/opt/llvm/lib")
61+
.define("OPENMP_INCLUDES", "/opt/homebrew/opt/llvm/include");
62+
63+
let dst = dst.build();
5464

5565
// bindgen build
5666
let bindings = bindgen::Builder::default()

0 commit comments

Comments
 (0)