Update iOS example README.md.
GitOrigin-RevId: df6d7bd81c1d1fdb915cb4bdc6edc80d93bcfed0
This commit is contained in:
parent
1424b2037e
commit
1d28119f4a
@ -60,7 +60,8 @@ cmake --build .
|
||||
<a name="installing-dependencies"></a>
|
||||
### Installing dependencies
|
||||
|
||||
#### OS X
|
||||
<a name="macos"></a>
|
||||
#### macOS
|
||||
* Install the latest Xcode command line tools.
|
||||
* Install other dependencies, for example, using [Homebrew](https://brew.sh):
|
||||
```
|
||||
@ -71,6 +72,7 @@ brew install gperf cmake openssl
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ ..
|
||||
```
|
||||
|
||||
<a name="windows"></a>
|
||||
#### Windows
|
||||
* Download and install [gperf](https://sourceforge.net/projects/gnuwin32/files/gperf/3.0.1/). Add the path to gperf to the PATH environment variable.
|
||||
* Install [vcpkg](https://github.com/Microsoft/vcpkg#quick-start).
|
||||
@ -83,6 +85,7 @@ C:\src\vcpkg> .\vcpkg install openssl zlib
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=C:\src\vcpkg\scripts\buildsystems\vcpkg.cmake ..
|
||||
```
|
||||
|
||||
<a name="linux"></a>
|
||||
#### Linux
|
||||
* Install all dependencies using your package manager.
|
||||
|
||||
|
@ -1,29 +1,39 @@
|
||||
# Build for iOS
|
||||
|
||||
Bellow are instructions for building TdLib for iOS, watchOS and also macOS.
|
||||
Below are instructions for building TDLib for iOS, watchOS, tvOS, and also macOS.
|
||||
|
||||
If you need just macOS build take a look [here](https://github.com/tdlib/td#os-x).
|
||||
If you need only a macOS build, take a look at our build instructions for [macOS](https://github.com/tdlib/td#macos).
|
||||
|
||||
For example of usage take a look [here](https://github.com/tdlib/td/tree/master/example/swift).
|
||||
For example of usage take a look at our [Swift example](https://github.com/tdlib/td/tree/master/example/swift).
|
||||
|
||||
## Build OpenSSL
|
||||
First, you should build OpenSSL library for ios
|
||||
To compile `TDLib` you will need to:
|
||||
* Install the latest Xcode command line tools.
|
||||
* Install other build dependencies, for example, using [Homebrew](https://brew.sh):
|
||||
```
|
||||
brew install gperf cmake
|
||||
```
|
||||
* If you don't want to build `TDLib` for macOS, you can pregenerate required source code files using CMake prepare_cross_compiling target:
|
||||
```
|
||||
cd <path to TDLib sources>
|
||||
mkdir native-build
|
||||
cd native-build
|
||||
cmake ..
|
||||
cmake --build . --target prepare_cross_compiling
|
||||
```
|
||||
* Build OpenSSL for iOS, watchOS, tvOS and macOS:
|
||||
```
|
||||
cd <path to TDLib sources>/example/ios
|
||||
./build-openssl.sh
|
||||
```
|
||||
In this example we are using scripts from [Python Apple support](https://github.com/pybee/Python-Apple-support), but any other OpenSSL builds should work too.
|
||||
Libraries will be stored in `third_party/openssl/<platfrom>`. The next script will rely on this location.
|
||||
|
||||
## Build TdLib
|
||||
Run:
|
||||
Here we use scripts from [Python Apple support](https://github.com/pybee/Python-Apple-support), but any other OpenSSL builds should work too.
|
||||
Built libraries should be stored in `third_party/openssl/<platform>`, because the next script will rely on this location.
|
||||
* Build TDLib for iOS, watchOS, tvOS and macOS:
|
||||
```
|
||||
cd <path to TDLib sources>/example/ios
|
||||
./build.sh
|
||||
```
|
||||
This may take a while, because TdLib will be build about 8 times.
|
||||
As an upside resulting library for iOS will work on any architecture (arv7, armv7s, arm64) and even on a simulator.
|
||||
We use [CMake/iOS.cmake](https://github.com/tdlib/td/blob/master/CMake/iOS.cmake) toolchain, other toolchains
|
||||
may work too.
|
||||
|
||||
Libraries will be store in `tdjson` directory.
|
||||
|
||||
This may take a while, because TDLib will be built about 10 times.
|
||||
Resulting library for iOS will work on any architecture (arv7, armv7s, arm64) and even on a simulator.
|
||||
We use [CMake/iOS.cmake](https://github.com/tdlib/td/blob/master/CMake/iOS.cmake) toolchain, other toolchains may work too.
|
||||
|
||||
Built libraries will be store in `tdjson` directory.
|
||||
|
@ -1,11 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
git clone https://github.com/pybee/Python-Apple-support
|
||||
cd Python-Apple-support
|
||||
git checkout 2.7
|
||||
cd ..
|
||||
|
||||
#TODO: change openssl version
|
||||
platforms="macOS iOS watchOS tvOS"
|
||||
#platforms="macOS"
|
||||
for platform in $platforms;
|
||||
do
|
||||
echo $platform
|
||||
|
@ -10,12 +10,14 @@ for platform in $platforms;
|
||||
do
|
||||
echo "Platform = ${platform} Simulator = ${simulator}"
|
||||
openssl_path=$(realpath ../third_party/openssl/${platform})
|
||||
echo $openssl_path
|
||||
echo "OpenSSL path = ${openssl_path}"
|
||||
openssl_crypto_library="${openssl_path}/lib/libcrypto.a"
|
||||
openssl_ssl_library="${openssl_path}/lib/libssl.a"
|
||||
options="$options -DOPENSSL_FOUND=1"
|
||||
options="$options -DOPENSSL_CRYPTO_LIBRARY=${openssl_path}/lib/libcrypto.a"
|
||||
#options="$options -DOPENSSL_SSL_LIBRARY=${openssl_path}/lib/libssl.a"
|
||||
options="$options -DOPENSSL_CRYPTO_LIBRARY=${openssl_crypto_library}"
|
||||
#options="$options -DOPENSSL_SSL_LIBRARY=${openssl_ssl_library}"
|
||||
options="$options -DOPENSSL_INCLUDE_DIR=${openssl_path}/include"
|
||||
options="$options -DOPENSSL_LIBRARIES=${openssl_path}/lib/libcrypto.a;${openssl_path}/lib/libssl.a"
|
||||
options="$options -DOPENSSL_LIBRARIES=${openssl_crypto_library};${openssl_ssl_library}"
|
||||
options="$options -DCMAKE_BUILD_TYPE=Release"
|
||||
if [[ $platform = "macOS" ]]; then
|
||||
build="build-${platform}"
|
||||
@ -54,9 +56,7 @@ do
|
||||
mkdir -p $build
|
||||
mkdir -p $install
|
||||
cd $build
|
||||
echo "A"
|
||||
cmake $td_path $options -DIOS_PLATFORM=${ios_platform} -DCMAKE_TOOLCHAIN_FILE=${td_path}/CMake/iOS.cmake -DCMAKE_INSTALL_PREFIX=../${install}
|
||||
echo "B"
|
||||
make -j3 install || exit
|
||||
cd ..
|
||||
done
|
||||
|
Reference in New Issue
Block a user