File tree 5 files changed +425
-0
lines changed 5 files changed +425
-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 = " sgxstep-sys"
3
+ version = " 0.1.0"
4
+ edition = " 2021"
5
+ links = " libsgxstep"
6
+ authors = [" Daan Vanoverloop" , " Jo Van Bulck" ]
7
+ license = " GPL-3.0"
8
+ repository = " https://github.com/jovanbulck/sgx-step/"
9
+
10
+ [features ]
11
+ default = [" build" ]
12
+ build = [" cc" , " glob" ]
13
+
14
+ [dependencies ]
15
+
16
+ [build-dependencies ]
17
+ cc = { version = " 1.0" , optional = true }
18
+ glob = { version = " 0.3" , optional = true }
19
+ bindgen = " 0.69"
20
+
Original file line number Diff line number Diff line change
1
+ use std:: { env, path:: PathBuf } ;
2
+
3
+ fn main ( ) {
4
+ #[ cfg( feature = "build" ) ]
5
+ {
6
+ cc:: Build :: new ( )
7
+ . files (
8
+ glob:: glob ( "../libsgxstep/*.c" )
9
+ . unwrap ( )
10
+ . filter_map ( |e| e. ok ( ) ) ,
11
+ )
12
+ . cargo_metadata ( true )
13
+ . compile ( "sgxstep" ) ;
14
+ }
15
+
16
+ let bindings = bindgen:: Builder :: default ( )
17
+ . header ( "wrapper.h" )
18
+ . clang_arg ( format ! (
19
+ "-I{}" ,
20
+ env:: var( "LIBSGXSTEP" ) . expect( "missing LIBSGXSTEP environment variable" )
21
+ ) )
22
+ . parse_callbacks ( Box :: new ( bindgen:: CargoCallbacks :: new ( ) ) )
23
+ . generate ( )
24
+ . expect ( "Unable to generate bindings" ) ;
25
+
26
+ let out_path = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
27
+ bindings
28
+ . write_to_file ( out_path. join ( "bindings.rs" ) )
29
+ . expect ( "Couldn't write bindings!" ) ;
30
+ }
You can’t perform that action at this time.
0 commit comments