skia2/gyp/common_conditions.gypi

393 lines
12 KiB
Plaintext
Raw Normal View History

# conditions used in both common.gypi and skia.gyp in chromium
#
{
'defines': [
'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
# 'SK_SUPPORT_HINTING_SCALE_FACTOR',
],
'conditions' : [
['skia_gpu == 1',
{
'defines': [
'SK_SUPPORT_GPU=1',
],
}, {
'defines': [
'SK_SUPPORT_GPU=0',
],
},
],
['skia_os == "win"',
{
'defines': [
'SK_BUILD_FOR_WIN32',
'SK_IGNORE_STDINT_DOT_H',
'_CRT_SECURE_NO_WARNINGS',
'GR_GL_FUNCTION_TYPE=__stdcall',
],
'msvs_cygwin_shell': 0,
'msvs_settings': {
'VCCLCompilerTool': {
'WarningLevel': '1',
'DebugInformationFormat': '3',
'AdditionalOptions': [ '/MP' ],
},
'VCLinkerTool': {
'AdditionalDependencies': [
'OpenGL32.lib',
'usp10.lib',
],
},
},
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
'DebugInformationFormat': '4', # editAndContiue (/ZI)
'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
'Optimization': '0', # optimizeDisabled (/Od)
'PreprocessorDefinitions': ['_DEBUG'],
'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
'ExceptionHandling': '0',
'RuntimeTypeInfo': 'false', # /GR-
'WarningLevel': '3', # level3 (/W3)
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true', # /DEBUG
'LinkIncremental': '2', # /INCREMENTAL
},
},
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'DebugInformationFormat': '3', # programDatabase (/Zi)
'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
'Optimization': '3', # full (/Ox)
'WholeProgramOptimization': 'true', #/GL
# Changing the floating point model requires rebaseling gm images
#'FloatingPointModel': '2', # fast (/fp:fast)
'FavorSizeOrSpeed': '1', # speed (/Ot)
'PreprocessorDefinitions': ['NDEBUG'],
'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
'ExceptionHandling': '0',
'EnableEnhancedInstructionSet': '2',# /arch:SSE2
'RuntimeTypeInfo': 'false', # /GR-
'WarningLevel': '3', # level3 (/W3)
},
'VCLinkerTool': {
'GenerateDebugInformation': 'true', # /DEBUG
'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
},
'VCLibrarianTool': {
'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
},
},
},
},
'conditions' : [
['skia_arch_width == 64', {
'msvs_configuration_platform': 'x64',
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'false',
},
},
}],
['skia_arch_width == 32', {
# This gypi file will be included directly into the gyp(i) files in the angle repo by
# our gyp_skia script. We don't want force WarnAsError on angle. So angle.gyp defines
# skia_building_angle=1 and here we select whether to enable WarnAsError based on that
# var's value. Here it defaults to 0.
'variables' : {
'skia_building_angle%': 0,
},
'conditions' : [
['skia_building_angle', {
'msvs_configuration_platform': 'Win32',
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'false',
},
},
},{ # not angle
'msvs_configuration_platform': 'Win32',
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'true',
},
},
}],
],
}],
],
},
],
['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]',
{
'defines': [
'SK_SAMPLES_FOR_X',
'SK_BUILD_FOR_UNIX',
],
'configurations': {
'Debug': {
'cflags': ['-g']
},
'Release': {
'cflags': ['-O3 -g'],
'defines': [ 'NDEBUG' ],
},
},
'cflags': [
'-Werror',
'-Wall',
'-Wextra',
# suppressions below here were added for clang
'-Wno-unused-parameter',
'-Wno-c++11-extensions'
],
'conditions' : [
['skia_warnings_as_errors == 1', {
'cflags': [
'-Werror',
],
}],
['skia_arch_width == 64', {
'cflags': [
'-m64',
],
'ldflags': [
'-m64',
],
}],
['skia_arch_width == 32', {
'cflags': [
'-m32',
],
'ldflags': [
'-m32',
],
}],
[ 'skia_os == "nacl"', {
'defines': [
'SK_BUILD_FOR_NACL',
],
'link_settings': {
'libraries': [
'-lppapi',
'-lppapi_cpp',
'-lnosys',
'-pthread',
],
},
}, { # skia_os != "nacl"
'include_dirs' : [
'/usr/include/freetype2',
],
}],
],
},
],
['skia_os == "mac"',
{
'variables': {
'mac_sdk%': '<!(python <(DEPTH)/tools/find_mac_sdk.py 10.6)',
},
'defines': [
'SK_BUILD_FOR_MAC',
],
'conditions' : [
['skia_arch_width == 64', {
'xcode_settings': {
'ARCHS': 'x86_64',
},
}],
['skia_arch_width == 32', {
'xcode_settings': {
'ARCHS': 'i386',
'OTHER_CPLUSPLUSFLAGS': [
'-Werror',
],
},
}],
],
'configurations': {
'Debug': {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '0',
},
},
'Release': {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3',
},
'defines': [ 'NDEBUG' ],
},
},
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
'conditions': [
['skia_osx_sdkroot==""', {
'SDKROOT': 'macosx<(mac_sdk)', # -isysroot
}, {
'SDKROOT': '<(skia_osx_sdkroot)', # -isysroot
}],
],
# trying to get this to work, but it needs clang I think...
# 'WARNING_CFLAGS': '-Wexit-time-destructors',
'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
'GCC_WARN_MISSING_PARENTHESES': 'YES',
'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
'GCC_WARN_SIGN_COMPARE': 'YES',
'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
'GCC_WARN_UNUSED_FUNCTION': 'YES',
'GCC_WARN_UNUSED_LABEL': 'YES',
'GCC_WARN_UNUSED_VALUE': 'YES',
'GCC_WARN_UNUSED_VARIABLE': 'YES',
'OTHER_CPLUSPLUSFLAGS': [
'-mssse3',
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
],
},
},
],
['skia_os == "ios"',
{
'defines': [
'SK_BUILD_FOR_IOS',
],
'configurations': {
'Debug': {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '0',
},
},
'Release': {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3',
},
'defines': [ 'NDEBUG' ],
},
},
'xcode_settings': {
'ARCHS': 'armv6 armv7',
'CODE_SIGNING_REQUIRED': 'NO',
'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
'SDKROOT': 'iphoneos',
'TARGETED_DEVICE_FAMILY': '1,2',
'OTHER_CPLUSPLUSFLAGS': '-fvisibility=hidden -fvisibility-inlines-hidden',
'GCC_THUMB_SUPPORT': 'NO',
},
},
],
['skia_os == "android"',
{
'defines': [
'SK_BUILD_FOR_ANDROID',
],
'configurations': {
'Debug': {
'cflags': ['-g']
},
'Release': {
'cflags': ['-O3'],
'defines': [ 'NDEBUG' ],
},
},
'libraries': [
'-lstdc++',
'-lm',
'-llog',
],
'cflags': [
'-Wall',
'-fno-exceptions',
'-fno-rtti',
'-fstrict-aliasing',
'-fuse-ld=gold',
],
'conditions': [
[ 'skia_warnings_as_errors == 1', {
'cflags': [
'-Werror',
],
}],
[ 'skia_profile_enabled == 1', {
'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
}],
[ 'skia_arch_type == "arm" and arm_thumb == 1', {
'cflags': [
'-mthumb',
],
}],
[ 'skia_arch_type == "arm" and armv7 == 1', {
arm: First step towards dynamic NEON support. This patch adds minimal support for dynamic ARM NEON support, i.e. the ability to probe the CPU at runtime for NEON and provide alternate code paths when it is available. - Add include/core/SkUtilsArm.h, which declares a few helper macros (e.g. SK_NEON_ARM_IS_DYNAMIC), plus the handy function 'sk_cpu_arm_has_neon()' which returns true if the target CPU supports the ARM NEON instruction set. Note that the header is in include/core/ because it will have to be included from NEON-specific code under src/code/ It would probably be more logical to put it under include/opts/ instead, but this would require moving all the NEON-specific stuff under src/code/ into src/opts/, which is not trivial due to the way the code is currently architected. - Add src/core/SkUtilsArm.cpp which implements 'sk_cpu_arm_has_neon' for ARM-based Linux systems, only when SK_NEON_ARM_IS_DYNAMIC is true. (For other cases, 'sk_cpu_arm_has_neon' is an inline function that returns a constant 'true' or 'false' value). There is no user-level accessible CPUID instruction on ARM, so do all CPU feature probing by parsing /proc/cpuinfo. This is Linux-specific. For Debug build types, the CPU probing result is printed to the Android log (or Linux command-line) for easier debugging. - Create a new 'opts_neon' target (static library) which shall contain all the NEON-specific code paths for the library. This is necessary because -mfpu=neon impacts also non-scalar code. Just like with -mssse3 on x86, we can't build the rest of the library with this flag. Note that for now, we only include memset16_neon and memset32_neon in this library. - Modify opts_check_arm.cpp to implement SK_ARM_NEON_IS_DYNAMIC properly. Compared to a 'xoom' build, the only difference is the use of NEON-optimized memset16/32 functions. Later patches will move more NEON-specific code paths to 'opts_neon'. Review URL: https://codereview.appspot.com/6247058 git-svn-id: http://skia.googlecode.com/svn/trunk@4069 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-30 13:54:41 +00:00
'variables': {
'arm_neon_optional%': 0,
},
'defines': [
'__ARM_ARCH__=7',
],
'cflags': [
'-march=armv7-a',
'-mfloat-abi=softfp',
],
'conditions': [
[ 'arm_neon == 1', {
'defines': [
'__ARM_HAVE_NEON',
],
'cflags': [
'-mfpu=neon',
],
'ldflags': [
'-march=armv7-a',
'-Wl,--fix-cortex-a8',
],
arm: First step towards dynamic NEON support. This patch adds minimal support for dynamic ARM NEON support, i.e. the ability to probe the CPU at runtime for NEON and provide alternate code paths when it is available. - Add include/core/SkUtilsArm.h, which declares a few helper macros (e.g. SK_NEON_ARM_IS_DYNAMIC), plus the handy function 'sk_cpu_arm_has_neon()' which returns true if the target CPU supports the ARM NEON instruction set. Note that the header is in include/core/ because it will have to be included from NEON-specific code under src/code/ It would probably be more logical to put it under include/opts/ instead, but this would require moving all the NEON-specific stuff under src/code/ into src/opts/, which is not trivial due to the way the code is currently architected. - Add src/core/SkUtilsArm.cpp which implements 'sk_cpu_arm_has_neon' for ARM-based Linux systems, only when SK_NEON_ARM_IS_DYNAMIC is true. (For other cases, 'sk_cpu_arm_has_neon' is an inline function that returns a constant 'true' or 'false' value). There is no user-level accessible CPUID instruction on ARM, so do all CPU feature probing by parsing /proc/cpuinfo. This is Linux-specific. For Debug build types, the CPU probing result is printed to the Android log (or Linux command-line) for easier debugging. - Create a new 'opts_neon' target (static library) which shall contain all the NEON-specific code paths for the library. This is necessary because -mfpu=neon impacts also non-scalar code. Just like with -mssse3 on x86, we can't build the rest of the library with this flag. Note that for now, we only include memset16_neon and memset32_neon in this library. - Modify opts_check_arm.cpp to implement SK_ARM_NEON_IS_DYNAMIC properly. Compared to a 'xoom' build, the only difference is the use of NEON-optimized memset16/32 functions. Later patches will move more NEON-specific code paths to 'opts_neon'. Review URL: https://codereview.appspot.com/6247058 git-svn-id: http://skia.googlecode.com/svn/trunk@4069 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-05-30 13:54:41 +00:00
}],
[ 'arm_neon_optional == 1', {
'defines': [
'__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
],
}],
],
}],
],
},
],
posix: Avoid static initializers in static/global mutexes This patch removes static initializers related to static and global mutexes from the final library's machine code when building on a pthread-capable system. We use PTHREAD_MUTEX_INITIALIZER to perform POD-style initialization. You need a line like the following to declare a global mutex with it: SkBaseMutex gMutex = { PTHREAD_MUTEX_INITIALIZER }; We introduce the SK_DECLARE_STATIC_MUTEX and SK_DECLARE_GLOBAL_MUTEX macros to be able to declare static/global mutexes in the source tree uniformly. SkMutex is now defined as a sub-class of SkBaseMutex, with standard construction/destruction semantics. This is useful if the mutex object is a member of another C++ class, or allocated dynamically. We also modify a few places to refer to SkBaseMutex instead of a SkMutex, where it makes sense. Generally speaking, client code should hold and use pointers to SkBaseMutex whenever they can now. We defined a new built-time macro named SK_USE_POSIX_THREADS to indicate that we're using a pthread-based SkThread.h interface. The macro will also be used in future patches to implement other helper thread synchronization classes. Finally, we inline the acquire() and release() functions in the case of Posix to improve performance a bit. Running: 'bench -repeat 10 -match mutex' on an Android device or a 2.4GHz Xeon Linux desktop shows the following improvements: Before After Galaxy Nexus 1.64 1.45 Nexus S 1.47 1.16 Xoom 1.86 1.66 Xeon 0.36 0.31 This removes 5 static mutex initializers from the library Review URL: https://codereview.appspot.com/5501066 git-svn-id: http://skia.googlecode.com/svn/trunk@3091 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-01-26 21:26:40 +00:00
# We can POD-style initialization of static mutexes to avoid generating
# static initializers if we're using a pthread-compatible thread interface.
[ 'skia_os != "win"', {
'defines': [
'SK_USE_POSIX_THREADS',
posix: Avoid static initializers in static/global mutexes This patch removes static initializers related to static and global mutexes from the final library's machine code when building on a pthread-capable system. We use PTHREAD_MUTEX_INITIALIZER to perform POD-style initialization. You need a line like the following to declare a global mutex with it: SkBaseMutex gMutex = { PTHREAD_MUTEX_INITIALIZER }; We introduce the SK_DECLARE_STATIC_MUTEX and SK_DECLARE_GLOBAL_MUTEX macros to be able to declare static/global mutexes in the source tree uniformly. SkMutex is now defined as a sub-class of SkBaseMutex, with standard construction/destruction semantics. This is useful if the mutex object is a member of another C++ class, or allocated dynamically. We also modify a few places to refer to SkBaseMutex instead of a SkMutex, where it makes sense. Generally speaking, client code should hold and use pointers to SkBaseMutex whenever they can now. We defined a new built-time macro named SK_USE_POSIX_THREADS to indicate that we're using a pthread-based SkThread.h interface. The macro will also be used in future patches to implement other helper thread synchronization classes. Finally, we inline the acquire() and release() functions in the case of Posix to improve performance a bit. Running: 'bench -repeat 10 -match mutex' on an Android device or a 2.4GHz Xeon Linux desktop shows the following improvements: Before After Galaxy Nexus 1.64 1.45 Nexus S 1.47 1.16 Xoom 1.86 1.66 Xeon 0.36 0.31 This removes 5 static mutex initializers from the library Review URL: https://codereview.appspot.com/5501066 git-svn-id: http://skia.googlecode.com/svn/trunk@3091 2bbb7eff-a529-9590-31e7-b0007b416f81
2012-01-26 21:26:40 +00:00
],
}],
], # end 'conditions'
# The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
'xcode_settings': {
'SYMROOT': '<(DEPTH)/xcodebuild',
},
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2: