Skip to content

Commit 292f4e5

Browse files
author
Jon Parise
committed
Initial import of the plugin-based protobuf compiler.
This is essentially the existing protobuf-objc code remixed as a protoc plugin (for protobuf 2.3.0). A few things have been renamed or otherwise reorganized, but the functionality should be identical at this point.
0 parents  commit 292f4e5

File tree

115 files changed

+40060
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+40060
-0
lines changed

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.deps
2+
.DS_Store
3+
Makefile
4+
Makefile.in
5+
aclocal.m4
6+
config.h
7+
config.h.in
8+
config.guess
9+
config.log
10+
config.status
11+
config.sub
12+
configure
13+
depcomp
14+
install-sh
15+
libtool
16+
ltmain.sh
17+
missing
18+
m4
19+
stamp-h1

CREDITS

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Booyah Inc.
2+
-------------------------------------------------------------------------------
3+
Jon Parise <[email protected]>
4+
5+
6+
Google Protocol Buffers, Objective C
7+
-------------------------------------------------------------------------------
8+
Cyrus Najmabadi (http://code.google.com/p/metasyntactic/wiki/ProtocolBuffers)
9+
Sergey Martynov (http://github.com/martynovs/protobuf-objc)
10+
11+
12+
Google Protocol Buffers
13+
-------------------------------------------------------------------------------
14+
Kenton Varda, Sanjay Ghemawat, Jeff Dean, and others

Makefile.am

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Process this file with automake to produce Makefile.am
2+
3+
ACLOCAL_AMFLAGS = -I m4
4+
AUTOMAKE_OPTIONS = foreign
5+
SUBDIRS = src/compiler
6+
7+
EXTRA_DIST = \
8+
autogen.sh
9+
10+
# Clean up all of the files generated by autogen.sh
11+
MAINTAINERCLEANFILES = \
12+
aclocal.m4 \
13+
config.guess \
14+
config.sub \
15+
configure \
16+
depcomp \
17+
install-sh \
18+
ltmain.sh \
19+
Makefile.in \
20+
missing \
21+
mkinstalldirs \
22+
config.h.in \
23+
stamp.h.in

autogen.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
#
3+
# This script regenerates the authconf-based configure script. The resulting
4+
# files aren't managed by source control but are included in the distribution.
5+
6+
set -e
7+
autoreconf -f -i -Wall
8+
rm -rf autom4te.cache configure.ac~ config.h.in~
9+
exit 0

configure.ac

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
AC_PREREQ(2.61)
2+
3+
AC_INIT([protobuf-plugin-objc],[0.1],[[email protected]],[protobuf-plugin-objc])
4+
5+
AC_CONFIG_SRCDIR(src/compiler/main.cc)
6+
AC_CONFIG_HEADERS([config.h])
7+
AC_CONFIG_MACRO_DIR([m4])
8+
9+
AC_CANONICAL_TARGET
10+
AM_INIT_AUTOMAKE
11+
12+
# Check for programs
13+
AC_PROG_CC
14+
AC_PROG_CXX
15+
AC_LANG([C++])
16+
17+
AC_MSG_CHECKING([C++ compiler flags...])
18+
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
19+
# Disable debugging checks by default.
20+
CXXFLAGS="$CXXFLAGS -DNDEBUG"
21+
AC_MSG_RESULT([use default: $CXXFLAGS])
22+
],[
23+
AC_MSG_RESULT([use user-supplied: $CXXFLAGS])
24+
])
25+
26+
LT_INIT
27+
28+
# Check for header files
29+
AC_HEADER_STDC
30+
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdlib.h unistd.h])
31+
32+
# Check for libaries
33+
AC_FUNC_MEMCMP
34+
AC_FUNC_STRTOD
35+
AC_CHECK_FUNCS([ftruncate memset mkdir strchr strerror strtol])
36+
37+
# Locate the protobuf library.
38+
AC_CHECK_HEADER(google/protobuf/stubs/common.h,,
39+
[AC_MSG_ERROR([
40+
ERROR: protobuf headers are required.
41+
42+
You must either install protobuf from google,
43+
or if you have it installed in a custom location
44+
you must add '-Iincludedir' to CXXFLAGS
45+
and '-Llibdir' to LDFLAGS.
46+
47+
If you did not specify a prefix when installing
48+
protobuf, try
49+
'./configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib'
50+
In some 64-bit environments, try LDFLAGS=-L/usr/local/lib64.
51+
])])
52+
pbc_savelibs="$LIBS"
53+
LIBS="$LIBS -lprotoc -lprotobuf -lpthread"
54+
AC_LINK_IFELSE(
55+
[AC_LANG_PROGRAM([[#include <google/protobuf/compiler/command_line_interface.h>]],
56+
[[google::protobuf::compiler::CommandLineInterface cli;]])],
57+
[],
58+
[AC_MSG_ERROR([
59+
ERROR:
60+
protobuf test program failed to link:
61+
perhaps you need to add -Llibdir to your LDFLAGS.])])
62+
LIBS="$pbc_savelibs"
63+
64+
AC_CONFIG_FILES([Makefile src/compiler/Makefile])
65+
AC_OUTPUT

src/compiler/Makefile.am

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
MAINTAINERCLEANFILES = \
2+
Makefile.in
3+
4+
bin_PROGRAMS = protoc-gen-objc
5+
protoc_gen_objc_LDFLAGS = -pthreads -lprotobuf -lprotoc
6+
protoc_gen_objc_SOURCES = \
7+
main.cc \
8+
objc_enum_field.cc \
9+
objc_file.cc \
10+
objc_message_field.cc \
11+
objc_enum.cc \
12+
objc_generator.cc \
13+
objc_primitive_field.cc \
14+
objc_extension.cc \
15+
objc_helpers.cc \
16+
objc_field.cc \
17+
objc_message.cc \
18+
google/protobuf/objectivec-descriptor.pb.cc

0 commit comments

Comments
 (0)