README.md: expand the overview, and add a brief build/usage synopsis

This commit is contained in:
Robert Edmonds 2013-11-18 18:14:46 -05:00
parent aab12f20bc
commit 12b18decb2

View File

@ -1,9 +1,37 @@
[![Build Status](https://travis-ci.org/protobuf-c/protobuf-c.png?branch=master)](https://travis-ci.org/protobuf-c/protobuf-c)
## Overview
This package provides a code generator and runtime libraries to use Protocol Buffers from pure C (not C++).
This is `protobuf-c`, a C implementation of [Google Protocol Buffers](https://developers.google.com/protocol-buffers/). It includes `libprotobuf-c`, a pure C library that implements protobuf encoding and decoding, and `protoc-c`, a code generator that converts Protocol Buffer `.proto` files to C descriptor code, based on the original `protoc`. It also includes `libprotobuf-c-rpc`, a separate library for performing RPC with Protocol Buffers.
It uses a modified version of protoc called protoc-c to generate message and service descriptors.
`protobuf-c` was originally maintained by Dave Benson through version 0.15 but is now being maintained by a new team. Thanks, Dave!
## Build Status
## Building
[![Build Status](https://travis-ci.org/protobuf-c/protobuf-c.png?branch=master)](https://travis-ci.org/protobuf-c/protobuf-c)
`protobuf-c` requires a C compiler, a C++ compiler, [Google Protocol Buffers](https://developers.google.com/protocol-buffers/), and `pkg-config` to be installed.
./configure && make && make install
If building from a git checkout, the `autotools` (`autoconf`, `automake`, `libtool`) must also be installed, and the build system must be generated by running the `autogen.sh` script.
./autogen.sh && ./configure && make && make install
The `libprotobuf-c-rpc` library is included in the source distribution but is not built by default. Add `--enable-rpc` to the `configure` command to enable this library.
## Synopsis
Include the `protobuf-c` header file:
#include <protobuf-c/protobuf-c.h>
Link against the `protobuf-c` library.
-lprotobuf-c
`libprotobuf-c` includes a `pkg-config` file. It is recommended to use the `pkg-config` system in order to determine the complete set of compiler and linker flags for building applications that utilize `libprotobuf-c`. If using `pkg-config` with `autoconf`, the `PKG_CHECK_MODULES` macro can be used to detect the presence of `libprotobuf-c`:
PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c])
This will place compiler flags in the `PROTOBUF_C_CFLAGS` variable and linker flags in the `PROTOBUF_C_LDFLAGS` variable.
(Note that the `protobuf-c` header file used to be installed as `google/protobuf-c/protobuf-c.h` in previous versions.)