Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / protobuf / 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 if (is_win) {
6   config_h_dir = "vsprojects"
7 } else {
8   config_h_dir = "."
9 }
10
11 config("protobuf_config") {
12   include_dirs = [
13     "src",
14     config_h_dir,
15   ]
16   defines = [
17     "GOOGLE_PROTOBUF_NO_RTTI",
18     "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
19   ]
20
21   if (is_win) {
22     # TODO(jschuh): http://crbug.com/167187 size_t -> int.
23     cflags = [ "/wd4267" ]
24   }
25 }
26
27 if (component_mode == "shared_library") {
28   config("protobuf_use_dlls") {
29     defines = [ "PROTOBUF_USE_DLLS" ]
30   }
31 }
32
33 # This condif should be applied to targets using generated code from the proto
34 # compiler. It sets up the include directories properly.
35 config("using_proto") {
36   include_dirs = [
37     "$root_gen_dir/protoc_out",
38   ]
39 }
40
41 protobuf_lite_sources = [
42   "src/google/protobuf/extension_set.cc",
43   "src/google/protobuf/extension_set.h",
44   "src/google/protobuf/generated_message_util.cc",
45   "src/google/protobuf/generated_message_util.h",
46   "src/google/protobuf/io/coded_stream.cc",
47   "src/google/protobuf/io/coded_stream.h",
48   "src/google/protobuf/io/coded_stream_inl.h",
49   "src/google/protobuf/io/zero_copy_stream.cc",
50   "src/google/protobuf/io/zero_copy_stream.h",
51   "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
52   "src/google/protobuf/io/zero_copy_stream_impl_lite.h",
53   "src/google/protobuf/message_lite.cc",
54   "src/google/protobuf/message_lite.h",
55   "src/google/protobuf/repeated_field.cc",
56   "src/google/protobuf/repeated_field.h",
57   "src/google/protobuf/stubs/atomicops.h",
58   "src/google/protobuf/stubs/atomicops_internals_arm_gcc.h",
59   "src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h",
60   "src/google/protobuf/stubs/atomicops_internals_macosx.h",
61   "src/google/protobuf/stubs/atomicops_internals_mips_gcc.h",
62   "src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc",
63   "src/google/protobuf/stubs/atomicops_internals_x86_gcc.h",
64   "src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc",
65   "src/google/protobuf/stubs/atomicops_internals_x86_msvc.h",
66   "src/google/protobuf/stubs/common.cc",
67   "src/google/protobuf/stubs/common.h",
68   "src/google/protobuf/stubs/hash.h",
69   "src/google/protobuf/stubs/map-util.h",
70   "src/google/protobuf/stubs/once.cc",
71   "src/google/protobuf/stubs/once.h",
72   "src/google/protobuf/stubs/platform_macros.h",
73   "src/google/protobuf/unknown_field_set.cc",
74   "src/google/protobuf/unknown_field_set.h",
75   "src/google/protobuf/wire_format_lite.cc",
76   "src/google/protobuf/wire_format_lite.h",
77   "src/google/protobuf/wire_format_lite_inl.h",
78   "$config_h_dir/config.h",
79 ]
80
81 protobuf_lite_cflags = []
82 if (is_win) {
83   protobuf_lite_cflags = [
84     "/wd4018",  # signed/unsigned mismatch in comparison
85     "/wd4244",  # implicit conversion, possible loss of data
86     "/wd4355",  # 'this' used in base member initializer list
87     "/wd4267",  # size_t to int truncation
88     "/wd4291",  # no matching operator delete for a placement new
89   ]
90 }
91
92 component("protobuf_lite") {
93   sources = protobuf_lite_sources
94
95   configs -= [ "//build/config/compiler:chromium_code" ]
96   configs += [ "//build/config/compiler:no_chromium_code" ]
97   if (is_win) {
98     configs -= [ "//build/config/win:lean_and_mean" ]
99   }
100   public_configs = [ ":protobuf_config" ]
101
102   cflags = protobuf_lite_cflags
103
104   # Required for component builds. See http://crbug.com/172800.
105   if (component_mode == "shared_library") {
106     public_configs += [ ":protobuf_use_dlls" ]
107     defines = [ "LIBPROTOBUF_EXPORTS" ]
108   }
109 }
110
111 # This is the full, heavy protobuf lib that's needed for c++ .protos that don't
112 # specify the LITE_RUNTIME option. The protocol compiler itself (protoc) falls
113 # into that category. Do not use in Chrome code.
114
115 source_set("protobuf_full") {
116   # Prevent people from depending on this outside our file.
117   visibility = [ ":*" ]
118
119   sources = protobuf_lite_sources
120   sources += [
121     "src/google/protobuf/descriptor.h",
122     "src/google/protobuf/descriptor.pb.h",
123     "src/google/protobuf/descriptor_database.h",
124     "src/google/protobuf/dynamic_message.h",
125     "src/google/protobuf/generated_enum_reflection.h",
126     "src/google/protobuf/generated_message_reflection.h",
127     "src/google/protobuf/message.h",
128     "src/google/protobuf/reflection_ops.h",
129     "src/google/protobuf/service.h",
130     "src/google/protobuf/text_format.h",
131     "src/google/protobuf/wire_format.h",
132     "src/google/protobuf/io/gzip_stream.h",
133     "src/google/protobuf/io/printer.h",
134     "src/google/protobuf/io/tokenizer.h",
135     "src/google/protobuf/io/zero_copy_stream_impl.h",
136     "src/google/protobuf/compiler/code_generator.h",
137     "src/google/protobuf/compiler/command_line_interface.h",
138     "src/google/protobuf/compiler/importer.h",
139     "src/google/protobuf/compiler/java/java_doc_comment.cc",
140     "src/google/protobuf/compiler/java/java_doc_comment.h",
141     "src/google/protobuf/compiler/parser.h",
142
143     "src/google/protobuf/stubs/strutil.cc",
144     "src/google/protobuf/stubs/strutil.h",
145     "src/google/protobuf/stubs/substitute.cc",
146     "src/google/protobuf/stubs/substitute.h",
147     "src/google/protobuf/stubs/stl_util.h",
148     "src/google/protobuf/stubs/stringprintf.cc",
149     "src/google/protobuf/stubs/stringprintf.h",
150     "src/google/protobuf/stubs/structurally_valid.cc",
151     "src/google/protobuf/stubs/template_util.h",
152     "src/google/protobuf/stubs/type_traits.h",
153
154     "src/google/protobuf/descriptor.cc",
155     "src/google/protobuf/descriptor.pb.cc",
156     "src/google/protobuf/descriptor_database.cc",
157     "src/google/protobuf/dynamic_message.cc",
158     "src/google/protobuf/extension_set_heavy.cc",
159     "src/google/protobuf/generated_message_reflection.cc",
160     "src/google/protobuf/message.cc",
161     "src/google/protobuf/reflection_ops.cc",
162     "src/google/protobuf/service.cc",
163     "src/google/protobuf/text_format.cc",
164     "src/google/protobuf/wire_format.cc",
165     # This file pulls in zlib, but it's not actually used by protoc, so
166     # instead of compiling zlib for the host, let's just exclude this.
167     # "src/src/google/protobuf/io/gzip_stream.cc",
168     "src/google/protobuf/io/printer.cc",
169     "src/google/protobuf/io/tokenizer.cc",
170     "src/google/protobuf/io/zero_copy_stream_impl.cc",
171     "src/google/protobuf/compiler/importer.cc",
172     "src/google/protobuf/compiler/parser.cc",
173   ]
174
175   configs -= [ "//build/config/compiler:chromium_code" ]
176   configs += [ "//build/config/compiler:no_chromium_code" ]
177   if (is_win) {
178     configs -= [ "//build/config/win:lean_and_mean" ]
179   }
180   public_configs = [ ":protobuf_config" ]
181
182   cflags = protobuf_lite_cflags
183 }
184
185 # Only compile the compiler for the host architecture.
186 if (current_toolchain == host_toolchain) {
187   executable("protoc") {
188     sources = [
189       "src/google/protobuf/compiler/code_generator.cc",
190       "src/google/protobuf/compiler/command_line_interface.cc",
191       "src/google/protobuf/compiler/plugin.cc",
192       "src/google/protobuf/compiler/plugin.pb.cc",
193       "src/google/protobuf/compiler/subprocess.cc",
194       "src/google/protobuf/compiler/subprocess.h",
195       "src/google/protobuf/compiler/zip_writer.cc",
196       "src/google/protobuf/compiler/zip_writer.h",
197       "src/google/protobuf/compiler/cpp/cpp_enum.cc",
198       "src/google/protobuf/compiler/cpp/cpp_enum.h",
199       "src/google/protobuf/compiler/cpp/cpp_enum_field.cc",
200       "src/google/protobuf/compiler/cpp/cpp_enum_field.h",
201       "src/google/protobuf/compiler/cpp/cpp_extension.cc",
202       "src/google/protobuf/compiler/cpp/cpp_extension.h",
203       "src/google/protobuf/compiler/cpp/cpp_field.cc",
204       "src/google/protobuf/compiler/cpp/cpp_field.h",
205       "src/google/protobuf/compiler/cpp/cpp_file.cc",
206       "src/google/protobuf/compiler/cpp/cpp_file.h",
207       "src/google/protobuf/compiler/cpp/cpp_generator.cc",
208       "src/google/protobuf/compiler/cpp/cpp_helpers.cc",
209       "src/google/protobuf/compiler/cpp/cpp_helpers.h",
210       "src/google/protobuf/compiler/cpp/cpp_message.cc",
211       "src/google/protobuf/compiler/cpp/cpp_message.h",
212       "src/google/protobuf/compiler/cpp/cpp_message_field.cc",
213       "src/google/protobuf/compiler/cpp/cpp_message_field.h",
214       "src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
215       "src/google/protobuf/compiler/cpp/cpp_primitive_field.h",
216       "src/google/protobuf/compiler/cpp/cpp_service.cc",
217       "src/google/protobuf/compiler/cpp/cpp_service.h",
218       "src/google/protobuf/compiler/cpp/cpp_string_field.cc",
219       "src/google/protobuf/compiler/cpp/cpp_string_field.h",
220       "src/google/protobuf/compiler/java/java_enum.cc",
221       "src/google/protobuf/compiler/java/java_enum.h",
222       "src/google/protobuf/compiler/java/java_enum_field.cc",
223       "src/google/protobuf/compiler/java/java_enum_field.h",
224       "src/google/protobuf/compiler/java/java_extension.cc",
225       "src/google/protobuf/compiler/java/java_extension.h",
226       "src/google/protobuf/compiler/java/java_field.cc",
227       "src/google/protobuf/compiler/java/java_field.h",
228       "src/google/protobuf/compiler/java/java_file.cc",
229       "src/google/protobuf/compiler/java/java_file.h",
230       "src/google/protobuf/compiler/java/java_generator.cc",
231       "src/google/protobuf/compiler/java/java_helpers.cc",
232       "src/google/protobuf/compiler/java/java_helpers.h",
233       "src/google/protobuf/compiler/java/java_message.cc",
234       "src/google/protobuf/compiler/java/java_message.h",
235       "src/google/protobuf/compiler/java/java_message_field.cc",
236       "src/google/protobuf/compiler/java/java_message_field.h",
237       "src/google/protobuf/compiler/java/java_primitive_field.cc",
238       "src/google/protobuf/compiler/java/java_primitive_field.h",
239       "src/google/protobuf/compiler/java/java_service.cc",
240       "src/google/protobuf/compiler/java/java_service.h",
241       "src/google/protobuf/compiler/java/java_string_field.cc",
242       "src/google/protobuf/compiler/java/java_string_field.h",
243       "src/google/protobuf/compiler/python/python_generator.cc",
244       "src/google/protobuf/compiler/main.cc",
245     ]
246
247     configs -= [ "//build/config/compiler:chromium_code" ]
248     configs += [ "//build/config/compiler:no_chromium_code" ]
249     if (is_win) {
250       # This is defined internally, don't warn on duplicate.
251       configs -= [ "//build/config/win:lean_and_mean" ]
252     }
253
254     cflags = protobuf_lite_cflags
255
256     deps = [
257       ":protobuf_full",
258     ]
259     deps += [ "//build/config/sanitizers:deps" ]
260   }
261 }