Skip to content

Commit dfb15d9

Browse files
committed
cmake: we now use flutter engine from our 3rdparty
No longer needed to have env variables pointing to a local flutter which needed to exist somewhere else. download_engine.sh now detects which flutter version you need and downloads it.
1 parent 994eaf4 commit dfb15d9

File tree

17 files changed

+97
-271
lines changed

17 files changed

+97
-271
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 63 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/docker/Dockerfile

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/docker/compose.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,35 @@ jobs:
1414
fail-fast: true
1515
matrix:
1616
os:
17-
- self-hosted
18-
# - windows-latest
19-
# - macos-latest
17+
- ubuntu-24.04
2018

2119
steps:
22-
- uses: actions/checkout@v4
20+
- name: Install Qt
21+
uses: jurplel/install-qt-action@v4
2322
with:
24-
fetch-depth: 0
25-
26-
- name: Install ninja-build tool (must be after Qt due PATH changes)
27-
if: ${{ runner.os == 'Windows' }}
28-
uses: turtlesec-no/get-ninja@main
29-
30-
- name: Make sure MSVC is found when Ninja generator is in use
31-
if: ${{ runner.os == 'Windows' }}
32-
uses: ilammy/msvc-dev-cmd@v1
23+
version: 6.6.0
24+
cache: true
3325

3426
- name: Checkout qt-embedder
3527
uses: actions/checkout@v4
3628

29+
- name: Install clang
30+
run: sudo apt-get update && sudo apt-get install -y clang ninja-build
31+
32+
- name: Setup Flutter
33+
uses: subosito/flutter-action@v2
34+
with:
35+
channel: stable
36+
37+
- name: Download flutter engine
38+
run: sh download_engine.sh
39+
env:
40+
GH_TOKEN: ${{ github.token }}
41+
3742
- name: Configure project
3843
run: cmake -S . -B ./build-dev --preset dev
3944

40-
- name: Build Project ${{ matrix.preset.build_preset_arg }}
45+
- name: Build Project
4146
run: cmake --build ./build-dev
4247

4348
- name: Build example

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ compile_commands.json
33
.cache/
44
/examples/default_counter_app/linux/flutter/generated_plugins.cmake
55
/examples/default_counter_app/windows/flutter/generated_plugins.cmake
6+
libflutter_engine.so

3rdparty/flutter

Submodule flutter updated 1706 files

CMakeLists.txt

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,29 @@ set(CMAKE_INCLUDE_CURRENT_DIRS ON)
1818

1919
find_package(Qt6 6.6 NO_MODULE REQUIRED COMPONENTS Widgets OpenGL)
2020

21-
if(NOT DEFINED ENV{FLUTTER_ENGINE_FOLDER})
22-
message(FATAL_ERROR "Point env var FLUTTER_ENGINE_FOLDER to engine folder")
23-
endif()
24-
2521
if(MSVC)
22+
# Windows is not tested, this probably doesn't work
2623
set(FLUTTER_ENGINE_LIBRARY flutter_engine.lib)
2724
else()
28-
if(EXISTS "$ENV{FLUTTER_ENGINE_FOLDER}/rel/")
29-
if(QT_EMBEDDER_AOT)
30-
set(FLUTTER_ENGINE_LIBRARY
31-
rel/libflutter_engine.${CMAKE_SHARED_LIBRARY_SUFFIX})
32-
else()
33-
set(FLUTTER_ENGINE_LIBRARY
34-
dbg_unopt/libflutter_engine.${CMAKE_SHARED_LIBRARY_SUFFIX})
35-
endif()
36-
set(FLUTTER_ENGINE_INCLUDE_DIR $ENV{FLUTTER_ENGINE_FOLDER})
25+
if(QT_EMBEDDER_AOT)
26+
set(FLUTTER_ENGINE_LIBRARY
27+
${CMAKE_SOURCE_DIR}/engine_binaries/rel/libflutter_engine${CMAKE_SHARED_LIBRARY_SUFFIX}
28+
)
3729
else()
38-
if(APPLE)
39-
set(BUILD_FOLDER_NAME host_debug_unopt_arm64)
40-
else()
41-
set(BUILD_FOLDER_NAME host_debug_unopt)
42-
endif()
43-
4430
set(FLUTTER_ENGINE_LIBRARY
45-
../out/${BUILD_FOLDER_NAME}/libflutter_engine${CMAKE_SHARED_LIBRARY_SUFFIX}
31+
${CMAKE_SOURCE_DIR}/engine_binaries/dbg_unopt/libflutter_engine${CMAKE_SHARED_LIBRARY_SUFFIX}
4632
)
47-
set(FLUTTER_ENGINE_INCLUDE_DIR
48-
$ENV{FLUTTER_ENGINE_FOLDER}/../out/${BUILD_FOLDER_NAME})
4933
endif()
5034
endif()
5135

