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"
3434[dev-dependencies ]
3535env_logger = " 0.7.1"
3636
37- [build-dependencies ]
38- cbindgen = " 0.5.2"
39-
4037[features ]
4138# Enable mp4parse_fallible to use fallible memory allocation rather than
4239# 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"
88mp4parse_capi = { path = " ../mp4parse_capi" }
99
1010[build-dependencies ]
11+ cbindgen = " 0.14.2"
1112mp4parse_capi = { path = " ../mp4parse_capi" }
1213cc = " 1.0"
Original file line number Diff line number Diff line change 1+ extern crate cbindgen;
12extern crate cc;
23
4+ use cbindgen:: { Config , RenameRule } ;
5+ use std:: path:: Path ;
6+
7+ const CAPI_CRATE : & str = "../mp4parse_capi" ;
8+
39fn 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+
420 println ! ( "cargo:rerun-if-changed=src/main.rs" ) ;
521 println ! ( "cargo:rerun-if-changed=src/test.cc" ) ;
622
723 cc:: Build :: new ( )
824 . file ( "src/test.cc" )
925 . cpp ( true )
1026 . flag_if_supported ( "-std=c++11" )
11- . include ( "../mp4parse_capi/include" )
27+ . include ( "include" )
28+ . include ( generated_include_dir)
1229 . compile ( "libtest.a" ) ;
1330
1431 #[ 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