Edit READMEs to include new cmake instructions and remove references to language specific source distributions.

PiperOrigin-RevId: 520980524
pull/12381/head
Deanna Garcia 2023-03-31 12:03:38 -07:00 committed by Copybara-Service
parent 4b3844e596
commit 3f8625b306
2 changed files with 21 additions and 15 deletions

View File

@ -1,9 +1,9 @@
This directory contains *CMake* files that can be used to build protobuf.
You need to have [CMake](http://www.cmake.org) and
[Git](http://git-scm.com) installed on your computer before proceeding. We
currently support CMake 3.5 and newer on both [Windows](#windows-builds) and
[Linux](#linux-builds).
You need to have [CMake](http://www.cmake.org),
[Git](http://git-scm.com), and [Abseil](https://github.com/abseil/abseil-cpp)
installed on your computer before proceeding. We currently support CMake 3.5
and newer on both [Windows](#windows-builds) and [Linux](#linux-builds).
Most of the instructions will be given using CMake's command-line interface, but
the same actions can be performed using appropriate GUI tools.
@ -67,11 +67,6 @@ You can get the latest stable source packages from the release page:
https://github.com/protocolbuffers/protobuf/releases/latest
For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if
you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package
contains C++ source already); if you need C++ and multiple other languages,
download `protobuf-all-[VERSION].tar.gz`.
Or you can use git to clone from protobuf git repository.
C:\Path\to> mkdir src & cd src
@ -119,6 +114,20 @@ Create a temporary *build* folder and change your working directory to it:
cd C:\Path\to\build\protobuf
C:\Path\to\build\protobuf>
During configuration you will also be specifying where CMake should expect to
find your Abseil installation. To do so, first set `-Dprotobuf_ABSL_PROVIDER=package`
and then set `-DCMAKE_PREFIX_PATH` to the path where you installed Abseil.
For example:
```console
C:\Path\to\build\protobuf> cmake -S. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX=/tmp/protobuf \
-DCMAKE_CXX_STANDARD=14 \
-Dprotobuf_ABSL_PROVIDER=package \
-DCMAKE_PREFIX_PATH=/tmp/absl # Path to where I installed Abseil
```
The *Makefile* and *Ninja* generators can build the project in only one configuration, so you need to build
a separate folder for each configuration.

View File

@ -19,6 +19,7 @@ To build protobuf from source, the following tools are needed:
* bazel
* git
* g++
* Abseil
On Ubuntu/Debian, for example, you can install them with:
@ -27,18 +28,14 @@ On Ubuntu/Debian, for example, you can install them with:
On other platforms, please use the corresponding package managing tool to
install them before proceeding. See https://bazel.build/install for further
instructions on installing Bazel, or to build from source using CMake, see
[cmake/README.md](../cmake/README.md).
[cmake/README.md](../cmake/README.md). See https://github.com/abseil/abseil-cpp
for instructions on installing Abseil.
To get the source, download the release .tar.gz or .zip package in the
release page:
https://github.com/protocolbuffers/protobuf/releases/latest
For example: if you only need C++, download `protobuf-cpp-[VERSION].tar.gz`; if
you need C++ and Java, download `protobuf-java-[VERSION].tar.gz` (every package
contains C++ source already); if you need C++ and multiple other languages,
download `protobuf-all-[VERSION].tar.gz`.
You can also get the source by "git clone" our git repository. Make sure you
have also cloned the submodules and generated the configure script (skip this
if you are using a release .tar.gz or .zip package):