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