diff --git a/build/win/config/BUILD.gn b/build/win/config/BUILD.gn deleted file mode 100644 index 525930bd1..000000000 --- a/build/win/config/BUILD.gn +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//library/windows/glfw.gni") - -config("glfw3") { - libs = [ - "$glfw_lib_name", - "opengl32.lib", - - "user32.lib", - "gdi32.lib", - "shell32.lib", - ] -} diff --git a/library/BUILD.gn b/library/BUILD.gn index 12929894f..4b1efa9d9 100644 --- a/library/BUILD.gn +++ b/library/BUILD.gn @@ -16,9 +16,16 @@ import("//build/flutter.gni") import("//build/packaging.gni") import("//library/engine.gni") +declare_args() { + # Whether to use the GLFW embedding implementation. Currently overriding this + # would not work since each platform only has one working implementation, + # but in the future GLFW may be one of multiple supported implementations. + use_glfw = is_linux || is_win +} + published_shared_library("flutter_embedder") { # GLFW embedding implementation. - if (is_linux || is_win) { + if (use_glfw) { public = [ "include/flutter_desktop_embedding/glfw/embedder.h", "include/flutter_desktop_embedding/glfw/flutter_window_controller.h", @@ -64,7 +71,7 @@ published_shared_library("flutter_embedder") { } deps = [ - ":fetch_flutter_engine", + ":flutter_engine", ] defines = [ "FLUTTER_DESKTOP_EMBEDDING_IMPL" ] @@ -74,31 +81,30 @@ published_shared_library("flutter_embedder") { public_configs = [ ":relative_public_headers" ] if (is_linux) { - libs = [ "GL" ] - - deps += [ "//library/linux:publish_flutter_engine" ] - - configs += [ - "//build/linux/config:epoxy", - "//build/linux/config:glfw3", - "//build/linux/config:gtk3", - "//build/linux/config:jsoncpp", - "//build/linux/config:x11", - ] + configs += [ "//build/linux/config:jsoncpp" ] } if (is_win) { - deps += [ - "//library/windows:fetch_glfw", - "//library/windows:publish_flutter_engine", - "//third_party/jsoncpp:jsoncpp", - ] + deps += [ "//third_party/jsoncpp:jsoncpp" ] libs = [ engine_files[2] ] + } - public_configs += [ - "//library/windows:relative_glfw_dependencies", - ] + if (use_glfw) { + if (is_linux) { + libs = [ "GL" ] + + configs += [ + "//build/linux/config:epoxy", + "//build/linux/config:glfw3", + "//build/linux/config:gtk3", + "//build/linux/config:x11", + ] + } + + if (is_win) { + deps += [ "//library/windows:fetch_glfw" ] + } } } @@ -114,6 +120,13 @@ config("relative_engine_headers") { include_dirs = [ "$engine_download_dir" ] } +group("flutter_engine") { + public_deps = [ + ":fetch_flutter_engine", + ":publish_flutter_engine", + ] +} + action("fetch_flutter_engine") { script = "//tools/dart_tools/bin/update_flutter_engine.dart" inputs = [ @@ -126,3 +139,20 @@ action("fetch_flutter_engine") { ] public_configs = [ ":relative_engine_headers" ] } + +# Places the downloaded Flutter engine library at the top level of the +# output directory where built libraries go, so that it doesn't require +# special link handling, and publishes its header. +copy("publish_flutter_engine") { + sources = engine_files + + # Remove the header, since "SDK" clients don't need access to that. + sources -= [ engine_files[0] ] + + outputs = [ + "$root_out_dir/{{source_file_part}}", + ] + deps = [ + ":fetch_flutter_engine", + ] +} diff --git a/library/linux/BUILD.gn b/library/linux/BUILD.gn deleted file mode 100644 index e11322f55..000000000 --- a/library/linux/BUILD.gn +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/packaging.gni") -import("//library/engine.gni") - -copy_includes("_publish_engine_headers") { - sources = [ - engine_files[0], - ] - deps = [ - "//library:fetch_flutter_engine", - ] -} - -# Places the downloaded Flutter engine library at the top level of the -# output directory where built libraries go, so that it doesn't require -# special link handling, and publishes its header. -copy("publish_flutter_engine") { - sources = [ - engine_files[1], - ] - outputs = [ - "$root_out_dir/{{source_file_part}}", - ] - deps = [ - ":_publish_engine_headers", - "//library:fetch_flutter_engine", - ] -} diff --git a/library/windows/BUILD.gn b/library/windows/BUILD.gn index 06608b522..0b69dfac3 100644 --- a/library/windows/BUILD.gn +++ b/library/windows/BUILD.gn @@ -12,46 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/packaging.gni") -import("//library/engine.gni") import("//library/windows/glfw.gni") action("fetch_glfw") { script = "//tools/dart_tools/bin/fetch_glfw.dart" outputs = glfw_files args = [ rebase_path(glfw_download_dir, root_build_dir) ] - public_configs = [ "//build/win/config:glfw3" ] + public_configs = [ ":glfw3" ] } -config("relative_glfw_dependencies") { - include_dirs = [ glfw_include_dir ] - lib_dirs = [ glfw_download_dir ] -} +config("glfw3") { + libs = [ + "$glfw_lib_name", + "opengl32.lib", -copy_includes("_publish_engine_headers") { - sources = [ - engine_files[0], - ] - deps = [ - "//library:fetch_flutter_engine", - ] -} - -# Places the downloaded Flutter engine library at the top level of the -# output directory where built libraries go, so that it doesn't require -# special link handling, and publishes its header. -copy("publish_flutter_engine") { - sources = [ - engine_files[1], - engine_files[2], - engine_files[3], - engine_files[4], - ] - outputs = [ - "$root_out_dir/{{source_file_part}}", - ] - deps = [ - ":_publish_engine_headers", - "//library:fetch_flutter_engine", + "user32.lib", + "gdi32.lib", + "shell32.lib", ] + lib_dirs = [ glfw_download_dir ] + include_dirs = [ glfw_include_dir ] }