File tree Expand file tree Collapse file tree 6 files changed +48
-50
lines changed Expand file tree Collapse file tree 6 files changed +48
-50
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,6 @@ num-traits = "0.2.0"
34
34
[dev-dependencies ]
35
35
env_logger = " 0.7.1"
36
36
37
- [build-dependencies ]
38
- cbindgen = " 0.5.2"
39
-
40
37
[features ]
41
38
# Enable mp4parse_fallible to use fallible memory allocation rather than
42
39
# panicking on OOM. Note that this is only safe within Gecko where the system
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ header = """ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */"""
4
+ autogen_warning = """ /* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen. */
5
+ #ifndef mp4parse_rust_mp4parse_h
6
+ #error "Don't include this file directly, instead include mp4parse.h"
7
+ #endif
8
+ """
9
+ include_version = true
10
+ braces = " SameLine"
11
+ line_length = 100
12
+ tab_width = 2
13
+ language = " C"
14
+ cpp_compat = true
15
+
16
+ [enum ]
17
+ rename_variants = " QualifiedScreamingSnakeCase"
Original file line number Diff line number Diff line change @@ -8,5 +8,6 @@ edition = "2018"
8
8
mp4parse_capi = { path = " ../mp4parse_capi" }
9
9
10
10
[build-dependencies ]
11
+ cbindgen = " 0.14.2"
11
12
mp4parse_capi = { path = " ../mp4parse_capi" }
12
13
cc = " 1.0"
Original file line number Diff line number Diff line change
1
+ extern crate cbindgen;
1
2
extern crate cc;
2
3
4
+ use cbindgen:: { Config , RenameRule } ;
5
+ use std:: path:: Path ;
6
+
7
+ const CAPI_CRATE : & str = "../mp4parse_capi" ;
8
+
3
9
fn main ( ) {
10
+ println ! ( "cargo:rerun-if-changed={}/src/lib.rs" , CAPI_CRATE ) ;
11
+
12
+ let crate_dir = Path :: new ( & std:: env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ) . join ( CAPI_CRATE ) ;
13
+ let generated_include_dir = Path :: new ( & std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ) . join ( "include" ) ;
14
+ let header_path = generated_include_dir. join ( "mp4parse_ffi_generated.h" ) ;
15
+
16
+ cbindgen:: generate ( & crate_dir)
17
+ . expect ( "Could not generate header" )
18
+ . write_to_file ( header_path) ;
19
+
4
20
println ! ( "cargo:rerun-if-changed=src/main.rs" ) ;
5
21
println ! ( "cargo:rerun-if-changed=src/test.cc" ) ;
6
22
7
23
cc:: Build :: new ( )
8
24
. file ( "src/test.cc" )
9
25
. cpp ( true )
10
26
. flag_if_supported ( "-std=c++11" )
11
- . include ( "../mp4parse_capi/include" )
27
+ . include ( "include" )
28
+ . include ( generated_include_dir)
12
29
. compile ( "libtest.a" ) ;
13
30
14
31
#[ cfg( unix) ]
Original file line number Diff line number Diff line change
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+
5
+ #ifndef mp4parse_rust_mp4parse_h
6
+ #define mp4parse_rust_mp4parse_h
7
+
8
+ #include "mp4parse_ffi_generated.h"
9
+
10
+ // Add any non-generated support code here
11
+
12
+ #endif
You can’t perform that action at this time.
0 commit comments