aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2015-06-15 18:21:48 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2015-06-15 18:24:01 -0700
commite96ff30120a3834f7d1e31e43e591bf7cfbd731f (patch)
tree7e4c317912ac3809fbff11bb692084debd4a27eb /cmake
parent4cbb612299eaf8259db25f5dcda46022fbd1db54 (diff)
Down-integrate from internal code base.
[ci skip] Change-Id: I9391c09640e0b0b2b21c45a97a1fc91814d95c5d
Diffstat (limited to 'cmake')
-rw-r--r--cmake/README.md10
-rw-r--r--cmake/extract_includes.bat.in6
-rw-r--r--cmake/libprotobuf-lite.cmake5
-rw-r--r--cmake/libprotobuf.cmake17
-rw-r--r--cmake/tests.cmake44
5 files changed, 68 insertions, 14 deletions
diff --git a/cmake/README.md b/cmake/README.md
index 1d5c8bc1..0abe078e 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -5,17 +5,17 @@ on your computer before proceeding.
Compiling and Installing
========================
-1. Check whether a gtest directory exists in the upper level directory. If you
- checkout the code from github via "git clone", this gtest directory won't
+1. Check whether a gmock directory exists in the upper level directory. If you
+ checkout the code from github via "git clone", this gmock directory won't
exist and you won't be able to build protobuf unit-tests. Consider using one
of the release tar balls instead:
https://github.com/google/protobuf/releases
These release tar balls are more stable versions of protobuf and already
- have the gtest directory included.
+ have the gmock directory included.
- You can also download gtest by yourself and put it in the right place.
+ You can also download gmock by yourself and put it in the right place.
If you absolutely don't want to build and run protobuf unit-tests, skip
this step and use protobuf at your own risk.
@@ -29,7 +29,7 @@ Compiling and Installing
$ cd build
$ cmake -G "Visual Studio 9 2008" ..
- If you don't have gtest, skip the build of tests by turning off the
+ If you don't have gmock, skip the build of tests by turning off the
BUILD_TESTING option:
$ cmake -G "Visutal Studio 9 2008" -DBUILD_TESTING=OFF ..
diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in
index b2e9444d..d0c6dbfb 100644
--- a/cmake/extract_includes.bat.in
+++ b/cmake/extract_includes.bat.in
@@ -11,6 +11,7 @@ mkdir include\google\protobuf\compiler\python
mkdir include\google\protobuf\compiler\ruby
mkdir include\google\protobuf\io
mkdir include\google\protobuf\stubs
+mkdir include\google\protobuf\util
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.h include\google\protobuf\any.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.pb.h include\google\protobuf\any.pb.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h include\google\protobuf\api.pb.h
@@ -98,6 +99,11 @@ copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h include\
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h include\google\protobuf\timestamp.pb.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h include\google\protobuf\type.pb.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\unknown_field_set.h include\google\protobuf\unknown_field_set.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_comparator.h include\google\protobuf\util\field_comparator.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\json_util.h include\google\protobuf\util\json_util.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\message_differencer.h include\google\protobuf\util\message_differencer.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver.h include\google\protobuf\util\type_resolver.h
+copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver_util.h include\google\protobuf\util\type_resolver_util.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h include\google\protobuf\wire_format.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h include\google\protobuf\wire_format_lite.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite_inl.h include\google\protobuf\wire_format_lite_inl.h
diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake
index 32c2d026..8d995df4 100644
--- a/cmake/libprotobuf-lite.cmake
+++ b/cmake/libprotobuf-lite.cmake
@@ -10,9 +10,14 @@ set(libprotobuf_lite_files
${protobuf_source_dir}/src/google/protobuf/repeated_field.cc
${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc
${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc
${protobuf_source_dir}/src/google/protobuf/stubs/common.cc
${protobuf_source_dir}/src/google/protobuf/stubs/once.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/status.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/time.cc
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc
)
diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake
index b1f2dc3e..850d93a7 100644
--- a/cmake/libprotobuf.cmake
+++ b/cmake/libprotobuf.cmake
@@ -24,6 +24,7 @@ set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/service.cc
${protobuf_source_dir}/src/google/protobuf/source_context.pb.cc
${protobuf_source_dir}/src/google/protobuf/struct.pb.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/mathlimits.cc
${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid.cc
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.cc
${protobuf_source_dir}/src/google/protobuf/stubs/substitute.cc
@@ -31,6 +32,22 @@ set(libprotobuf_files
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.cc
${protobuf_source_dir}/src/google/protobuf/type.pb.cc
${protobuf_source_dir}/src/google/protobuf/unknown_field_set.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/field_comparator.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/json_util.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.cc
${protobuf_source_dir}/src/google/protobuf/wire_format.cc
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc
)
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index 8fb5eef1..4396a657 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -1,10 +1,13 @@
-include_directories(
- ${protobuf_source_dir}/gtest/include
- ${protobuf_source_dir}/gtest)
+if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../gmock/CMakeLists.txt")
+ message(FATAL_ERROR "Cannot find gmock directory.")
+endif()
+
+add_subdirectory(../gmock ${PROJECT_BINARY_DIR}/gmock)
-add_library(gtest STATIC ${protobuf_source_dir}/gtest/src/gtest-all.cc)
-add_library(gtest_main STATIC ${protobuf_source_dir}/gtest/src/gtest_main.cc)
-target_link_libraries(gtest_main gtest)
+include_directories(
+ ${protobuf_source_dir}/gmock/gtest/include
+ ${protobuf_source_dir}/gmock/include
+)
set(lite_test_protos
google/protobuf/map_lite_unittest.proto
@@ -39,6 +42,15 @@ set(tests_protos
google/protobuf/unittest_preserve_unknown_enum2.proto
google/protobuf/unittest_proto3_arena.proto
google/protobuf/unittest_well_known_types.proto
+ google/protobuf/util/internal/testdata/anys.proto
+ google/protobuf/util/internal/testdata/books.proto
+ google/protobuf/util/internal/testdata/default_value.proto
+ google/protobuf/util/internal/testdata/default_value_test.proto
+ google/protobuf/util/internal/testdata/field_mask.proto
+ google/protobuf/util/internal/testdata/maps.proto
+ google/protobuf/util/internal/testdata/struct.proto
+ google/protobuf/util/internal/testdata/timestamp_duration.proto
+ google/protobuf/util/json_format_proto3.proto
)
macro(compile_proto_file filename)
@@ -46,10 +58,10 @@ macro(compile_proto_file filename)
get_filename_component(basename ${filename} NAME_WE)
add_custom_command(
OUTPUT ${protobuf_source_dir}/src/${dirname}/${basename}.pb.cc
+ DEPENDS protoc ${protobuf_source_dir}/src/${dirname}/${basename}.proto
COMMAND protoc ${protobuf_source_dir}/src/${dirname}/${basename}.proto
--proto_path=${protobuf_source_dir}/src
--cpp_out=${protobuf_source_dir}/src
- DEPENDS protoc
)
endmacro(compile_proto_file)
@@ -113,21 +125,35 @@ set(tests_files
${protobuf_source_dir}/src/google/protobuf/reflection_ops_unittest.cc
${protobuf_source_dir}/src/google/protobuf/repeated_field_reflection_unittest.cc
${protobuf_source_dir}/src/google/protobuf/repeated_field_unittest.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/common_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/once_unittest.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/status_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/statusor_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/strutil_unittest.cc
${protobuf_source_dir}/src/google/protobuf/stubs/template_util_unittest.cc
+ ${protobuf_source_dir}/src/google/protobuf/stubs/time_test.cc
${protobuf_source_dir}/src/google/protobuf/stubs/type_traits_unittest.cc
${protobuf_source_dir}/src/google/protobuf/text_format_unittest.cc
${protobuf_source_dir}/src/google/protobuf/unknown_field_set_unittest.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/field_comparator_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/json_util_test.cc
+ ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util_test.cc
${protobuf_source_dir}/src/google/protobuf/well_known_types_unittest.cc
${protobuf_source_dir}/src/google/protobuf/wire_format_unittest.cc
)
add_executable(tests ${tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files})
-target_link_libraries(tests libprotoc libprotobuf gtest_main)
+target_link_libraries(tests libprotoc libprotobuf gmock_main)
set(test_plugin_files
${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.cc
@@ -137,7 +163,7 @@ set(test_plugin_files
)
add_executable(test_plugin ${test_plugin_files})
-target_link_libraries(test_plugin libprotoc libprotobuf gtest)
+target_link_libraries(test_plugin libprotoc libprotobuf gmock)
set(lite_test_files
${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc