diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/README.md | 10 | ||||
-rw-r--r-- | cmake/extract_includes.bat.in | 7 | ||||
-rw-r--r-- | cmake/libprotobuf-lite.cmake | 6 | ||||
-rw-r--r-- | cmake/libprotobuf.cmake | 19 | ||||
-rw-r--r-- | cmake/tests.cmake | 49 |
5 files changed, 77 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..21c95748 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 @@ -88,6 +89,7 @@ copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h include copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h include\google\protobuf\stubs\fastmem.h copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h include\google\protobuf\stubs\hash.h copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h +copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\pbconfig.h include\google\protobuf\stubs\pbconfig.h copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h include\google\protobuf\stubs\platform_macros.h copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\shared_ptr.h include\google\protobuf\stubs\shared_ptr.h copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h include\google\protobuf\stubs\singleton.h @@ -98,6 +100,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..db55ea92 100644 --- a/cmake/libprotobuf-lite.cmake +++ b/cmake/libprotobuf-lite.cmake @@ -10,9 +10,15 @@ 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/strutil.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..53ba3d3e 100644 --- a/cmake/libprotobuf.cmake +++ b/cmake/libprotobuf.cmake @@ -24,13 +24,30 @@ 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 ${protobuf_source_dir}/src/google/protobuf/text_format.cc ${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/type_info_test_helper.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..16c94933 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -1,10 +1,20 @@ +if (NOT EXISTS "${PROJECT_SOURCE_DIR}/../gmock/CMakeLists.txt") + message(FATAL_ERROR "Cannot find gmock directory.") +endif() + include_directories( - ${protobuf_source_dir}/gtest/include - ${protobuf_source_dir}/gtest) + ${protobuf_source_dir}/gmock + ${protobuf_source_dir}/gmock/gtest + ${protobuf_source_dir}/gmock/gtest/include + ${protobuf_source_dir}/gmock/include +) -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) +add_library(gmock STATIC + ${protobuf_source_dir}/gmock/src/gmock-all.cc + ${protobuf_source_dir}/gmock/gtest/src/gtest-all.cc +) +add_library(gmock_main STATIC ${protobuf_source_dir}/gmock/src/gmock_main.cc) +target_link_libraries(gmock_main gmock) set(lite_test_protos google/protobuf/map_lite_unittest.proto @@ -39,6 +49,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 +65,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 +132,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 +170,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 |