remove gen_flutter_rust_bridge in build.rs
This commit is contained in:
parent
52f1383903
commit
5ad0730a26
@ -164,7 +164,6 @@ winapi = { version = "0.3", features = [ "winnt" ] }
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
hbb_common = { path = "libs/hbb_common" }
|
||||
flutter_rust_bridge_codegen = "=1.75"
|
||||
os-version = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
|
40
build.rs
40
build.rs
@ -76,52 +76,12 @@ fn install_oboe() {
|
||||
//cc::Build::new().file("oboe.cc").include(include).compile("oboe_wrapper");
|
||||
}
|
||||
|
||||
#[cfg(feature = "flutter")]
|
||||
fn gen_flutter_rust_bridge() {
|
||||
if !std::env::var("RUN_FFIGEN").is_ok() {
|
||||
return;
|
||||
}
|
||||
use lib_flutter_rust_bridge_codegen::{
|
||||
config_parse, frb_codegen, get_symbols_if_no_duplicates, RawOpts,
|
||||
};
|
||||
let llvm_path = match std::env::var("LLVM_HOME") {
|
||||
Ok(path) => Some(vec![path]),
|
||||
Err(_) => None,
|
||||
};
|
||||
// Tell Cargo that if the given file changes, to rerun this build script.
|
||||
println!("cargo:rerun-if-changed=src/flutter_ffi.rs");
|
||||
// Options for frb_codegen
|
||||
let raw_opts = RawOpts {
|
||||
// Path of input Rust code
|
||||
rust_input: vec!["src/flutter_ffi.rs".to_string()],
|
||||
// Path of output generated Dart code
|
||||
dart_output: vec!["flutter/lib/generated_bridge.dart".to_string()],
|
||||
// Path of output generated C header
|
||||
c_output: Some(vec!["flutter/macos/Runner/bridge_generated.h".to_string()]),
|
||||
/// Path to the installed LLVM
|
||||
llvm_path,
|
||||
// for other options use defaults
|
||||
..Default::default()
|
||||
};
|
||||
// get opts from raw opts
|
||||
let configs = config_parse(raw_opts);
|
||||
// generation of rust api for ffi
|
||||
let all_symbols = get_symbols_if_no_duplicates(&configs).unwrap();
|
||||
for config in configs.iter() {
|
||||
frb_codegen(config, &all_symbols).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
hbb_common::gen_version();
|
||||
install_oboe();
|
||||
// there is problem with cfg(target_os) in build.rs, so use our workaround
|
||||
// let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
// if target_os == "android" || target_os == "ios" {
|
||||
#[cfg(feature = "flutter")]
|
||||
gen_flutter_rust_bridge();
|
||||
// return;
|
||||
// }
|
||||
#[cfg(all(windows, feature = "inline"))]
|
||||
build_manifest();
|
||||
#[cfg(windows)]
|
||||
|
Loading…
Reference in New Issue
Block a user