Skip to content

Commit 9d4a692

Browse files
swift-kimbbrto21bwikbs
committed
Separate builds for profiles (#67)
* Separate binaries * Clean up the build script * Use templates * Use __dlog_print() only on TV * Copy headers and icudata * Partially update azure-pipelines.yml * Temporarily unsupport Tizen 4.0 and use only ecore_wl2 * Cherry-pick "Enable Evas GL direct mode (#54)" - Cherry-pick the commit from flutter-2.0.1-tizen-dev - Rename FLUTTER_TIZEN_EVASGL with TIZEN_RENDERER_EVAS_GL - Add missing switches and fix build errors Co-authored-by: Boram Bae <[email protected]> Co-authored-by: MuHong Byun <[email protected]> * Fix CI build * Disable Evas GL direct mode and remove use of elm_win_aux_hint_add * Simplify the CI job * A workaround for isIME in Evas GL mode * Refactor: Clean up tizen_renderer.h and re-order functions * Refactor: Rename GetEcoreWindowId and change its return type to uintptr_t * Refactor: Make GetImageHandle() Evas GL-only * Refactor: Additional clean ups * Initialize members properly * Get window id from evas_window_ * Re-format code Co-authored-by: Boram Bae <[email protected]> Co-authored-by: MuHong Byun <[email protected]>
1 parent fe92903 commit 9d4a692

21 files changed

+1756
-971
lines changed

azure-pipelines.yml

+9-39
Original file line numberDiff line numberDiff line change
@@ -68,39 +68,21 @@ jobs:
6868
--runtime-mode $(mode) \
6969
--embedder-for-target \
7070
--disable-desktop-embeddings \
71-
--build-tizen-shell \
72-
--out-dir output/default
73-
ninja -C output/default/out/linux_$(mode)_$(arch)
71+
--build-tizen-shell
72+
ninja -C out/linux_$(mode)_$(arch)
7473
displayName: Build
7574
workingDirectory: $(buildroot)
7675
failOnStderr: true
77-
- bash: |
78-
flutter/tools/gn \
79-
--target-os linux \
80-
--linux-cpu $(arch) \
81-
--target-toolchain `pwd`/tizen_tools/toolchains \
82-
--target-sysroot `pwd`/tizen_tools/sysroot/$(arch)_40 \
83-
--target-triple $(targetTriple) \
84-
--runtime-mode $(mode) \
85-
--embedder-for-target \
86-
--disable-desktop-embeddings \
87-
--build-tizen-shell \
88-
--tizen-sdk-4 \
89-
--out-dir output/tizen40
90-
ninja -C output/tizen40/out/linux_$(mode)_$(arch)
91-
displayName: Build for Tizen 4.0
92-
workingDirectory: $(buildroot)
93-
condition: ne(variables['arch'], 'arm64')
94-
failOnStderr: true
9576
- bash: |
9677
OUTDIR=$(Build.StagingDirectory)
97-
cp default/out/linux_$(mode)_$(arch)/libflutter_engine.so $OUTDIR
98-
cp default/out/linux_$(mode)_$(arch)/libflutter_tizen.so $OUTDIR
99-
if [[ "$(arch)" != "arm64" ]]; then
100-
cp tizen40/out/linux_$(mode)_$(arch)/libflutter_tizen.so $OUTDIR/libflutter_tizen40.so
78+
cp out/linux_$(mode)_$(arch)/libflutter_*.so $OUTDIR
79+
if [[ $(System.JobName) == "tizen-arm-release" ]]; then
80+
mkdir $OUTDIR/common
81+
cp -r out/linux_$(mode)_$(arch)/{cpp_client_wrapper,icu,public} $OUTDIR/common
82+
rm $OUTDIR/common/cpp_client_wrapper/engine_method_result.cc
10183
fi
10284
displayName: Copy artifacts
103-
workingDirectory: $(buildroot)/output
85+
workingDirectory: $(buildroot)
10486
failOnStderr: true
10587
- publish: $(Build.StagingDirectory)
10688
artifact: $(System.JobName)
@@ -119,19 +101,7 @@ jobs:
119101
path: src/flutter
120102
- download: current
121103
- bash: |
122-
mkdir -p common/client_wrapper
123-
ROOT=$(Pipeline.Workspace)/src/flutter/shell/platform
124-
cp $ROOT/common/cpp/client_wrapper/*.{h,cc} common/client_wrapper
125-
rm common/client_wrapper/{*_unittests.*,engine_method_result.cc}
126-
cp -r $ROOT/common/cpp/public common
127-
cp -r $ROOT/common/cpp/client_wrapper/include common/client_wrapper
128-
cp $ROOT/tizen/public/*.h common/public
129-
cp $ROOT/tizen/LICENSE .
130-
displayName: Copy headers
131-
workingDirectory: $(Build.BinariesDirectory)
132-
failOnStderr: true
133-
- bash: |
134-
cp $(Pipeline.Workspace)/src/third_party/icu/flutter/icudtl.dat common
104+
mv $(Pipeline.Workspace)/tizen-arm-release/common .
135105
mv $(Pipeline.Workspace)/tizen-* .
136106
for platform in linux windows darwin; do
137107
for arch in arm arm64; do

shell/platform/tizen/BUILD.gn

+182-88
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,39 @@
11
# Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved.
2-
# Copyright 2013 The Flutter Authors. All rights reserved.
32
# Use of this source code is governed by a BSD-style license that can be
43
# found in the LICENSE file.
5-
import("//flutter/shell/platform/tizen/config.gni")
6-
7-
group("tizen") {
8-
deps = [ ":flutter_tizen_library" ]
9-
}
104

11-
shared_library("flutter_tizen_library") {
12-
output_name = "flutter_tizen"
5+
import("//flutter/shell/platform/common/cpp/client_wrapper/publish.gni")
6+
import("//flutter/shell/platform/tizen/config.gni")
137

8+
# Sets the rpath of dependent targets (shared libs) to $ORIGIN.
9+
# We assume that the flutter_engine library exists next to the embedder library
10+
# when they are deployed on Tizen devices.
11+
config("tizen_embedder_rpath") {
1412
ldflags = [ "-Wl,-rpath,\$ORIGIN" ]
15-
16-
deps = [ ":flutter_tizen" ]
17-
18-
public_configs = [ "//flutter:config" ]
1913
}
2014

21-
source_set("flutter_tizen_headers") {
22-
public = [
23-
"public/flutter_platform_view.h",
24-
"public/flutter_tizen_texture_registrar.h",
25-
"public/flutter_tizen.h",
26-
]
15+
source_set("flutter_engine") {
16+
visibility = [ ":*" ]
2717

28-
public_deps =
29-
[ "//flutter/shell/platform/common/cpp:common_cpp_library_headers" ]
18+
libs = [ "flutter_engine" ]
3019

31-
configs +=
32-
[ "//flutter/shell/platform/common/cpp:desktop_library_implementation" ]
20+
lib_dirs = [ root_out_dir ]
3321

34-
public_configs =
35-
[ "//flutter/shell/platform/common/cpp:relative_flutter_library_headers" ]
36-
}
37-
38-
source_set("flutter_tizen") {
39-
sources = [
40-
"channels/key_event_channel.cc",
41-
"channels/lifecycle_channel.cc",
42-
"channels/localization_channel.cc",
43-
"channels/navigation_channel.cc",
44-
"channels/platform_channel.cc",
45-
"channels/platform_view_channel.cc",
46-
"channels/settings_channel.cc",
47-
"channels/text_input_channel.cc",
48-
"external_texture_gl.cc",
49-
"flutter_tizen.cc",
50-
"key_event_handler.cc",
51-
"tizen_embedder_engine.cc",
52-
"tizen_event_loop.cc",
53-
"tizen_log.cc",
54-
"tizen_renderer.cc",
55-
"tizen_vsync_waiter.cc",
56-
"touch_event_handler.cc",
57-
]
22+
public_configs = [ ":tizen_embedder_rpath" ]
5823

59-
configs +=
60-
[ "//flutter/shell/platform/common/cpp:desktop_library_implementation" ]
24+
deps = [ "//flutter/shell/platform/embedder:flutter_engine" ]
25+
}
6126

62-
deps = [
63-
":flutter_tizen_headers",
64-
"//flutter/shell/platform/common/cpp:common_cpp",
65-
"//flutter/shell/platform/common/cpp:common_cpp_input",
66-
"//flutter/shell/platform/common/cpp/client_wrapper:client_wrapper",
67-
"//flutter/shell/platform/embedder:flutter_engine",
68-
"//third_party/rapidjson",
69-
]
27+
_public_headers = [
28+
"public/flutter_platform_view.h",
29+
"public/flutter_tizen_texture_registrar.h",
30+
"public/flutter_tizen.h",
31+
]
7032

33+
# Tizen native headers assume that the following include dirs are already
34+
# added to the compiler's search paths. Since we are not using the Tizen CLI
35+
# builder, we have to add them manually.
36+
config("tizen_rootstrap_include_dirs") {
7137
include_dirs = [
7238
"$custom_sysroot/usr/include",
7339
"$custom_sysroot/usr/include/appfw",
@@ -87,41 +53,169 @@ source_set("flutter_tizen") {
8753
"$custom_sysroot/usr/include/eo-1",
8854
"$custom_sysroot/usr/include/evas-1",
8955
"$custom_sysroot/usr/include/system",
90-
"$custom_sysroot/usr/include/wayland-extension"
56+
"$custom_sysroot/usr/include/wayland-extension",
57+
# For Evas_GL.
58+
"$custom_sysroot/usr/include/ecore-con-1",
59+
"$custom_sysroot/usr/include/ecore-file-1",
60+
"$custom_sysroot/usr/include/edje-1",
61+
"$custom_sysroot/usr/include/eet-1",
62+
"$custom_sysroot/usr/include/efl-1/interfaces",
63+
"$custom_sysroot/usr/include/efreet-1",
64+
"$custom_sysroot/usr/include/elementary-1",
65+
"$custom_sysroot/usr/include/ethumb-1",
66+
"$custom_sysroot/usr/include/ethumb-client-1",
9167
]
92-
93-
lib_dirs = [ root_out_dir, "$custom_sysroot/usr/lib" ]
9468

95-
cflags_cc = [
96-
"-Wno-newline-eof",
97-
"-Wno-macro-redefined",
98-
]
69+
lib_dirs = [ "$custom_sysroot/usr/lib" ]
70+
}
9971

100-
libs = [
101-
"base-utils-i18n",
102-
"capi-appfw-application",
103-
"capi-system-info",
104-
"capi-system-system-settings",
105-
"dlog",
106-
"ecore",
107-
"ecore_imf",
108-
"ecore_input",
109-
"eina",
110-
"EGL",
111-
"evas",
112-
"flutter_engine",
113-
"GLESv2",
114-
"tbm",
115-
"tdm-client",
116-
"wayland-client",
117-
]
72+
# Template for the embedder build. Used to generate embedders for different
73+
# device profiles. The output library name is "flutter_tizen_[profile]".
74+
#
75+
# If use_evas_gl_renderer is provided as true, the Evas_GL renderer is used,
76+
# otherwise the Ecore_Wl2 renderer is used.
77+
template("embedder_for_profile") {
78+
forward_variables_from(invoker, [ "use_evas_gl_renderer" ])
11879

119-
if (tizen_sdk_4) {
120-
sources += [ "tizen_renderer_ecore_wl.cc" ]
121-
libs += [ "ecore_wayland", "wayland-egl" ]
122-
defines = [ "FLUTTER_TIZEN_4" ]
123-
} else {
124-
sources += [ "tizen_renderer_ecore_wl2.cc" ]
125-
libs += [ "ecore_wl2" ]
80+
if (!defined(use_evas_gl_renderer)) {
81+
use_evas_gl_renderer = false
12682
}
83+
84+
shared_library("flutter_tizen_${target_name}") {
85+
public = _public_headers
86+
87+
sources = [
88+
"channels/key_event_channel.cc",
89+
"channels/lifecycle_channel.cc",
90+
"channels/localization_channel.cc",
91+
"channels/navigation_channel.cc",
92+
"channels/platform_channel.cc",
93+
"channels/platform_view_channel.cc",
94+
"channels/settings_channel.cc",
95+
"channels/text_input_channel.cc",
96+
"external_texture_gl.cc",
97+
"flutter_tizen.cc",
98+
"key_event_handler.cc",
99+
"tizen_embedder_engine.cc",
100+
"tizen_event_loop.cc",
101+
"tizen_log.cc",
102+
"tizen_renderer.cc",
103+
"touch_event_handler.cc",
104+
]
105+
106+
libs = [
107+
"base-utils-i18n",
108+
"capi-appfw-application",
109+
"capi-system-info",
110+
"capi-system-system-settings",
111+
"dlog",
112+
"ecore",
113+
"ecore_imf",
114+
"ecore_input",
115+
"eina",
116+
"evas",
117+
"EGL",
118+
"GLESv2",
119+
"tbm",
120+
"tdm-client",
121+
"wayland-client",
122+
]
123+
124+
defines = invoker.defines
125+
126+
if (use_evas_gl_renderer) {
127+
sources += [ "tizen_renderer_evas_gl.cc" ]
128+
129+
libs += [
130+
"ecore_evas",
131+
"elementary",
132+
]
133+
134+
defines += [ "TIZEN_RENDERER_EVAS_GL" ]
135+
} else {
136+
sources += [
137+
"tizen_renderer_ecore_wl2.cc",
138+
"tizen_vsync_waiter.cc",
139+
]
140+
141+
libs += [ "ecore_wl2" ]
142+
}
143+
144+
cflags_cc = [
145+
"-Wno-newline-eof",
146+
"-Wno-macro-redefined",
147+
]
148+
149+
configs += [
150+
":tizen_rootstrap_include_dirs",
151+
"//flutter/shell/platform/common/cpp:desktop_library_implementation"
152+
]
153+
154+
public_configs = [ "//flutter:config" ]
155+
156+
public_deps = [ ":flutter_engine" ]
157+
158+
deps = [
159+
"//flutter/shell/platform/common/cpp:common_cpp",
160+
"//flutter/shell/platform/common/cpp:common_cpp_input",
161+
"//flutter/shell/platform/common/cpp:common_cpp_library_headers",
162+
"//flutter/shell/platform/common/cpp/client_wrapper:client_wrapper",
163+
"//third_party/rapidjson",
164+
]
165+
}
166+
}
167+
168+
embedder_for_profile("mobile") {
169+
defines = [ "MOBILE_PROFILE" ]
170+
}
171+
172+
embedder_for_profile("wearable") {
173+
defines = [ "WEARABLE_PROFILE" ]
174+
175+
use_evas_gl_renderer = true
176+
}
177+
178+
embedder_for_profile("tv") {
179+
defines = [ "TV_PROFILE" ]
180+
}
181+
182+
embedder_for_profile("common") {
183+
defines = [ "COMMON_PROFILE" ]
184+
}
185+
186+
publish_client_wrapper_core("publish_cpp_client_wrapper") {
187+
visibility = [ ":*" ]
188+
}
189+
190+
_common_cpp_public_headers = [
191+
"//flutter/shell/platform/common/cpp/public/flutter_export.h",
192+
"//flutter/shell/platform/common/cpp/public/flutter_messenger.h",
193+
"//flutter/shell/platform/common/cpp/public/flutter_plugin_registrar.h",
194+
"//flutter/shell/platform/common/cpp/public/flutter_texture_registrar.h",
195+
]
196+
197+
copy("publish_headers_tizen") {
198+
sources = _public_headers + _common_cpp_public_headers
199+
200+
outputs = [ "$root_out_dir/public/{{source_file_part}}" ]
201+
}
202+
203+
copy("copy_icu") {
204+
visibility = [ ":*" ]
205+
206+
sources = [ "//third_party/icu/flutter/icudtl.dat" ]
207+
208+
outputs = [ "$root_out_dir/icu/{{source_file_part}}" ]
209+
}
210+
211+
group("tizen") {
212+
deps = [
213+
":flutter_tizen_mobile",
214+
":flutter_tizen_wearable",
215+
":flutter_tizen_tv",
216+
":flutter_tizen_common",
217+
":publish_cpp_client_wrapper",
218+
":publish_headers_tizen",
219+
":copy_icu",
220+
]
127221
}

0 commit comments

Comments
 (0)