Index: build/config/BUILD.gn |
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bbd6768c807aad6aed5b6db9202784c790ac3340 |
--- /dev/null |
+++ b/build/config/BUILD.gn |
@@ -0,0 +1,186 @@ |
+# 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. |
+ |
+import("//build/config/allocator.gni") |
+import("//build/config/chrome_build.gni") |
+import("//build/config/crypto.gni") |
+import("//build/config/features.gni") |
+import("//build/config/ui.gni") |
+import("//build/module_args/v8.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, e.g. ifdef out all __DATE__ |
+ # and __TIME__. Set to 0 to reenable the use of these macros in the code |
+ # base. See http://crbug.com/314403. |
+ # |
+ # Continue to embed build meta data in Official builds, basically the |
+ # time it was built. |
+ # TODO(maruel): This decision should be revisited because having an |
+ # official deterministic build has high value too but MSVC toolset can't |
+ # generate anything deterministic with WPO enabled AFAIK. |
+ dont_embed_build_metadata = !is_official_build |
+ |
+ # Set to true to enable dcheck in Release builds. |
+ dcheck_always_on = false |
+ |
+ # Set to true to compile with the OpenGL ES 2.0 conformance tests. |
+ internal_gles2_conform_tests = 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) this probably needs to be parameterized. |
+ defines = [ "V8_DEPRECATION_WARNINGS" ] # Don't use deprecated V8 APIs anywhere. |
+ |
+ if (dcheck_always_on) { |
+ defines += [ "DCHECK_ALWAYS_ON=1" ] |
+ } |
+ if (use_udev) { |
+ # TODO(brettw) should probably be "=1". |
+ defines += [ "USE_UDEV" ] |
+ } |
+ if (use_openssl) { |
+ defines += [ "USE_OPENSSL=1" ] |
+ } |
+ if (use_openssl_certs) { |
+ defines += [ "USE_OPENSSL_CERTS=1" ] |
+ } |
+ if (use_nss_certs) { |
+ defines += [ "USE_NSS_CERTS=1" ] |
+ } |
+ if (use_ozone) { |
+ defines += [ "USE_OZONE=1" ] |
+ } |
+ if (use_x11) { |
+ defines += [ "USE_X11=1" ] |
+ } |
+ if (use_allocator != "tcmalloc") { |
+ defines += [ "NO_TCMALLOC" ] |
+ } |
+ if (is_asan || is_lsan || is_tsan || is_msan) { |
+ defines += [ |
+ "MEMORY_TOOL_REPLACES_ALLOCATOR", |
+ "MEMORY_SANITIZER_INITIAL_SIZE", |
+ ] |
+ } |
+ if (is_asan) { |
+ defines += [ "ADDRESS_SANITIZER" ] |
+ } |
+ if (is_lsan) { |
+ defines += [ "LEAK_SANITIZER" ] |
+ } |
+ if (is_tsan) { |
+ defines += [ |
+ "THREAD_SANITIZER", |
+ "DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1", |
+ ] |
+ } |
+ if (is_msan) { |
+ defines += [ "MEMORY_SANITIZER" ] |
+ } |
+ if (!enable_nacl) { |
+ defines += [ "DISABLE_NACL" ] |
+ } |
+ if (v8_use_external_startup_data) { |
+ defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ] |
+ } |
+ if (is_official_build) { |
+ defines += [ "OFFICIAL_BUILD" ] |
+ } |
+ if (is_chrome_branded) { |
+ defines += [ "GOOGLE_CHROME_BUILD" ] |
+ } else { |
+ defines += [ "CHROMIUM_BUILD" ] |
+ } |
+} |
+ |
+# Debug/release ---------------------------------------------------------------- |
+ |
+config("debug") { |
+ defines = [ |
+ "_DEBUG", |
+ "DYNAMIC_ANNOTATIONS_ENABLED=1", |
+ ] |
+ |
+ if (is_nacl) { |
+ defines += [ "DYNAMIC_ANNOTATIONS_PREFIX=NACL_" ] |
+ } |
+ |
+ if (is_linux && !is_android && current_cpu == "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" ] |
+ |
+ # Sanitizers. |
+ # TODO(GYP) The GYP build has "release_valgrind_build == 0" for this |
+ # condition. When Valgrind is set up, we need to do the same here. |
+ if (is_tsan) { |
+ defines += [ "DYNAMIC_ANNOTATIONS_ENABLED=1" ] |
+ } else { |
+ defines += [ "NVALGRIND" ] |
+ if (!is_nacl) { |
+ # NaCl always enables dynamic annotations. Currently this value is set to |
+ # 1 for all .nexes. |
+ defines += [ "DYNAMIC_ANNOTATIONS_ENABLED=0" ] |
+ } |
+ } |
+} |
+ |
+# Default libraries ------------------------------------------------------------ |
+ |
+# This config defines the default libraries applied to all targets. |
+config("default_libs") { |
+ 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 (is_ios) { |
+ libs = [ |
+ "CoreFoundation.framework", |
+ "CoreGraphics.framework", |
+ "CoreText.framework", |
+ "Foundation.framework", |
+ "UIKit.framework", |
+ ] |
+ } else if (is_linux) { |
+ libs = [ "dl" ] |
+ } |
+} |