Hook up more GN toolkit and UI-based flags.

This renames the hack "my_msvs" project to "feature_flags" and creates an include file that gives the proper definitions of most of the UI-related feature and OS flags. Hook these flags up the build.

Review URL: https://codereview.chromium.org/160143002

git-svn-id: http://src.chromium.org/svn/trunk/src/build@250692 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
brettw@chromium.org 2014-02-12 11:34:25 +00:00
Родитель d2dedb2c78
Коммит d80637fd4a
4 изменённых файлов: 88 добавлений и 24 удалений

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

@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/ui.gni")
declare_args() {
# When set, turns off the (normally-on) iterator debugging and related stuff
# that is normall turned on for Debug builds. These are generally useful for
@ -9,11 +11,17 @@ declare_args() {
disable_iterator_debugging = false
}
# TODO(brettw) this is a hack to set the feature flags we use.
config("my_msvs") {
# TODO(brettw) Most of these should be removed. Instead of global feature
# flags, we should have more modular flags that apply only to a target and its
# dependents. For example, depending on the "x11" meta-target should define
# USE_X11 for all dependents so that everything that could use X11 gets the
# define, but anything that doesn't depend on X11 doesn't see it.
#
# For now we define these globally to match the current GYP build.
config("feature_flags") {
# TODO(brettw) most of these need to be parameterized.
defines = [
"CHROMIUM_BUILD",
"TOOLKIT_VIEWS=1",
"USE_LIBJPEG_TURBO=1",
"ENABLE_ONE_CLICK_SIGNIN",
"ENABLE_REMOTING=1",
@ -40,12 +48,24 @@ config("my_msvs") {
"ENABLE_MANAGED_USERS=1",
]
if (toolkit_views) {
defines += [ "TOOLKIT_VIEWS=1" ]
}
if (use_ash) {
defines += [ "USE_ASH=1" ]
}
if (use_aura) {
defines += [ "USE_AURA=1" ]
}
}
config("feature_flags") {
if (use_glib) {
defines += [ "USE_GLIB=1" ]
}
if (use_ozone) {
defines += [ "USE_OZONE=1" ]
}
if (use_x11) {
defines += [ "USE_X11=1" ]
}
}
# Debug/release ----------------------------------------------------------------

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

@ -33,16 +33,6 @@ declare_args() {
# to configure warnings.
is_clang = false
# ASH is enabled.
# TODO(brettw) this should be moved out of the main build config file.
use_ash = false
# Aura is enabled.
# TODO(brettw) this should be moved out of the main build config file.
use_aura = false
# Ozone is enabled.
# TODO(brettw) this should be moved out of the main build config file.
use_ozone = false
# Forces a 64-bit build on Windows. Does nothing on other platforms. Normally
# we build 32-bit on Windows regardless of the current host OS bit depth.
# Setting this flag will override this logic and generate 64-bit toolchains.
@ -113,9 +103,6 @@ if (os == "win") {
is_nacl = false
is_posix = false
is_win = true
# Windows currelty implies Aura.
use_aura = true
} else if (os == "mac") {
is_android = false
is_chromeos = false
@ -313,8 +300,6 @@ if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
is_clang = true
}
toolkit_uses_gtk = is_linux
# =============================================================================
# TARGET DEFAULTS
# =============================================================================
@ -327,7 +312,7 @@ toolkit_uses_gtk = is_linux
# Holds all configs used for making native executables and libraries, to avoid
# duplication in each target below.
native_compiler_configs = [
"//build/config:my_msvs", # TODO(brettw) eraseme
"//build/config:feature_flags",
"//build/config/compiler:compiler",
"//build/config/compiler:chromium_code",

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

@ -45,7 +45,6 @@ pkg_config("gtk") {
# Gtk requires gmodule, but it does not list it as a dependency in some
# misconfigured systems.
packages = [ "gmodule-2.0", "gtk+-2.0", "gthread-2.0" ]
defines = [ "TOOLKIT_GTK" ]
}
pkg_config("pangocairo") {
@ -59,7 +58,6 @@ pkg_config("udev") {
config("x11") {
# Don't bother running pkg-config for these X related libraries since it just
# returns the same libs, and forking pkg-config is slow.
defines = [ "USE_X11" ]
libs = [
"X11",
"Xcomposite",

61
config/ui.gni Normal file
Просмотреть файл

@ -0,0 +1,61 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file contains UI-related build flags. It should theoretically be in the
# src/ui directory and only things that depend on the ui module should get the
# definitions.
#
# However, today we have many "bad" dependencies on some of these flags from,
# e.g. base, so they need to be global.
declare_args() {
# True means the UI is built useing the "views" framework.
toolkit_views = false
# Indicates if Ash is enabled. Ash is the Aura SHell which provides a
# desktop-like environment for Aura. Requires use_aura = true
use_ash = false
# Indicates if Aura is enabled. Aura is a low-level windowing library, sort
# of a replacement for GDI or GTK.
use_aura = false
# Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
# that does not require X11.
use_ozone = false
}
if (is_win || is_chromeos) {
# Windows currelty implies Aura.
# TODO(brettw) bug 342937 move to declare_args block.
use_ash = true
use_aura = true
}
if (is_linux || use_ozone) {
use_aura = true
}
if (!use_aura) {
use_ash = false # Ash needs Aura.
}
# TODO(brettw) bug 342937 move this to the declare_args block above when this
# is supported. It would look like:
# toolkit_views = is_win || is_chromeos || use_aura
if (is_win || is_chromeos || use_aura) {
toolkit_views = true
}
# Additional dependent variables -----------------------------------------------
#
# These variables depend on other variables and can't be set externally.
# Indicates if the UI toolkit depends on GTK.
toolkit_uses_gtk = is_linux && !is_chromeos && !use_aura && !use_ozone
# Indicates if the UI toolkit depends on X11.
use_x11 = is_linux && !use_ozone
use_glib = is_linux