@@ -16,9 +16,16 @@ import("//build/flutter.gni")
16
16
import (" //build/packaging.gni" )
17
17
import (" //library/engine.gni" )
18
18
19
+ declare_args () {
20
+ # Whether to use the GLFW embedding implementation. Currently overriding this
21
+ # would not work since each platform only has one working implementation,
22
+ # but in the future GLFW may be one of multiple supported implementations.
23
+ use_glfw = is_linux || is_win
24
+ }
25
+
19
26
published_shared_library (" flutter_embedder" ) {
20
27
# GLFW embedding implementation.
21
- if (is_linux || is_win ) {
28
+ if (use_glfw ) {
22
29
public = [
23
30
" include/flutter_desktop_embedding/glfw/embedder.h" ,
24
31
" include/flutter_desktop_embedding/glfw/flutter_window_controller.h" ,
@@ -64,7 +71,7 @@ published_shared_library("flutter_embedder") {
64
71
}
65
72
66
73
deps = [
67
- " :fetch_flutter_engine " ,
74
+ " :flutter_engine " ,
68
75
]
69
76
70
77
defines = [ " FLUTTER_DESKTOP_EMBEDDING_IMPL" ]
@@ -74,31 +81,30 @@ published_shared_library("flutter_embedder") {
74
81
public_configs = [ " :relative_public_headers" ]
75
82
76
83
if (is_linux ) {
77
- libs = [ " GL" ]
78
-
79
- deps += [ " //library/linux:publish_flutter_engine" ]
80
-
81
- configs += [
82
- " //build/linux/config:epoxy" ,
83
- " //build/linux/config:glfw3" ,
84
- " //build/linux/config:gtk3" ,
85
- " //build/linux/config:jsoncpp" ,
86
- " //build/linux/config:x11" ,
87
- ]
84
+ configs += [ " //build/linux/config:jsoncpp" ]
88
85
}
89
86
90
87
if (is_win ) {
91
- deps += [
92
- " //library/windows:fetch_glfw" ,
93
- " //library/windows:publish_flutter_engine" ,
94
- " //third_party/jsoncpp:jsoncpp" ,
95
- ]
88
+ deps += [ " //third_party/jsoncpp:jsoncpp" ]
96
89
97
90
libs = [ engine_files [2 ] ]
91
+ }
98
92
99
- public_configs += [
100
- " //library/windows:relative_glfw_dependencies" ,
101
- ]
93
+ if (use_glfw ) {
94
+ if (is_linux ) {
95
+ libs = [ " GL" ]
96
+
97
+ configs += [
98
+ " //build/linux/config:epoxy" ,
99
+ " //build/linux/config:glfw3" ,
100
+ " //build/linux/config:gtk3" ,
101
+ " //build/linux/config:x11" ,
102
+ ]
103
+ }
104
+
105
+ if (is_win ) {
106
+ deps += [ " //library/windows:fetch_glfw" ]
107
+ }
102
108
}
103
109
}
104
110
@@ -114,6 +120,13 @@ config("relative_engine_headers") {
114
120
include_dirs = [ " $engine_download_dir " ]
115
121
}
116
122
123
+ group (" flutter_engine" ) {
124
+ public_deps = [
125
+ " :fetch_flutter_engine" ,
126
+ " :publish_flutter_engine" ,
127
+ ]
128
+ }
129
+
117
130
action (" fetch_flutter_engine" ) {
118
131
script = " //tools/dart_tools/bin/update_flutter_engine.dart"
119
132
inputs = [
@@ -126,3 +139,20 @@ action("fetch_flutter_engine") {
126
139
]
127
140
public_configs = [ " :relative_engine_headers" ]
128
141
}
142
+
143
+ # Places the downloaded Flutter engine library at the top level of the
144
+ # output directory where built libraries go, so that it doesn't require
145
+ # special link handling, and publishes its header.
146
+ copy (" publish_flutter_engine" ) {
147
+ sources = engine_files
148
+
149
+ # Remove the header, since "SDK" clients don't need access to that.
150
+ sources -= [ engine_files [0 ] ]
151
+
152
+ outputs = [
153
+ " $root_out_dir /{{source_file_part}}" ,
154
+ ]
155
+ deps = [
156
+ " :fetch_flutter_engine" ,
157
+ ]
158
+ }
0 commit comments