Cronet is a network library of Chromium for mobile terminals, which provides Java and OC APIS and supports HTTP, HTTPS, QUIC, SPDY and other protocols. This paper mainly refers to this literature
1, rely on
1.1 depot_tools
Install depot_tools with the following command, which contains subsequent fetch commands and so on. Python version needs to be less than 2.7, preferably 2.7 (create a soft link /usr/bin/python to /usr/bin/python2.7+)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:/path/to/depot_tools" Bashrc or add the command line in ~/.bashrc and source the file
Copy the code
1.2 the chromium source code
–no-history saves code download time by ignoring the history of the repository; The whole code volume is large, about 14G, and need to climb over the wall, about 1M speed takes 20~30 minutes.
mkdir chromium && cd chromium
fetch --nohooks --no-history ios
Copy the code
1.3 Dependent Files
This command requires the.gclient file in the SRC directory.
gclient sync
Copy the code
2, compile,
Compilation must be done on the MAC platform. The cronet library is available on ios for emulators and real machines. For both the emulator and the real machine, now create a soft link in the SRC directory and create the Ninja build file.
# ln -s ./components/cronet/tools/cr_cronet.py cr_cronet.py
./cr_cronet.py gn
Copy the code
The following command generates the cronet static library, directory obj/components/cronet/ios/libcronet *. A
The simulator:
./cr_cronet.py build -d out/Debug-iphonesimulator
Copy the code
True machine:
./cr_cronet.py build -d out/Debug-iphoneos Method # 1
./cr_cronet.py gn -i Method # 2
./cr_cronet.py build -i Method # 3
Copy the code