1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
--- /src/gyp/defines.gypi
+++ /src/gyp/defines.gypi
@@ -71,6 +71,12 @@
# use_libibus represents if ibus library is used or not.
# This option is only for Linux.
'use_libibus%': '0',
+
+ # use_libgtest represents if gtest library is used or not.
+ 'use_libgtest%': '0',
+
+ # use_libjsoncpp represents if jsoncpp library is used or not.
+ 'use_libjsoncpp%': '0',
},
'target_defaults': {
'defines': [
--- /src/net/jsoncpp.gyp
+++ /src/net/jsoncpp.gyp
@@ -31,32 +31,57 @@
'targets': [
{
'target_name': 'jsoncpp',
- 'type': 'static_library',
- 'variables': {
- 'jsoncpp_root': '<(third_party_dir)/jsoncpp',
- 'jsoncpp_srcs': [
- '<(jsoncpp_root)/src/lib_json/json_reader.cpp',
- '<(jsoncpp_root)/src/lib_json/json_value.cpp',
- '<(jsoncpp_root)/src/lib_json/json_writer.cpp',
- ],
- 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'],
- 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'],
- },
- 'defines': [
- '<@(jsoncpp_additional_macros)',
+ 'conditions': [
+ ['use_libjsoncpp==1', {
+ 'type': 'none',
+ 'variables': {
+ 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'],
+ },
+ 'all_dependent_settings': {
+ 'defines': [
+ '<@(jsoncpp_additional_macros)',
+ ],
+ 'cflags': [
+ '<!@(pkg-config --cflags jsoncpp)',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '<!@(pkg-config --libs-only-l jsoncpp)',
+ ],
+ 'ldflags': [
+ '<!@(pkg-config --libs-only-L jsoncpp)',
+ ],
+ }
+ },
+ }, {
+ 'type': 'static_library',
+ 'variables': {
+ 'jsoncpp_root': '<(third_party_dir)/jsoncpp',
+ 'jsoncpp_srcs': [
+ '<(jsoncpp_root)/src/lib_json/json_reader.cpp',
+ '<(jsoncpp_root)/src/lib_json/json_value.cpp',
+ '<(jsoncpp_root)/src/lib_json/json_writer.cpp',
+ ],
+ 'jsoncpp_include_dirs': ['<(jsoncpp_root)/include'],
+ 'jsoncpp_additional_macros': ['JSON_USE_EXCEPTION=0'],
+ },
+ 'defines': [
+ '<@(jsoncpp_additional_macros)',
+ ],
+ 'sources': [
+ '<@(jsoncpp_srcs)',
+ 'jsoncpp.h',
+ ],
+ 'include_dirs': [
+ '<@(jsoncpp_include_dirs)',
+ ],
+ 'all_dependent_settings': {
+ 'defines': [
+ '<@(jsoncpp_additional_macros)',
+ ],
+ },
+ }],
],
- 'sources': [
- '<@(jsoncpp_srcs)',
- 'jsoncpp.h',
- ],
- 'include_dirs': [
- '<@(jsoncpp_include_dirs)',
- ],
- 'all_dependent_settings': {
- 'defines': [
- '<@(jsoncpp_additional_macros)',
- ],
- },
},
],
}
--- /src/net/jsoncpp.h
+++ /src/net/jsoncpp.h
@@ -35,7 +35,7 @@
// Mozc basically disables C++ exception.
#define JSON_USE_EXCEPTION 0
#endif // !JSON_USE_EXCEPTION
-#include "third_party/jsoncpp/include/json/json.h"
+#include <json/json.h>
#define MOZC_JSONCPP_JSON_H_INCLUDED
#endif // !MOZC_JSONCPP_JSON_H_INCLUDED
--- /src/testing/testing.gyp
+++ /src/testing/testing.gyp
@@ -53,66 +53,101 @@
'targets': [
{
'target_name': 'testing',
- 'type': 'static_library',
- 'variables': {
- 'gtest_defines': [
- 'GTEST_LANG_CXX11=1',
- 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple.
- ],
- 'gtest_dir': '<(third_party_dir)/gtest/googletest',
- 'gmock_dir': '<(third_party_dir)/gtest/googlemock',
- 'conditions': [
- ['_toolset=="target" and target_platform=="Android"', {
- 'gtest_defines': [
- 'GTEST_HAS_RTTI=0', # Android NDKr7 requires this.
- 'GTEST_HAS_CLONE=0',
- 'GTEST_HAS_GLOBAL_WSTRING=0',
- 'GTEST_HAS_POSIX_RE=0',
- 'GTEST_HAS_STD_WSTRING=0',
- 'GTEST_OS_LINUX=1',
- 'GTEST_OS_LINUX_ANDROID=1',
- ],
- }],
- ],
- },
- 'sources': [
- '<(gmock_dir)/src/gmock-cardinalities.cc',
- '<(gmock_dir)/src/gmock-internal-utils.cc',
- '<(gmock_dir)/src/gmock-matchers.cc',
- '<(gmock_dir)/src/gmock-spec-builders.cc',
- '<(gmock_dir)/src/gmock.cc',
- '<(gtest_dir)/src/gtest-death-test.cc',
- '<(gtest_dir)/src/gtest-filepath.cc',
- '<(gtest_dir)/src/gtest-port.cc',
- '<(gtest_dir)/src/gtest-printers.cc',
- '<(gtest_dir)/src/gtest-test-part.cc',
- '<(gtest_dir)/src/gtest-typed-test.cc',
- '<(gtest_dir)/src/gtest.cc',
- ],
- 'include_dirs': [
- '<(gmock_dir)',
- '<(gmock_dir)/include',
- '<(gtest_dir)',
- '<(gtest_dir)/include',
- ],
- 'defines': [
- '<@(gtest_defines)',
- ],
- 'all_dependent_settings': {
- 'defines': [
- '<@(gtest_defines)',
- ],
- 'include_dirs': [
- '<(gmock_dir)/include',
- '<(gtest_dir)/include',
- ],
- },
'conditions': [
- ['(_toolset=="target" and compiler_target=="clang") or '
- '(_toolset=="host" and compiler_host=="clang")', {
- 'cflags': [
- '-Wno-missing-field-initializers',
- '-Wno-unused-private-field',
+ ['use_libgtest==1', {
+ 'type': 'none',
+ 'variables': {
+ 'gtest_defines': [
+ 'GTEST_LANG_CXX11=1',
+ 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple.
+ ],
+ 'conditions': [
+ ['_toolset=="target" and target_platform=="Android"', {
+ 'gtest_defines': [
+ 'GTEST_HAS_RTTI=0', # Android NDKr7 requires this.
+ 'GTEST_HAS_CLONE=0',
+ 'GTEST_HAS_GLOBAL_WSTRING=0',
+ 'GTEST_HAS_POSIX_RE=0',
+ 'GTEST_HAS_STD_WSTRING=0',
+ 'GTEST_OS_LINUX=1',
+ 'GTEST_OS_LINUX_ANDROID=1',
+ ],
+ }],
+ ],
+ },
+ 'all_dependent_settings': {
+ 'defines': [
+ '<@(gtest_defines)',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '-lgmock -lgtest',
+ ],
+ },
+ },
+ }, {
+ 'type': 'static_library',
+ 'variables': {
+ 'gtest_defines': [
+ 'GTEST_LANG_CXX11=1',
+ 'GTEST_HAS_TR1_TUPLE=0', # disable tr1 tuple in favor of C++11 tuple.
+ ],
+ 'gtest_dir': '<(third_party_dir)/gtest/googletest',
+ 'gmock_dir': '<(third_party_dir)/gtest/googlemock',
+ 'conditions': [
+ ['_toolset=="target" and target_platform=="Android"', {
+ 'gtest_defines': [
+ 'GTEST_HAS_RTTI=0', # Android NDKr7 requires this.
+ 'GTEST_HAS_CLONE=0',
+ 'GTEST_HAS_GLOBAL_WSTRING=0',
+ 'GTEST_HAS_POSIX_RE=0',
+ 'GTEST_HAS_STD_WSTRING=0',
+ 'GTEST_OS_LINUX=1',
+ 'GTEST_OS_LINUX_ANDROID=1',
+ ],
+ }],
+ ],
+ },
+ 'sources': [
+ '<(gmock_dir)/src/gmock-cardinalities.cc',
+ '<(gmock_dir)/src/gmock-internal-utils.cc',
+ '<(gmock_dir)/src/gmock-matchers.cc',
+ '<(gmock_dir)/src/gmock-spec-builders.cc',
+ '<(gmock_dir)/src/gmock.cc',
+ '<(gtest_dir)/src/gtest-death-test.cc',
+ '<(gtest_dir)/src/gtest-filepath.cc',
+ '<(gtest_dir)/src/gtest-port.cc',
+ '<(gtest_dir)/src/gtest-printers.cc',
+ '<(gtest_dir)/src/gtest-test-part.cc',
+ '<(gtest_dir)/src/gtest-typed-test.cc',
+ '<(gtest_dir)/src/gtest.cc',
+ ],
+ 'include_dirs': [
+ '<(gmock_dir)',
+ '<(gmock_dir)/include',
+ '<(gtest_dir)',
+ '<(gtest_dir)/include',
+ ],
+ 'defines': [
+ '<@(gtest_defines)',
+ ],
+ 'all_dependent_settings': {
+ 'defines': [
+ '<@(gtest_defines)',
+ ],
+ 'include_dirs': [
+ '<(gmock_dir)/include',
+ '<(gtest_dir)/include',
+ ],
+ },
+ 'conditions': [
+ ['(_toolset=="target" and compiler_target=="clang") or '
+ '(_toolset=="host" and compiler_host=="clang")', {
+ 'cflags': [
+ '-Wno-missing-field-initializers',
+ '-Wno-unused-private-field',
+ ],
+ }],
],
}],
],
|