274 lines
8.9 KiB
Diff
274 lines
8.9 KiB
Diff
--- /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',
|
|
+ ],
|
|
+ }],
|
|
],
|
|
}],
|
|
],
|