blob: 8c85b9ab43fc35a3046168b0c4236cfe68109bf8 [file] [log] [blame]
epoger@google.comae85aea2011-05-31 13:50:51 +00001{
epoger@google.comae85aea2011-05-31 13:50:51 +00002 'targets': [
3 # Due to an unfortunate intersection of lameness between gcc and gyp,
4 # we have to build the *_SSE2.cpp files in a separate target. The
5 # gcc lameness is that, in order to compile SSE2 intrinsics code, it
6 # must be passed the -msse2 flag. However, with this flag, it may
7 # emit SSE2 instructions even for scalar code, such as the CPUID
8 # test used to test for the presence of SSE2. So that, and all other
9 # code must be compiled *without* -msse2. The gyp lameness is that it
10 # does not allow file-specific CFLAGS, so we must create this extra
11 # target for those files to be compiled with -msse2.
12 #
13 # This is actually only a problem on 32-bit Linux (all Intel Macs have
14 # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit
15 # SSE2 from instrinsics, while generating plain ol' 386 for everything
16 # else). However, to keep the .gyp file simple and avoid platform-specific
17 # build breakage, we do this on all platforms.
18
19 # For about the same reason, we need to compile the ARM opts files
20 # separately as well.
21 {
22 'target_name': 'opts',
23 'type': 'static_library',
24 'include_dirs': [
25 '../include/config',
26 '../include/core',
27 '../src/core',
djsollen@google.coma44e6c62012-01-09 14:38:25 +000028 '../src/opts',
epoger@google.comae85aea2011-05-31 13:50:51 +000029 ],
30 'conditions': [
djsollen@google.come341cb32012-06-28 16:08:05 +000031 [ 'skia_arch_type == "x86"', {
tomhudson@google.com95ad1552012-02-14 18:28:54 +000032 'conditions': [
33 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
34 'cflags': [
35 '-msse2',
36 ],
37 }],
38 ],
djsollen@google.com58629292011-11-03 13:08:29 +000039 'sources': [
djsollen@google.coma44e6c62012-01-09 14:38:25 +000040 '../src/opts/opts_check_SSE2.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000041 '../src/opts/SkBitmapProcState_opts_SSE2.cpp',
42 '../src/opts/SkBlitRow_opts_SSE2.cpp',
tomhudson@google.com8dd90a92012-03-19 13:49:50 +000043 '../src/opts/SkBlitRect_opts_SSE2.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000044 '../src/opts/SkUtils_opts_SSE2.cpp',
45 ],
tomhudson@google.com95ad1552012-02-14 18:28:54 +000046 'dependencies': [
47 'opts_ssse3',
48 ],
djsollen@google.com58629292011-11-03 13:08:29 +000049 }],
djsollen@google.come341cb32012-06-28 16:08:05 +000050 [ 'skia_arch_type == "arm" and armv7 == 1', {
djsollen@google.com58629292011-11-03 13:08:29 +000051 # The assembly uses the frame pointer register (r7 in Thumb/r11 in
52 # ARM), the compiler doesn't like that.
53 'cflags!': [
54 '-fno-omit-frame-pointer',
55 ],
56 'cflags': [
57 '-fomit-frame-pointer',
58 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +000059 'variables': {
60 'arm_neon_optional%': '<(arm_neon_optional>',
61 },
djsollen@google.com58629292011-11-03 13:08:29 +000062 'sources': [
djsollen@google.coma44e6c62012-01-09 14:38:25 +000063 '../src/opts/opts_check_arm.cpp',
64 '../src/opts/memset.arm.S',
djsollen@google.com58629292011-11-03 13:08:29 +000065 '../src/opts/SkBitmapProcState_opts_arm.cpp',
66 '../src/opts/SkBlitRow_opts_arm.cpp',
djsollen@google.com58629292011-11-03 13:08:29 +000067 ],
digit@google.comeec9dbc2012-05-30 13:54:41 +000068 'conditions': [
69 [ 'arm_neon == 1 or arm_neon_optional == 1', {
70 'dependencies': [
71 'opts_neon',
72 ]
73 }]
74 ],
djsollen@google.com58629292011-11-03 13:08:29 +000075 }],
djsollen@google.come341cb32012-06-28 16:08:05 +000076 [ 'skia_arch_type == "arm" and armv7 != 1', {
djsollen@google.com58629292011-11-03 13:08:29 +000077 'sources': [
78 '../src/opts/SkBitmapProcState_opts_none.cpp',
79 '../src/opts/SkBlitRow_opts_none.cpp',
80 '../src/opts/SkUtils_opts_none.cpp',
81 ],
82 }],
epoger@google.comae85aea2011-05-31 13:50:51 +000083 ],
84 },
tomhudson@google.com95ad1552012-02-14 18:28:54 +000085 # For the same lame reasons as what is done for skia_opts, we have to
86 # create another target specifically for SSSE3 code as we would not want
87 # to compile the SSE2 code with -mssse3 which would potentially allow
88 # gcc to generate SSSE3 code.
89 {
90 'target_name': 'opts_ssse3',
91 'type': 'static_library',
92 'include_dirs': [
93 '../include/config',
94 '../include/core',
95 '../src/core',
96 ],
97 'conditions': [
epoger@google.com21099232012-02-14 19:49:19 +000098 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
tomhudson@google.com95ad1552012-02-14 18:28:54 +000099 'cflags': [
100 '-mssse3',
101 ],
102 }],
epoger@google.com21099232012-02-14 19:49:19 +0000103 # TODO(epoger): the following will enable SSSE3 on Macs, but it will
104 # break once we set OTHER_CFLAGS anywhere else (the first setting will
105 # be replaced, not added to)
106 [ 'skia_os in ["mac"]', {
107 'xcode_settings': {
108 'OTHER_CFLAGS': ['-mssse3',],
109 },
110 }],
djsollen@google.come341cb32012-06-28 16:08:05 +0000111 [ 'skia_arch_type == "x86"', {
tomhudson@google.com95ad1552012-02-14 18:28:54 +0000112 'sources': [
113 '../src/opts/SkBitmapProcState_opts_SSSE3.cpp',
114 ],
115 }],
116 ],
117 },
digit@google.comeec9dbc2012-05-30 13:54:41 +0000118 # NEON code must be compiled with -mfpu=neon which also affects scalar
119 # code. To support dynamic NEON code paths, we need to build all
120 # NEON-specific sources in a separate static library. The situation
121 # is very similar to the SSSE3 one.
122 {
123 'target_name': 'opts_neon',
124 'type': 'static_library',
125 'include_dirs': [
126 '../include/config',
127 '../include/core',
128 '../src/core',
digit@google.comfce02ac2012-08-01 14:25:07 +0000129 '../src/opts',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000130 ],
131 'cflags!': [
132 '-fno-omit-frame-pointer',
133 '-mfpu=vfp', # remove them all, just in case.
134 '-mfpu=vfpv3',
135 '-mfpu=vfpv3-d16',
136 ],
137 'cflags': [
digit@google.comeec9dbc2012-05-30 13:54:41 +0000138 '-mfpu=neon',
digit@google.comfce02ac2012-08-01 14:25:07 +0000139 '-fomit-frame-pointer',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000140 ],
141 'sources': [
142 '../src/opts/memset16_neon.S',
143 '../src/opts/memset32_neon.S',
digit@google.comfce02ac2012-08-01 14:25:07 +0000144 '../src/opts/SkBitmapProcState_matrixProcs_neon.cpp',
145 '../src/opts/SkBitmapProcState_matrix_clamp_neon.h',
146 '../src/opts/SkBitmapProcState_matrix_repeat_neon.h',
digit@google.comeec9dbc2012-05-30 13:54:41 +0000147 ],
148 },
epoger@google.comae85aea2011-05-31 13:50:51 +0000149 ],
150}
151
152# Local Variables:
153# tab-width:2
154# indent-tabs-mode:nil
155# End:
156# vim: set expandtab tabstop=2 shiftwidth=2: