OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 if (is_win) { | 5 if (is_win) { |
6 config_h_dir = "vsprojects" | 6 config_h_dir = "vsprojects" |
7 } else { | 7 } else { |
8 config_h_dir = "." | 8 config_h_dir = "." |
9 } | 9 } |
10 | 10 |
11 config("protobuf_config") { | 11 config("protobuf_config") { |
12 include_dirs = [ | 12 include_dirs = [ |
13 "src", | 13 "src", |
14 config_h_dir, | 14 config_h_dir, |
15 ] | 15 ] |
16 defines = [ | 16 defines = [ |
17 "PROTOBUF_USE_DLLS", | |
18 "GOOGLE_PROTOBUF_NO_RTTI", | 17 "GOOGLE_PROTOBUF_NO_RTTI", |
19 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", | 18 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", |
20 ] | 19 ] |
21 | 20 |
22 if (is_win) { | 21 if (is_win) { |
23 # TODO(jschuh): http://crbug.com/167187 size_t -> int. | 22 # TODO(jschuh): http://crbug.com/167187 size_t -> int. |
24 cflags = [ "/wd4267" ] | 23 cflags = [ "/wd4267" ] |
25 } | 24 } |
26 } | 25 } |
27 | 26 |
| 27 if (component_mode == "shared_library") { |
| 28 config("protobuf_use_dlls") { |
| 29 defines = [ "PROTOBUF_USE_DLLS" ] |
| 30 } |
| 31 } |
| 32 |
28 # This condif should be applied to targets using generated code from the proto | 33 # This condif should be applied to targets using generated code from the proto |
29 # compiler. It sets up the include directories properly. | 34 # compiler. It sets up the include directories properly. |
30 config("using_proto") { | 35 config("using_proto") { |
31 include_dirs = [ | 36 include_dirs = [ |
32 "$root_gen_dir/protoc_out", | 37 "$root_gen_dir/protoc_out", |
33 ] | 38 ] |
34 } | 39 } |
35 | 40 |
36 protobuf_lite_sources = [ | 41 protobuf_lite_sources = [ |
37 "src/google/protobuf/extension_set.cc", | 42 "src/google/protobuf/extension_set.cc", |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if (is_win) { | 82 if (is_win) { |
78 protobuf_lite_cflags = [ | 83 protobuf_lite_cflags = [ |
79 "/wd4018", # signed/unsigned mismatch in comparison | 84 "/wd4018", # signed/unsigned mismatch in comparison |
80 "/wd4244", # implicit conversion, possible loss of data | 85 "/wd4244", # implicit conversion, possible loss of data |
81 "/wd4355", # 'this' used in base member initializer list | 86 "/wd4355", # 'this' used in base member initializer list |
82 "/wd4267", # size_t to int truncation | 87 "/wd4267", # size_t to int truncation |
83 "/wd4291", # no matching operator delete for a placement new | 88 "/wd4291", # no matching operator delete for a placement new |
84 ] | 89 ] |
85 } | 90 } |
86 | 91 |
87 source_set("protobuf_lite") { | 92 component("protobuf_lite") { |
88 sources = protobuf_lite_sources | 93 sources = protobuf_lite_sources |
89 | 94 |
90 configs -= [ "//build/config/compiler:chromium_code" ] | 95 configs -= [ "//build/config/compiler:chromium_code" ] |
91 configs += [ "//build/config/compiler:no_chromium_code" ] | 96 configs += [ "//build/config/compiler:no_chromium_code" ] |
92 if (is_win) { | 97 if (is_win) { |
93 configs -= [ "//build/config/win:lean_and_mean" ] | 98 configs -= [ "//build/config/win:lean_and_mean" ] |
94 } | 99 } |
95 public_configs = [ ":protobuf_config" ] | 100 public_configs = [ ":protobuf_config" ] |
96 | 101 |
97 cflags = protobuf_lite_cflags | 102 cflags = protobuf_lite_cflags |
98 | 103 |
99 # Required for component builds. See http://crbug.com/172800. | 104 # Required for component builds. See http://crbug.com/172800. |
100 defines = [ "LIBPROTOBUF_EXPORTS" ] | 105 if (component_mode == "shared_library") { |
| 106 public_configs += [ ":protobuf_use_dlls" ] |
| 107 defines = [ "LIBPROTOBUF_EXPORTS" ] |
| 108 } |
101 } | 109 } |
102 | 110 |
103 # This is the full, heavy protobuf lib that's needed for c++ .protos that don't | 111 # This is the full, heavy protobuf lib that's needed for c++ .protos that don't |
104 # specify the LITE_RUNTIME option. The protocol compiler itself (protoc) falls | 112 # specify the LITE_RUNTIME option. The protocol compiler itself (protoc) falls |
105 # into that category. Do not use in Chrome code. | 113 # into that category. Do not use in Chrome code. |
106 | 114 |
107 source_set("protobuf_full") { | 115 source_set("protobuf_full") { |
108 # Prevent people from depending on this outside our file. | 116 # Prevent people from depending on this outside our file. |
109 visibility = [ ":*" ] | 117 visibility = [ ":*" ] |
110 | 118 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 configs -= [ "//build/config/win:lean_and_mean" ] | 251 configs -= [ "//build/config/win:lean_and_mean" ] |
244 } | 252 } |
245 | 253 |
246 cflags = protobuf_lite_cflags | 254 cflags = protobuf_lite_cflags |
247 | 255 |
248 deps = [ | 256 deps = [ |
249 ":protobuf_full", | 257 ":protobuf_full", |
250 ] | 258 ] |
251 } | 259 } |
252 } | 260 } |
OLD | NEW |