Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
protobuf-c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
protobuf-c
Commits
0e060260
Unverified
Commit
0e060260
authored
Mar 19, 2021
by
Ilya Lipnitskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
protoc-c: add custom options support
parent
38af0d26
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
75 additions
and
11 deletions
+75
-11
Makefile.am
Makefile.am
+10
-1
build-cmake/CMakeLists.txt
build-cmake/CMakeLists.txt
+6
-3
protobuf-c/protobuf-c.proto
protobuf-c/protobuf-c.proto
+52
-0
protoc-c/c_bytes_field.cc
protoc-c/c_bytes_field.cc
+1
-1
protoc-c/c_field.cc
protoc-c/c_field.cc
+1
-1
protoc-c/c_file.cc
protoc-c/c_file.cc
+1
-1
protoc-c/c_generator.cc
protoc-c/c_generator.cc
+1
-1
protoc-c/c_helpers.h
protoc-c/c_helpers.h
+1
-1
protoc-c/c_message.cc
protoc-c/c_message.cc
+1
-1
protoc-c/c_string_field.cc
protoc-c/c_string_field.cc
+1
-1
No files found.
Makefile.am
View file @
0e060260
...
...
@@ -42,7 +42,8 @@ lib_LTLIBRARIES += \
protobuf-c/libprotobuf-c.la
nobase_include_HEADERS
+=
\
protobuf-c/protobuf-c.h
protobuf-c/protobuf-c.h
\
protobuf-c/protobuf-c.proto
protobuf_c_libprotobuf_c_la_SOURCES
=
\
protobuf-c/protobuf-c.c
\
...
...
@@ -99,6 +100,8 @@ protoc_c_protoc_gen_c_SOURCES = \
protoc-c/c_service.h
\
protoc-c/c_string_field.cc
\
protoc-c/c_string_field.h
\
protobuf-c/protobuf-c.pb.cc
\
protobuf-c/protobuf-c.pb.h
\
protoc-c/main.cc
protoc_c_protoc_gen_c_CXXFLAGS
=
\
$(AM_CXXFLAGS)
\
...
...
@@ -107,6 +110,12 @@ protoc_c_protoc_gen_c_LDADD = \
$(protobuf_LIBS)
\
-lprotoc
protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h
:
@PROTOC@ $(top_srcdir)/protobuf-c/protobuf-c.proto
$(AM_V_GEN)
@PROTOC@
-I
$(top_srcdir)
--cpp_out
=
$(top_builddir)
$(top_srcdir)
/protobuf-c/protobuf-c.proto
BUILT_SOURCES
+=
\
protobuf-c/protobuf-c.pb.cc
\
protobuf-c/protobuf-c.pb.h
#
# protoc-c compat link
#
...
...
build-cmake/CMakeLists.txt
View file @
0e060260
...
...
@@ -81,8 +81,11 @@ IF(BUILD_PROTOC)
SET
(
CMAKE_CXX_STANDARD 11
)
SET
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
SET
(
CMAKE_CXX_EXTENSIONS OFF
)
ADD_CUSTOM_COMMAND
(
OUTPUT protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h
COMMAND
${
PROTOBUF_PROTOC_EXECUTABLE
}
ARGS --cpp_out
${
CMAKE_BINARY_DIR
}
-I
${
MAIN_DIR
}
${
MAIN_DIR
}
/protobuf-c/protobuf-c.proto
)
FILE
(
GLOB PROTOC_GEN_C_SRC
${
MAIN_DIR
}
/protoc-c/*.h
${
MAIN_DIR
}
/protoc-c/*.cc
)
ADD_EXECUTABLE
(
protoc-gen-c
${
PROTOC_GEN_C_SRC
}
)
ADD_EXECUTABLE
(
protoc-gen-c
${
PROTOC_GEN_C_SRC
}
protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h
)
TARGET_LINK_LIBRARIES
(
protoc-gen-c
${
PROTOBUF_PROTOC_LIBRARY
}
${
PROTOBUF_LIBRARY
}
)
...
...
@@ -115,7 +118,7 @@ ADD_CUSTOM_COMMAND(OUTPUT t/test-full.pb.cc t/test-full.pb.h
GENERATE_TEST_SOURCES
(
${
TEST_DIR
}
/test-full.proto t/test-full.pb-c.c t/test-full.pb-c.h
)
ADD_EXECUTABLE
(
cxx-generate-packed-data
${
TEST_DIR
}
/generated-code2/cxx-generate-packed-data.cc t/test-full.pb.h t/test-full.pb.cc
)
ADD_EXECUTABLE
(
cxx-generate-packed-data
${
TEST_DIR
}
/generated-code2/cxx-generate-packed-data.cc t/test-full.pb.h t/test-full.pb.cc
protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h
)
TARGET_LINK_LIBRARIES
(
cxx-generate-packed-data
${
PROTOBUF_LIBRARY
}
)
FILE
(
MAKE_DIRECTORY
${
CMAKE_BINARY_DIR
}
/t/generated-code2
)
...
...
@@ -162,7 +165,7 @@ INSTALL(TARGETS protoc-gen-c RUNTIME DESTINATION bin)
ENDIF
()
# BUILD_PROTOC
INSTALL
(
TARGETS protobuf-c LIBRARY DESTINATION lib ARCHIVE DESTINATION lib
)
INSTALL
(
FILES
${
MAIN_DIR
}
/protobuf-c/protobuf-c.h DESTINATION include/protobuf-c
)
INSTALL
(
FILES
${
MAIN_DIR
}
/protobuf-c/protobuf-c.h
${
MAIN_DIR
}
/protobuf-c/protobuf-c.proto
DESTINATION include/protobuf-c
)
INSTALL
(
FILES
${
MAIN_DIR
}
/protobuf-c/protobuf-c.h DESTINATION include
)
INSTALL
(
FILES
${
CMAKE_BINARY_DIR
}
/protobuf-c.pdb DESTINATION lib OPTIONAL
)
...
...
protobuf-c/protobuf-c.proto
0 → 100644
View file @
0e060260
/*
* Copyright (c) 2021, the protobuf-c authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
syntax
=
"proto2"
;
import
"google/protobuf/descriptor.proto"
;
message
ProtobufCFileOptions
{
}
extend
google
.
protobuf.FileOptions
{
optional
ProtobufCFileOptions
pb_c_file
=
1019
;
}
message
ProtobufCMessageOptions
{
}
extend
google
.
protobuf.MessageOptions
{
optional
ProtobufCMessageOptions
pb_c_msg
=
1019
;
}
message
ProtobufCFieldOptions
{
}
extend
google
.
protobuf.FieldOptions
{
optional
ProtobufCFieldOptions
pb_c_field
=
1019
;
}
protoc-c/c_bytes_field.cc
View file @
0e060260
...
...
@@ -64,7 +64,7 @@
#include <protoc-c/c_helpers.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h>
#include <
google/protobuf/descriptor
.pb.h>
#include <
protobuf-c/protobuf-c
.pb.h>
namespace
google
{
namespace
protobuf
{
...
...
protoc-c/c_field.cc
View file @
0e060260
...
...
@@ -67,7 +67,7 @@
#include <protoc-c/c_enum_field.h>
#include <protoc-c/c_message_field.h>
#include <protoc-c/c_helpers.h>
#include <
google/protobuf/descriptor
.pb.h>
#include <
protobuf-c/protobuf-c
.pb.h>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/io/printer.h>
...
...
protoc-c/c_file.cc
View file @
0e060260
...
...
@@ -68,7 +68,7 @@
#include <protoc-c/c_helpers.h>
#include <protoc-c/c_message.h>
#include <google/protobuf/io/printer.h>
#include <
google/protobuf/descriptor
.pb.h>
#include <
protobuf-c/protobuf-c
.pb.h>
#include "protobuf-c.h"
...
...
protoc-c/c_generator.cc
View file @
0e060260
...
...
@@ -70,7 +70,7 @@
#include <protoc-c/c_helpers.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream.h>
#include <
google/protobuf/descriptor
.pb.h>
#include <
protobuf-c/protobuf-c
.pb.h>
namespace
google
{
namespace
protobuf
{
...
...
protoc-c/c_helpers.h
View file @
0e060260
...
...
@@ -67,7 +67,7 @@
#include <vector>
#include <sstream>
#include <google/protobuf/descriptor.h>
#include <
google/protobuf/descriptor
.pb.h>
#include <
protobuf-c/protobuf-c
.pb.h>
#include <google/protobuf/io/printer.h>
namespace
google
{
...
...
protoc-c/c_message.cc
View file @
0e060260
...
...
@@ -70,7 +70,7 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format.h>
#include <
google/protobuf/descriptor
.pb.h>
#include <
protobuf-c/protobuf-c
.pb.h>
namespace
google
{
namespace
protobuf
{
...
...
protoc-c/c_string_field.cc
View file @
0e060260
...
...
@@ -64,7 +64,7 @@
#include <protoc-c/c_helpers.h>
#include <google/protobuf/io/printer.h>
#include <google/protobuf/wire_format.h>
#include <
google/protobuf/descriptor
.pb.h>
#include <
protobuf-c/protobuf-c
.pb.h>
namespace
google
{
namespace
protobuf
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment