From c3fe407d5cfc0975ffaf6ba88b90ea0d779c2512 Mon Sep 17 00:00:00 2001 From: Asura Date: Fri, 2 Sep 2022 02:06:40 -0700 Subject: [PATCH] Check LLVM_HOME when build --- build.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build.rs b/build.rs index d9b7a5516..73f48ded2 100644 --- a/build.rs +++ b/build.rs @@ -78,18 +78,24 @@ fn install_oboe() { fn gen_flutter_rust_bridge() { // Get dependent of flutter - if !std::path::Path::new("./flutter/.packages").exists(){ + if !std::path::Path::new("./flutter/.packages").exists() { std::process::Command::new("flutter") - .args(["pub", "get"]) - .current_dir("./flutter") - .output() - .expect("failed to execute flutter pub get"); + .args(["pub", "get"]) + .current_dir("./flutter") + .output() + .expect("failed to execute flutter pub get"); }; - let llvm_path = match std::env::var("LLVM_HOME") { - Ok(path) => Some(vec![path]), - Err(_) => None, + Ok(path) => { + if !path.is_empty() { + Some(vec![path]) + } else { + panic!("Missing LVM_HOME environment variable"); + } + } + Err(_) => panic!("Failure to get environments"), }; + // Tell Cargo that if the given file changes, to rerun this build script. println!("cargo:rerun-if-changed=src/flutter_ffi.rs"); // settings for fbr_codegen