diff --git a/shell/platform/glfw/config.gni b/shell/platform/glfw/config.gni index 8ac933d8dc1e3..3e636c8239143 100644 --- a/shell/platform/glfw/config.gni +++ b/shell/platform/glfw/config.gni @@ -9,5 +9,5 @@ declare_args() { # but it can be enabled for supported platforms (Windows, macOS, and Linux) # as an extra build artifact with this flag. The native toolkit shell will # still be built as well. - build_glfw_shell = is_linux || is_win + build_glfw_shell = (is_linux || is_win) && current_toolchain == host_toolchain } diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index a86fe7927e16c..b60e7e35242d8 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -4,13 +4,17 @@ assert(is_linux) +import("$flutter_root/shell/platform/glfw/config.gni") + group("linux") { - deps = [ - ":flutter_linux", - "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper", - "$flutter_root/shell/platform/glfw:publish_headers_glfw", - "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw", - ] + if (build_glfw_shell) { + deps = [ + ":flutter_linux", + "$flutter_root/shell/platform/common/cpp/client_wrapper:publish_wrapper", + "$flutter_root/shell/platform/glfw:publish_headers_glfw", + "$flutter_root/shell/platform/glfw/client_wrapper:publish_wrapper_glfw", + ] + } } # Temporary workraround for the issue describe in @@ -23,12 +27,14 @@ config("disable_fatal_link_warnings") { ldflags = [ "-Wl,--no-fatal-warnings" ] } -shared_library("flutter_linux") { - deps = [ - "$flutter_root/shell/platform/glfw:flutter_glfw", - ] +if (build_glfw_shell) { + shared_library("flutter_linux") { + deps = [ + "$flutter_root/shell/platform/glfw:flutter_glfw", + ] - configs += [ ":disable_fatal_link_warnings" ] + configs += [ ":disable_fatal_link_warnings" ] - public_configs = [ "$flutter_root:config" ] + public_configs = [ "$flutter_root:config" ] + } }