Home | History | Annotate | Download | only in config
      1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import("//build/config/allocator.gni")
      6 import("//build/config/crypto.gni")
      7 import("//build/config/features.gni")
      8 import("//build/config/ui.gni")
      9 
     10 declare_args() {
     11   # When set, turns off the (normally-on) iterator debugging and related stuff
     12   # that is normally turned on for Debug builds. These are generally useful for
     13   # catching bugs but in some cases may cause conflicts or excessive slowness.
     14   disable_iterator_debugging = false
     15 
     16   # Set to true to not store any build metadata (this isn't working yet but
     17   # this flag will help us to get there). See http://crbug.com/314403.
     18   # TODO(sebmarchand): Update this comment once this flag guarantee that
     19   #     there's no build metadata in the build artifacts.
     20   dont_embed_build_metadata = false
     21 }
     22 
     23 # TODO(brettw) Most of these should be removed. Instead of global feature
     24 # flags, we should have more modular flags that apply only to a target and its
     25 # dependents. For example, depending on the "x11" meta-target should define
     26 # USE_X11 for all dependents so that everything that could use X11 gets the
     27 # define, but anything that doesn't depend on X11 doesn't see it.
     28 #
     29 # For now we define these globally to match the current GYP build.
     30 config("feature_flags") {
     31   # TODO(brettw) most of these need to be parameterized.
     32   defines = [
     33       "CHROMIUM_BUILD",
     34       "ENABLE_ONE_CLICK_SIGNIN",
     35       "ENABLE_REMOTING=1",
     36       "ENABLE_CONFIGURATION_POLICY",
     37       "ENABLE_NOTIFICATIONS",
     38       "ENABLE_EGLIMAGE=1",
     39       "ENABLE_TASK_MANAGER=1",
     40       "ENABLE_EXTENSIONS=1",
     41       "ENABLE_PLUGIN_INSTALLATION=1",
     42       "ENABLE_SESSION_SERVICE=1",
     43       "ENABLE_THEMES=1",
     44       "ENABLE_AUTOFILL_DIALOG=1",
     45       "ENABLE_BACKGROUND=1",
     46       "ENABLE_GOOGLE_NOW=1",
     47       "ENABLE_CAPTIVE_PORTAL_DETECTION=1",
     48       "ENABLE_APP_LIST=1",
     49       "ENABLE_SETTINGS_APP=1",
     50       "ENABLE_MANAGED_USERS=1",
     51       "ENABLE_SERVICE_DISCOVERY=1",
     52       "USE_MOJO=1",
     53       "V8_DEPRECATION_WARNINGS",  # Don't use deprecated V8 APIs anywhere.
     54       # Temporary suppression until Blink code can be removed.
     55       "BLINK_SCALE_FILTERS_AT_RECORD_TIME",
     56   ]
     57 
     58   if (cld_version > 0) {
     59     defines += [ "CLD_VERSION=$cld_version" ]
     60   }
     61   if (enable_mdns) {
     62     defines += [ "ENABLE_MDNS=1" ]
     63   }
     64   if (enable_pepper_cdms) {
     65     # TODO(brettw) should probably be "=1"
     66     defines += [ "ENABLE_PEPPER_CDMS" ]
     67   }
     68   if (enable_plugins) {
     69     defines += [ "ENABLE_PLUGINS=1" ]
     70   }
     71   if (enable_printing > 0) {
     72     defines += [ "ENABLE_PRINTING=1" ]
     73     if (enable_printing < 2) {
     74       defines += [ "ENABLE_FULL_PRINTING=1" ]
     75     }
     76   }
     77   if (enable_spellcheck) {
     78     defines += [ "ENABLE_SPELLCHECK=1" ]
     79   }
     80   if (dont_embed_build_metadata) {
     81     defines += [ "DONT_EMBED_BUILD_METADATA" ]
     82   }
     83   if (use_udev) {
     84     # TODO(brettw) should probably be "=1".
     85     defines += [ "USE_UDEV" ]
     86   }
     87   if (toolkit_views) {
     88     defines += [ "TOOLKIT_VIEWS=1" ]
     89   }
     90   if (ui_compositor_image_transport) {
     91     # TODO(brettw) should probably be "=1".
     92     defines += [ "UI_COMPOSITOR_IMAGE_TRANSPORT" ]
     93   }
     94   if (use_ash) {
     95     defines += [ "USE_ASH=1" ]
     96   }
     97   if (use_aura) {
     98     defines += [ "USE_AURA=1" ]
     99   }
    100   if (use_cairo) {
    101     defines += [ "USE_CAIRO=1" ]
    102   }
    103   if (use_clipboard_aurax11) {
    104     defines += [ "USE_CLIPBOARD_AURAX11=1" ]
    105   }
    106   if (use_default_render_theme) {
    107     defines += [ "USE_DEFAULT_RENDER_THEME=1" ]
    108   }
    109   if (use_glib) {
    110     defines += [ "USE_GLIB=1" ]
    111   }
    112   if (use_openssl) {
    113     defines += [ "USE_OPENSSL=1" ]
    114     if (use_openssl_certs) {
    115       defines += [ "USE_OPENSSL_CERTS=1" ]
    116     }
    117   } else if (use_nss_certs) {
    118     # USE_NSS really means "use nss for certificate validation and storage"
    119     # (like USE_OPENSSL_CERTS) and not "we're linking to NSS." It might be nice
    120     # to rename this but we're hoping to transition away from NSS.
    121     defines += [ "USE_NSS=1" ]
    122   }
    123   if (use_ozone) {
    124     defines += [ "USE_OZONE=1" ]
    125   }
    126   if (use_x11) {
    127     defines += [ "USE_X11=1" ]
    128     if (use_xi2_mt > 0) {
    129       defines += [ "USE_XI2_MT=$use_xi2_mt" ]
    130     }
    131   }
    132   if (use_allocator != "tcmalloc") {
    133     defines += [ "NO_TCMALLOC" ]
    134   }
    135   if (enable_webrtc) {
    136     defines += [ "ENABLE_WEBRTC=1" ]
    137   }
    138   if (disable_ftp_support) {
    139     defines += [ "DISABLE_FTP_SUPPORT=1" ]
    140   }
    141 }
    142 
    143 # Debug/release ----------------------------------------------------------------
    144 
    145 config("debug") {
    146   defines = [
    147     "_DEBUG",
    148     "DYNAMIC_ANNOTATIONS_ENABLED=1",
    149     "WTF_USE_DYNAMIC_ANNOTATIONS=1",
    150   ]
    151 
    152   if (is_win) {
    153     if (disable_iterator_debugging) {
    154       # Iterator debugging is enabled by the compiler on debug builds, and we
    155       # have to tell it to turn it off.
    156       defines += [ "_HAS_ITERATOR_DEBUGGING=0" ]
    157     }
    158   } else if (is_linux && !is_android && cpu_arch == "x64" &&
    159              !disable_iterator_debugging) {
    160     # Enable libstdc++ debugging facilities to help catch problems early, see
    161     # http://crbug.com/65151 .
    162     # TODO(phajdan.jr): Should we enable this for all of POSIX?
    163     defines += [ "_GLIBCXX_DEBUG=1" ]
    164   }
    165 }
    166 
    167 config("release") {
    168 }
    169 
    170 # Default libraries ------------------------------------------------------------
    171 
    172 # This config defines the default libraries applied to all targets.
    173 config("default_libs") {
    174   if (is_win) {
    175     # TODO(brettw) this list of defaults should probably be smaller, and
    176     # instead the targets that use the less common ones (e.g. wininet or
    177     # winspool) should include those explicitly.
    178     libs = [
    179       "advapi32.lib",
    180       "comdlg32.lib",
    181       "dbghelp.lib",
    182       "delayimp.lib",
    183       "dnsapi.lib",
    184       "gdi32.lib",
    185       "kernel32.lib",
    186       "msimg32.lib",
    187       "odbc32.lib",
    188       "odbccp32.lib",
    189       "ole32.lib",
    190       "oleaut32.lib",
    191       "psapi.lib",
    192       "shell32.lib",
    193       "shlwapi.lib",
    194       "user32.lib",
    195       "usp10.lib",
    196       "uuid.lib",
    197       "version.lib",
    198       "wininet.lib",
    199       "winmm.lib",
    200       "winspool.lib",
    201       "ws2_32.lib",
    202       # Please don't add more stuff here. We should actually be making this
    203       # list smaller, since all common things should be covered. If you need
    204       # some extra libraries, please just add a libs = [ "foo.lib" ] to your
    205       # target that needs it.
    206     ]
    207   } else if (is_android) {
    208     # Android uses -nostdlib so we need to add even libc here.
    209     libs = [
    210       # TODO(brettw) write a version of this, hopefully we can express this
    211       # without forking out to GCC just to get the library name. The android
    212       # toolchain directory should probably be extracted into a .gni file that
    213       # this file and the android toolchain .gn file can share.
    214       #   # Manually link the libgcc.a that the cross compiler uses.
    215       #   '<!(<(android_toolchain)/*-gcc -print-libgcc-file-name)',
    216       "c",
    217       "dl",
    218       "m"
    219     ]
    220   } else if (is_mac) {
    221     libs = [
    222       "AppKit.framework",
    223       "ApplicationServices.framework",
    224       "Carbon.framework",
    225       "CoreFoundation.framework",
    226       "Foundation.framework",
    227       "IOKit.framework",
    228       "Security.framework",
    229     ]
    230   } else if (is_ios) {
    231     libs = [
    232       "CoreFoundation.framework",
    233       "CoreGraphics.framework",
    234       "CoreText.framework",
    235       "Foundation.framework",
    236       "UIKit.framework",
    237     ]
    238   } else if (is_linux) {
    239     libs = [
    240       "dl",
    241     ]
    242   }
    243 }
    244