[TOC]
Follow all the Get the Code instructions for your target platform up to and including running hooks.
To build Cronet for development and debugging purposes:
First, gn is used to create ninja files targeting the intended platform, then
ninja executes the ninja files to run the build.
$ ./components/cronet/tools/cr_cronet.py gn --out_dir=out/CronetIf the build host is Linux, Android binaries will be built. If the build host is macOS, iOS binaries will be built.
Note: these commands clobber output of previously executed gn commands in
out/Cronet. If --out_dir is left out, the output directory defaults to
out/Debug for debug builds and out/Release for release builds (see below).
If --x86 option is specified, then a native library is built for Intel x86
architecture, and the output directory defaults to out/Debug-x86 if
unspecified. This can be useful for running on mobile emulators.
TODO(caraitto): Specify how to target Chrome OS and Fuchsia.
gn gen out/CronetNow, use the generated ninja files to execute the build against the
cronet_package build target:
$ ninja -C out/Cronet cronet_packageTo build Cronet with optimizations and with debug information stripped out:
$ ./components/cronet/tools/cr_cronet.py gn --release
$ ninja -C out/Release cronet_packageNote: these commands clobber output of previously executed gn commands in
out/Release.
By default ARMv7 32-bit executables are generated. To generate executables
targeting other architectures modify cr_cronet.py's
gn_args variable to include:
- For ARMv8 64-bit:
target_cpu="arm64" - For x86 32-bit:
target_cpu="x86" - For x86 64-bit:
target_cpu="x64"
Alternatively you can run gn args {out_dir} and modify arguments in the editor
that comes up. This has advantage of not changing cr_cronet.py.