blob: 396a37e3ef3f4ebcdd8419a775dc616d6191a99e [file] [log] [blame]
scroggo3e562272015-03-25 10:22:41 -07001# Copyright 2015 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
scroggodf1c3372015-02-12 10:48:25 -08005# Gyp file for building opts target.
epoger@google.comae85aea2011-05-31 13:50:51 +00006{
mtkleinf7069d52015-01-26 18:55:58 -08007 # Source lists live in opts.gypi. This makes it easier to maintain our Chrome GYP/GN setup.
8 # (To be honest, I'm not sure why we need to include common.gypi. I thought it was automatic.)
9 'variables': {
10 'includes': [ 'common.gypi', 'opts.gypi' ],
11 },
mtklein09337252015-01-26 18:15:31 -080012
mtkleinf7069d52015-01-26 18:55:58 -080013 # Generally we shove things into one 'opts' target conditioned on platform.
14 # If a particular platform needs some files built with different flags,
15 # those become separate targets: opts_ssse3, opts_sse41, opts_neon.
16
17 'targets': [
epoger@google.comae85aea2011-05-31 13:50:51 +000018 {
19 'target_name': 'opts',
borenet@google.comefb1d772012-10-10 19:45:51 +000020 'product_name': 'skia_opts',
epoger@google.comae85aea2011-05-31 13:50:51 +000021 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +000022 'standalone_static_library': 1,
bungeman@google.comb8f36552013-07-22 14:39:45 +000023 'dependencies': [
24 'core.gyp:*',
senorblanco@chromium.org0ded88d2014-01-24 15:43:50 +000025 'effects.gyp:*'
bungeman@google.comb8f36552013-07-22 14:39:45 +000026 ],
epoger@google.comae85aea2011-05-31 13:50:51 +000027 'include_dirs': [
mtkleincd1f2da2015-07-28 08:55:14 -070028 '../include/private',
epoger@google.comae85aea2011-05-31 13:50:51 +000029 '../src/core',
djsollen@google.coma44e6c62012-01-09 14:38:25 +000030 '../src/opts',
krajcevski630598c2014-07-14 12:00:04 -070031 '../src/utils',
mtkleinf7069d52015-01-26 18:55:58 -080032 '../include/utils',
epoger@google.comae85aea2011-05-31 13:50:51 +000033 ],
34 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -080035 [ '"x86" in skia_arch_type and skia_os != "ios"', {
mtkleinf7069d52015-01-26 18:55:58 -080036 'cflags': [ '-msse2' ],
mtklein5141d902015-08-24 10:32:02 -070037 'dependencies': [ 'opts_ssse3', 'opts_sse41', 'opts_sse42', 'opts_avx', 'opts_avx2' ],
mtkleinf7069d52015-01-26 18:55:58 -080038 'sources': [ '<@(sse2_sources)' ],
mtkleinc98fe3a2015-01-26 18:05:37 -080039 }],
mtkleinf7069d52015-01-26 18:55:58 -080040
41 [ 'skia_arch_type == "mips"', {
42 'conditions': [
43 [ '(mips_arch_variant == "mips32r2") and (mips_dsp == 1 or mips_dsp == 2)', {
44 'sources': [ '<@(mips_dsp_sources)' ],
45 },{
46 'sources': [ '<@(none_sources)' ],
47 }],
48 ]
49 }],
50
51 [ '(skia_arch_type == "arm" and arm_version < 7) \
mtkleinf3f94402015-04-17 14:02:40 -070052 or (skia_os == "ios") \
scroggodf1c3372015-02-12 10:48:25 -080053 or (skia_os == "android" \
mtkleinf3f94402015-04-17 14:02:40 -070054 and skia_arch_type not in ["x86", "x86_64", "arm", "mips", \
55 "arm64"])', {
mtkleinf7069d52015-01-26 18:55:58 -080056 'sources': [ '<@(none_sources)' ],
57 }],
58
djsollen@google.comf7542ba2013-07-31 12:57:27 +000059 [ 'skia_arch_type == "arm" and arm_version >= 7', {
djsollen@google.com58629292011-11-03 13:08:29 +000060 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
61 # ARM), the compiler doesn't like that.
mtkleinf7069d52015-01-26 18:55:58 -080062 'cflags!': [ '-fno-omit-frame-pointer', '-mapcs-frame', '-mapcs' ],
63 'cflags': [ '-fomit-frame-pointer' ],
64 'variables': { 'arm_neon_optional%': '<(arm_neon_optional>' },
65 'sources': [ '<@(armv7_sources)' ],
digit@google.comeec9dbc2012-05-30 13:54:41 +000066 'conditions': [
67 [ 'arm_neon == 1 or arm_neon_optional == 1', {
mtkleinf7069d52015-01-26 18:55:58 -080068 'dependencies': [ 'opts_neon' ]
caryclark@google.com867cbd82012-09-20 15:45:41 +000069 }],
digit@google.comeec9dbc2012-05-30 13:54:41 +000070 ],
djsollen@google.com58629292011-11-03 13:08:29 +000071 }],
mtkleinf7069d52015-01-26 18:55:58 -080072
73 [ 'skia_arch_type == "arm64"', {
74 'sources': [ '<@(arm64_sources)' ],
djordje.pesut632a4542014-06-11 06:56:10 -070075 }],
mtkleinf7069d52015-01-26 18:55:58 -080076
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +000077 [ 'skia_android_framework', {
78 'cflags!': [
79 '-msse2',
80 '-mfpu=neon',
81 '-fomit-frame-pointer',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +000082 ]
83 }],
epoger@google.comae85aea2011-05-31 13:50:51 +000084 ],
85 },
tomhudson@google.com95ad1552012-02-14 18:28:54 +000086 {
87 'target_name': 'opts_ssse3',
borenet@google.comefb1d772012-10-10 19:45:51 +000088 'product_name': 'skia_opts_ssse3',
tomhudson@google.com95ad1552012-02-14 18:28:54 +000089 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +000090 'standalone_static_library': 1,
mtkleinf7069d52015-01-26 18:55:58 -080091 'dependencies': [ 'core.gyp:*' ],
mtkleincd1f2da2015-07-28 08:55:14 -070092 'include_dirs': [
93 '../include/private',
94 '../src/core',
mtkleinb6394742015-08-06 08:17:16 -070095 '../src/utils',
mtkleincd1f2da2015-07-28 08:55:14 -070096 ],
mtkleinf7069d52015-01-26 18:55:58 -080097 'sources': [ '<@(ssse3_sources)' ],
tomhudson@google.com95ad1552012-02-14 18:28:54 +000098 'conditions': [
mtklein85533962015-08-25 06:30:07 -070099 [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ] }],
100 [ 'not skia_android_framework', { 'cflags': [ '-mssse3' ] }],
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000101 ],
102 },
henrik.smiding3bb195e2014-06-27 08:03:17 -0700103 {
mtkleinf7069d52015-01-26 18:55:58 -0800104 'target_name': 'opts_sse41',
105 'product_name': 'skia_opts_sse41',
henrik.smiding3bb195e2014-06-27 08:03:17 -0700106 'type': 'static_library',
107 'standalone_static_library': 1,
mtkleinf7069d52015-01-26 18:55:58 -0800108 'dependencies': [ 'core.gyp:*' ],
mtkleincd1f2da2015-07-28 08:55:14 -0700109 'include_dirs': [
110 '../include/private',
111 '../src/core',
mtkleinb6394742015-08-06 08:17:16 -0700112 '../src/utils',
mtkleincd1f2da2015-07-28 08:55:14 -0700113 ],
mtkleinf7069d52015-01-26 18:55:58 -0800114 'sources': [ '<@(sse41_sources)' ],
mtklein85533962015-08-25 06:30:07 -0700115 'xcode_settings': { 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES' },
henrik.smiding3bb195e2014-06-27 08:03:17 -0700116 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700117 [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ] }],
118 [ 'not skia_android_framework', { 'cflags': [ '-msse4.1' ] }],
henrik.smiding3bb195e2014-06-27 08:03:17 -0700119 ],
120 },
digit@google.comeec9dbc2012-05-30 13:54:41 +0000121 {
mtklein5141d902015-08-24 10:32:02 -0700122 'target_name': 'opts_sse42',
123 'product_name': 'skia_opts_sse42',
124 'type': 'static_library',
125 'standalone_static_library': 1,
126 'dependencies': [ 'core.gyp:*' ],
127 'include_dirs': [
128 '../include/private',
129 '../src/core',
130 '../src/utils',
131 ],
132 'sources': [ '<@(sse42_sources)' ],
mtklein85533962015-08-25 06:30:07 -0700133 'xcode_settings': { 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES' },
mtklein5141d902015-08-24 10:32:02 -0700134 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700135 [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ] }],
136 [ 'not skia_android_framework', { 'cflags': [ '-msse4.2' ] }],
mtklein5141d902015-08-24 10:32:02 -0700137 ],
138 },
139 {
140 'target_name': 'opts_avx',
141 'product_name': 'skia_opts_avx',
142 'type': 'static_library',
143 'standalone_static_library': 1,
144 'dependencies': [ 'core.gyp:*' ],
145 'include_dirs': [
146 '../include/private',
147 '../src/core',
148 '../src/utils',
149 ],
150 'sources': [ '<@(avx_sources)' ],
mtklein85533962015-08-25 06:30:07 -0700151 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '3' } },
152 'xcode_settings': { 'OTHER_CFLAGS': [ '-mavx' ] },
mtklein5141d902015-08-24 10:32:02 -0700153 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700154 [ 'not skia_android_framework', { 'cflags': [ '-mavx' ] }],
mtklein5141d902015-08-24 10:32:02 -0700155 ],
156 },
157 {
158 'target_name': 'opts_avx2',
159 'product_name': 'skia_opts_avx2',
160 'type': 'static_library',
161 'standalone_static_library': 1,
162 'dependencies': [ 'core.gyp:*' ],
163 'include_dirs': [
164 '../include/private',
165 '../src/core',
166 '../src/utils',
167 ],
168 'sources': [ '<@(avx2_sources)' ],
mtklein85533962015-08-25 06:30:07 -0700169 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '5' } },
170 'xcode_settings': { 'OTHER_CFLAGS': [ '-mavx2' ] },
mtklein5141d902015-08-24 10:32:02 -0700171 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700172 [ 'not skia_android_framework', { 'cflags': [ '-mavx2' ] }],
mtklein5141d902015-08-24 10:32:02 -0700173 ],
174 },
175 {
digit@google.comeec9dbc2012-05-30 13:54:41 +0000176 'target_name': 'opts_neon',
borenet@google.comefb1d772012-10-10 19:45:51 +0000177 'product_name': 'skia_opts_neon',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000178 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +0000179 'standalone_static_library': 1,
bungeman@google.comb8f36552013-07-22 14:39:45 +0000180 'dependencies': [
181 'core.gyp:*',
senorblanco@chromium.org0ded88d2014-01-24 15:43:50 +0000182 'effects.gyp:*'
bungeman@google.comb8f36552013-07-22 14:39:45 +0000183 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000184 'include_dirs': [
mtkleincd1f2da2015-07-28 08:55:14 -0700185 '../include/private',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000186 '../src/core',
digit@google.comfce02ac2012-08-01 14:25:07 +0000187 '../src/opts',
krajcevski630598c2014-07-14 12:00:04 -0700188 '../src/utils',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000189 ],
mtkleinf7069d52015-01-26 18:55:58 -0800190 'sources': [ '<@(neon_sources)' ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000191 'cflags!': [
192 '-fno-omit-frame-pointer',
193 '-mfpu=vfp', # remove them all, just in case.
194 '-mfpu=vfpv3',
195 '-mfpu=vfpv3-d16',
196 ],
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000197 'conditions': [
198 [ 'not skia_android_framework', {
199 'cflags': [
200 '-mfpu=neon',
201 '-fomit-frame-pointer',
202 ],
203 }],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000204 ],
djsollen@google.com4dcc6242013-01-23 18:56:38 +0000205 'ldflags': [
206 '-march=armv7-a',
207 '-Wl,--fix-cortex-a8',
208 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000209 },
epoger@google.comae85aea2011-05-31 13:50:51 +0000210 ],
211}