Windows On Arm (WOA)Dart/Flutter

Dart/Flutter

Introduction

https://en.wikipedia.org/wiki/Dart_(programming_language) is a language created by Google to replace Javascript. It is targetting a VM (DartVM).

https://en.wikipedia.org/wiki/Flutter_(software) is a framework to create native, web, or mobile apps (from the same code) written in Dart.


Status

Dart: It’s supported for Windows on Arm for Dev Channel and latest binaries are available here (or on this page: https://dart.dev/get-dart/archive#dev-channel ).

Flutter: Build from source works, and flutter engine binaries are available. Building flutter apps is a work in progress. See this design document for details: https://docs.google.com/document/d/1yuexY-EtzeVhU3V6RGBII_kH-znLSkQCspzW70jayZk/edit?resourcekey=0-8pQRSXSHQlwOo7QtCVLvBA and open issues https://github.com/flutter/flutter/issues/62597

Setup (common to both projects)

Those two projects are built using chromium build system (https://gn.googlesource.com/gn/ , a cmake like, and https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up ). Both projects provide wrappers to build, without the need to call gn directly.

get visual studio components

you need to install ATL libraries for your visual studio version.

get windows sdk debuggers

you need to install debuggers from https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ . Dart/Flutter build search for dbgcore.dll and dbghelp.dll.

get python3

python3.exe should be available on the PATH. arm64 version should be installed as it is used by depot_tools to identify cpu architecture.

When installing python on windows, only python.exe is available. You need to copy it (duplicate it) as python3.exe.

get depot_tools

First, you need to retrieve depot_tools from this URL, and unzip it

Then, add following directories to your PATH:

# contains ninja.exe and other binaries for windows depot_tools/.cipd_bin # main scripts (fetch, gsync, ...) depot_tools/

set environment

# force to get local toolchain (needed when you're not a Google employee) set DEPOT_TOOLS_WIN_TOOLCHAIN=0

Dart

Clone

fetch dart cd sdk

Build

python3 ./tools/build.py --arch arm64 --mode release create_sdk --no-goma

Test

python3 ./tools/test.py -mrelease --arch=arm64 --runtime=vm --compiler=none vm # you can select other test suites than "vm"

Run

Create file named hw.dart with this content:

void main() { print('Hello, World!'); }

You can run it using:

# execute directly out/ReleaseXARM64/dart.exe run hw.dart # compile it to bytecode out/ReleaseXARM64/dart.exe compile kernel hw.dart -o hw.dill # run from bytecode out/ReleaseXARM64/dart.exe run hw.dill

Flutter

Clone

fetch flutter cd src

Build engine

set GYP_MSVS_OVERRIDE_PATH='C:\Program Files (x86)\Microsoft Visual Studio\2019\Community' # --no-goma: is google distributed build system (only for Googlers) python3 ./flutter/tools/gn --no-goma --windows-cpu arm64 --target-dir host_debug ninja -C out/host_debug

Build example app (gallery)

This is a work in progress.