summaryrefslogtreecommitdiff
path: root/build_gyp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-19 11:04:01 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-19 11:04:02 -0700
commitc37b04e80aafc8437d458ced2366f825749ae2d7 (patch)
tree695828739b07bd9ede2dcfe5b84f6bfb148278de /build_gyp
parenta28ae388f3859c52630deb6ef3d0ea468e5177e3 (diff)
downloadpdfium-c37b04e80aafc8437d458ced2366f825749ae2d7.tar.xz
Move build/ to build_gyp/.
This CL moves the build/ files to build_gyp/ in anticipation of pulling in Chromiums build/ directory. The gyp_pdfium files have been duplicated into both places. Once the bots are updated we'll remove the build/ versions. BUG=pdfium:106 Review URL: https://codereview.chromium.org/1900913003
Diffstat (limited to 'build_gyp')
-rw-r--r--build_gyp/all.gyp17
-rwxr-xr-xbuild_gyp/gyp_pdfium52
-rw-r--r--build_gyp/gyp_pdfium.py8
-rw-r--r--build_gyp/mac_find_sdk.py93
-rw-r--r--build_gyp/set_clang_warning_flags.gypi58
-rw-r--r--build_gyp/standalone.gypi507
6 files changed, 735 insertions, 0 deletions
diff --git a/build_gyp/all.gyp b/build_gyp/all.gyp
new file mode 100644
index 0000000000..47097e39b4
--- /dev/null
+++ b/build_gyp/all.gyp
@@ -0,0 +1,17 @@
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'All',
+ 'type': 'none',
+ 'dependencies': [
+ '../pdfium.gyp:*',
+ '../samples/samples.gyp:*',
+ '../testing/libfuzzer/fuzzers.gyp:*',
+ ],
+ }
+ ]
+}
diff --git a/build_gyp/gyp_pdfium b/build_gyp/gyp_pdfium
new file mode 100755
index 0000000000..3dbbbeea75
--- /dev/null
+++ b/build_gyp/gyp_pdfium
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+#
+# Copyright 2014 PDFium 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 script is wrapper for PDFium that adds some support for how GYP
+# is invoked by PDFium beyond what can be done in the gclient hooks.
+
+import os
+import platform
+import sys
+
+script_dir = os.path.dirname(os.path.realpath(__file__))
+pdfium_root = os.path.abspath(os.path.join(script_dir, os.pardir))
+
+sys.path.insert(0, os.path.join(pdfium_root, 'build_gyp', 'gyp', 'pylib'))
+import gyp
+
+
+def run_gyp(args):
+ rc = gyp.main(args)
+ if rc != 0:
+ print 'Error running GYP'
+ sys.exit(rc)
+
+
+def main():
+ args = sys.argv[1:]
+ args.append(os.path.join(pdfium_root, 'build_gyp', 'all.gyp'))
+
+ args.append('-I')
+ args.append(os.path.join(pdfium_root, 'build_gyp', 'standalone.gypi'))
+
+ args.extend(['-D', 'gyp_output_dir=out'])
+
+ # Set the GYP DEPTH variable to the root of the PDFium project.
+ args.append('--depth=' + os.path.relpath(pdfium_root))
+
+ # GYP does not default to ninja, but PDFium should.
+ if not os.environ.get('GYP_GENERATORS', ''):
+ print 'GYP_GENERATORS is not set, defaulting to ninja'
+ os.environ['GYP_GENERATORS'] = 'ninja'
+
+ print 'Updating projects from gyp files...'
+ sys.stdout.flush()
+
+ run_gyp(args)
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/build_gyp/gyp_pdfium.py b/build_gyp/gyp_pdfium.py
new file mode 100644
index 0000000000..6831702b54
--- /dev/null
+++ b/build_gyp/gyp_pdfium.py
@@ -0,0 +1,8 @@
+# Copyright 2014 PDFium 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 os
+
+path = os.path.abspath(os.path.split(__file__)[0])
+execfile(os.path.join(path, 'gyp_pdfium'))
diff --git a/build_gyp/mac_find_sdk.py b/build_gyp/mac_find_sdk.py
new file mode 100644
index 0000000000..230c2fd52e
--- /dev/null
+++ b/build_gyp/mac_find_sdk.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+# Copyright 2016 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Prints the lowest locally available SDK version greater than or equal to a
+given minimum sdk version to standard output.
+
+Usage:
+ python mac_find_sdk.py 10.6 # Ignores SDKs < 10.6
+"""
+
+import os
+import re
+import subprocess
+import sys
+
+
+from optparse import OptionParser
+
+
+def parse_version(version_str):
+ """'10.6' => [10, 6]"""
+ return map(int, re.findall(r'(\d+)', version_str))
+
+
+def main():
+ parser = OptionParser()
+ parser.add_option("--verify",
+ action="store_true", dest="verify", default=False,
+ help="return the sdk argument and warn if it doesn't exist")
+ parser.add_option("--sdk_path",
+ action="store", type="string", dest="sdk_path", default="",
+ help="user-specified SDK path; bypasses verification")
+ parser.add_option("--print_sdk_path",
+ action="store_true", dest="print_sdk_path", default=False,
+ help="Additionaly print the path the SDK (appears first).")
+ options, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error('Please specify a minimum SDK version')
+ min_sdk_version = args[0]
+
+ job = subprocess.Popen(['xcode-select', '-print-path'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ out, err = job.communicate()
+ if job.returncode != 0:
+ print >> sys.stderr, out
+ print >> sys.stderr, err
+ raise Exception(('Error %d running xcode-select, you might have to run '
+ '|sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer| '
+ 'if you are using Xcode 4.') % job.returncode)
+ # The Developer folder moved in Xcode 4.3.
+ xcode43_sdk_path = os.path.join(
+ out.rstrip(), 'Platforms/MacOSX.platform/Developer/SDKs')
+ if os.path.isdir(xcode43_sdk_path):
+ sdk_dir = xcode43_sdk_path
+ else:
+ sdk_dir = os.path.join(out.rstrip(), 'SDKs')
+ sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
+ sdks = [s[0] for s in sdks if s] # [['10.5'], ['10.6']] => ['10.5', '10.6']
+ sdks = [s for s in sdks # ['10.5', '10.6'] => ['10.6']
+ if parse_version(s) >= parse_version(min_sdk_version)]
+ if not sdks:
+ raise Exception('No %s+ SDK found' % min_sdk_version)
+ best_sdk = sorted(sdks, key=parse_version)[0]
+
+ if options.verify and best_sdk != min_sdk_version and not options.sdk_path:
+ print >> sys.stderr, ''
+ print >> sys.stderr, ' vvvvvvv'
+ print >> sys.stderr, ''
+ print >> sys.stderr, \
+ 'This build requires the %s SDK, but it was not found on your system.' \
+ % min_sdk_version
+ print >> sys.stderr, \
+ 'Either install it, or explicitly set mac_sdk in your GYP_DEFINES.'
+ print >> sys.stderr, ''
+ print >> sys.stderr, ' ^^^^^^^'
+ print >> sys.stderr, ''
+ return min_sdk_version
+
+ if options.print_sdk_path:
+ print subprocess.check_output(['xcodebuild', '-version', '-sdk',
+ 'macosx' + best_sdk, 'Path']).strip()
+
+ return best_sdk
+
+
+if __name__ == '__main__':
+ if sys.platform != 'darwin':
+ raise Exception("This script only runs on Mac")
+ print main()
+ sys.exit(0)
diff --git a/build_gyp/set_clang_warning_flags.gypi b/build_gyp/set_clang_warning_flags.gypi
new file mode 100644
index 0000000000..f6d7aea700
--- /dev/null
+++ b/build_gyp/set_clang_warning_flags.gypi
@@ -0,0 +1,58 @@
+# Copyright (c) 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 is meant to be included to set clang-specific compiler flags.
+# To use this the following variable can be defined:
+# clang_warning_flags: list: Compiler flags to pass to clang.
+# clang_warning_flags_unset: list: Compiler flags to not pass to clang.
+#
+# Only use this in third-party code. In chromium_code, fix your code to not
+# warn instead!
+#
+# Note that the gypi file is included in target_defaults, so it does not need
+# to be explicitly included.
+#
+# Warning flags set by this will be used on all platforms. If you want to set
+# warning flags on only some platforms, you have to do so manually.
+#
+# To use this, create a gyp target with the following form:
+# {
+# 'target_name': 'my_target',
+# 'variables': {
+# 'clang_warning_flags': ['-Wno-awesome-warning'],
+# 'clang_warning_flags_unset': ['-Wpreviously-set-flag'],
+# }
+# }
+
+{
+ 'variables': {
+ 'clang_warning_flags_unset%': [], # Provide a default value.
+ },
+ 'conditions': [
+ ['clang==1', {
+ # This uses >@ instead of @< to also see clang_warning_flags set in
+ # targets directly, not just the clang_warning_flags in target_defaults.
+ 'cflags': [ '>@(clang_warning_flags)' ],
+ 'cflags!': [ '>@(clang_warning_flags_unset)' ],
+ 'xcode_settings': {
+ 'WARNING_CFLAGS': ['>@(clang_warning_flags)'],
+ 'WARNING_CFLAGS!': ['>@(clang_warning_flags_unset)'],
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': [ '>@(clang_warning_flags)' ],
+ 'AdditionalOptions!': [ '>@(clang_warning_flags_unset)' ],
+ },
+ },
+ }],
+ ['clang==0 and host_clang==1', {
+ 'target_conditions': [
+ ['_toolset=="host"', {
+ 'cflags': [ '>@(clang_warning_flags)' ],
+ 'cflags!': [ '>@(clang_warning_flags_unset)' ],
+ }],
+ ],
+ }],
+ ],
+}
diff --git a/build_gyp/standalone.gypi b/build_gyp/standalone.gypi
new file mode 100644
index 0000000000..7292947226
--- /dev/null
+++ b/build_gyp/standalone.gypi
@@ -0,0 +1,507 @@
+# Copyright 2014 PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Definitions to be used when building stand-alone PDFium binaries.
+
+{
+ 'variables': {
+ 'component%': 'static_library',
+ 'clang%': 0,
+ 'asan%': 0,
+ 'sanitizer_coverage%': 0,
+ 'use_goma%': 0,
+ 'gomadir%': '',
+ 'msvs_multi_core_compile%': '1',
+ 'pdf_enable_xfa%': 1,
+ 'variables': {
+ 'variables': {
+ 'variables': {
+ 'conditions': [
+ ['OS=="linux" or OS=="mac"', {
+ # This handles the Unix platforms we generally deal with.
+ # Anything else gets passed through, which probably won't work
+ # very well; such hosts should pass an explicit target_arch
+ # to gyp.
+ 'host_arch%':
+ '<!(uname -m | sed -e "s/i.86/ia32/;\
+ s/x86_64/x64/;\
+ s/amd64/x64/;\
+ s/arm.*/arm/;\
+ s/aarch64/arm64/;\
+ s/mips.*/mipsel/")',
+ }, {
+ # OS!="linux" and OS!="mac"
+ 'host_arch%': 'ia32',
+ }],
+ ],
+ },
+ 'host_arch%': '<(host_arch)',
+ 'target_arch%': '<(host_arch)',
+ },
+ 'host_arch%': '<(host_arch)',
+ 'target_arch%': '<(target_arch)',
+ },
+ 'clang_dir%': 'third_party/llvm-build/Release+Asserts',
+ # These two are needed by V8.
+ 'host_arch%': '<(host_arch)',
+ 'target_arch%': '<(target_arch)',
+ 'werror%': '-Werror',
+ 'v8_optimized_debug%': 0,
+ 'v8_use_external_startup_data%': 0,
+ 'icu_gyp_path': '../v8/third_party/icu/icu.gyp',
+ 'libjpeg_gyp_path': '../third_party/third_party.gyp',
+ 'conditions': [
+ ['OS == "win"', {
+ 'os_posix%': 0,
+ }, {
+ 'os_posix%': 1,
+ }],
+ ['OS=="linux" or OS=="mac"', {
+ 'clang%': 1,
+ 'host_clang%': 1,
+ }, {
+ 'clang%': 0,
+ 'host_clang%': 0,
+ }],
+ # Set default gomadir.
+ ['OS=="win"', {
+ 'gomadir%': 'c:\\goma\\goma-win',
+ }, {
+ 'gomadir%': '<!(/bin/echo -n ${HOME}/goma)',
+ }],
+ ],
+ },
+ 'target_defaults': {
+ 'default_configuration': 'Debug',
+ 'configurations': {
+ 'Debug': {
+ 'cflags': [
+ '-g',
+ '-O0',
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'defines': ['_DEBUG'],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '0',
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'RuntimeLibrary': '3', # /MDd
+ }, {
+ 'RuntimeLibrary': '1', # /MTd
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '2',
+ },
+ },
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
+ },
+ 'conditions': [
+ ['OS=="linux"', {
+ # Enable libstdc++ debugging to help catch problems early.
+ 'defines': ['_GLIBCXX_DEBUG=1',],
+ }],
+ ],
+ },
+ 'Release': {
+ 'cflags': [
+ '-fno-strict-aliasing',
+ ],
+ 'defines': ['NDEBUG'],
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
+ 'GCC_STRICT_ALIASING': 'NO',
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '2',
+ 'InlineFunctionExpansion': '2',
+ 'EnableIntrinsicFunctions': 'true',
+ 'FavorSizeOrSpeed': '0',
+ 'StringPooling': 'true',
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'RuntimeLibrary': '2', #/MD
+ }, {
+ 'RuntimeLibrary': '0', #/MT
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '1',
+ 'OptimizeReferences': '2',
+ 'EnableCOMDATFolding': '2',
+ },
+ },
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [
+ '-fdata-sections',
+ '-ffunction-sections',
+ '-O3',
+ '-O2',
+ ],
+ }],
+ ['OS=="android"', {
+ 'cflags!': [
+ '-O3',
+ '-Os',
+ ],
+ 'cflags': [
+ '-fdata-sections',
+ '-ffunction-sections',
+ '-O2',
+ ],
+ }],
+ ], # conditions
+ },
+ 'Debug_x64': {
+ 'inherit_from': ['Debug'],
+ 'msvs_configuration_platform': 'x64',
+ },
+ 'Release_x64': {
+ 'inherit_from': ['Release'],
+ 'msvs_configuration_platform': 'x64',
+ },
+ },
+ 'cflags': [
+ '-Wall',
+ '-Werror',
+ '-W',
+ '-Wno-missing-field-initializers',
+ # Code might someday be made clean for -Wsign-compare, but for now
+ # this produces too much noise to be useful.
+ '-Wno-sign-compare',
+ '-Wno-unused-parameter',
+ '-pthread',
+ '-fno-exceptions',
+ '-fvisibility=hidden',
+ ],
+ 'cflags_cc': [
+ '-std=c++11',
+ # Add back when ICU is clean
+ # '-Wnon-virtual-dtor',
+ '-fno-rtti',
+ ],
+ 'ldflags': [
+ '-pthread',
+ ],
+ 'defines': [
+ # Don't use deprecated V8 APIs anywhere.
+ 'V8_DEPRECATION_WARNINGS',
+ ],
+ 'msvs_cygwin_dirs': ['<(DEPTH)/v8/third_party/cygwin'],
+ 'msvs_configuration_attributes': {
+ 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
+ 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
+ 'CharacterSet': '1',
+ },
+ 'msvs_disabled_warnings': [
+ # ####
+ # This section is PDFium specific.
+ # ####
+
+ # C4800: forcing value to bool 'true' or 'false' (performance warning)
+ 4800,
+
+ # ####
+ # This section should match Chromium's build/common.gypi.
+ # ####
+
+ # C4091: 'typedef ': ignored on left of 'X' when no variable is
+ # declared.
+ # This happens in a number of Windows headers. Dumb.
+ 4091,
+
+ # C4127: conditional expression is constant
+ # This warning can in theory catch dead code and other problems, but
+ # triggers in far too many desirable cases where the conditional
+ # expression is either set by macros or corresponds some legitimate
+ # compile-time constant expression (due to constant template args,
+ # conditionals comparing the sizes of different types, etc.). Some of
+ # these can be worked around, but it's not worth it.
+ 4127,
+
+ # C4351: new behavior: elements of array 'array' will be default
+ # initialized
+ # This is a silly "warning" that basically just alerts you that the
+ # compiler is going to actually follow the language spec like it's
+ # supposed to, instead of not following it like old buggy versions
+ # did. There's absolutely no reason to turn this on.
+ 4351,
+
+ # C4355: 'this': used in base member initializer list
+ # It's commonly useful to pass |this| to objects in a class'
+ # initializer list. While this warning can catch real bugs, most of
+ # the time the constructors in question don't attempt to call methods
+ # on the passed-in pointer (until later), and annotating every legit
+ # usage of this is simply more hassle than the warning is worth.
+ 4355,
+
+ # C4503: 'identifier': decorated name length exceeded, name was
+ # truncated
+ # This only means that some long error messages might have truncated
+ # identifiers in the presence of lots of templates. It has no effect
+ # on program correctness and there's no real reason to waste time
+ # trying to prevent it.
+ 4503,
+
+ # Warning C4589 says: "Constructor of abstract class ignores
+ # initializer for virtual base class." Disable this warning because it
+ # is flaky in VS 2015 RTM. It triggers on compiler generated
+ # copy-constructors in some cases.
+ 4589,
+
+ # C4611: interaction between 'function' and C++ object destruction is
+ # non-portable
+ # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN
+ # suggests using exceptions instead of setjmp/longjmp for C++, but
+ # Chromium code compiles without exception support. We therefore have
+ # to use setjmp/longjmp for e.g. JPEG decode error handling, which
+ # means we have to turn off this warning (and be careful about how
+ # object destruction happens in such cases).
+ 4611,
+
+ # TODO(thestig): These warnings are level 4. They will be slowly
+ # removed as code is fixed.
+ 4100, # Unreferenced formal parameter
+ 4121, # Alignment of a member was sensitive to packing
+ 4244, # Conversion from 'type1' to 'type2', possible loss of data
+ 4505, # Unreferenced local function has been removed
+ 4510, # Default constructor could not be generated
+ 4512, # Assignment operator could not be generated
+ 4610, # Object can never be instantiated
+ 4838, # Narrowing conversion. Doesn't seem to be very useful.
+ 4995, # 'X': name was marked as #pragma deprecated
+ 4996, # 'X': was declared deprecated (for GetVersionEx).
+
+ # These are variable shadowing warnings that are new in VS2015. We
+ # should work through these at some point -- they may be removed from
+ # the RTM release in the /W4 set.
+ 4456, 4457, 4458, 4459,
+
+ # TODO(brucedawson): http://crbug.com/554200 4312 is a VS
+ # 2015 64-bit warning for integer to larger pointer
+ 4312,
+
+ # ####
+ # Do not add PDFium specific entries here. Add them to the top.
+ # ####
+ ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'MinimalRebuild': 'false',
+ 'BufferSecurityCheck': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'RuntimeTypeInfo': 'false',
+ 'WarningLevel': '3',
+ 'DebugInformationFormat': '3',
+ 'Detect64BitPortabilityProblems': 'false',
+ 'conditions': [
+ [ 'msvs_multi_core_compile', {
+ 'AdditionalOptions': ['/MP'],
+ }],
+ ['component=="shared_library"', {
+ 'ExceptionHandling': '1', # /EHsc
+ }, {
+ 'ExceptionHandling': '0',
+ }],
+ ['target_arch=="x64"', {
+ # 64-bit warnings need to be resolved.
+ # https://code.google.com/p/pdfium/issues/detail?id=101
+ 'WarnAsError': 'false',
+ }, {
+ 'WarnAsError': 'true',
+ }],
+ ['clang==1', {
+ 'AdditionalOptions': [
+ # Don't warn about unused function parameters.
+ # (This is also used on other platforms.)
+ '-Wno-unused-parameter',
+ # Don't warn about the "struct foo f = {0};" initialization
+ # pattern.
+ '-Wno-missing-field-initializers',
+
+ # Many files use intrinsics without including this header.
+ # TODO(hans): Fix those files, or move this to sub-GYPs.
+ '/FIIntrin.h',
+
+ # TODO(hans): Make this list shorter eventually, http://crbug.com/504657
+ '-Qunused-arguments', # http://crbug.com/504658
+ '-Wno-microsoft-enum-value', # http://crbug.com/505296
+ '-Wno-unknown-pragmas', # http://crbug.com/505314
+ '-Wno-microsoft-cast', # http://crbug.com/550065
+ ],
+ }],
+ ['OS=="win" and clang==1 and MSVS_VERSION == "2013"', {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': [
+ '-fmsc-version=1800',
+ ],
+ },
+ }],
+ ['OS=="win" and clang==1 and MSVS_VERSION == "2015"', {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': [
+ '-fmsc-version=1900',
+ ],
+ },
+ }],
+ ],
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalOptions': ['/ignore:4221'],
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ 'LinkIncremental': '1',
+ # SubSystem values:
+ # 0 == not set
+ # 1 == /SUBSYSTEM:CONSOLE
+ # 2 == /SUBSYSTEM:WINDOWS
+ 'SubSystem': '1',
+ },
+ },
+ 'xcode_settings': {
+ 'ALWAYS_SEARCH_USER_PATHS': 'NO',
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
+ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
+ 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
+ # (Equivalent to -fPIC)
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
+ 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
+ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
+ # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
+ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
+ 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror
+ 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor
+ 'SYMROOT': '<(DEPTH)/xcodebuild',
+ 'USE_HEADERMAP': 'NO',
+ 'OTHER_CFLAGS': [
+ '-fno-strict-aliasing',
+ ],
+ 'WARNING_CFLAGS': [
+ '-Wall',
+ '-Wendif-labels',
+ '-W',
+ '-Wno-unused-parameter',
+ ],
+ },
+ 'variables': {
+ 'clang_warning_flags': [],
+ },
+ 'includes': [ 'set_clang_warning_flags.gypi', ],
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'cflags': [
+ '-fPIC',
+ ],
+ }],
+ ['asan==1', {
+ 'defines': [
+ 'ADDRESS_SANITIZER',
+ 'LEAK_SANITIZER',
+ ],
+ 'cflags': [
+ '-fsanitize=address',
+ '-gline-tables-only',
+ ],
+ 'ldflags': [
+ '-fsanitize=address',
+ ],
+ }],
+ ['sanitizer_coverage!=0', {
+ 'cflags': [
+ '-fsanitize-coverage=<(sanitizer_coverage)',
+ ],
+ }],
+ ['OS=="win"', {
+ 'defines': [
+ 'NOMINMAX',
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_CRT_NONSTDC_NO_DEPRECATE',
+ ],
+ 'conditions': [
+ ['component=="static_library"', {
+ 'defines': [
+ '_HAS_EXCEPTIONS=0',
+ ],
+ }],
+ ['use_goma==1', {
+ # goma doesn't support PDB yet.
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ },
+ 'VCCLCompilerTool': {
+ 'DebugInformationFormat': '1',
+ },
+ },
+ }],
+ ],
+ }], # OS=="win"
+ ['OS=="mac"', {
+ 'target_conditions': [
+ ['_type!="static_library"', {
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
+ }],
+ ], # target_conditions
+ 'variables': {
+ 'mac_sdk_min': '10.10',
+ 'mac_sdk%': '<!(python <(DEPTH)/build_gyp/mac_find_sdk.py <(mac_sdk_min))',
+ },
+ 'xcode_settings': {
+ 'SDKROOT': 'macosx<(mac_sdk)', # -isysroot
+ # See comment in Chromium's common.gypi for why this is needed.
+ 'SYMROOT': '<(DEPTH)/xcodebuild',
+ },
+ }], # OS=="mac"
+ ['v8_use_external_startup_data==1', {
+ 'defines': [
+ 'V8_USE_EXTERNAL_STARTUP_DATA',
+ ],
+ }], # v8_use_external_startup_data==1
+ ['clang==1 or host_clang==1', {
+ # This is here so that all files get recompiled after a clang roll and
+ # when turning clang on or off.
+ # (defines are passed via the command line, and build systems rebuild
+ # things when their commandline changes). Nothing should ever read this
+ # define.
+ 'defines': ['CR_CLANG_REVISION=<!(python <(DEPTH)/tools/clang/scripts/update.py --print-revision)'],
+ }],
+ ],
+ },
+ 'conditions': [
+ ['OS=="linux" or OS=="mac"', {
+ 'conditions': [
+ ['clang==1', {
+ 'make_global_settings': [
+ ['CC', '<(clang_dir)/bin/clang'],
+ ['CXX', '<(clang_dir)/bin/clang++'],
+ ],
+ }],
+ ],
+ }], # OS=="linux" or OS=="mac"
+ ['OS=="win"', {
+ 'conditions': [
+ ['clang==1', {
+ 'make_global_settings': [
+ ['CC', '<(clang_dir)/bin/clang-cl'],
+ ],
+ }],
+ ],
+ }], # OS=="win"
+ ["use_goma==1", {
+ 'make_global_settings': [
+ ['CC_wrapper', '<(gomadir)/gomacc'],
+ ['CXX_wrapper', '<(gomadir)/gomacc'],
+ ],
+ }], # use_goma==1
+ ],
+}