ADD: added new version of protobuf
This commit is contained in:
@@ -1,21 +1,15 @@
|
||||
This directory contains *CMake* files that can be used to build protobuf.
|
||||
This directory contains *CMake* files that can be used to build protobuf
|
||||
with *MSVC* on *Windows*. You can build the project from *Command Prompt*
|
||||
and using an *Visual Studio* IDE.
|
||||
|
||||
You need to have [CMake](http://www.cmake.org) and
|
||||
[Git](http://git-scm.com) installed on your computer before proceeding. We
|
||||
currently support CMake 3.5 and newer on both [Windows](#windows-builds) and
|
||||
[Linux](#linux-builds).
|
||||
You need to have [CMake](http://www.cmake.org), [Visual Studio](https://www.visualstudio.com)
|
||||
and optionally [Git](http://git-scm.com) installed on your computer before proceeding.
|
||||
|
||||
Most of the instructions will be given using CMake's command-line interface, but
|
||||
the same actions can be performed using appropriate GUI tools.
|
||||
Most of the instructions will be given to the *Сommand Prompt*, but the same
|
||||
actions can be performed using appropriate GUI tools.
|
||||
|
||||
# Windows Builds
|
||||
|
||||
On Windows, you can build the project from *Command Prompt* and using an
|
||||
*Visual Studio* IDE. You will also need to have
|
||||
[Visual Studio](https://www.visualstudio.com) installed on your computer before
|
||||
proceeding.
|
||||
|
||||
## Environment Setup
|
||||
Environment Setup
|
||||
=================
|
||||
|
||||
Open the appropriate *Command Prompt* from the *Start* menu.
|
||||
|
||||
@@ -48,7 +42,8 @@ Optionally, you will want to download [ninja](https://ninja-build.org/) and add
|
||||
|
||||
Good. Now you are ready to continue.
|
||||
|
||||
## Getting Sources
|
||||
Getting Sources
|
||||
===============
|
||||
|
||||
You can get the latest stable source packages from the release page:
|
||||
|
||||
@@ -81,7 +76,8 @@ C:\Path\to\src\protobuf> git submodule update --init --recursive
|
||||
|
||||
Good. Now you are ready for *CMake* configuration.
|
||||
|
||||
## CMake Configuration
|
||||
CMake Configuration
|
||||
===================
|
||||
|
||||
*CMake* supports a lot of different
|
||||
[generators](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
|
||||
@@ -89,6 +85,9 @@ for various native build systems.
|
||||
|
||||
Of most interest to Windows programmers are the following:
|
||||
|
||||
* [Makefile](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#makefile-generators).
|
||||
This generates NMake Makefiles for Visual Studio. These work, but they are rather slow.
|
||||
|
||||
* [Visual Studio](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators)
|
||||
This generates a Visual Studio solution for the project.
|
||||
|
||||
@@ -109,6 +108,16 @@ Create a temporary *build* folder and change your working directory to it:
|
||||
The *Makefile* and *Ninja* generators can build the project in only one configuration, so you need to build
|
||||
a separate folder for each configuration.
|
||||
|
||||
To start using a *Release* configuration via the *NMmake* generator:
|
||||
|
||||
C:\Path\to\build\protobuf>mkdir release & cd release
|
||||
C:\Path\to\build\protobuf\release>cmake -G "NMake Makefiles" ^
|
||||
-DCMAKE_BUILD_TYPE=Release ^
|
||||
-DCMAKE_INSTALL_PREFIX=C:\Path\to\install ^
|
||||
C:\Path\to\src\protobuf
|
||||
|
||||
It will generate a *NMake* *Makefile* in the current directory.
|
||||
|
||||
To use *Debug* configuration using *Ninja*:
|
||||
|
||||
C:\Path\to\build\protobuf>mkdir debug & cd debug
|
||||
@@ -128,7 +137,8 @@ The *Visual Studio* generator is multi-configuration: it will generate a single
|
||||
|
||||
It will generate *Visual Studio* solution file *protobuf.sln* in current directory.
|
||||
|
||||
### Unit Tests
|
||||
Unit Tests
|
||||
----------
|
||||
|
||||
Unit tests are being built along with the rest of protobuf. The unit tests require Google Mock (now a part of Google Test).
|
||||
|
||||
@@ -168,7 +178,8 @@ For example:
|
||||
-Dprotobuf_BUILD_TESTS=OFF ^
|
||||
C:\Path\to\src\protobuf
|
||||
|
||||
## Compiling
|
||||
Compiling
|
||||
=========
|
||||
|
||||
The standard way to compile a *CMake* project is `cmake --build <directory>`.
|
||||
|
||||
@@ -179,6 +190,10 @@ Note that if your generator supports multiple configurations, you will probably
|
||||
|
||||
You can also run directly the build tool you've configured:
|
||||
|
||||
C:\Path\to\build\protobuf\release>nmake
|
||||
|
||||
or
|
||||
|
||||
C:\Path\to\build\protobuf\debug>ninja
|
||||
|
||||
And wait for the compilation to finish.
|
||||
@@ -191,7 +206,8 @@ If you prefer to use the IDE:
|
||||
|
||||
And wait for the compilation to finish.
|
||||
|
||||
## Testing
|
||||
Testing
|
||||
=======
|
||||
|
||||
To run unit-tests, first you must compile protobuf as described above.
|
||||
Then run:
|
||||
@@ -243,7 +259,8 @@ Note that the tests must be run from the source folder.
|
||||
|
||||
If all tests are passed, safely continue.
|
||||
|
||||
## Installing
|
||||
Installing
|
||||
==========
|
||||
|
||||
To install protobuf to the *install* folder you've specified in the configuration step, you need to build the `install` target:
|
||||
|
||||
@@ -251,6 +268,10 @@ To install protobuf to the *install* folder you've specified in the configuratio
|
||||
|
||||
Or if you prefer:
|
||||
|
||||
C:\Path\to\build\protobuf\release>nmake install
|
||||
|
||||
or
|
||||
|
||||
C:\Path\to\build\protobuf\debug>ninja install
|
||||
|
||||
You can also build project *INSTALL* from Visual Studio solution.
|
||||
@@ -271,7 +292,8 @@ compiling a debug build of your application, you may need to link against a
|
||||
debug build of libprotobufd.lib with "d" postfix. Similarly, release builds should link against
|
||||
release libprotobuf.lib library.
|
||||
|
||||
## DLLs vs. static linking
|
||||
DLLs vs. static linking
|
||||
=======================
|
||||
|
||||
Static linking is now the default for the Protocol Buffer libraries. Due to
|
||||
issues with Win32's use of a separate heap for each DLL, as well as binary
|
||||
@@ -296,7 +318,8 @@ recommend that you do NOT expose protocol buffer objects in your library's
|
||||
public interface, and that you statically link protocol buffers into your
|
||||
library.
|
||||
|
||||
## ZLib support
|
||||
ZLib support
|
||||
============
|
||||
|
||||
If you want to include GzipInputStream and GzipOutputStream
|
||||
(google/protobuf/io/gzip_stream.h) in libprotobuf, you will need to do a few
|
||||
@@ -346,7 +369,8 @@ If you already have ZLIB library and headers at some other location on your syst
|
||||
|
||||
Build and testing protobuf as usual.
|
||||
|
||||
## Notes on Compiler Warnings
|
||||
Notes on Compiler Warnings
|
||||
==========================
|
||||
|
||||
The following warnings have been disabled while building the protobuf libraries
|
||||
and compiler. You may have to disable some of them in your own project as
|
||||
@@ -373,23 +397,3 @@ unique, so there should be no problem with this, but MSVC prints warning
|
||||
nevertheless. So, we disable it. Unfortunately, this warning will also be
|
||||
produced when compiling code which merely uses protocol buffers, meaning you
|
||||
may have to disable it in your code too.
|
||||
|
||||
# Linux Builds
|
||||
|
||||
Building with CMake works very similarly on Linux. Instead of Visual Studio,
|
||||
you will need to have gcc or clang installed to handle the C++ builds. CMake
|
||||
will generate Makefiles by default, but can also be configured to use Ninja. To
|
||||
build Protobuf, you will need to run (from the source directory):
|
||||
|
||||
cmake .
|
||||
cmake --build . --parallel 10
|
||||
|
||||
Protobuf can be tested and installed with CMake:
|
||||
|
||||
ctest --verbose
|
||||
sudo cmake --install .
|
||||
|
||||
or directly with the generated Makefiles:
|
||||
|
||||
make VERBOSE=1 test
|
||||
sudo make install
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
# Setup our dependency on Abseil.
|
||||
|
||||
set(ABSL_PROPAGATE_CXX_STD ON)
|
||||
|
||||
if(TARGET absl::strings)
|
||||
# If Abseil is included already, skip including it.
|
||||
# (https://github.com/protocolbuffers/protobuf/issues/10435)
|
||||
elseif(protobuf_ABSL_PROVIDER STREQUAL "module")
|
||||
if(NOT ABSL_ROOT_DIR)
|
||||
set(ABSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp)
|
||||
endif()
|
||||
if(EXISTS "${ABSL_ROOT_DIR}/CMakeLists.txt")
|
||||
if(protobuf_INSTALL)
|
||||
# When protobuf_INSTALL is enabled and Abseil will be built as a module,
|
||||
# Abseil will be installed along with protobuf for convenience.
|
||||
set(ABSL_ENABLE_INSTALL ON)
|
||||
endif()
|
||||
add_subdirectory(${ABSL_ROOT_DIR} third_party/abseil-cpp)
|
||||
else()
|
||||
message(WARNING "protobuf_ABSL_PROVIDER is \"module\" but ABSL_ROOT_DIR is wrong")
|
||||
endif()
|
||||
if(protobuf_INSTALL AND NOT _protobuf_INSTALL_SUPPORTED_FROM_MODULE)
|
||||
message(WARNING "protobuf_INSTALL will be forced to FALSE because protobuf_ABSL_PROVIDER is \"module\" and CMake version (${CMAKE_VERSION}) is less than 3.13.")
|
||||
set(protobuf_INSTALL FALSE)
|
||||
endif()
|
||||
elseif(protobuf_ABSL_PROVIDER STREQUAL "package")
|
||||
# Use "CONFIG" as there is no built-in cmake module for absl.
|
||||
find_package(absl REQUIRED CONFIG)
|
||||
endif()
|
||||
set(_protobuf_FIND_ABSL "if(NOT TARGET absl::strings)\n find_package(absl CONFIG)\nendif()")
|
||||
|
||||
set(protobuf_ABSL_USED_TARGETS
|
||||
absl::algorithm
|
||||
absl::base
|
||||
absl::bind_front
|
||||
absl::bits
|
||||
absl::cleanup
|
||||
absl::cord
|
||||
absl::core_headers
|
||||
absl::debugging
|
||||
absl::dynamic_annotations
|
||||
absl::flags
|
||||
absl::flat_hash_map
|
||||
absl::flat_hash_set
|
||||
absl::function_ref
|
||||
absl::hash
|
||||
absl::layout
|
||||
absl::memory
|
||||
absl::optional
|
||||
absl::span
|
||||
absl::status
|
||||
absl::statusor
|
||||
absl::strings
|
||||
absl::synchronization
|
||||
absl::time
|
||||
absl::utility
|
||||
absl::variant
|
||||
)
|
||||
@@ -1,18 +1,6 @@
|
||||
|
||||
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/jsoncpp/CMakeLists.txt")
|
||||
message(FATAL_ERROR
|
||||
"Cannot find third_party/jsoncpp directory that's needed to "
|
||||
"build conformance tests. If you use git, make sure you have cloned "
|
||||
"submodules:\n"
|
||||
" git submodule update --init --recursive\n"
|
||||
"If instead you want to skip them, run cmake with:\n"
|
||||
" cmake -Dprotobuf_BUILD_CONFORMANCE=OFF\n")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.h
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
|
||||
OUTPUT ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
|
||||
--proto_path=${protobuf_SOURCE_DIR}/conformance
|
||||
@@ -20,11 +8,8 @@ add_custom_command(
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
OUTPUT ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
|
||||
${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
|
||||
@@ -36,54 +21,29 @@ add_custom_command(
|
||||
add_executable(conformance_test_runner
|
||||
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.h
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.h
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance_test.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance_test_runner.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance_test_main.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/text_format_conformance_suite.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/text_format_conformance_suite.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h
|
||||
${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_proto2.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
)
|
||||
|
||||
add_executable(conformance_cpp
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.h
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
|
||||
${protobuf_SOURCE_DIR}/conformance/conformance_cpp.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
conformance_test_runner
|
||||
PUBLIC ${protobuf_SOURCE_DIR} ${protobuf_SOURCE_DIR}/conformance)
|
||||
PUBLIC ${protobuf_SOURCE_DIR}/conformance)
|
||||
|
||||
target_include_directories(
|
||||
conformance_cpp
|
||||
PUBLIC ${protobuf_SOURCE_DIR})
|
||||
PUBLIC ${protobuf_SOURCE_DIR}/conformance)
|
||||
|
||||
target_include_directories(conformance_test_runner PRIVATE ${ABSL_ROOT_DIR})
|
||||
target_include_directories(conformance_cpp PRIVATE ${ABSL_ROOT_DIR})
|
||||
|
||||
target_link_libraries(conformance_test_runner ${protobuf_LIB_PROTOBUF})
|
||||
target_link_libraries(conformance_test_runner ${protobuf_ABSL_USED_TARGETS})
|
||||
target_link_libraries(conformance_cpp ${protobuf_LIB_PROTOBUF})
|
||||
target_link_libraries(conformance_cpp ${protobuf_ABSL_USED_TARGETS})
|
||||
|
||||
add_test(NAME conformance_cpp_test
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/conformance_test_runner
|
||||
--failure_list ${protobuf_SOURCE_DIR}/conformance/failure_list_cpp.txt
|
||||
--text_format_failure_list ${protobuf_SOURCE_DIR}/conformance/text_format_failure_list_cpp.txt
|
||||
--output_dir ${protobuf_TEST_XML_OUTDIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/conformance_cpp
|
||||
DEPENDS conformance_test_runner conformance_cpp)
|
||||
|
||||
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Disable tests")
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp third_party/jsoncpp)
|
||||
target_include_directories(conformance_test_runner PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp/include)
|
||||
target_link_libraries(conformance_test_runner jsoncpp_lib)
|
||||
target_link_libraries(conformance_test_runner libprotobuf)
|
||||
target_link_libraries(conformance_cpp libprotobuf)
|
||||
|
||||
@@ -30,7 +30,7 @@ endfunction()
|
||||
# Add examples as an external project.
|
||||
# sub_directory cannot be used because the find_package(protobuf) call would cause failures with redefined targets.
|
||||
add_examples_build(examples "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}")
|
||||
add_dependencies(examples ${protobuf_LIB_PROTOBUF} ${protobuf_PROTOC_EXE})
|
||||
add_dependencies(examples libprotobuf protoc)
|
||||
|
||||
option(protobuf_BUILD_EXAMPLES_MULTITEST "Build Examples in multiple configurations. Useful for testing." OFF)
|
||||
mark_as_advanced(protobuf_BUILD_EXAMPLES_MULTITEST)
|
||||
@@ -42,7 +42,7 @@ if(protobuf_BUILD_EXAMPLES_MULTITEST)
|
||||
"-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}"
|
||||
"-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE"
|
||||
)
|
||||
add_dependencies(examples-legacy ${protobuf_LIB_PROTOBUF} ${protobuf_PROTOC_EXE})
|
||||
add_dependencies(examples-legacy libprotobuf protoc)
|
||||
|
||||
#Build using the installed library.
|
||||
add_examples_build(examples-installed
|
||||
|
||||
144
libs/protobuf/cmake/extract_includes.bat.in
Normal file
144
libs/protobuf/cmake/extract_includes.bat.in
Normal file
@@ -0,0 +1,144 @@
|
||||
mkdir include
|
||||
mkdir include\google
|
||||
mkdir include\google\protobuf
|
||||
mkdir include\google\protobuf\compiler
|
||||
mkdir include\google\protobuf\compiler\cpp
|
||||
mkdir include\google\protobuf\compiler\csharp
|
||||
mkdir include\google\protobuf\compiler\java
|
||||
mkdir include\google\protobuf\compiler\objectivec
|
||||
mkdir include\google\protobuf\compiler\php
|
||||
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
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h" include\google\protobuf\arena.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena_impl.h" include\google\protobuf\arena_impl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenaz_sampler.h" include\google\protobuf\arenaz_sampler.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\file.h" include\google\protobuf\compiler\cpp\file.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\generator.h" include\google\protobuf\compiler\cpp\generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\helpers.h" include\google\protobuf\compiler\cpp\helpers.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\names.h" include\google\protobuf\compiler\cpp\names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_doc_comment.h" include\google\protobuf\compiler\csharp\csharp_doc_comment.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_options.h" include\google\protobuf\compiler\csharp\csharp_options.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\generator.h" include\google\protobuf\compiler\java\generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\kotlin_generator.h" include\google\protobuf\compiler\java\kotlin_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\names.h" include\google\protobuf\compiler\java\names.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\php\php_generator.h" include\google\protobuf\compiler\php\php_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h" include\google\protobuf\compiler\plugin.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h" include\google\protobuf\compiler\plugin.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\generator.h" include\google\protobuf\compiler\python\generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\pyi_generator.h" include\google\protobuf\compiler\python\pyi_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h" include\google\protobuf\compiler\python\python_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h" include\google\protobuf\compiler\ruby\ruby_generator.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h" include\google\protobuf\descriptor.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.pb.h" include\google\protobuf\descriptor.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h" include\google\protobuf\descriptor_database.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h
|
||||
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\endian.h" include\google\protobuf\endian.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\explicitly_constructed.h" include\google\protobuf\explicitly_constructed.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_access_listener.h" include\google\protobuf\field_access_listener.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
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_bases.h" include\google\protobuf\generated_message_bases.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\implicit_weak_message.h" include\google\protobuf\implicit_weak_message.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\inlined_string_field.h" include\google\protobuf\inlined_string_field.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h" include\google\protobuf\io\coded_stream.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h" include\google\protobuf\io\gzip_stream.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\io_win32.h" include\google\protobuf\io\io_win32.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h" include\google\protobuf\io\printer.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\strtod.h" include\google\protobuf\io\strtod.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\tokenizer.h" include\google\protobuf\io\tokenizer.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream.h" include\google\protobuf\io\zero_copy_stream.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl.h" include\google\protobuf\io\zero_copy_stream_impl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl_lite.h" include\google\protobuf\io\zero_copy_stream_impl_lite.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map.h" include\google\protobuf\map.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry.h" include\google\protobuf\map_entry.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry_lite.h" include\google\protobuf\map_entry_lite.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field.h" include\google\protobuf\map_field.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_inl.h" include\google\protobuf\map_field_inl.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_lite.h" include\google\protobuf\map_field_lite.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_type_handler.h" include\google\protobuf\map_type_handler.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h" include\google\protobuf\message.h
|
||||
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
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_ptr_field.h" include\google\protobuf\repeated_ptr_field.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h" include\google\protobuf\service.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" include\google\protobuf\stubs\casts.h
|
||||
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\hash.h" include\google\protobuf\stubs\hash.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\map_util.h" include\google\protobuf\stubs\map_util.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\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
|
||||
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\delimited_message_util.h" include\google\protobuf\util\delimited_message_util.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\field_mask_util.h" include\google\protobuf\util\field_mask_util.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\time_util.h" include\google\protobuf\util\time_util.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\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
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.proto" include\google\protobuf\compiler\plugin.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.proto" include\google\protobuf\descriptor.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.proto" include\google\protobuf\duration.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.proto" include\google\protobuf\empty.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.proto" include\google\protobuf\field_mask.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.proto" include\google\protobuf\source_context.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.proto" include\google\protobuf\struct.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.proto" include\google\protobuf\timestamp.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.proto" include\google\protobuf\type.proto
|
||||
copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.proto" include\google\protobuf\wrappers.proto
|
||||
@@ -43,65 +43,106 @@ 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")
|
||||
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
set(protobuf_HEADERS
|
||||
${libprotobuf_hdrs}
|
||||
${libprotoc_hdrs}
|
||||
${wkt_protos_files}
|
||||
${descriptor_proto_proto_srcs}
|
||||
${plugin_proto_proto_srcs}
|
||||
)
|
||||
foreach(_header ${protobuf_HEADERS})
|
||||
string(REPLACE "${protobuf_SOURCE_DIR}/src" "" _header ${_header})
|
||||
file(STRINGS ${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in _extract_strings
|
||||
REGEX "^copy")
|
||||
foreach(_extract_string ${_extract_strings})
|
||||
string(REGEX REPLACE "^.* .+ include\\\\(.+)$" "\\1"
|
||||
_header ${_extract_string})
|
||||
string(REPLACE "\\" "/" _header ${_header})
|
||||
get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/src/${_header}" ABSOLUTE)
|
||||
get_filename_component(_extract_name ${_header} NAME)
|
||||
get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" DIRECTORY)
|
||||
install(FILES "${_extract_from}"
|
||||
DESTINATION "${_extract_to}"
|
||||
COMPONENT protobuf-headers
|
||||
RENAME "${_extract_name}")
|
||||
if(EXISTS "${_extract_from}")
|
||||
install(FILES "${_extract_from}"
|
||||
DESTINATION "${_extract_to}"
|
||||
COMPONENT protobuf-headers
|
||||
RENAME "${_extract_name}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in "
|
||||
"\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" "
|
||||
"but there not exists. The file will not be installed.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Internal function for parsing auto tools scripts
|
||||
function(_protobuf_auto_list FILE_NAME VARIABLE)
|
||||
file(STRINGS ${FILE_NAME} _strings)
|
||||
set(_list)
|
||||
foreach(_string ${_strings})
|
||||
set(_found)
|
||||
string(REGEX MATCH "^[ \t]*${VARIABLE}[ \t]*=[ \t]*" _found "${_string}")
|
||||
if(_found)
|
||||
string(LENGTH "${_found}" _length)
|
||||
string(SUBSTRING "${_string}" ${_length} -1 _draft_list)
|
||||
foreach(_item ${_draft_list})
|
||||
string(STRIP "${_item}" _item)
|
||||
list(APPEND _list "${_item}")
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${VARIABLE} ${_list} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Install well-known type proto files
|
||||
_protobuf_auto_list("${protobuf_SOURCE_DIR}/src/Makefile.am" nobase_dist_proto_DATA)
|
||||
foreach(_file ${nobase_dist_proto_DATA})
|
||||
get_filename_component(_file_from "${protobuf_SOURCE_DIR}/src/${_file}" ABSOLUTE)
|
||||
get_filename_component(_file_name ${_file} NAME)
|
||||
get_filename_component(_dir ${_file} DIRECTORY)
|
||||
if(EXISTS "${_file_from}")
|
||||
install(FILES "${_file_from}"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_dir}"
|
||||
COMPONENT protobuf-protos
|
||||
RENAME "${_file_name}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "The file \"${_file_from}\" is listed in "
|
||||
"\"${protobuf_SOURCE_DIR}/src/Makefile.am\" as nobase_dist_proto_DATA "
|
||||
"but there not exists. The file will not be installed.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Install configuration
|
||||
set(_install_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files")
|
||||
set(_build_cmakedir_desc "Directory relative to CMAKE_CURRENT_BINARY_DIR for cmake configuration files")
|
||||
set(_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files")
|
||||
set(_exampledir_desc "Directory relative to CMAKE_INSTALL_DATA to install examples")
|
||||
set(_protobuf_subdir_desc "Subdirectory in which to install cmake configuration files")
|
||||
if(NOT MSVC)
|
||||
set(protobuf_CMAKE_SUBDIR "cmake/protobuf" CACHE STRING "${_protobuf_subdir_desc}")
|
||||
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/${protobuf_CMAKE_SUBDIR}" CACHE STRING "${_install_cmakedir_desc}")
|
||||
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRING "${_cmakedir_desc}")
|
||||
set(CMAKE_INSTALL_EXAMPLEDIR "${CMAKE_INSTALL_DATADIR}/protobuf/examples" CACHE STRING "${_exampledir_desc}")
|
||||
else()
|
||||
set(protobuf_CMAKE_SUBDIR "cmake" CACHE STRING "${_protobuf_subdir_desc}")
|
||||
set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}")
|
||||
set(CMAKE_INSTALL_EXAMPLEDIR "examples" CACHE STRING "${_exampledir_desc}")
|
||||
endif()
|
||||
set(CMAKE_BUILD_CMAKEDIR "${CMAKE_CURRENT_BINARY_DIR}/${protobuf_CMAKE_SUBDIR}" CACHE STRING "${_build_cmakedir_desc}")
|
||||
mark_as_advanced(protobuf_CMAKE_SUBDIR)
|
||||
mark_as_advanced(CMAKE_BUILD_CMAKEDIR)
|
||||
mark_as_advanced(CMAKE_INSTALL_CMAKEDIR)
|
||||
mark_as_advanced(CMAKE_INSTALL_EXAMPLEDIR)
|
||||
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config.cmake.in
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-config.cmake @ONLY)
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-config-version.cmake.in
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-module.cmake.in
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-module.cmake @ONLY)
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-options.cmake
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-options.cmake @ONLY)
|
||||
configure_file(${protobuf_SOURCE_DIR}/cmake/protobuf-generate.cmake
|
||||
${CMAKE_BUILD_CMAKEDIR}/protobuf-generate.cmake @ONLY)
|
||||
${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
|
||||
|
||||
# Allows the build directory to be used as a find directory.
|
||||
|
||||
if (protobuf_BUILD_PROTOC_BINARIES)
|
||||
export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
|
||||
NAMESPACE protobuf::
|
||||
FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
|
||||
)
|
||||
else (protobuf_BUILD_PROTOC_BINARIES)
|
||||
export(TARGETS libprotobuf-lite libprotobuf
|
||||
NAMESPACE protobuf::
|
||||
FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
|
||||
)
|
||||
endif (protobuf_BUILD_PROTOC_BINARIES)
|
||||
|
||||
install(EXPORT protobuf-targets
|
||||
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
|
||||
NAMESPACE protobuf::
|
||||
COMPONENT protobuf-export
|
||||
)
|
||||
COMPONENT protobuf-export)
|
||||
|
||||
install(DIRECTORY ${CMAKE_BUILD_CMAKEDIR}/
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/
|
||||
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
|
||||
COMPONENT protobuf-export
|
||||
PATTERN protobuf-targets.cmake EXCLUDE
|
||||
|
||||
@@ -1,11 +1,93 @@
|
||||
# CMake definitions for libprotobuf_lite (the "lite" C++ protobuf runtime).
|
||||
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/arenaz_sampler.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_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/inlined_string_field.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.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map.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/repeated_ptr_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/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/structurally_valid.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
|
||||
)
|
||||
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
set(libprotobuf_lite_includes
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/any.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arena.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_impl.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/endian.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/explicitly_constructed.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_inl.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_decl.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_impl.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/has_bits.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/implicit_weak_message.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/io/coded_stream.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/io/io_win32.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.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry_lite.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_lite.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_type_handler.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/message_lite.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/port.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_field.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/repeated_ptr_field.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/bytestream.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/callback.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/casts.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/common.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/hash.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/logging.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/macros.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/map_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/mutex.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/once.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/platform_macros.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/port.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/status.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stl_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/stringpiece.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/strutil.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/stubs/template_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_lite.h
|
||||
)
|
||||
|
||||
add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotobuf_lite_srcs}
|
||||
${libprotobuf_lite_hdrs}
|
||||
${protobuf_version_rc_file})
|
||||
${libprotobuf_lite_files} ${libprotobuf_lite_includes} ${protobuf_version_rc_file})
|
||||
if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
|
||||
target_link_options(libprotobuf-lite PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf-lite.map)
|
||||
@@ -23,7 +105,6 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
||||
target_link_libraries(libprotobuf-lite PRIVATE log)
|
||||
endif()
|
||||
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_SOURCE_DIR}/src)
|
||||
target_link_libraries(libprotobuf-lite PUBLIC ${protobuf_ABSL_USED_TARGETS})
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotobuf-lite
|
||||
PUBLIC PROTOBUF_USE_DLLS
|
||||
@@ -31,6 +112,7 @@ if(protobuf_BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
set_target_properties(libprotobuf-lite PROPERTIES
|
||||
VERSION ${protobuf_VERSION}
|
||||
SOVERSION 32
|
||||
OUTPUT_NAME ${LIB_PREFIX}protobuf-lite
|
||||
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
|
||||
add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite)
|
||||
|
||||
@@ -1,11 +1,106 @@
|
||||
# CMake definitions for libprotobuf (the "full" C++ protobuf runtime).
|
||||
set(libprotobuf_files
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/any.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/extension_set_heavy.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_reflection.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_tctable_full.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/tokenizer.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/message.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.cc
|
||||
${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/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/delimited_message_util.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.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/proto_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/time_util.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
|
||||
)
|
||||
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
set(libprotobuf_includes
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/any.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/api.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/duration.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/empty.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/field_access_listener.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/field_mask.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_enum_reflection.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/generated_message_bases.h
|
||||
${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/tokenizer.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_entry.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_field.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_inl.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/message.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/metadata.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/service.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/source_context.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/struct.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/text_format.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/timestamp.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/type.pb.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/type_resolver_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/wrappers.pb.h
|
||||
)
|
||||
|
||||
add_library(libprotobuf ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotobuf_srcs}
|
||||
${libprotobuf_hdrs}
|
||||
${protobuf_version_rc_file})
|
||||
${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes} ${protobuf_version_rc_file})
|
||||
if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
|
||||
target_link_options(libprotobuf PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotobuf.map)
|
||||
@@ -26,7 +121,6 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
||||
target_link_libraries(libprotobuf PRIVATE log)
|
||||
endif()
|
||||
target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src)
|
||||
target_link_libraries(libprotobuf PUBLIC ${protobuf_ABSL_USED_TARGETS})
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotobuf
|
||||
PUBLIC PROTOBUF_USE_DLLS
|
||||
@@ -34,6 +128,7 @@ if(protobuf_BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
set_target_properties(libprotobuf PROPERTIES
|
||||
VERSION ${protobuf_VERSION}
|
||||
SOVERSION 32
|
||||
OUTPUT_NAME ${LIB_PREFIX}protobuf
|
||||
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
|
||||
add_library(protobuf::libprotobuf ALIAS libprotobuf)
|
||||
|
||||
@@ -1,11 +1,117 @@
|
||||
# CMake definitions for libprotoc (the protobuf compiler library).
|
||||
set(libprotoc_files
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/enum.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/enum_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/extension.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/file.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/map_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/padding_optimizer.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/parse_function_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/primitive_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/service.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/string_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_enum.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_field_base.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_helpers.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_map_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_message.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_message_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/context.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_field_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/enum_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/extension.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/extension_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/file.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator_factory.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/helpers.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/kotlin_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/map_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/map_field_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_builder.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_builder_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_field_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/message_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/name_resolver.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/primitive_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/primitive_field_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/service.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/shared_code_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/string_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/string_field_lite.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_file.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_message.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/php_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/helpers.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/pyi_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/subprocess.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/zip_writer.cc
|
||||
)
|
||||
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
set(libprotoc_headers
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/code_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/cpp_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/file.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/helpers.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/names.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_names.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_options.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/java_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/kotlin_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/names.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/php/php_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/pyi_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/python_generator.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator.h
|
||||
)
|
||||
|
||||
add_library(libprotoc ${protobuf_SHARED_OR_STATIC}
|
||||
${libprotoc_srcs}
|
||||
${libprotoc_hdrs}
|
||||
${protobuf_version_rc_file})
|
||||
${libprotoc_files} ${libprotoc_headers} ${protobuf_version_rc_file})
|
||||
if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER 3.13 OR ${CMAKE_VERSION} VERSION_EQUAL 3.13)
|
||||
target_link_options(libprotoc PRIVATE -Wl,--version-script=${protobuf_SOURCE_DIR}/src/libprotoc.map)
|
||||
@@ -16,7 +122,6 @@ if(protobuf_HAVE_LD_VERSION_SCRIPT)
|
||||
LINK_DEPENDS ${protobuf_SOURCE_DIR}/src/libprotoc.map)
|
||||
endif()
|
||||
target_link_libraries(libprotoc PRIVATE libprotobuf)
|
||||
target_link_libraries(libprotoc PUBLIC ${protobuf_ABSL_USED_TARGETS})
|
||||
if(protobuf_BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libprotoc
|
||||
PUBLIC PROTOBUF_USE_DLLS
|
||||
@@ -25,6 +130,7 @@ endif()
|
||||
set_target_properties(libprotoc PROPERTIES
|
||||
COMPILE_DEFINITIONS LIBPROTOC_EXPORTS
|
||||
VERSION ${protobuf_VERSION}
|
||||
SOVERSION 32
|
||||
OUTPUT_NAME ${LIB_PREFIX}protoc
|
||||
DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
|
||||
add_library(protobuf::libprotoc ALIAS libprotoc)
|
||||
|
||||
@@ -3,13 +3,165 @@ include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake")
|
||||
|
||||
# Depend packages
|
||||
@_protobuf_FIND_ZLIB@
|
||||
@_protobuf_FIND_ABSL@
|
||||
|
||||
# Imported targets
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake")
|
||||
|
||||
# protobuf-generate function
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-generate.cmake")
|
||||
function(protobuf_generate)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
set(_options APPEND_PATH)
|
||||
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS)
|
||||
if(COMMAND target_sources)
|
||||
list(APPEND _singleargs TARGET)
|
||||
endif()
|
||||
set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS)
|
||||
|
||||
cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}")
|
||||
|
||||
if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET)
|
||||
message(SEND_ERROR "Error: protobuf_generate called without any targets or source files")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET)
|
||||
message(SEND_ERROR "Error: protobuf_generate called without a target or output variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_LANGUAGE)
|
||||
set(protobuf_generate_LANGUAGE cpp)
|
||||
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()
|
||||
|
||||
foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS})
|
||||
# append comma - not using CMake lists and string replacement as users
|
||||
# might have semicolons in options
|
||||
if(_plugin_options)
|
||||
set( _plugin_options "${_plugin_options},")
|
||||
endif()
|
||||
set(_plugin_options "${_plugin_options}${_option}")
|
||||
endforeach()
|
||||
|
||||
if(protobuf_generate_PLUGIN)
|
||||
set(_plugin "--plugin=${protobuf_generate_PLUGIN}")
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_GENERATE_EXTENSIONS)
|
||||
if(protobuf_generate_LANGUAGE STREQUAL cpp)
|
||||
set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc)
|
||||
elseif(protobuf_generate_LANGUAGE STREQUAL python)
|
||||
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()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(protobuf_generate_TARGET)
|
||||
get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES)
|
||||
foreach(_file ${_source_list})
|
||||
if(_file MATCHES "proto$")
|
||||
list(APPEND protobuf_generate_PROTOS ${_file})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_PROTOS)
|
||||
message(SEND_ERROR "Error: protobuf_generate could not find any .proto files")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(protobuf_generate_APPEND_PATH)
|
||||
# Create an include path for each file specified
|
||||
foreach(_file ${protobuf_generate_PROTOS})
|
||||
get_filename_component(_abs_file ${_file} ABSOLUTE)
|
||||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||
list(FIND _protobuf_include_path ${_abs_dir} _contains_already)
|
||||
if(${_contains_already} EQUAL -1)
|
||||
list(APPEND _protobuf_include_path -I ${_abs_dir})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach(DIR ${protobuf_generate_IMPORT_DIRS})
|
||||
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
|
||||
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
|
||||
if(${_contains_already} EQUAL -1)
|
||||
list(APPEND _protobuf_include_path -I ${ABS_PATH})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT _protobuf_include_path)
|
||||
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
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(_file_full_name ${_proto} NAME)
|
||||
string(FIND "${_file_full_name}" "." _file_last_ext_pos REVERSE)
|
||||
string(SUBSTRING "${_file_full_name}" 0 ${_file_last_ext_pos} _basename)
|
||||
|
||||
set(_suitable_include_found FALSE)
|
||||
foreach(DIR ${_protobuf_include_path})
|
||||
if(NOT DIR STREQUAL "-I")
|
||||
file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir})
|
||||
string(FIND "${_rel_dir}" "../" _is_in_parent_folder)
|
||||
if (NOT ${_is_in_parent_folder} EQUAL 0)
|
||||
set(_suitable_include_found TRUE)
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT _suitable_include_found)
|
||||
message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_generated_srcs)
|
||||
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})
|
||||
|
||||
set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}")
|
||||
if(protobuf_generate_PROTOC_OPTIONS)
|
||||
set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}")
|
||||
endif()
|
||||
if(_plugin_options)
|
||||
set(_comment "${_comment}, plugin-options: ${_plugin_options}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_generated_srcs}
|
||||
COMMAND protobuf::protoc
|
||||
ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file}
|
||||
DEPENDS ${_abs_file} protobuf::protoc
|
||||
COMMENT ${_comment}
|
||||
VERBATIM )
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE)
|
||||
if(protobuf_generate_OUT_VAR)
|
||||
set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE)
|
||||
endif()
|
||||
if(protobuf_generate_TARGET)
|
||||
target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all})
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# CMake FindProtobuf module compatible file
|
||||
if(protobuf_MODULE_COMPATIBLE)
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
function(protobuf_generate)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
set(_options APPEND_PATH)
|
||||
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES)
|
||||
if(COMMAND target_sources)
|
||||
list(APPEND _singleargs TARGET)
|
||||
endif()
|
||||
set(_multiargs PROTOS IMPORT_DIRS GENERATE_EXTENSIONS PROTOC_OPTIONS)
|
||||
|
||||
cmake_parse_arguments(protobuf_generate "${_options}" "${_singleargs}" "${_multiargs}" "${ARGN}")
|
||||
|
||||
if(NOT protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET)
|
||||
message(SEND_ERROR "Error: protobuf_generate called without any targets or source files")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET)
|
||||
message(SEND_ERROR "Error: protobuf_generate called without a target or output variable")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_LANGUAGE)
|
||||
set(protobuf_generate_LANGUAGE cpp)
|
||||
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()
|
||||
|
||||
foreach(_option ${_dll_export_decl} ${protobuf_generate_PLUGIN_OPTIONS})
|
||||
# append comma - not using CMake lists and string replacement as users
|
||||
# might have semicolons in options
|
||||
if(_plugin_options)
|
||||
set( _plugin_options "${_plugin_options},")
|
||||
endif()
|
||||
set(_plugin_options "${_plugin_options}${_option}")
|
||||
endforeach()
|
||||
|
||||
if(protobuf_generate_PLUGIN)
|
||||
set(_plugin "--plugin=${protobuf_generate_PLUGIN}")
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_GENERATE_EXTENSIONS)
|
||||
if(protobuf_generate_LANGUAGE STREQUAL cpp)
|
||||
set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc)
|
||||
elseif(protobuf_generate_LANGUAGE STREQUAL python)
|
||||
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()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(protobuf_generate_TARGET)
|
||||
get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES)
|
||||
foreach(_file ${_source_list})
|
||||
if(_file MATCHES "proto$")
|
||||
list(APPEND protobuf_generate_PROTOS ${_file})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(NOT protobuf_generate_PROTOS)
|
||||
message(SEND_ERROR "Error: protobuf_generate could not find any .proto files")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(protobuf_generate_APPEND_PATH)
|
||||
# Create an include path for each file specified
|
||||
foreach(_file ${protobuf_generate_PROTOS})
|
||||
get_filename_component(_abs_file ${_file} ABSOLUTE)
|
||||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||
list(FIND _protobuf_include_path ${_abs_dir} _contains_already)
|
||||
if(${_contains_already} EQUAL -1)
|
||||
list(APPEND _protobuf_include_path -I ${_abs_dir})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach(DIR ${protobuf_generate_IMPORT_DIRS})
|
||||
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
|
||||
list(FIND _protobuf_include_path ${ABS_PATH} _contains_already)
|
||||
if(${_contains_already} EQUAL -1)
|
||||
list(APPEND _protobuf_include_path -I ${ABS_PATH})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT _protobuf_include_path)
|
||||
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
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(_file_full_name ${_proto} NAME)
|
||||
string(FIND "${_file_full_name}" "." _file_last_ext_pos REVERSE)
|
||||
string(SUBSTRING "${_file_full_name}" 0 ${_file_last_ext_pos} _basename)
|
||||
|
||||
set(_suitable_include_found FALSE)
|
||||
foreach(DIR ${_protobuf_include_path})
|
||||
if(NOT DIR STREQUAL "-I")
|
||||
file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir})
|
||||
string(FIND "${_rel_dir}" "../" _is_in_parent_folder)
|
||||
if (NOT ${_is_in_parent_folder} EQUAL 0)
|
||||
set(_suitable_include_found TRUE)
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT _suitable_include_found)
|
||||
message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_generated_srcs)
|
||||
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})
|
||||
|
||||
set(_comment "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}")
|
||||
if(protobuf_generate_PROTOC_OPTIONS)
|
||||
set(_comment "${_comment}, protoc-options: ${protobuf_generate_PROTOC_OPTIONS}")
|
||||
endif()
|
||||
if(_plugin_options)
|
||||
set(_comment "${_comment}, plugin-options: ${_plugin_options}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_generated_srcs}
|
||||
COMMAND protobuf::protoc
|
||||
ARGS ${protobuf_generate_PROTOC_OPTIONS} --${protobuf_generate_LANGUAGE}_out ${_plugin_options}:${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_protobuf_include_path} ${_abs_file}
|
||||
DEPENDS ${_abs_file} protobuf::protoc ${protobuf_generate_DEPENDENCIES}
|
||||
COMMENT ${_comment}
|
||||
VERBATIM )
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${_generated_srcs_all} PROPERTIES GENERATED TRUE)
|
||||
if(protobuf_generate_OUT_VAR)
|
||||
set(${protobuf_generate_OUT_VAR} ${_generated_srcs_all} PARENT_SCOPE)
|
||||
endif()
|
||||
if(protobuf_generate_TARGET)
|
||||
target_sources(${protobuf_generate_TARGET} PRIVATE ${_generated_srcs_all})
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
@@ -6,7 +6,6 @@ add_executable(protoc ${protoc_files} ${protobuf_version_rc_file})
|
||||
target_link_libraries(protoc
|
||||
libprotoc
|
||||
libprotobuf
|
||||
${protobuf_ABSL_USED_TARGETS}
|
||||
)
|
||||
add_executable(protobuf::protoc ALIAS protoc)
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script updates the CMake file lists (i.e. src/file_lists.cmake), commits
|
||||
# the resulting change, and pushes it. This does not do anything useful when
|
||||
# run manually, but should be run by our GitHub action instead.
|
||||
|
||||
set -ex
|
||||
|
||||
# Exit early if the previous commit was made by the bot. This reduces the risk
|
||||
# of a bug causing an infinite loop of auto-generated commits.
|
||||
if (git log -1 --pretty=format:'%an' | grep -q "Protobuf Team Bot"); then
|
||||
echo "Previous commit was authored by bot"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
$(dirname -- "$0")/update_file_lists.sh
|
||||
|
||||
# Try to determine the most recent pull request number.
|
||||
title=$(git log -1 --pretty='%s')
|
||||
pr_from_merge=$(echo "$title" | sed -n 's/^Merge pull request #\([0-9]\+\).*/\1/p')
|
||||
pr_from_squash=$(echo "$title" | sed -n 's/^.*(#\([0-9]\+\))$/\1/p')
|
||||
|
||||
pr=""
|
||||
if [ ! -z "$pr_from_merge" ]; then
|
||||
pr="$pr_from_merge"
|
||||
elif [ ! -z "$pr_from_squash" ]; then
|
||||
pr="$pr_from_squash"
|
||||
fi
|
||||
|
||||
if [ ! -z "$pr" ]; then
|
||||
commit_message="Auto-generate CMake file lists after PR #$pr"
|
||||
else
|
||||
# If we are unable to determine the pull request number, we fall back on this
|
||||
# default commit message. Typically this should not occur, but could happen
|
||||
# if a pull request was merged via a rebase.
|
||||
commit_message="Auto-generate CMake file lists"
|
||||
fi
|
||||
|
||||
git add -A
|
||||
git diff --staged --quiet || git commit -am "$commit_message"
|
||||
git push
|
||||
@@ -1,7 +1,6 @@
|
||||
option(protobuf_USE_EXTERNAL_GTEST "Use external Google Test (i.e. not the one in third_party/googletest)" OFF)
|
||||
|
||||
option(protobuf_REMOVE_INSTALLED_HEADERS
|
||||
"Remove local headers so that installed ones are used instead" OFF)
|
||||
option(protobuf_TEST_XML_OUTDIR "Output directory for XML logs from tests." "")
|
||||
|
||||
option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH
|
||||
"Using absolute test_plugin path in tests" ON)
|
||||
@@ -40,23 +39,65 @@ else()
|
||||
add_library(GTest::gmock_main ALIAS gmock_main)
|
||||
endif()
|
||||
|
||||
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
|
||||
|
||||
set(lite_test_protos
|
||||
${protobuf_lite_test_protos_files}
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_unittest.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_lite.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public_lite.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite.proto
|
||||
)
|
||||
|
||||
set(tests_protos
|
||||
${protobuf_test_protos_files}
|
||||
${compiler_test_protos_files}
|
||||
${util_test_protos_files}
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/any_test.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/test_large_enum_value.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_proto2_unittest.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_unittest.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_arena.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_custom_options.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_drop_unknown_fields.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_embed_optimize_for.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_empty.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_enormous_descriptor.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_enum.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite_imports_nonlite.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset_wire_format.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_field_presence.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_generic_services.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_optimize_for.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum2.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena_lite.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_lite.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_optional.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_well_known_types.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/anys.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/books.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/default_value.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/default_value_test.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/field_mask.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/maps.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/oneofs.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/proto3.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/struct.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/timestamp_duration.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/testdata/wrappers.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_format.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/json_format_proto3.proto
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/message_differencer_unittest.proto
|
||||
)
|
||||
|
||||
macro(compile_proto_file filename)
|
||||
string(REPLACE .proto .pb.h pb_hdr ${filename})
|
||||
string(REPLACE .proto .pb.cc pb_src ${filename})
|
||||
string(REPLACE .proto .pb.cc pb_file ${filename})
|
||||
add_custom_command(
|
||||
OUTPUT ${pb_hdr} ${pb_src}
|
||||
OUTPUT ${pb_file}
|
||||
DEPENDS ${protobuf_PROTOC_EXE} ${filename}
|
||||
COMMAND ${protobuf_PROTOC_EXE} ${filename}
|
||||
--proto_path=${protobuf_SOURCE_DIR}/src
|
||||
@@ -68,41 +109,119 @@ endmacro(compile_proto_file)
|
||||
set(lite_test_proto_files)
|
||||
foreach(proto_file ${lite_test_protos})
|
||||
compile_proto_file(${proto_file})
|
||||
set(lite_test_proto_files ${lite_test_proto_files} ${pb_src} ${pb_hdr})
|
||||
set(lite_test_proto_files ${lite_test_proto_files} ${pb_file})
|
||||
endforeach(proto_file)
|
||||
|
||||
set(tests_proto_files)
|
||||
foreach(proto_file ${tests_protos})
|
||||
compile_proto_file(${proto_file})
|
||||
set(tests_proto_files ${tests_proto_files} ${pb_src} ${pb_hdr})
|
||||
set(tests_proto_files ${tests_proto_files} ${pb_file})
|
||||
endforeach(proto_file)
|
||||
|
||||
set(common_lite_test_files
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_test_util.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_test_util.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_util_lite.cc
|
||||
)
|
||||
|
||||
add_library(protobuf-lite-test-common STATIC
|
||||
${lite_test_util_srcs} ${lite_test_proto_files})
|
||||
target_include_directories(protobuf-lite-test-common PRIVATE ${ABSL_ROOT_DIR})
|
||||
target_link_libraries(protobuf-lite-test-common
|
||||
${protobuf_LIB_PROTOBUF_LITE} ${protobuf_ABSL_USED_TARGETS} GTest::gmock)
|
||||
${common_lite_test_files} ${lite_test_proto_files})
|
||||
target_link_libraries(protobuf-lite-test-common libprotobuf-lite GTest::gmock)
|
||||
|
||||
set(common_test_files
|
||||
${test_util_hdrs}
|
||||
${test_util_srcs}
|
||||
${common_test_hdrs}
|
||||
${common_test_srcs}
|
||||
${common_lite_test_files}
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test_util.inc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_tester.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/test_util.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.cc
|
||||
)
|
||||
|
||||
add_library(protobuf-test-common STATIC
|
||||
${common_test_files} ${tests_proto_files})
|
||||
target_include_directories(protobuf-test-common PRIVATE ${ABSL_ROOT_DIR})
|
||||
target_link_libraries(protobuf-test-common
|
||||
${protobuf_LIB_PROTOBUF} ${protobuf_ABSL_USED_TARGETS} GTest::gmock)
|
||||
target_link_libraries(protobuf-test-common libprotobuf GTest::gmock)
|
||||
|
||||
set(tests_files
|
||||
${protobuf_test_files}
|
||||
${compiler_test_files}
|
||||
${annotation_test_util_srcs}
|
||||
${io_test_files}
|
||||
${util_test_files}
|
||||
${stubs_test_files}
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/any_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arenastring_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/arenaz_sampler_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.h
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/bootstrap_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/message_size_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/metadata_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/move_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/plugin_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/unittest.inc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/importer_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/doc_comment_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/java/plugin_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/parser_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/python/plugin_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_database_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/drop_unknown_fields_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/dynamic_message_unittest.cc
|
||||
${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/generated_message_tctable_lite_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/inlined_string_field_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
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_field_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test.inc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/message_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/message_unittest.inc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/no_field_presence_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/preserve_unknown_enum_test.cc
|
||||
${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/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/text_format_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/unknown_field_set_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator_test.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util_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/message_differencer_unittest.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/util/time_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
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.inc
|
||||
)
|
||||
|
||||
if(protobuf_ABSOLUTE_TEST_PLUGIN_PATH)
|
||||
@@ -135,75 +254,41 @@ if (MSVC)
|
||||
/wd4146 # unary minus operator applied to unsigned type, result still unsigned
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(tests protobuf-lite-test-common protobuf-test-common ${protobuf_LIB_PROTOC} ${protobuf_LIB_PROTOBUF} GTest::gmock_main)
|
||||
target_link_libraries(tests protobuf-lite-test-common protobuf-test-common libprotoc libprotobuf GTest::gmock_main)
|
||||
|
||||
set(test_plugin_files
|
||||
${test_plugin_files}
|
||||
${common_test_hdrs}
|
||||
${common_test_srcs}
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/test_plugin.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.h
|
||||
)
|
||||
|
||||
add_executable(test_plugin ${test_plugin_files})
|
||||
target_include_directories(test_plugin PRIVATE ${ABSL_ROOT_DIR})
|
||||
target_link_libraries(test_plugin
|
||||
${protobuf_LIB_PROTOC}
|
||||
${protobuf_LIB_PROTOBUF}
|
||||
${protobuf_ABSL_USED_TARGETS}
|
||||
GTest::gmock
|
||||
)
|
||||
target_link_libraries(test_plugin libprotoc libprotobuf GTest::gmock)
|
||||
|
||||
add_executable(lite-test ${protobuf_lite_test_files})
|
||||
target_link_libraries(lite-test protobuf-lite-test-common ${protobuf_LIB_PROTOBUF_LITE} GTest::gmock_main)
|
||||
set(lite_test_files
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/lite_unittest.cc
|
||||
)
|
||||
add_executable(lite-test ${lite_test_files})
|
||||
target_link_libraries(lite-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main)
|
||||
|
||||
add_test(NAME lite-test
|
||||
COMMAND lite-test ${protobuf_GTEST_ARGS})
|
||||
|
||||
set(lite_arena_test_files
|
||||
${protobuf_SOURCE_DIR}/src/google/protobuf/lite_arena_unittest.cc
|
||||
)
|
||||
add_executable(lite-arena-test ${lite_arena_test_files})
|
||||
target_link_libraries(lite-arena-test protobuf-lite-test-common libprotobuf-lite GTest::gmock_main)
|
||||
|
||||
add_test(NAME lite-arena-test
|
||||
COMMAND lite-arena-test ${protobuf_GTEST_ARGS})
|
||||
|
||||
add_custom_target(check
|
||||
COMMAND tests
|
||||
DEPENDS tests lite-test test_plugin
|
||||
DEPENDS tests test_plugin
|
||||
WORKING_DIRECTORY ${protobuf_SOURCE_DIR})
|
||||
|
||||
add_test(NAME check
|
||||
COMMAND tests ${protobuf_GTEST_ARGS})
|
||||
|
||||
# For test purposes, remove headers that should already be installed. This
|
||||
# prevents accidental conflicts and also version skew (since local headers take
|
||||
# precedence over installed headers).
|
||||
add_custom_target(save-installed-headers)
|
||||
add_custom_target(remove-installed-headers)
|
||||
add_custom_target(restore-installed-headers)
|
||||
|
||||
file(GLOB_RECURSE _local_hdrs
|
||||
"${PROJECT_SOURCE_DIR}/src/*.h"
|
||||
"${PROJECT_SOURCE_DIR}/src/*.inc")
|
||||
|
||||
# Exclude the bootstrapping that are directly used by tests.
|
||||
set(_exclude_hdrs
|
||||
"${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h"
|
||||
"${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h")
|
||||
|
||||
# Exclude test library headers.
|
||||
list(APPEND _exclude_hdrs ${test_util_hdrs} ${lite_test_util_hdrs} ${common_test_hdrs}
|
||||
${compiler_test_utils_hdrs})
|
||||
foreach(_hdr ${_exclude_hdrs})
|
||||
list(REMOVE_ITEM _local_hdrs ${_hdr})
|
||||
endforeach()
|
||||
|
||||
foreach(_hdr ${_local_hdrs})
|
||||
string(REPLACE "${protobuf_SOURCE_DIR}/src" "" _file ${_hdr})
|
||||
set(_tmp_file "${CMAKE_BINARY_DIR}/tmp-install-test/${_file}")
|
||||
add_custom_command(TARGET remove-installed-headers PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f "${_hdr}")
|
||||
add_custom_command(TARGET save-installed-headers PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy "${_hdr}" "${_tmp_file}" || true)
|
||||
add_custom_command(TARGET restore-installed-headers PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
copy "${_tmp_file}" "${_hdr}")
|
||||
endforeach()
|
||||
|
||||
add_dependencies(remove-installed-headers save-installed-headers)
|
||||
if(protobuf_REMOVE_INSTALLED_HEADERS)
|
||||
# Make sure we remove all the headers *before* any codegen occurs.
|
||||
add_dependencies(${protobuf_PROTOC_EXE} remove-installed-headers)
|
||||
endif()
|
||||
COMMAND tests ${protobuf_GTEST_ARGS}
|
||||
WORKING_DIRECTORY "${protobuf_SOURCE_DIR}")
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash -u
|
||||
|
||||
# This script generates file lists from Bazel for CMake.
|
||||
|
||||
set -e
|
||||
|
||||
bazel build //pkg:gen_src_file_lists
|
||||
cp -v bazel-bin/pkg/src_file_lists.cmake src/file_lists.cmake
|
||||
Reference in New Issue
Block a user