-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
+# Copyright (c) 2013 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.
-config("nacl_defines") {
+import("./allocator.gni")
+import("./crypto.gni")
+import("./features.gni")
+import("./ui.gni")
+
+declare_args() {
+ # When set, turns off the (normally-on) iterator debugging and related stuff
+ # that is normally turned on for Debug builds. These are generally useful for
+ # catching bugs but in some cases may cause conflicts or excessive slowness.
+ disable_iterator_debugging = false
+
+ # Set to true to not store any build metadata (this isn't working yet but
+ # this flag will help us to get there). See http://crbug.com/314403.
+ # TODO(sebmarchand): Update this comment once this flag guarantee that
+ # there's no build metadata in the build artifacts.
+ dont_embed_build_metadata = false
+}
+
+# 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 = [
- "NACL_ANDROID=0",
- "NACL_ENABLE_TMPFS_REDIRECT_VAR=0",
- "_BSD_SOURCE=1",
- "_POSIX_C_SOURCE=199506",
- "_XOPEN_SOURCE=600",
- "_GNU_SOURCE=1",
- "_LARGEFILE64_SOURCE=1",
- "__STDC_LIMIT_MACROS=1",
- "__STDC_FORMAT_MACROS=1",
+ "CHROMIUM_BUILD",
+ "ENABLE_ONE_CLICK_SIGNIN",
+ "ENABLE_REMOTING=1",
+ "ENABLE_NOTIFICATIONS",
+ "ENABLE_EGLIMAGE=1",
+ "ENABLE_BACKGROUND=1",
+ "ENABLE_GOOGLE_NOW=1",
+ "ENABLE_SETTINGS_APP=1",
+ "USE_MOJO=1",
+ "V8_DEPRECATION_WARNINGS", # Don't use deprecated V8 APIs anywhere.
+ # Temporary suppression until Blink code can be removed.
+ "BLINK_SCALE_FILTERS_AT_RECORD_TIME",
]
- if (is_win) {
- defines += ["NACL_WINDOWS=1"]
- } else {
- defines += ["NACL_WINDOWS=0"]
+ if (cld_version > 0) {
+ defines += [ "CLD_VERSION=$cld_version" ]
}
-
- if (is_linux) {
- defines += ["NACL_LINUX=1"]
- } else {
- defines += ["NACL_LINUX=0"]
+ if (enable_mdns) {
+ defines += [ "ENABLE_MDNS=1" ]
}
-
- if (is_mac) {
- defines += ["NACL_OSX=1"]
- } else {
- defines += ["NACL_OSX=0"]
+ if (enable_pepper_cdms) {
+ # TODO(brettw) should probably be "=1"
+ defines += [ "ENABLE_PEPPER_CDMS" ]
}
-
- if (cpu_arch == "arm") {
- defines += [
- "NACL_TARGET_ARCH=arm",
- "NACL_TARGET_SUBARCH=32",
- "NACL_BUILD_ARCH=arm",
- "NACL_BUILD_SUBARCH=32"
- ]
+ if (enable_plugins) {
+ defines += [ "ENABLE_PLUGINS=1" ]
}
-
- if (cpu_arch == "mips") {
- defines += [
- "NACL_TARGET_ARCH=mips",
- "NACL_TARGET_SUBARCH=32",
- "NACL_BUILD_ARCH=mips",
- "NACL_BUILD_SUBARCH=32"
- ]
+ if (enable_printing > 0) {
+ defines += [ "ENABLE_PRINTING=1" ]
+ if (enable_printing < 2) {
+ defines += [ "ENABLE_FULL_PRINTING=1" ]
+ }
}
-
- if (cpu_arch == "x86") {
- defines += [
- "NACL_TARGET_ARCH=x86",
- "NACL_TARGET_SUBARCH=32",
- "NACL_BUILD_ARCH=x86",
- "NACL_BUILD_SUBARCH=32",
- ]
+ if (enable_spellcheck) {
+ defines += [ "ENABLE_SPELLCHECK=1" ]
}
-
- if (cpu_arch == "x64") {
- defines += [
- "NACL_TARGET_ARCH=x86",
- "NACL_TARGET_SUBARCH=64",
- "NACL_BUILD_ARCH=x86",
- "NACL_BUILD_SUBARCH=64"
- ]
+ if (dont_embed_build_metadata) {
+ defines += [ "DONT_EMBED_BUILD_METADATA" ]
+ }
+ if (use_udev) {
+ # TODO(brettw) should probably be "=1".
+ defines += [ "USE_UDEV" ]
+ }
+ if (toolkit_views) {
+ defines += [ "TOOLKIT_VIEWS=1" ]
+ }
+ if (ui_compositor_image_transport) {
+ # TODO(brettw) should probably be "=1".
+ defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
+ }
+ if (use_ash) {
+ defines += [ "USE_ASH=1" ]
+ }
+ if (use_aura) {
+ defines += [ "USE_AURA=1" ]
+ }
+ if (use_cairo) {
+ defines += [ "USE_CAIRO=1" ]
+ }
+ if (use_clipboard_aurax11) {
+ defines += [ "USE_CLIPBOARD_AURAX11=1" ]
+ }
+ if (use_default_render_theme) {
+ defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
+ }
+ if (use_glib) {
+ defines += [ "USE_GLIB=1" ]
+ }
+ if (use_openssl) {
+ defines += [ "USE_OPENSSL=1" ]
+ if (use_openssl_certs) {
+ defines += [ "USE_OPENSSL_CERTS=1" ]
+ }
+ } else if (use_nss_certs) {
+ # USE_NSS really means "use nss for certificate validation and storage"
+ # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
+ # to rename this but we're hoping to transition away from NSS.
+ defines += [ "USE_NSS=1" ]
+ }
+ if (use_ozone) {
+ defines += [ "USE_OZONE=1" ]
+ }
+ if (use_x11) {
+ defines += [ "USE_X11=1" ]
+ if (use_xi2_mt > 0) {
+ defines += [ "USE_XI2_MT=$use_xi2_mt" ]
+ }
+ }
+ if (use_allocator != "tcmalloc") {
+ defines += [ "NO_TCMALLOC" ]
+ }
+ if (enable_webrtc) {
+ defines += [ "ENABLE_WEBRTC=1" ]
+ }
+ if (disable_ftp_support) {
+ defines += [ "DISABLE_FTP_SUPPORT=1" ]
+ }
+ if (!enable_nacl) {
+ defines += [ "DISABLE_NACL" ]
+ }
+ if (enable_extensions) {
+ defines += [ "ENABLE_EXTENSIONS=1" ]
+ }
+ if (enable_configuration_policy) {
+ defines += [ "ENABLE_CONFIGURATION_POLICY" ]
+ }
+ if (enable_task_manager) {
+ defines += [ "ENABLE_TASK_MANAGER=1" ]
+ }
+ if (enable_themes) {
+ defines += [ "ENABLE_THEMES=1" ]
+ }
+ if (is_win && win_pdf_metafile_for_printing) {
+ defines += [ "WIN_PDF_METAFILE_FOR_PRINTING=1" ]
+ }
+ if (enable_captive_portal_detection) {
+ defines += [ "ENABLE_CAPTIVE_PORTAL_DETECTION=1" ]
+ }
+ if (enable_session_service) {
+ defines += [ "ENABLE_SESSION_SERVICE=1" ]
+ }
+ if (enable_rlz) {
+ defines += [ "ENABLE_RLZ" ]
+ }
+ if (enable_plugin_installation) {
+ defines += [ "ENABLE_PLUGIN_INSTALLATION=1" ]
+ }
+ if (enable_app_list) {
+ defines += [ "ENABLE_APP_LIST=1" ]
+ }
+ if (enable_managed_users) {
+ defines += [ "ENABLE_MANAGED_USERS=1" ]
+ }
+ if (enable_service_discovery) {
+ defines += [ "ENABLE_SERVICE_DISCOVERY=1" ]
+ }
+ if (enable_autofill_dialog) {
+ defines += [ "ENABLE_AUTOFILL_DIALOG=1" ]
+ }
+ if (enable_wifi_bootstrapping) {
+ defines += [ "ENABLE_WIFI_BOOTSTRAPPING=1" ]
}
-
- include_dirs = ["//."]
}
+# Debug/release ----------------------------------------------------------------
+
config("debug") {
defines = [
"_DEBUG",
- "DEBUG",
"DYNAMIC_ANNOTATIONS_ENABLED=1",
+ "WTF_USE_DYNAMIC_ANNOTATIONS=1",
]
+
+ if (is_win) {
+ if (disable_iterator_debugging) {
+ # Iterator debugging is enabled by the compiler on debug builds, and we
+ # have to tell it to turn it off.
+ defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
+ }
+ } else if (is_linux && !is_android && cpu_arch == "x64" &&
+ !disable_iterator_debugging) {
+ # Enable libstdc++ debugging facilities to help catch problems early, see
+ # http://crbug.com/65151 .
+ # TODO(phajdan.jr): Should we enable this for all of POSIX?
+ defines += [ "_GLIBCXX_DEBUG=1" ]
+ }
}
config("release") {
- defines = [
- "NDEBUG"
- ]
}
# Default libraries ------------------------------------------------------------
+
# This config defines the default libraries applied to all targets.
config("default_libs") {
- if (os == "win") {
+ if (is_win) {
+ # TODO(brettw) this list of defaults should probably be smaller, and
+ # instead the targets that use the less common ones (e.g. wininet or
+ # winspool) should include those explicitly.
+ libs = [
+ "advapi32.lib",
+ "comdlg32.lib",
+ "dbghelp.lib",
+ "delayimp.lib",
+ "dnsapi.lib",
+ "gdi32.lib",
+ "kernel32.lib",
+ "msimg32.lib",
+ "odbc32.lib",
+ "odbccp32.lib",
+ "ole32.lib",
+ "oleaut32.lib",
+ "psapi.lib",
+ "shell32.lib",
+ "shlwapi.lib",
+ "user32.lib",
+ "usp10.lib",
+ "uuid.lib",
+ "version.lib",
+ "wininet.lib",
+ "winmm.lib",
+ "winspool.lib",
+ "ws2_32.lib",
+ # Please don't add more stuff here. We should actually be making this
+ # list smaller, since all common things should be covered. If you need
+ # some extra libraries, please just add a libs = [ "foo.lib" ] to your
+ # target that needs it.
+ ]
+ } else if (is_android) {
+ # Android uses -nostdlib so we need to add even libc here.
+ libs = [
+ # TODO(brettw) write a version of this, hopefully we can express this
+ # without forking out to GCC just to get the library name. The android
+ # toolchain directory should probably be extracted into a .gni file that
+ # this file and the android toolchain .gn file can share.
+ # # Manually link the libgcc.a that the cross compiler uses.
+ # '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
+ "c",
+ "dl",
+ "m"
+ ]
+ } else if (is_mac) {
libs = [
+ "AppKit.framework",
+ "ApplicationServices.framework",
+ "Carbon.framework",
+ "CoreFoundation.framework",
+ "Foundation.framework",
+ "IOKit.framework",
+ "Security.framework",
]
- } else if (os == "linux") {
+ } else if (is_ios) {
libs = [
+ "CoreFoundation.framework",
+ "CoreGraphics.framework",
+ "CoreText.framework",
+ "Foundation.framework",
+ "UIKit.framework",
]
- } else if (os == "mac") {
+ } else if (is_linux) {
libs = [
+ "dl",
]
}
}