Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.vscode
build
sdk
third_party
sysroot
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

41 changes: 13 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# Copyright (c) 2018 Joel Winarske
# Copyright (c) 2018-2020 Joel Winarske
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,18 +24,9 @@

cmake_minimum_required(VERSION 3.11)

if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
endif()

if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE)
message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to MinSizeRel.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE)
message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to Release.")
endif()

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake")
Expand All @@ -51,25 +42,19 @@ project(${PACKAGE_NAME} VERSION "${FLUTTER_EMBEDDED_VERSION}" LANGUAGES CXX C)
message(STATUS "Generator .............. ${CMAKE_GENERATOR}")
message(STATUS "Build Type ............. ${CMAKE_BUILD_TYPE}")

option(BUILD_PLATFORM_SYSROOT "Build Platform sysroot" ON)

option(BUILD_RPI_FLUTTER "Build Flutter for Raspberry Pi" ON)
option(BUILD_WAYLAND_FLUTTER "Build Flutter for Wayland" OFF)
include(ProcessorCount)
ProcessorCount(NUM_PROC)

include(build_dependencies)

if(ANDROID)
set(FLUTTER_TARGET_NAME "Android")
else()
include(options)
include(sysroot)
include(depot_tools)
include(engine)

if(BUILD_RPI_FLUTTER)
include(rpi)

elseif(BUILD_WAYLAND_FLUTTER)
include(wayland)

endif()
if(BUILD_FLUTTER_RPI)
include(rpi)

elseif(BUILD_FLUTTER_WAYLAND)
include(wayland)
endif()

message(STATUS "Flutter ................ ${FLUTTER_TARGET_NAME}")
73 changes: 22 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,54 @@
# flutter_embedded

This repo is currently about build automation for Tip of the Tree Clang, Binutils, and Flutter Engine artifacts. The useage target is for an embedded system.
This repo is currently about build automation for Tip of the Tree Flutter Engine, and alternative Linux shells.

# Motivation
See if Embedded Flutter is a compeling alternative to Chromium ContentShell+JS+CSS, and QT.
# Project Status

Areas of interest are memory footprint, stack latency, and where does it fit in the UI Framework landscape.
**Note: armv6 is not supported by Google**

I can build a ContentShell browser that with the smallest of pages, only has a 15MB system heap footprint. As the HTML5 application complexity increases, the memory usage ballons. We're looking for controlled predictability.
I have refactored things to take advantage of the Fuchsia Clang Toolchain (CIPD).

In regards to latency, one test case will be CAN bus signal from an Automotive ODBC-II connector, rendering a gauge.
This is building very close to tip of tree. It may be too new for your SDK. To regress engine build will most likely involve some hair pulling.

I need people to test their desired configuration and provide feedback.

# Project Status
I aam considering a new branch for each Engine milestones.

### I'm planning to refactor this repo to eliminate the Clang toolchain build, as Clang 8.0 is pulled in via the Engine build. The only external deps in case of Linux building the Embedder Engine is fontconfig, and crtstartS/crtendS. The actual runtime doesn't need Clang, and can be built with GCC. For building the Engine with Yocto I have a solution that doesn't involve CMake; easier/cleaner/faster - [flutter_wayland](https://github.com/jwinarske/meta-flutter)
When building with fontconfig enabled, you need to have PKG_CONFIG_PATH set to find `freetype2.pc`.


## * Raspberry PI bits *
My current focus has been evolving Wayland Client as part of Yocto based images:

