File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,15 @@ fn main() {
3535 println ! ( "cargo:rerun-if-changed=wrapper.h" ) ;
3636 println ! ( "cargo:rerun-if-changed=build.rs" ) ;
3737
38- println ! ( "cargo:rustc-link-search=native=/opt/homebrew/lib" ) ;
38+ println ! ( "cargo:rerun-if-env-changed=SUITESPARSE_INCLUDE_DIR" ) ;
39+ println ! ( "cargo:rerun-if-env-changed=SUITESPARSE_LIB_DIR" ) ;
40+
41+ let include_dir =
42+ env:: var ( "SUITESPARSE_INCLUDE_DIR" ) . unwrap_or_else ( |_| "/opt/homebrew/include" . to_string ( ) ) ;
43+ let lib_dir =
44+ env:: var ( "SUITESPARSE_LIB_DIR" ) . unwrap_or_else ( |_| "/opt/homebrew/lib" . to_string ( ) ) ;
45+
46+ println ! ( "cargo:rustc-link-search=native={}" , lib_dir) ;
3947 println ! ( "cargo:rustc-link-lib=spqr" ) ;
4048 println ! ( "cargo:rustc-link-lib=cholmod" ) ;
4149 println ! ( "cargo:rustc-link-lib=suitesparseconfig" ) ;
@@ -44,10 +52,10 @@ fn main() {
4452 println ! ( "cargo:rustc-link-lib=ccolamd" ) ;
4553 println ! ( "cargo:rustc-link-lib=camd" ) ;
4654
47- // Generate bindings
4855 let bindings = bindgen:: Builder :: default ( )
4956 . header ( "wrapper.h" )
50- . clang_arg ( "-I/opt/homebrew/include" )
57+ . clang_arg ( format ! ( "-I{}" , include_dir) )
58+ . clang_arg ( format ! ( "-I{}/suitesparse" , include_dir) )
5159 . wrap_unsafe_ops ( true )
5260 . parse_callbacks ( Box :: new ( bindgen:: CargoCallbacks :: new ( ) ) )
5361 . allowlist_function ( "SuiteSparseQR_C_QR" )
Original file line number Diff line number Diff line change 1- #include </opt/homebrew/include/suitesparse/ SuiteSparseQR_C.h>
2- #include </opt/homebrew/include/suitesparse/ cholmod.h>
3- #include </opt/homebrew/include/suitesparse/ colamd.h>
1+ #include <SuiteSparseQR_C.h>
2+ #include <cholmod.h>
3+ #include <colamd.h>
You can’t perform that action at this time.
0 commit comments