1 # Copyright 2015 Google Inc.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5 # conditions used in both common.gypi and skia.gyp in chromium
9 'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
10 'SK_SUPPORT_GPU=<(skia_gpu)',
11 'SK_SUPPORT_OPENCL=<(skia_opencl)',
12 'SK_FORCE_DISTANCE_FIELD_TEXT=<(skia_force_distance_field_text)',
20 # FIXME: The reason we don't do this on Android is due to the way
21 # we build the executables/skia_launcher on Android. See
22 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
23 ['skia_os != "android"', {
24 'target_conditions': [
25 [ '_type == "executable"', {
26 'cflags': [ '-fPIE' ],
27 'ldflags': [ '-pie' ],
34 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
35 [ 'skia_arch_type == "x86"', {
46 '_CRT_SECURE_NO_WARNINGS',
47 'GR_GL_FUNCTION_TYPE=__stdcall',
49 'msvs_disabled_warnings': [
50 4275, # An exported class was derived from a class that was not exported
51 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
52 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
54 'msvs_cygwin_shell': 0,
58 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
59 'DebugInformationFormat': '3',
60 'ExceptionHandling': '0',
61 'AdditionalOptions': [ '/MP', ],
64 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
65 'AdditionalDependencies': [
69 # Prior to gyp r1584, the following were included automatically.
90 'DebugInformationFormat': '4', # editAndContiue (/ZI)
91 'Optimization': '0', # optimizeDisabled (/Od)
92 'PreprocessorDefinitions': ['_DEBUG'],
93 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
94 'RuntimeTypeInfo': 'false', # /GR-
97 'GenerateDebugInformation': 'true', # /DEBUG
98 'LinkIncremental': '2', # /INCREMENTAL
104 'VCCLCompilerTool': {
105 'DebugInformationFormat': '3', # programDatabase (/Zi)
106 'Optimization': '<(skia_release_optimization_level)',
107 # Changing the floating point model requires rebaseling gm images
108 #'FloatingPointModel': '2', # fast (/fp:fast)
109 'FavorSizeOrSpeed': '1', # speed (/Ot)
110 'PreprocessorDefinitions': ['NDEBUG'],
111 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
112 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
113 'RuntimeTypeInfo': 'false', # /GR-
116 'GenerateDebugInformation': 'true', # /DEBUG
122 # Gyp's ninja generator depends on these specially named
123 # configurations to build 64-bit on Windows.
124 # See http://skbug.com/2348
126 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
127 # OK for us to just make these inherit non-archwidth-specific
128 # configurations without modification.
130 # See http://skbug.com/2442 : These targets cause problems in the
131 # MSVS build, so only include them if gyp is generating a ninja build.
132 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
135 'inherit_from': ['Debug'],
137 'VCCLCompilerTool': {
138 # /ZI is not supported on 64bit
139 'DebugInformationFormat': '3', # programDatabase (/Zi)
144 'inherit_from': ['Release'],
146 'VCCLCompilerTool': {
147 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
148 'EnableEnhancedInstructionSet': '0', #
152 'Release_Developer_x64': {
153 'inherit_from': ['Release_Developer'],
155 'VCCLCompilerTool': {
156 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
157 'EnableEnhancedInstructionSet': '0', #
163 [ 'skia_arch_width == 64', {
164 'msvs_configuration_platform': 'x64',
166 [ 'skia_arch_width == 32', {
167 'msvs_configuration_platform': 'Win32',
169 [ 'skia_warnings_as_errors', {
171 'VCCLCompilerTool': {
172 'WarnAsError': 'true',
173 'AdditionalOptions': [
174 '/we4189', # initialized but unused var warning
179 [ 'skia_win_exceptions', {
181 'VCCLCompilerTool': {
182 'AdditionalOptions': [
192 'VCCLCompilerTool': {
193 'WholeProgramOptimization': 'true', #/GL
196 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
199 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
209 # The following section is common to linux + derivatives and android
210 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
223 '-Wno-unused-parameter',
228 '-Wnon-virtual-dtor',
229 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
232 [ 'skia_os != "chromeos"', {
234 [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
242 [ 'skia_arch_type == "x86" and not skia_android_framework', {
252 [ 'skia_warnings_as_errors', {
257 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
258 [ 'skia_disable_inlining', {
261 '-fno-default-inline',
263 '-fno-omit-frame-pointer',
266 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
270 # The --fix-cortex-a8 switch enables a link-time workaround for
271 # an erratum in certain Cortex-A8 processors. The workaround is
272 # enabled by default if you target the ARM v7-A arch profile.
273 # It can be enabled otherwise by specifying --fix-cortex-a8, or
274 # disabled unconditionally by specifying --no-fix-cortex-a8.
276 # The erratum only affects Thumb-2 code.
278 [ 'arm_version < 7', {
280 '-Wl,--fix-cortex-a8',
285 [ 'skia_arch_type == "arm" and arm_version >= 7', {
301 [ 'arm_neon_optional == 1', {
303 'SK_ARM_HAS_OPTIONAL_NEON',
306 [ 'skia_os != "chromeos" and skia_os != "linux"', {
308 '-mfloat-abi=softfp',
313 [ 'skia_arch_type == "mips"', {
318 [ 'mips_arch_variant == "mips32r2"', {
348 [ 'skia_os == "nacl"', {
349 # NaCl compiler is GCC 4.4, which is too old to understand 'c++11', so call it '0x'.
350 # NaCl's newlib needs gnu++ mode to see snprintf, vsnprintf, etc in C++11 mode.
351 'cflags_cc!': [ '-std=c++11' ],
352 'cflags_cc' : [ '-std=gnu++0x' ],
355 ['skia_android_framework', {
357 'skia_for_android_framework_defines.gypi',
360 # Skia does not enforce this usage pattern so we disable it here to avoid
361 # unecessary log spew when building
362 '-Wno-unused-parameter',
364 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
365 # Revert to -D_FORTIFY_SOURCE=1
367 '-D_FORTIFY_SOURCE=1',
369 # We can't use the skia_shared_library gyp setting because we need to
370 # isolate this define to Skia sources. CFLAGS are local to Android.mk
371 # and ensures that this define is not exported to clients of the library
372 '-DSKIA_IMPLEMENTATION=1',
374 # Remove flags which are either unnecessary or problematic for the
375 # Android framework build. Many of these flags are removed simply because
376 # they were not previously in the Android framework makefile, and we did
377 # did not intend to add them when generating the makefile.
378 # TODO (scroggo): Investigate whether any of these flags are actually
379 # needed/would be beneficial.
381 # Android has one makefile, used for both debugging (after manual
382 # modification) and release. Turn off debug info by default.
387 '-mfloat-abi=softfp',
390 # Remove flags to turn on warnings, since most people building Android
391 # are not focused on Skia and do not need the extra warning info.
400 '-Wnon-virtual-dtor',
403 'DCT_IFAST_SUPPORTED',
404 # using freetype's embolden allows us to adjust fake bold settings at
405 # draw-time, at which point we know which SkTypeface is being drawn
406 'SK_USE_FREETYPE_EMBOLDEN',
407 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
408 # When built as part of the system image we can enable certian non-NDK
409 # compliant optimizations.
410 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
411 # Optimizations for chromium (m30)
412 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
413 'IGNORE_ROT_AA_RECT_OPT',
414 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
415 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
416 'SK_IGNORE_ETC1_SUPPORT',
417 # We can't use the skia_shared_library gyp setting because we need expose
418 # this define globally and the the implemention define as a cflag.
421 # Defines from skia_for_android_framework_defines.gypi
422 '<@(skia_for_android_framework_defines)',
426 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
434 'cflags': ['--coverage'],
435 'ldflags': ['--coverage'],
441 '-O<(skia_release_optimization_level)',
443 'defines': [ 'NDEBUG' ],
447 [ 'skia_shared_lib', {
450 'SKIA_IMPLEMENTATION=1',
453 [ 'skia_os == "nacl"', {
458 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
468 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
469 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
473 # Enable asan, tsan, etc.
474 [ 'skia_sanitizer', {
476 '-fsanitize=<(skia_sanitizer)',
479 '-fsanitize=<(skia_sanitizer)',
482 [ 'skia_sanitizer == "thread"', {
483 'defines': [ 'THREAD_SANITIZER' ],
485 [ 'skia_sanitizer == "undefined"', {
486 'cflags_cc!': ['-fno-rtti'],
490 [ 'skia_clang_build', {
492 '-Wno-unknown-warning-option', # Allows unknown warnings.
493 '-Wno-deprecated', # From Qt, via debugger (older Clang).
494 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
497 # Extra warnings we like but that only Clang knows about.
498 '-Wstring-conversion',
501 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
504 [ 'skia_keep_frame_pointer', {
505 'cflags': [ '-fno-omit-frame-pointer' ],
511 [ 'skia_os == "mac"',
513 'defines': [ 'SK_BUILD_FOR_MAC' ],
517 'GCC_OPTIMIZATION_LEVEL': '0',
518 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
519 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
523 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
526 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
527 'defines': [ 'NDEBUG' ],
532 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
533 [ 'skia_arch_width == 32', { 'ARCHS': ['i386'] }],
534 [ 'skia_arch_width == 64', { 'ARCHS': ['x86_64'] }],
535 [ 'skia_osx_deployment_target==""', {
536 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in env to ld.
538 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
541 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
542 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
543 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
544 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
545 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
546 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
547 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
555 '-Wno-unused-parameter',
561 [ 'skia_os == "ios"',
567 [ 'skia_warnings_as_errors', {
569 'OTHER_CPLUSPLUSFLAGS': [
578 'GCC_OPTIMIZATION_LEVEL': '0',
583 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
585 'defines': [ 'NDEBUG' ],
590 'CODE_SIGNING_REQUIRED': 'NO',
591 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
592 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
593 'SDKROOT': 'iphoneos',
594 'TARGETED_DEVICE_FAMILY': '1,2',
595 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
596 'OTHER_CPLUSPLUSFLAGS': [
598 '-fvisibility=hidden',
599 '-fvisibility-inlines-hidden',
601 'GCC_THUMB_SUPPORT': 'NO',
606 [ 'skia_os == "android"',
609 'SK_BUILD_FOR_ANDROID',
611 # Android Text Tuning
612 'SK_GAMMA_EXPONENT=1.4',
613 'SK_GAMMA_CONTRAST=0.0',
615 # Android defines a fixed gamma exponent instead of using SRGB
634 [ '"x86" in skia_arch_type', {
639 [ 'skia_android_framework', {
645 [ 'skia_shared_lib', {
648 'SKIA_IMPLEMENTATION=1',
649 # Needed until we fix skbug.com/2440.
650 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
653 [ 'skia_profile_enabled == 1', {
654 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
662 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
666 ], # end 'conditions'
667 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
669 'SYMROOT': '<(DEPTH)/xcodebuild',