blob: 6dc6f858517d781a660ac7a4255382c41300bf45 [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 # (To be honest, I'm not sure why we need to include common.gypi. I thought it was automatic.)
8 'variables': {
Mike Kleineb94e562016-10-26 18:37:24 -04009 'includes': [ 'common.gypi' ],
mtkleinf7069d52015-01-26 18:55:58 -080010 },
mtklein09337252015-01-26 18:15:31 -080011
mtkleinf7069d52015-01-26 18:55:58 -080012 # Generally we shove things into one 'opts' target conditioned on platform.
13 # If a particular platform needs some files built with different flags,
14 # those become separate targets: opts_ssse3, opts_sse41, opts_neon.
15
16 'targets': [
epoger@google.comae85aea2011-05-31 13:50:51 +000017 {
18 'target_name': 'opts',
borenet@google.comefb1d772012-10-10 19:45:51 +000019 'product_name': 'skia_opts',
epoger@google.comae85aea2011-05-31 13:50:51 +000020 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +000021 'standalone_static_library': 1,
bungeman@google.comb8f36552013-07-22 14:39:45 +000022 'dependencies': [
23 'core.gyp:*',
senorblanco@chromium.org0ded88d2014-01-24 15:43:50 +000024 'effects.gyp:*'
bungeman@google.comb8f36552013-07-22 14:39:45 +000025 ],
epoger@google.comae85aea2011-05-31 13:50:51 +000026 'include_dirs': [
mtkleincd1f2da2015-07-28 08:55:14 -070027 '../include/private',
epoger@google.comae85aea2011-05-31 13:50:51 +000028 '../src/core',
djsollen@google.coma44e6c62012-01-09 14:38:25 +000029 '../src/opts',
krajcevski630598c2014-07-14 12:00:04 -070030 '../src/utils',
mtkleinf7069d52015-01-26 18:55:58 -080031 '../include/utils',
epoger@google.comae85aea2011-05-31 13:50:51 +000032 ],
33 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -080034 [ '"x86" in skia_arch_type and skia_os != "ios"', {
mtkleinf7069d52015-01-26 18:55:58 -080035 'cflags': [ '-msse2' ],
Mike Klein78d5a3b2016-09-30 10:48:01 -040036 'dependencies': [ 'opts_ssse3', 'opts_sse41', 'opts_sse42', 'opts_avx', 'opts_hsw' ],
Mike Kleineb94e562016-10-26 18:37:24 -040037 'sources': [ '<!@(python read_gni.py ../gn/opts.gni sse2)' ],
mtkleinc98fe3a2015-01-26 18:05:37 -080038 }],
mtkleinf7069d52015-01-26 18:55:58 -080039
40 [ 'skia_arch_type == "mips"', {
41 'conditions': [
42 [ '(mips_arch_variant == "mips32r2") and (mips_dsp == 1 or mips_dsp == 2)', {
Mike Kleineb94e562016-10-26 18:37:24 -040043 'sources': [ '<!@(python read_gni.py ../gn/opts.gni mips_dsp)' ],
mtkleinf7069d52015-01-26 18:55:58 -080044 },{
Mike Kleineb94e562016-10-26 18:37:24 -040045 'sources': [ '<!@(python read_gni.py ../gn/opts.gni none)' ],
mtkleinf7069d52015-01-26 18:55:58 -080046 }],
47 ]
48 }],
49
50 [ '(skia_arch_type == "arm" and arm_version < 7) \
mtkleinf3f94402015-04-17 14:02:40 -070051 or (skia_os == "ios") \
scroggodf1c3372015-02-12 10:48:25 -080052 or (skia_os == "android" \
mtkleinf3f94402015-04-17 14:02:40 -070053 and skia_arch_type not in ["x86", "x86_64", "arm", "mips", \
54 "arm64"])', {
Mike Kleineb94e562016-10-26 18:37:24 -040055 'sources': [ '<!@(python read_gni.py ../gn/opts.gni none)' ],
mtkleinf7069d52015-01-26 18:55:58 -080056 }],
57
djsollen@google.comf7542ba2013-07-31 12:57:27 +000058 [ 'skia_arch_type == "arm" and arm_version >= 7', {
djsollen@google.com58629292011-11-03 13:08:29 +000059 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
60 # ARM), the compiler doesn't like that.
mtkleinf7069d52015-01-26 18:55:58 -080061 'cflags!': [ '-fno-omit-frame-pointer', '-mapcs-frame', '-mapcs' ],
62 'cflags': [ '-fomit-frame-pointer' ],
Mike Kleineb94e562016-10-26 18:37:24 -040063 'sources': [ '<!@(python read_gni.py ../gn/opts.gni armv7)' ],
digit@google.comeec9dbc2012-05-30 13:54:41 +000064 'conditions': [
mtklein809ccf32016-05-05 10:58:39 -070065 [ 'arm_neon == 1', {
mtkleinf7069d52015-01-26 18:55:58 -080066 'dependencies': [ 'opts_neon' ]
caryclark@google.com867cbd82012-09-20 15:45:41 +000067 }],
digit@google.comeec9dbc2012-05-30 13:54:41 +000068 ],
djsollen@google.com58629292011-11-03 13:08:29 +000069 }],
mtkleinf7069d52015-01-26 18:55:58 -080070
71 [ 'skia_arch_type == "arm64"', {
Mike Kleineb94e562016-10-26 18:37:24 -040072 'sources': [ '<!@(python read_gni.py ../gn/opts.gni arm64)' ],
mtklein9c3887c2016-08-19 08:07:51 -070073 'dependencies': [ 'opts_crc32' ]
djordje.pesut632a4542014-06-11 06:56:10 -070074 }],
mtkleinf7069d52015-01-26 18:55:58 -080075
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +000076 [ 'skia_android_framework', {
77 'cflags!': [
78 '-msse2',
79 '-mfpu=neon',
80 '-fomit-frame-pointer',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +000081 ]
82 }],
epoger@google.comae85aea2011-05-31 13:50:51 +000083 ],
84 },
tomhudson@google.com95ad1552012-02-14 18:28:54 +000085 {
mtklein9c3887c2016-08-19 08:07:51 -070086 'target_name': 'opts_crc32',
87 'product_name': 'skia_opts_crc32',
88 'type': 'static_library',
89 'standalone_static_library': 1,
90 'dependencies': [ 'core.gyp:*' ],
91 'include_dirs': [
92 '../include/private',
93 '../src/core',
94 '../src/utils',
95 ],
Mike Kleineb94e562016-10-26 18:37:24 -040096 'sources': [ '<!@(python read_gni.py ../gn/opts.gni crc32)' ],
mtklein9c3887c2016-08-19 08:07:51 -070097 'conditions': [
98 [ 'not skia_android_framework', { 'cflags': [ '-march=armv8-a+crc' ] }],
99 ],
100 },
101 {
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000102 'target_name': 'opts_ssse3',
borenet@google.comefb1d772012-10-10 19:45:51 +0000103 'product_name': 'skia_opts_ssse3',
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000104 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +0000105 'standalone_static_library': 1,
mtkleinf7069d52015-01-26 18:55:58 -0800106 'dependencies': [ 'core.gyp:*' ],
mtkleincd1f2da2015-07-28 08:55:14 -0700107 'include_dirs': [
108 '../include/private',
109 '../src/core',
mtkleinb6394742015-08-06 08:17:16 -0700110 '../src/utils',
mtkleincd1f2da2015-07-28 08:55:14 -0700111 ],
Mike Kleineb94e562016-10-26 18:37:24 -0400112 'sources': [ '<!@(python read_gni.py ../gn/opts.gni ssse3)' ],
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000113 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700114 [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ] }],
115 [ 'not skia_android_framework', { 'cflags': [ '-mssse3' ] }],
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000116 ],
117 },
henrik.smiding3bb195e2014-06-27 08:03:17 -0700118 {
mtkleinf7069d52015-01-26 18:55:58 -0800119 'target_name': 'opts_sse41',
120 'product_name': 'skia_opts_sse41',
henrik.smiding3bb195e2014-06-27 08:03:17 -0700121 'type': 'static_library',
122 'standalone_static_library': 1,
mtkleinf7069d52015-01-26 18:55:58 -0800123 'dependencies': [ 'core.gyp:*' ],
mtkleincd1f2da2015-07-28 08:55:14 -0700124 'include_dirs': [
125 '../include/private',
126 '../src/core',
mtkleinb6394742015-08-06 08:17:16 -0700127 '../src/utils',
mtkleincd1f2da2015-07-28 08:55:14 -0700128 ],
Mike Kleineb94e562016-10-26 18:37:24 -0400129 'sources': [ '<!@(python read_gni.py ../gn/opts.gni sse41)' ],
mtklein85533962015-08-25 06:30:07 -0700130 'xcode_settings': { 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES' },
henrik.smiding3bb195e2014-06-27 08:03:17 -0700131 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700132 [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ] }],
133 [ 'not skia_android_framework', { 'cflags': [ '-msse4.1' ] }],
henrik.smiding3bb195e2014-06-27 08:03:17 -0700134 ],
135 },
digit@google.comeec9dbc2012-05-30 13:54:41 +0000136 {
mtklein5141d902015-08-24 10:32:02 -0700137 'target_name': 'opts_sse42',
138 'product_name': 'skia_opts_sse42',
139 'type': 'static_library',
140 'standalone_static_library': 1,
141 'dependencies': [ 'core.gyp:*' ],
142 'include_dirs': [
143 '../include/private',
144 '../src/core',
145 '../src/utils',
146 ],
Mike Kleineb94e562016-10-26 18:37:24 -0400147 'sources': [ '<!@(python read_gni.py ../gn/opts.gni sse42)' ],
mtklein85533962015-08-25 06:30:07 -0700148 'xcode_settings': { 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES' },
mtklein5141d902015-08-24 10:32:02 -0700149 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700150 [ 'skia_os == "win"', { 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ] }],
151 [ 'not skia_android_framework', { 'cflags': [ '-msse4.2' ] }],
mtklein5141d902015-08-24 10:32:02 -0700152 ],
153 },
154 {
155 'target_name': 'opts_avx',
156 'product_name': 'skia_opts_avx',
157 'type': 'static_library',
158 'standalone_static_library': 1,
159 'dependencies': [ 'core.gyp:*' ],
160 'include_dirs': [
161 '../include/private',
162 '../src/core',
163 '../src/utils',
164 ],
Mike Kleineb94e562016-10-26 18:37:24 -0400165 'sources': [ '<!@(python read_gni.py ../gn/opts.gni avx)' ],
mtklein85533962015-08-25 06:30:07 -0700166 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '3' } },
mtklein20473342016-01-25 09:26:54 -0800167 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '-mavx' ] },
mtklein5141d902015-08-24 10:32:02 -0700168 'conditions': [
mtklein85533962015-08-25 06:30:07 -0700169 [ 'not skia_android_framework', { 'cflags': [ '-mavx' ] }],
mtklein5141d902015-08-24 10:32:02 -0700170 ],
171 },
172 {
Mike Klein78d5a3b2016-09-30 10:48:01 -0400173 'target_name': 'opts_hsw',
174 'product_name': 'skia_opts_hsw',
mtklein5141d902015-08-24 10:32:02 -0700175 'type': 'static_library',
176 'standalone_static_library': 1,
177 'dependencies': [ 'core.gyp:*' ],
178 'include_dirs': [
179 '../include/private',
180 '../src/core',
181 '../src/utils',
182 ],
Mike Kleineb94e562016-10-26 18:37:24 -0400183 'sources': [ '<!@(python read_gni.py ../gn/opts.gni hsw)' ],
mtklein85533962015-08-25 06:30:07 -0700184 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '5' } },
Mike Klein78d5a3b2016-09-30 10:48:01 -0400185 'xcode_settings': {
186 'OTHER_CPLUSPLUSFLAGS': [ '-mavx2', '-mbmi', '-mbmi2', '-mf16c', '-mfma' ]
187 },
mtklein5141d902015-08-24 10:32:02 -0700188 'conditions': [
Mike Klein78d5a3b2016-09-30 10:48:01 -0400189 [ 'not skia_android_framework', {
190 'cflags': [ '-mavx2', '-mbmi', '-mbmi2', '-mf16c', '-mfma' ]
191 }],
mtklein5141d902015-08-24 10:32:02 -0700192 ],
193 },
194 {
digit@google.comeec9dbc2012-05-30 13:54:41 +0000195 'target_name': 'opts_neon',
borenet@google.comefb1d772012-10-10 19:45:51 +0000196 'product_name': 'skia_opts_neon',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000197 'type': 'static_library',
borenet@google.comefb1d772012-10-10 19:45:51 +0000198 'standalone_static_library': 1,
bungeman@google.comb8f36552013-07-22 14:39:45 +0000199 'dependencies': [
200 'core.gyp:*',
senorblanco@chromium.org0ded88d2014-01-24 15:43:50 +0000201 'effects.gyp:*'
bungeman@google.comb8f36552013-07-22 14:39:45 +0000202 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000203 'include_dirs': [
mtkleincd1f2da2015-07-28 08:55:14 -0700204 '../include/private',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000205 '../src/core',
digit@google.comfce02ac2012-08-01 14:25:07 +0000206 '../src/opts',
krajcevski630598c2014-07-14 12:00:04 -0700207 '../src/utils',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000208 ],
Mike Kleineb94e562016-10-26 18:37:24 -0400209 'sources': [ '<!@(python read_gni.py ../gn/opts.gni neon)' ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000210 'cflags!': [
211 '-fno-omit-frame-pointer',
212 '-mfpu=vfp', # remove them all, just in case.
213 '-mfpu=vfpv3',
214 '-mfpu=vfpv3-d16',
215 ],
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000216 'conditions': [
217 [ 'not skia_android_framework', {
218 'cflags': [
219 '-mfpu=neon',
220 '-fomit-frame-pointer',
221 ],
222 }],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000223 ],
djsollen@google.com4dcc6242013-01-23 18:56:38 +0000224 'ldflags': [
225 '-march=armv7-a',
226 '-Wl,--fix-cortex-a8',
227 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +0000228 },
epoger@google.comae85aea2011-05-31 13:50:51 +0000229 ],
230}