The default build configuration (provided a properly configured sysroot), will generate bits that execute on a Raspberry Pi.
[meta-flutter](https://github.com/jwinarske/meta-flutter)

Planned Work Items

1. Memory Profiling and optimization. With Debug engine running a simple app on the PI, it's allocating around 150MB, with 12 threads.
2. Platform Channel handler. This will allow Dart to call C/C++ code. Think CAN bus, I2C, SPI, RS-232, RS-485, MIDI, Audio, Espresso Machine I/O, etc.
3. Support all 4 machine architectures to build on Linux. Currently only ARM has been tested.
4. Depending on demand and use cases, add support for building on Mac and Windows (although it may already work)...
[flutter_wayland](https://github.com/jwinarske/flutter_wayland)


# Pre-requisites

1. CMake 3.11 or greater

2. Setup depot_tools and add to path. This provides gclient, ninja, autoninja, etc.

http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
## * Raspberry PI bits *

3. Confirm you can build the engine repo standalone
The default build configuration (provided a properly configured sysroot), will generate bits that execute on a Raspberry Pi.

https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment
# Pre-requisites

https://github.com/flutter/flutter/wiki/Compiling-the-engine
1. CMake 3.11 or greater

Install build dependencies with this shell script:
2. (Engine) fontconfig if enabled and building on Linux

install-build-deps.sh
3. Sysroot compatible with the Clang runtime flavors

4. Raspberry Pi prior to generating sysroot
4. (Wayland flutter) handful of dependencies. Read the CMakeLists.txt for fluttr_wayland.

sudo apt-get install libx11-dev


# Build Tip-Of-Tree Clang, Latest Binutils, and Flutter Engine master branch for Linux arm
# Build Tip-Of-Tree Flutter Engine master branch for Linux arm

git clone https://github.com/jwinarske/flutter_embedded
cd flutter_embedded
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -GNinja
autoninja
autoninja engine

Note: Your build folder can be wherever you want...

Expand All @@ -82,22 +72,6 @@ This is the target architecture of your build. It must match your toolchain, a
### ENGINE_REPO
This is the repo of the flutter engine. The default value is https://github.com/flutter/engine.git. If you want to use your own fork, set this variable to point to your fork's url.

### LLVM_TARGETS_TO_BUILD
List of Targets LLVM should be built with. Relavant to Flutter the options are:
"AArch64;ARM;X86". Host architecture (x86_64) is implicit, as that is the expected build host. If crosscompiling compiler-rt, libcxxabi, and libcxx the current scheme expects only a single value for LLVM_TARGETS_TO_BUILD.

### BUILD_COMPILER_RT
Checks out and builds compiler-rt for host and target. Default value is ON, and valid only when TOOLCHAIN_DIR is not set.

### BUILD_LIBCXXABI
Checks out and builds libcxxabi for host and target. Default value is ON, and valid only when TOOLCHAIN_DIR is not set.

### BUILD_LIBCXX
Checks out and builds libcxx. Default value is ON, and valid only when TOOLCHAIN_DIR is not set.

### BUILD_LLD
Checks out and builds lld. Default value is OFF, and valid only when TOOLCHAIN_DIR is not set. This option enables the use of "-fuse-ld=lld".

### ENGINE_UNOPTIMIZED
Unoptimized flag, defaults to OFF

Expand Down Expand Up @@ -229,8 +203,7 @@ When adding in Linux support to the Dart code, start by adding "case TargetPlatf
cd {flutter app project folder}
flutter build bundle

*Note: You either need to override debugDefaultTargetPlatformOverride, or
"Enable Linux as a Platform in your Flutter Repo"*
*Note: You either need to override TargetPlatform prior to running the app*

## Tested Flutter Examples

Expand All @@ -241,13 +214,11 @@ Tested apps post Flutter Dart "linux" platfrom add
flutter/examples/flutter_view
flutter/examples/hello_world
flutter/examples/layers * Generates rendered text: "Instead run", "flutter run lib/xxx.dart"
flutter/examples/platform_channel *requires MessageCallback impl for 100%
flutter/examples/platform_channel
flutter/examples/platform_view * Android view not impl.. no-op btn
flutter/examples/stocks
flutter-desktop-embedding/example/flutter_app

Depending on the app, be preapred for Dart runtime exceptions. Refer to https://github.com/flutter/flutter/issues

### Push built Flutter Application to Target

scp -r {flutter app root }/build/* [email protected]:/home/pi
Expand Down
138 changes: 0 additions & 138 deletions cmake/build_dependencies.cmake

This file was deleted.

Loading