Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / build / secondary / third_party / libjpeg_turbo / BUILD.gn
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # Do not use the targets in this file unless you need a certain libjpeg
6 # implementation. Use the meta target //third_party:jpeg instead.
7
8 if (cpu_arch == "arm") {
9   import("//build/config/arm.gni")
10 }
11
12 if (cpu_arch == "x86" || cpu_arch == "x64") {
13
14 import("//third_party/yasm/yasm_assemble.gni")
15
16 yasm_assemble("simd_asm") {
17   defines = []
18
19   if (cpu_arch == "x86") {
20     sources = [
21       "simd/jccolmmx.asm",
22       "simd/jccolss2.asm",
23       "simd/jcgrammx.asm",
24       "simd/jcgrass2.asm",
25       "simd/jcqnt3dn.asm",
26       "simd/jcqntmmx.asm",
27       "simd/jcqnts2f.asm",
28       "simd/jcqnts2i.asm",
29       "simd/jcqntsse.asm",
30       "simd/jcsammmx.asm",
31       "simd/jcsamss2.asm",
32       "simd/jdcolmmx.asm",
33       "simd/jdcolss2.asm",
34       "simd/jdmermmx.asm",
35       "simd/jdmerss2.asm",
36       "simd/jdsammmx.asm",
37       "simd/jdsamss2.asm",
38       "simd/jf3dnflt.asm",
39       "simd/jfmmxfst.asm",
40       "simd/jfmmxint.asm",
41       "simd/jfss2fst.asm",
42       "simd/jfss2int.asm",
43       "simd/jfsseflt.asm",
44       "simd/ji3dnflt.asm",
45       "simd/jimmxfst.asm",
46       "simd/jimmxint.asm",
47       "simd/jimmxred.asm",
48       "simd/jiss2flt.asm",
49       "simd/jiss2fst.asm",
50       "simd/jiss2int.asm",
51       "simd/jiss2red.asm",
52       "simd/jisseflt.asm",
53       "simd/jsimdcpu.asm",
54     ]
55     defines += [
56       "__x86__",
57     ]
58   } else if (cpu_arch == "x64") {
59     sources = [
60       "simd/jccolss2-64.asm",
61       "simd/jcgrass2-64.asm",
62       "simd/jcqnts2f-64.asm",
63       "simd/jcqnts2i-64.asm",
64       "simd/jcsamss2-64.asm",
65       "simd/jdcolss2-64.asm",
66       "simd/jdmerss2-64.asm",
67       "simd/jdsamss2-64.asm",
68       "simd/jfss2fst-64.asm",
69       "simd/jfss2int-64.asm",
70       "simd/jfsseflt-64.asm",
71       "simd/jiss2flt-64.asm",
72       "simd/jiss2fst-64.asm",
73       "simd/jiss2int-64.asm",
74       "simd/jiss2red-64.asm",
75     ]
76     defines += [
77       "__x86_64__",
78     ]
79   }
80
81   if (is_win) {
82     defines += [
83       "MSVC",
84     ]
85     include_dirs = [ "win" ]
86     if (cpu_arch == "x86") {
87       defines += [
88         "WIN32",
89       ]
90     } else {
91       defines += [
92         "WIN64",
93       ]
94     }
95   } else if (is_mac) {
96     defines += [
97       "MACHO",
98     ]
99     include_dirs = [ "mac" ]
100   } else if (is_linux) {
101     defines += [
102       "ELF",
103     ]
104     include_dirs = [ "linux" ]
105   }
106 }
107
108 }
109
110 source_set("simd") {
111   if (cpu_arch == "x86") {
112     deps = [ ":simd_asm" ]
113     sources = [
114       "simd/jsimd_i386.c",
115     ]
116     if (is_win) {
117       cflags = [ "/wd4245" ]
118     }
119   } else if (cpu_arch == "x64") {
120     deps = [ ":simd_asm" ]
121     sources = [
122       "simd/jsimd_x86_64.c",
123     ]
124   } else if (cpu_arch == "arm" && arm_version >= 7 &&
125              (arm_use_neon || arm_optionally_use_neon)) {
126     sources = [
127       "simd/jsimd_arm.c",
128       "simd/jsimd_arm_neon.S",
129     ]
130   } else {
131     sources = [ "jsimd_none.c" ]
132   }
133 }
134
135 config("libjpeg_config") {
136   include_dirs = [ "." ]
137 }
138
139 source_set("libjpeg") {
140   sources = [
141     "jcapimin.c",
142     "jcapistd.c",
143     "jccoefct.c",
144     "jccolor.c",
145     "jcdctmgr.c",
146     "jchuff.c",
147     "jchuff.h",
148     "jcinit.c",
149     "jcmainct.c",
150     "jcmarker.c",
151     "jcmaster.c",
152     "jcomapi.c",
153     "jconfig.h",
154     "jcparam.c",
155     "jcphuff.c",
156     "jcprepct.c",
157     "jcsample.c",
158     "jdapimin.c",
159     "jdapistd.c",
160     "jdatadst.c",
161     "jdatasrc.c",
162     "jdcoefct.c",
163     "jdcolor.c",
164     "jdct.h",
165     "jddctmgr.c",
166     "jdhuff.c",
167     "jdhuff.h",
168     "jdinput.c",
169     "jdmainct.c",
170     "jdmarker.c",
171     "jdmaster.c",
172     "jdmerge.c",
173     "jdphuff.c",
174     "jdpostct.c",
175     "jdsample.c",
176     "jerror.c",
177     "jerror.h",
178     "jfdctflt.c",
179     "jfdctfst.c",
180     "jfdctint.c",
181     "jidctflt.c",
182     "jidctfst.c",
183     "jidctint.c",
184     "jidctred.c",
185     "jinclude.h",
186     "jmemmgr.c",
187     "jmemnobs.c",
188     "jmemsys.h",
189     "jmorecfg.h",
190     "jpegint.h",
191     "jpeglib.h",
192     "jpeglibmangler.h",
193     "jquant1.c",
194     "jquant2.c",
195     "jutils.c",
196     "jversion.h",
197   ]
198
199   defines = [
200     "WITH_SIMD",
201     "MOTION_JPEG_SUPPORTED",
202     "NO_GETENV",
203   ]
204
205   configs += [ ":libjpeg_config" ]
206
207   public_configs = [ ":libjpeg_config" ]
208
209   # MemorySanitizer doesn't support assembly code, so keep it disabled in
210   # MSan builds for now.
211   # TODO: Enable on Linux when .asm files are recognized.
212   if (is_msan || is_linux) {
213     sources += [ "jsimd_none.c" ]
214   } else {
215     deps = [ ":simd" ]
216   }
217
218   # TODO(GYP): Compile the .asm files with YASM as GYP does.
219 }