52-
message(
53-
"FLUTTER_ENGINE_LIBRARY=$ENV{FLUTTER_ENGINE_FOLDER}/${FLUTTER_ENGINE_LIBRARY}"
54-
)
36+
message("FLUTTER_ENGINE_LIBRARY=${FLUTTER_ENGINE_LIBRARY}}")
5537

56-
include_directories(${FLUTTER_ENGINE_INCLUDE_DIR})
38+
if(NOT EXISTS ${FLUTTER_ENGINE_LIBRARY})
39+
message(
40+
FATAL_ERROR
41+
"Could not find ${FLUTTER_ENGINE_LIBRARY}. Did you run dowload_engine.sh ?"
42+
)
43+
endif()
5744

5845
if(ENABLE_ASAN)
5946
add_compile_options(-fsanitize=address -fsanitize=undefined)
@@ -62,31 +49,27 @@ endif()
6249

6350
add_library(
6451
flutter_common_client_wrapper STATIC
65-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/client_wrapper/plugin_registrar.cc
66-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/client_wrapper/core_implementations.cc
67-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/client_wrapper/standard_codec.cc
68-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/client_wrapper/engine_method_result.cc
69-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/client_wrapper/engine_method_result.cc
70-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/incoming_message_dispatcher.cc
71-
)
52+
3rdparty/flutter/shell/platform/common/client_wrapper/plugin_registrar.cc
53+
3rdparty/flutter/shell/platform/common/client_wrapper/core_implementations.cc
54+
3rdparty/flutter/shell/platform/common/client_wrapper/standard_codec.cc
55+
3rdparty/flutter/shell/platform/common/client_wrapper/engine_method_result.cc
56+
3rdparty/flutter/shell/platform/common/client_wrapper/engine_method_result.cc
57+
3rdparty/flutter/shell/platform/common/incoming_message_dispatcher.cc)
7258

7359
target_include_directories(
7460
flutter_common_client_wrapper
75-
PUBLIC
76-
"$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/public"
77-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/embedder/
78-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common
79-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/client_wrapper
80-
$ENV{FLUTTER_ENGINE_FOLDER}/shell/platform/common/client_wrapper/include/
81-
"$ENV{FLUTTER_ENGINE_FOLDER}/..")
61+
PUBLIC 3rdparty/flutter/shell/platform/common/public
62+
3rdparty/flutter/shell/platform/embedder/
63+
3rdparty/flutter/shell/platform/common
64+
3rdparty/flutter/shell/platform/common/client_wrapper
65+
3rdparty/flutter/shell/platform/common/client_wrapper/include/
66+
3rdparty/flutter/..)
8267

8368
add_executable(qtembedder main.cpp src/Embedder.cpp src/FlutterWindow.cpp
8469
src/3rdparty/flutter/glfw_shell.cpp)
8570

86-
target_link_libraries(
87-
qtembedder Qt6::Widgets Qt6::OpenGL Qt6::GuiPrivate
88-
$ENV{FLUTTER_ENGINE_FOLDER}/${FLUTTER_ENGINE_LIBRARY}
89-
flutter_common_client_wrapper)
71+
target_link_libraries(qtembedder Qt6::Widgets Qt6::OpenGL Qt6::GuiPrivate
72+
${FLUTTER_ENGINE_LIBRARY} flutter_common_client_wrapper)
9073

9174
if(NOT APPLE)
9275
target_link_libraries(qtembedder EGL)

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ Can be used to launch a 100% flutter app or to integrate flutter into an existin
2424

2525
## Instructions
2626

27-
Install `ms-vscode-remote.remote-containers` extension in vscode and open the `.devcontainer`.
28-
29-
Build the embedder.
30-
31-
Build the example by running `build_example.sh`.
32-
33-
Run the example:
34-
`./build-dev/qtembedder -m -e examples/default_counter_app`
35-
27+
```bash
28+
git submodule update --init
29+
cmake --preset=dev
30+
cmake --build build-dev
31+
build_example.sh
32+
build-dev/qtembedder -m -e examples/default_counter_app
33+
```
3634

3735
## Licensing
3836

build_example.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ else
1313
fi
1414

1515
cd examples/default_counter_app && flutter pub get && \
16-
echo "FLUTTER_HOST=${FLUTTER_HOST} ; FLUTTER_ENGINE_FOLDER=${FLUTTER_ENGINE_FOLDER} ; FLUTTER_ARCH=${FLUTTER_ARCH}"
17-
flutter build ${FLUTTER_HOST} --debug --local-engine-src-path=$FLUTTER_ENGINE_FOLDER/.. --local-engine=host_debug_unopt${FLUTTER_ARCH} --local-engine-host=host_debug_unopt${FLUTTER_ARCH}
16+
flutter build ${FLUTTER_HOST} --debug

0 commit comments

Comments
 (0)