Source release 15.2.0
This commit is contained in:
33
third_party/protobuf/cmake/CMakeLists.txt
vendored
33
third_party/protobuf/cmake/CMakeLists.txt
vendored
@@ -7,7 +7,11 @@ endif()
|
||||
|
||||
# CMake policies
|
||||
cmake_policy(SET CMP0022 NEW)
|
||||
|
||||
# On MacOS use @rpath/ for target's install name prefix path
|
||||
if (POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif ()
|
||||
# Clear VERSION variables when no VERSION is given to project()
|
||||
if(POLICY CMP0048)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
endif()
|
||||
@@ -26,6 +30,7 @@ endif()
|
||||
|
||||
# Options
|
||||
option(protobuf_BUILD_TESTS "Build tests" ON)
|
||||
option(protobuf_BUILD_CONFORMANCE "Build conformance tests" OFF)
|
||||
option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
@@ -63,23 +68,28 @@ string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2"
|
||||
string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\3"
|
||||
protobuf_CONTACT "${protobuf_AC_INIT_LINE}")
|
||||
# Parse version tweaks
|
||||
set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)$")
|
||||
set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1"
|
||||
protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2"
|
||||
protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3"
|
||||
protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}")
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\4"
|
||||
string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\5"
|
||||
protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}")
|
||||
|
||||
message(STATUS "${protobuf_VERSION_PRERELEASE}")
|
||||
|
||||
# Package version
|
||||
set(protobuf_VERSION
|
||||
"${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}")
|
||||
|
||||
if(protobuf_VERSION_PRERELEASE)
|
||||
set(protobuf_VERSION "${protobuf_VERSION}-${protobuf_VERSION_PRERELEASE}")
|
||||
set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}")
|
||||
else()
|
||||
set(protobuf_VERSION "${protobuf_VERSION}.0")
|
||||
endif()
|
||||
message(STATUS "${protobuf_VERSION}")
|
||||
|
||||
if(protobuf_VERBOSE)
|
||||
message(STATUS "Configuration script parsing status [")
|
||||
@@ -166,12 +176,23 @@ if (MSVC)
|
||||
add_definitions(/bigobj)
|
||||
string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR})
|
||||
string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR})
|
||||
string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}")
|
||||
configure_file(extract_includes.bat.in extract_includes.bat)
|
||||
|
||||
# Suppress linker warnings about files with no symbols defined.
|
||||
set(CMAKE_STATIC_LINKER_FLAGS /ignore:4221)
|
||||
|
||||
# Configure Resource Compiler
|
||||
enable_language(RC)
|
||||
# use English language (0x409) in resource compiler
|
||||
set(rc_flags "/l0x409")
|
||||
# fix rc.exe invocations because of usage of add_definitions()
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> ${rc_flags} <DEFINES> /fo<OBJECT> <SOURCE>")
|
||||
|
||||
configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH)
|
||||
|
||||
include_directories(
|
||||
@@ -203,6 +224,10 @@ if (protobuf_BUILD_TESTS)
|
||||
include(tests.cmake)
|
||||
endif (protobuf_BUILD_TESTS)
|
||||
|
||||
if (protobuf_BUILD_CONFORMANCE)
|
||||
include(conformance.cmake)
|
||||
endif (protobuf_BUILD_CONFORMANCE)
|
||||
|
||||
include(install.cmake)
|
||||
|
||||
if (protobuf_BUILD_EXAMPLES)
|
||||
|
||||
19
third_party/protobuf/cmake/README.md
vendored
19
third_party/protobuf/cmake/README.md
vendored
@@ -43,7 +43,7 @@ Getting Sources
|
||||
|
||||
You can get the latest stable source packages from the release page:
|
||||
|
||||
https://github.com/google/protobuf/releases/latest
|
||||
https://github.com/protocolbuffers/protobuf/releases/latest
|
||||
|
||||
For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if
|
||||
you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package
|
||||
@@ -52,7 +52,7 @@ download `protobuf-all-[VERSION].tar.gz`.
|
||||
|
||||
Or you can use git to clone from protobuf git repository.
|
||||
|
||||
C:\Path\to> git clone -b [release_tag] https://github.com/google/protobuf.git
|
||||
C:\Path\to> git clone -b [release_tag] https://github.com/protocolbuffers/protobuf.git
|
||||
|
||||
Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *master*
|
||||
if you want to get the latest code.
|
||||
@@ -130,6 +130,13 @@ It will generate *Visual Studio* solution file *protobuf.sln* in current directo
|
||||
If the *gmock* directory does not exist, and you do not want to build protobuf unit tests,
|
||||
you need to add *cmake* command argument `-Dprotobuf_BUILD_TESTS=OFF` to disable testing.
|
||||
|
||||
To make a *Visual Studio* file for Visual Studio 15 2017, create the *Visual Studio*
|
||||
solution file above and edit the CmakeCache file.
|
||||
|
||||
C:Path\to\protobuf\cmake\build\solution\CMakeCache
|
||||
|
||||
Then create the *Visual Studio* solution file again
|
||||
|
||||
Compiling
|
||||
=========
|
||||
|
||||
@@ -170,9 +177,9 @@ You should see output similar to:
|
||||
|
||||
Running main() from gmock_main.cc
|
||||
[==========] Running 1546 tests from 165 test cases.
|
||||
|
||||
|
||||
...
|
||||
|
||||
|
||||
[==========] 1546 tests from 165 test cases ran. (2529 ms total)
|
||||
[ PASSED ] 1546 tests.
|
||||
|
||||
@@ -191,7 +198,7 @@ To run specific tests:
|
||||
[ RUN ] AnyTest.TestIs
|
||||
[ OK ] AnyTest.TestIs (0 ms)
|
||||
[----------] 3 tests from AnyTest (1 ms total)
|
||||
|
||||
|
||||
[----------] Global test environment tear-down
|
||||
[==========] 3 tests from 1 test case ran. (2 ms total)
|
||||
[ PASSED ] 3 tests.
|
||||
@@ -303,7 +310,7 @@ If you already have ZLIB library and headers at some other location on your syst
|
||||
|
||||
-DZLIB_INCLUDE_DIR=<path to dir containing zlib headers>
|
||||
-DZLIB_LIB=<path to dir containing zlib>
|
||||
|
||||
|
||||
Build and testing protobuf as usual.
|
||||
|
||||
Notes on Compiler Warnings
|
||||
|
||||
50
third_party/protobuf/cmake/conformance.cmake
vendored
Normal file
50
third_party/protobuf/cmake/conformance.cmake
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
DEPENDS protoc ${protobuf_source_dir}/conformance/conformance.proto
|
||||
COMMAND protoc ${protobuf_source_dir}/conformance/conformance.proto
|
||||
--proto_path=${protobuf_source_dir}/conformance
|
||||
--cpp_out=${protobuf_source_dir}/conformance
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
DEPENDS protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
|
||||
protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
|
||||
COMMAND protoc ${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.proto
|
||||
--proto_path=${protobuf_source_dir}/src
|
||||
--cpp_out=${protobuf_source_dir}/src
|
||||
)
|
||||
|
||||
add_executable(conformance_test_runner
|
||||
${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
${protobuf_source_dir}/conformance/conformance_test.cc
|
||||
${protobuf_source_dir}/conformance/binary_json_conformance_main.cc
|
||||
${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc
|
||||
${protobuf_source_dir}/conformance/binary_json_conformance_suite.h
|
||||
${protobuf_source_dir}/conformance/conformance_test_runner.cc
|
||||
${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h
|
||||
${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
)
|
||||
|
||||
add_executable(conformance_cpp
|
||||
${protobuf_source_dir}/conformance/conformance.pb.cc
|
||||
${protobuf_source_dir}/conformance/conformance_cpp.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
conformance_test_runner
|
||||
PUBLIC ${protobuf_source_dir}/conformance)
|
||||
|
||||
target_include_directories(
|
||||
conformance_cpp
|
||||
PUBLIC ${protobuf_source_dir}/conformance)
|
||||
|
||||
target_link_libraries(conformance_test_runner libprotobuf)
|
||||
target_link_libraries(conformance_cpp libprotobuf)
|
||||
@@ -44,6 +44,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" includ
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
|
||||
@@ -72,6 +73,10 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h" include\go
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h" include\google\protobuf\message_lite.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h" include\google\protobuf\metadata.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata_lite.h" include\google\protobuf\metadata_lite.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\parse_context.h" include\google\protobuf\parse_context.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port.h" include\google\protobuf\port.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_def.inc" include\google\protobuf\port_def.inc
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_undef.inc" include\google\protobuf\port_undef.inc
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h" include\google\protobuf\reflection.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h" include\google\protobuf\reflection_ops.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h" include\google\protobuf\repeated_field.h
|
||||
@@ -84,16 +89,17 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" includ
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h" include\google\protobuf\stubs\common.h
|
||||
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\io_win32.h" include\google\protobuf\stubs\io_win32.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\logging.h" include\google\protobuf\stubs\logging.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\macros.h" include\google\protobuf\stubs\macros.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h" include\google\protobuf\stubs\mutex.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\platform_macros.h" include\google\protobuf\stubs\platform_macros.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h" include\google\protobuf\stubs\singleton.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\strutil.h" include\google\protobuf\stubs\strutil.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h
|
||||
@@ -109,7 +115,6 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\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
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.proto" include\google\protobuf\any.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.proto" include\google\protobuf\api.proto
|
||||
|
||||
14
third_party/protobuf/cmake/install.cmake
vendored
14
third_party/protobuf/cmake/install.cmake
vendored
@@ -15,6 +15,13 @@ foreach(_library ${_protobuf_libraries})
|
||||
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
$<BUILD_INTERFACE:${protobuf_source_dir}/src>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
if (UNIX AND NOT APPLE)
|
||||
set_property(TARGET ${_library}
|
||||
PROPERTY INSTALL_RPATH "$ORIGIN")
|
||||
elseif (APPLE)
|
||||
set_property(TARGET ${_library}
|
||||
PROPERTY INSTALL_RPATH "@loader_path")
|
||||
endif()
|
||||
install(TARGETS ${_library} EXPORT protobuf-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
|
||||
@@ -24,6 +31,13 @@ endforeach()
|
||||
if (protobuf_BUILD_PROTOC_BINARIES)
|
||||
install(TARGETS protoc EXPORT protobuf-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
|
||||
if (UNIX AND NOT APPLE)
|
||||
set_property(TARGET protoc
|
||||
PROPERTY INSTALL_RPATH "$ORIGIN/../lib")
|
||||
elseif (APPLE)
|
||||
set_property(TARGET protoc
|
||||
PROPERTY INSTALL_RPATH "@loader_path/../lib")
|
||||
endif()
|
||||
endif (protobuf_BUILD_PROTOC_BINARIES)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
set(libprotobuf_lite_files
|
||||
${protobuf_source_dir}/src/google/protobuf/any_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/arena.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/arenastring.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/message_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/parse_context.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/repeated_field.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/int128.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/io_win32.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
|
||||
@@ -30,7 +32,9 @@ set(libprotobuf_lite_includes
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set.h
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
|
||||
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
|
||||
${protobuf_source_dir}/src/google/protobuf/parse_context.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/strtod.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/message_lite.h
|
||||
@@ -48,8 +52,14 @@ set(libprotobuf_lite_includes
|
||||
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
set(libprotobuf_lite_rc_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotobuf_lite_files} ${libprotobuf_lite_includes})
|
||||
${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${libprotobuf_lite_rc_files})
|
||||
target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src)
|
||||
if(MSVC AND protobuf_BUILD_SHARED_LIBS)
|
||||
|
||||
10
third_party/protobuf/cmake/libprotobuf.cmake
vendored
10
third_party/protobuf/cmake/libprotobuf.cmake
vendored
@@ -16,7 +16,6 @@ set(libprotobuf_files
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/printer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/map_field.cc
|
||||
@@ -72,7 +71,6 @@ set(libprotobuf_includes
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/printer.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/strtod.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h
|
||||
${protobuf_source_dir}/src/google/protobuf/map_field.h
|
||||
@@ -112,8 +110,14 @@ set(libprotobuf_includes
|
||||
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
set(libprotobuf_rc_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes})
|
||||
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${libprotobuf_rc_files})
|
||||
target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(protobuf_WITH_ZLIB)
|
||||
target_link_libraries(libprotobuf ${ZLIB_LIBRARIES})
|
||||
|
||||
9
third_party/protobuf/cmake/libprotoc.cmake
vendored
9
third_party/protobuf/cmake/libprotoc.cmake
vendored
@@ -44,8 +44,6 @@ set(libprotoc_files
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc
|
||||
@@ -128,8 +126,6 @@ set(libprotoc_headers
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h
|
||||
@@ -155,8 +151,10 @@ set(libprotoc_headers
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/scc.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
|
||||
)
|
||||
@@ -168,7 +166,7 @@ set(libprotoc_rc_files
|
||||
endif()
|
||||
|
||||
add_library(libprotoc ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotoc_files} ${libprotoc_headers})
|
||||
${libprotoc_files} ${libprotoc_headers} ${libprotoc_rc_files})
|
||||
target_link_libraries(libprotoc libprotobuf)
|
||||
if(MSVC AND protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotoc
|
||||
@@ -181,3 +179,4 @@ set_target_properties(libprotoc PROPERTIES
|
||||
OUTPUT_NAME ${LIB_PREFIX}protoc
|
||||
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
|
||||
add_library(protobuf::libprotoc ALIAS libprotoc)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ function(protobuf_generate)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
set(_options APPEND_PATH)
|
||||
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO)
|
||||
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR)
|
||||
if(COMMAND target_sources)
|
||||
list(APPEND _singleargs TARGET)
|
||||
endif()
|
||||
@@ -34,15 +34,19 @@ function(protobuf_generate)
|
||||
endif()
|
||||
string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE)
|
||||
|
||||
if(NOT protobuf_generate_PROTOC_OUT_DIR)
|
||||
set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp)
|
||||
set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_GENERATE_EXTENSIONS)
|
||||
if(NOT protobuf_generate_GENERATE_EXTENSIONS)
|
||||
if(protobuf_generate_LANGUAGE STREQUAL cpp)
|
||||
set(protobuf_GENERATE_EXTENSIONS .pb.h .pb.cc)
|
||||
set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc)
|
||||
elseif(protobuf_generate_LANGUAGE STREQUAL python)
|
||||
set(protobuf_GENERATE_EXTENSIONS _pb2.py)
|
||||
set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py)
|
||||
else()
|
||||
message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS")
|
||||
return()
|
||||
@@ -88,19 +92,21 @@ function(protobuf_generate)
|
||||
set(_generated_srcs_all)
|
||||
foreach(_proto ${protobuf_generate_PROTOS})
|
||||
get_filename_component(_abs_file ${_proto} ABSOLUTE)
|
||||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||
get_filename_component(_basename ${_proto} NAME_WE)
|
||||
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
|
||||
|
||||
set(_generated_srcs)
|
||||
foreach(_ext ${protobuf_GENERATE_EXTENSIONS})
|
||||
list(APPEND _generated_srcs "${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_ext}")
|
||||
foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS})
|
||||
list(APPEND _generated_srcs "${protobuf_generate_PROTOC_OUT_DIR}/${_rel_dir}/${_basename}${_ext}")
|
||||
endforeach()
|
||||
list(APPEND _generated_srcs_all ${_generated_srcs})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_generated_srcs}
|
||||
COMMAND protobuf::protoc
|
||||
ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${_abs_file}
|
||||
DEPENDS ${ABS_FIL} protobuf::protoc
|
||||
ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_protobuf_include_path} ${_abs_file}
|
||||
DEPENDS ${_abs_file} protobuf::protoc
|
||||
COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}"
|
||||
VERBATIM )
|
||||
endforeach()
|
||||
|
||||
13
third_party/protobuf/cmake/protoc.cmake
vendored
13
third_party/protobuf/cmake/protoc.cmake
vendored
@@ -2,6 +2,15 @@ set(protoc_files
|
||||
${protobuf_source_dir}/src/google/protobuf/compiler/main.cc
|
||||
)
|
||||
|
||||
add_executable(protoc ${protoc_files})
|
||||
target_link_libraries(protoc libprotobuf libprotoc)
|
||||
if (MSVC)
|
||||
set(protoc_rc_files
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(protoc ${protoc_files} ${protoc_rc_files})
|
||||
target_link_libraries(protoc libprotoc libprotobuf)
|
||||
add_executable(protobuf::protoc ALIAS protoc)
|
||||
|
||||
set_target_properties(protoc PROPERTIES
|
||||
VERSION ${protobuf_VERSION})
|
||||
|
||||
16
third_party/protobuf/cmake/tests.cmake
vendored
16
third_party/protobuf/cmake/tests.cmake
vendored
@@ -63,6 +63,7 @@ set(tests_protos
|
||||
google/protobuf/unittest_optimize_for.proto
|
||||
google/protobuf/unittest_preserve_unknown_enum.proto
|
||||
google/protobuf/unittest_preserve_unknown_enum2.proto
|
||||
google/protobuf/unittest_proto3.proto
|
||||
google/protobuf/unittest_proto3_arena.proto
|
||||
google/protobuf/unittest_proto3_arena_lite.proto
|
||||
google/protobuf/unittest_proto3_lite.proto
|
||||
@@ -78,6 +79,7 @@ set(tests_protos
|
||||
google/protobuf/util/internal/testdata/struct.proto
|
||||
google/protobuf/util/internal/testdata/timestamp_duration.proto
|
||||
google/protobuf/util/internal/testdata/wrappers.proto
|
||||
google/protobuf/util/json_format.proto
|
||||
google/protobuf/util/json_format_proto3.proto
|
||||
google/protobuf/util/message_differencer_unittest.proto
|
||||
)
|
||||
@@ -154,6 +156,7 @@ set(tests_files
|
||||
${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/tokenizer_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc
|
||||
@@ -166,13 +169,13 @@ set(tests_files
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_arena_lite_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_arena_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/proto3_lite_unittest.inc
|
||||
${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/int128_unittest.cc
|
||||
${protobuf_source_dir}/src/google/protobuf/stubs/io_win32_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
|
||||
@@ -204,6 +207,17 @@ if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
|
||||
add_compile_options(-DGOOGLE_PROTOBUF_TEST_PLUGIN_PATH="$<TARGET_FILE:test_plugin>")
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
set_source_files_properties(${tests_files} PROPERTIES COMPILE_FLAGS "-Wno-narrowing")
|
||||
|
||||
# required for tests on MinGW Win64
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,16777216")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
add_executable(tests ${tests_files} ${common_test_files} ${tests_proto_files} ${lite_test_proto_files})
|
||||
target_link_libraries(tests libprotoc libprotobuf gmock_main)
|
||||
|
||||
|
||||
45
third_party/protobuf/cmake/version.rc.in
vendored
Normal file
45
third_party/protobuf/cmake/version.rc.in
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
#define VS_FF_DEBUG 0x1L
|
||||
#define VS_VERSION_INFO 0x1L
|
||||
#define VS_FFI_FILEFLAGSMASK 0x17L
|
||||
#define VER_PRIVATEBUILD 0x0L
|
||||
#define VER_PRERELEASE 0x0L
|
||||
#define VOS__WINDOWS32 0x4L
|
||||
#define VFT_DLL 0x2L
|
||||
#define VFT2_UNKNOWN 0x0L
|
||||
|
||||
#ifndef DEBUG
|
||||
#define VER_DEBUG 0
|
||||
#else
|
||||
#define VER_DEBUG VS_FF_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION @protobuf_RC_FILEVERSION@
|
||||
PRODUCTVERSION @protobuf_RC_FILEVERSION@
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEFLAGS VER_DEBUG
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
BEGIN
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
// English language (0x409) and the Windows Unicode codepage (1200)
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "Compiled with @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@\0"
|
||||
VALUE "ProductVersion", "@protobuf_VERSION@\0"
|
||||
VALUE "FileVersion", "@protobuf_VERSION@\0"
|
||||
VALUE "InternalName", "protobuf\0"
|
||||
VALUE "ProductName", "Protocol Buffers - Google's Data Interchange Format\0"
|
||||
VALUE "CompanyName", "Google Inc.\0"
|
||||
VALUE "LegalCopyright", "Copyright 2008 Google Inc. All rights reserved.\0"
|
||||
VALUE "Licence", "BSD\0"
|
||||
VALUE "Info", "https://developers.google.com/protocol-buffers/\0"
|
||||
END
|
||||
END
|
||||
END
|
||||
Reference in New Issue
Block a user