From c9b9133b2e708154499b10188e2a936db4b20337 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 16 Jan 2022 18:21:46 -0500 Subject: [PATCH] flutter setup for windows --- external/keyring-manager | 2 +- setup_flutter.bat | 56 ++++++++++++++++++++++++++++++++++++++++ setup_flutter.sh | 26 +++++++++++++------ 3 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 setup_flutter.bat diff --git a/external/keyring-manager b/external/keyring-manager index 935ca957..1295d708 160000 --- a/external/keyring-manager +++ b/external/keyring-manager @@ -1 +1 @@ -Subproject commit 935ca957d7e223ef560a0b20b656730a325e0ba7 +Subproject commit 1295d708ec42542f076a13db69eadc448a94f985 diff --git a/setup_flutter.bat b/setup_flutter.bat new file mode 100644 index 00000000..bb0f7d9f --- /dev/null +++ b/setup_flutter.bat @@ -0,0 +1,56 @@ +@ECHO OFF +SETLOCAL + +PUSHD %~dp0 +SET ROOTDIR=%CD% +POPD + +REM ensure flutter is installed +FOR %%X IN (flutter.bat) DO (SET FLUTTER_FOUND=%%~$PATH:X) +IF NOT DEFINED FLUTTER_FOUND ( + echo Flutter is not available in the path, install Flutter from here: https://docs.flutter.dev/get-started/install + goto end +) +echo [X] Flutter is available in the path + +REM ensure dart is installed +FOR %%X IN (dart.bat) DO (SET DART_FOUND=%%~$PATH:X) +IF NOT DEFINED DART_FOUND ( + echo Dart is not available in the path, check your environment variables and that Flutter is installed correctly + goto end +) +echo [X] Dart is available in the path + +REM ensure cargo is installed +FOR %%X IN (cargo.exe) DO (SET CARGO_FOUND=%%~$PATH:X) +IF NOT DEFINED CARGO_FOUND ( + echo Cargo is not available in the path, ensure Rust is installed correctly + goto end +) +echo [X] Cargo is available in the path + +REM ensure winget is installed +FOR %%X IN (winget.exe) DO (SET WINGET_FOUND=%%~$PATH:X) +IF NOT DEFINED WINGET_FOUND ( + echo Winget is not available in the path, ensure your version of Windows is new enough and has Winget installed from the Microsoft Store + echo https://docs.microsoft.com/en-us/windows/package-manager/winget/ + goto end +) +echo [X] Winget is available in the path + +rem install cargo cbindgen +cargo install cbindgen + +rem install dart ffigen +call dart pub global activate ffigen + +rem install flutter_rust_bridge_codegen +cargo install flutter_rust_bridge_codegen + +rem ensure packages are installed +winget install -e --id LLVM.LLVM --accept-package-agreements --accept-source-agreements + +rem ensure windows is enabled in flutter +flutter config --enable-windows-desktop --no-enable-android + +flutter doctor -v \ No newline at end of file diff --git a/setup_flutter.sh b/setup_flutter.sh index 06fb922b..2ec7a94f 100755 --- a/setup_flutter.sh +++ b/setup_flutter.sh @@ -18,25 +18,25 @@ fi # ensure flutter is installed if command -v flutter &> /dev/null; then - echo '[X] flutter is available in the path' + echo '[X] Flutter is available in the path' else - echo 'flutter is not available in the path, install flutter from here: https://docs.flutter.dev/get-started/install' + echo 'Flutter is not available in the path, install Flutter from here: https://docs.flutter.dev/get-started/install' exit 1 fi # ensure dart is installed if command -v dart &> /dev/null; then - echo '[X] dart is available in the path' + echo '[X] Dart is available in the path' else - echo 'dart is not available in the path, check your environment variables and that Flutter was installed correctly' + echo 'Dart is not available in the path, check your environment variables and that Flutter is installed correctly' exit 1 fi # ensure cargo is installed if command -v cargo &> /dev/null; then - echo '[X] cargo is available in the path' + echo '[X] Cargo is available in the path' else - echo 'cargo is not available in the path, ensure Rust is installed correctly' + echo 'Cargo is not available in the path, ensure Rust is installed correctly' exit 1 fi @@ -49,11 +49,21 @@ dart pub global activate ffigen # install flutter_rust_bridge_codegen cargo install flutter_rust_bridge_codegen -# Ensure packages are installed +# platform specific stuff if [ "$OS" == "linux" ]; then + # ensure packages are installed sudo apt-get install libclang-dev + + # ensure platforms are enabled in flutter + flutter config --enable-linux-desktop --enable-android + elif [ "$OS" == "macos" ]; then + # ensure packages are installed brew install llvm + + # ensure platforms are enabled in flutter + flutter config --enable-macos-desktop --enable-ios --no-enable-android fi - +# run flutter doctor +flutter doctor -v