File tree 5 files changed +51
-0
lines changed 5 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ /target
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " cplex-sys"
3
+ version = " 0.1.0"
4
+ edition = " 2021"
5
+ publish = [" artifactory" ]
6
+
7
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+
9
+ [dependencies ]
10
+
11
+ [build-dependencies ]
12
+ bindgen = " 0.69"
Original file line number Diff line number Diff line change
1
+ use std:: env;
2
+ use std:: path:: PathBuf ;
3
+
4
+ fn main ( ) {
5
+ // Tell cargo to look for shared libraries in the specified directory
6
+ println ! ( "cargo:rustc-link-search=/usr/local/cplex/lib/x86-64_linux/static_pic" ) ;
7
+
8
+ // Tell cargo to tell rustc to link the system bzip2
9
+ // shared library.
10
+ println ! ( "cargo:rustc-link-lib=cplex" ) ;
11
+
12
+ // The bindgen::Builder is the main entry point
13
+ // to bindgen, and lets you build up options for
14
+ // the resulting bindings.
15
+ let bindings = bindgen:: Builder :: default ( )
16
+ // The input header we would like to generate
17
+ // bindings for.
18
+ . header ( "wrapper.h" )
19
+ // Tell cargo to invalidate the built crate whenever any of the
20
+ // included header files changed.
21
+ . parse_callbacks ( Box :: new ( bindgen:: CargoCallbacks :: new ( ) ) )
22
+ // Finish the builder and generate the bindings.
23
+ . generate ( )
24
+ // Unwrap the Result and panic on failure.
25
+ . expect ( "Unable to generate bindings" ) ;
26
+
27
+ // Write the bindings to the $OUT_DIR/bindings.rs file.
28
+ let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
29
+ bindings
30
+ . write_to_file ( out_path. join ( "bindings.rs" ) )
31
+ . expect ( "Couldn't write bindings!" ) ;
32
+ }
Original file line number Diff line number Diff line change
1
+ #![ allow( non_upper_case_globals) ]
2
+ #![ allow( non_camel_case_types) ]
3
+ #![ allow( non_snake_case) ]
4
+
5
+ include ! ( concat!( env!( "OUT_DIR" ) , "/bindings.rs" ) ) ;
Original file line number Diff line number Diff line change
1
+ #include <ilcplex/cplex.h>
You can’t perform that action at this time.
0 commit comments