Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
3c66c2e6
Commit
3c66c2e6
authored
Aug 03, 2009
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow dependents to use pkg-config to figure out what flags to pass to link against protobuf.
parent
ad2cfe03
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
3 deletions
+72
-3
Makefile.am
Makefile.am
+3
-0
README.txt
README.txt
+38
-0
configure.ac
configure.ac
+1
-1
Makefile
examples/Makefile
+4
-2
protobuf-lite.pc.in
protobuf-lite.pc.in
+13
-0
protobuf.pc.in
protobuf.pc.in
+13
-0
No files found.
Makefile.am
View file @
3c66c2e6
...
...
@@ -32,6 +32,9 @@ clean-local:
cd
gtest
&&
$(MAKE)
$(AM_MAKEFLAGS)
clean
;
\
fi
pkgconfigdir
=
$(libdir)
/pkgconfig
pkgconfig_DATA
=
protobuf.pc protobuf-lite.pc
EXTRA_DIST
=
\
autogen.sh
\
generate_descriptor_proto.sh
\
...
...
README.txt
View file @
3c66c2e6
...
...
@@ -33,6 +33,44 @@ For advanced usage information on configure and make, see INSTALL.txt.
If you already built the package with a different prefix, make sure
to run "make clean" before building again.
** Compiling dependent packages **
To compile a package that uses Protocol Buffers, you need to pass
various flags to your compiler and linker. As of version 2.2.0,
Protocol Buffers integrates with pkg-config to manage this. If you
have pkg-config installed, then you can invoke it to get a list of
flags like so:
pkg-config --cflags protobuf # print compiler flags
pkg-config --libs protobuf # print linker flags
pkg-config --cflags --libs protobuf # print both
For example:
c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf`
Note that packages written prior to the 2.2.0 release of Protocol
Buffers may not yet integrate with pkg-config to get flags, and may
not pass the correct set of flags to correctly link against
libprotobuf. If the package in question uses autoconf, you can
often fix the problem by invoking its configure script like:
configure CXXFLAGS="$(pkg-config --cflags protobuf)" \
LIBS="$(pkg-config --libs protobuf)"
This will force it to use the correct flags.
If you are writing an autoconf-based package that uses Protocol
Buffers, you should probably use the PKG_CHECK_MODULES macro in your
configure script like:
PKG_CHECK_MODULES([protobuf], [protobuf])
See the pkg-config man page for more info.
If you only want protobuf-lite, substitute "protobuf-lite" in place
of "protobuf" in these examples.
** Note for cross-compiling **
The makefiles normally invoke the protoc executable that they just
...
...
configure.ac
View file @
3c66c2e6
...
...
@@ -119,5 +119,5 @@ AC_CXX_STL_HASH
AC_CONFIG_SUBDIRS([gtest])
AC_CONFIG_FILES([Makefile src/Makefile ])
AC_CONFIG_FILES([Makefile src/Makefile
protobuf.pc protobuf-lite.pc
])
AC_OUTPUT
examples/Makefile
View file @
3c66c2e6
...
...
@@ -22,10 +22,12 @@ protoc_middleman: addressbook.proto
@
touch
protoc_middleman
add_person_cpp
:
add_person.cc protoc_middleman
c++ add_person.cc addressbook.pb.cc
-lprotobuf
-lpthread
-o
add_person_cpp
pkg-config
--cflags
protobuf
# fails if protobuf is not installed
c++ add_person.cc addressbook.pb.cc
-o
add_person_cpp
`
pkg-config
--cflags
--libs
protobuf
`
list_people_cpp
:
list_people.cc protoc_middleman
c++ list_people.cc addressbook.pb.cc
-lprotobuf
-lpthread
-o
list_people_cpp
pkg-config
--cflags
protobuf
# fails if protobuf is not installed
c++ list_people.cc addressbook.pb.cc
-o
list_people_cpp
`
pkg-config
--cflags
--libs
protobuf
`
javac_middleman
:
AddPerson.java ListPeople.java protoc_middleman
javac AddPerson.java ListPeople.java com/example/tutorial/AddressBookProtos.java
...
...
protobuf-lite.pc.in
0 → 100644
View file @
3c66c2e6
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Protocol Buffers
Description: Google's Data Interchange Format
Version: @VERSION@
Libs: -L${libdir} -lprotobuf-lite @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
Cflags: -I${includedir} @PTHREAD_CFLAGS@
# Commented out because it crashes pkg-config *sigh*:
# http://bugs.freedesktop.org/show_bug.cgi?id=13265
# Conflicts: protobuf
protobuf.pc.in
0 → 100644
View file @
3c66c2e6
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Protocol Buffers
Description: Google's Data Interchange Format
Version: @VERSION@
Libs: -L${libdir} -lprotobuf @LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@
Cflags: -I${includedir} @PTHREAD_CFLAGS@
# Commented out because it crashes pkg-config *sigh*:
# http://bugs.freedesktop.org/show_bug.cgi?id=13265
# Conflicts: protobuf-lite
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