Skip to content

Consolidate GN rules #268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 5, 2019
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
26 changes: 0 additions & 26 deletions build/win/config/BUILD.gn

This file was deleted.

72 changes: 51 additions & 21 deletions library/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -64,7 +71,7 @@ published_shared_library("flutter_embedder") {
}

deps = [
":fetch_flutter_engine",
":flutter_engine",
]

defines = [ "FLUTTER_DESKTOP_EMBEDDING_IMPL" ]
Expand All @@ -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" ]
}
}
}

Expand All @@ -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 = [
Expand All @@ -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",
]
}
41 changes: 0 additions & 41 deletions library/linux/BUILD.gn

This file was deleted.

42 changes: 10 additions & 32 deletions library/windows/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
}