README.md
1
2 # Overview
3
4 A C++ implementation of gRPC
5
6 # To start using gRPC C++
7
8 In the C++ world, there's no universally accepted standard for managing project dependencies.
9 Therefore, gRPC supports several major build systems, which should satisfy most users.
10
11 ## bazel
12
13 We recommend using Bazel for projects that use gRPC as it will give you the best developer experience
14 (easy handling of dependencies that support bazel & fast builds).
15
16 To add gRPC as a dependency in bazel:
17 1. determine commit SHA for the grpc release you want to use
18 2. Use the [http_archive](https://docs.bazel.build/versions/master/be/workspace.html#http_archive) bazel rule to include gRPC source
19 ```
20 http_archive(
21 name = "com_github_grpc_grpc",
22 urls = [
23 "https://github.com/grpc/grpc/archive/YOUR_GRPC_COMMIT_SHA.tar.gz",
24 ],
25 strip_prefix = "grpc-YOUR_GRPC_COMMIT_SHA",
26 )
27
28 load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
29
30 grpc_deps()
31 ```
32
33 NOTE: currently bazel is only supported for building gRPC on Linux.
34
35 ## make
36
37 Currently the default choice for building on UNIX based systems is `make`.
38
39 To install gRPC for C++ on your system using `make`, follow the [Building gRPC C++](../../BUILDING.md)
40 instructions to build from source and then install locally using `make install`.
41 This also installs the protocol buffer compiler `protoc` (if you don't have it already),
42 and the C++ gRPC plugin for `protoc`.
43
44 WARNING: After installing with `make install` there is no easy way to uninstall, which can cause issues
45 if you later want to remove the grpc and/or protobuf installation or upgrade to a newer version.
46
47 ## cmake
48
49 `cmake` is the default build option on Windows, but also works on Linux, MacOS. `cmake` has good
50 support for crosscompiling and can be used for targeting Android platform.
51
52 If your project is using cmake, there are several ways to add gRPC dependency.
53 - install gRPC via cmake first and then locate it with `find_package(gRPC CONFIG)`. [Example](../../examples/cpp/helloworld/CMakeLists.txt)
54 - via cmake's `ExternalProject_Add` using a technique called "superbuild". [Example](../../examples/cpp/helloworld/cmake_externalproject/CMakeLists.txt)
55 - add gRPC source tree to your project (preferrably as a git submodule) and add it to your cmake project with `add_subdirectory`. [Example](../../examples/cpp/helloworld/CMakeLists.txt)
56
57 ## Packaging systems
58
59 There's no standard packaging system for C++. We've looked into supporting some (e.g. Conan and vcpkg) but we are not there yet.
60 Contributions and community-maintained packages for popular packaging systems are welcome!
61
62
63 ## Examples & Additional Documentation
64
65 You can find out how to build and run our simplest gRPC C++ example in our
66 [C++ quick start](../../examples/cpp).
67
68 For more detailed documentation on using gRPC in C++ , see our main
69 documentation site at [grpc.io](https://grpc.io), specifically:
70
71 * [Overview](https://grpc.io/docs/): An introduction to gRPC with a simple
72 Hello World example in all our supported languages, including C++.
73 * [gRPC Basics - C++](https://grpc.io/docs/tutorials/basic/c.html):
74 A tutorial that steps you through creating a simple gRPC C++ example
75 application.
76 * [Asynchronous Basics - C++](https://grpc.io/docs/tutorials/async/helloasync-cpp.html):
77 A tutorial that shows you how to use gRPC C++'s asynchronous/non-blocking
78 APIs.
79
80
81 # To start developing gRPC C++
82
83 For instructions on how to build gRPC C++ from source, follow the [Building gRPC C++](../../BUILDING.md) instructions.
84