GN: Make X11 optional, based on a user-defined variable.

Not all Linux platforms will have X11 available (Wayland, GGP), so we have to
declare a variable that checks use_x11 separately.

Bug: angleproject:4116
Change-Id: I7e33956da6344b8db4d4e32dbbd1b42f58f7019c
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1919632
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Ethan Lee 2019-11-15 12:26:39 -05:00 коммит произвёл Commit Bot
Родитель 53e4536092
Коммит d22b8be4b4
6 изменённых файлов: 25 добавлений и 14 удалений

Просмотреть файл

@ -60,3 +60,4 @@ Till Rathmann
Nick Shaforostov
Jaime Bernardo
Le Hoang Quyen
Ethan Lee

Просмотреть файл

@ -20,7 +20,7 @@ if (angle_has_build) {
declare_args() {
# Use the PCI lib to collect GPU information on Linux.
use_libpci = is_linux && (!is_chromecast || is_cast_desktop_build) &&
(use_x11 || use_ozone)
(angle_use_x11 || use_ozone)
# Link in system libGL, to work with apitrace. See doc/DebuggingTips.md.
angle_link_glx = false
@ -380,7 +380,7 @@ angle_static_library("angle_gpu_info_util") {
if (is_linux || is_fuchsia) {
sources += libangle_gpu_info_util_linux_sources
if (use_x11) {
if (angle_use_x11) {
sources += libangle_gpu_info_util_x11_sources
deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
defines += [ "GPU_INFO_USE_X11" ]
@ -582,7 +582,7 @@ config("libANGLE_config") {
}
}
if (use_x11) {
if (angle_use_x11) {
defines += [ "ANGLE_USE_X11" ]
}
}
@ -689,7 +689,7 @@ angle_source_set("libANGLE_base") {
if (is_win) {
sources += libangle_gl_wgl_sources
}
if (use_x11) {
if (angle_use_x11) {
sources += libangle_gl_glx_sources
deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ]
libs += [
@ -1062,7 +1062,7 @@ angle_source_set("angle_util_loader") {
config("angle_util_config") {
include_dirs = [ "." ]
if (is_linux && use_x11) {
if (is_linux && angle_use_x11) {
libs = [ "X11" ]
}
}
@ -1112,7 +1112,7 @@ foreach(is_shared_library,
]
}
if (use_x11) {
if (angle_use_x11) {
sources += util_x11_sources
}

Просмотреть файл

@ -0,0 +1,7 @@
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//gni/angle.gni")
vulkan_use_x11 = angle_use_x11

Просмотреть файл

@ -21,6 +21,8 @@ if (angle_has_build) {
if (is_win) {
import("//build/config/win/visual_studio_version.gni")
}
angle_use_x11 = use_x11 && !is_ggp
} else {
declare_args() {
is_ubsan = false
@ -28,7 +30,7 @@ if (angle_has_build) {
is_asan = false
build_with_chromium = false
dcheck_always_on = false
use_x11 = is_linux
angle_use_x11 = is_linux && !is_ggp
use_ozone = false
use_fuzzing_engine = false
}
@ -84,16 +86,17 @@ declare_args() {
angle_enable_d3d9 = is_win && !angle_is_winuwp
angle_enable_d3d11 = is_win
angle_enable_gl =
(ozone_platform_gbm || !is_linux || (use_x11 && !is_chromeos)) &&
!is_fuchsia && !angle_is_winuwp
(ozone_platform_gbm || !is_linux || (angle_use_x11 && !is_chromeos)) &&
!is_fuchsia && !angle_is_winuwp && !is_ggp
# ANGLE Vulkan backend on Android requires API level 26, i.e. Oreo, due to
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
# Otherwise, API level 24 would have been enough.
angle_enable_vulkan =
angle_has_build &&
((is_win && !angle_is_winuwp) || (is_linux && use_x11 && !is_chromeos) ||
(is_android && ndk_api_level_at_least_26) || is_fuchsia)
((is_win && !angle_is_winuwp) ||
(is_linux && angle_use_x11 && !is_chromeos) ||
(is_android && ndk_api_level_at_least_26) || is_fuchsia || is_ggp)
angle_enable_null = true
angle_enable_essl = true
angle_enable_glsl = true

Просмотреть файл

@ -19,7 +19,7 @@ declare_args() {
# Currently SwiftShader's Vulkan front-end doesn't build on Android.
# SwiftShader is not needed on Fuchsia because Vulkan is supported on all
# devices that run Fuchsia.
angle_swiftshader = !is_android && !is_fuchsia
angle_swiftshader = !is_android && !is_fuchsia && !is_ggp
}
_vulkan_backend_sources = [
@ -119,7 +119,7 @@ if (is_win) {
]
}
if (is_linux) {
if (angle_use_x11) {
_vulkan_backend_sources += [
"xcb/DisplayVkXcb.cpp",
"xcb/DisplayVkXcb.h",

Просмотреть файл

@ -131,7 +131,7 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) {
if (is_win) {
sources += angle_end2end_tests_win_sources
}
if (use_x11) {
if (angle_use_x11) {
sources += angle_end2end_tests_x11_sources
}
if (angle_enable_vulkan) {